[PATCH] ARC: [axs10x] enable DW DMA controller

2015-12-04 Thread Alexey Brodkin
From: Nelson Pereira 

ARC SDP baseboard among other peripherals sports
DesignWare DMA controller.

This enables support of that device.
Note typically DW DMA controller is used with external devices
connected to ARC SDP board via HAPS Extension bus.

Signed-off-by: Nelson Pereira 
Cc: Vineet Gupta 
Signed-off-by: Alexey Brodkin 
---
 arch/arc/boot/dts/axs10x_mb.dtsi  | 16 
 arch/arc/configs/axs101_defconfig |  5 +
 arch/arc/configs/axs103_defconfig |  5 +
 arch/arc/configs/axs103_smp_defconfig |  5 +
 4 files changed, 31 insertions(+)

diff --git a/arch/arc/boot/dts/axs10x_mb.dtsi b/arch/arc/boot/dts/axs10x_mb.dtsi
index f3db321..1e57580 100644
--- a/arch/arc/boot/dts/axs10x_mb.dtsi
+++ b/arch/arc/boot/dts/axs10x_mb.dtsi
@@ -220,5 +220,21 @@
reg = <2>;
};
};
+
+   dmac: dmac@0x8 {
+   compatible = "snps,dma-spear1340";
+   reg = <0x8 0x1000>;
+   interrupts = <9>;
+   dma-channels = <4>;
+   dma-requests = <16>;
+   dma-masters = <2>;
+   #dma-cells = <3>;
+   chan_allocation_order = <1>;
+   chan_priority = <1>;
+   block_size = <0xfff>;
+   data_width = <3 3>;
+   clocks = <&apbclk>;
+   clock-names = "hclk";
+   };
};
 };
diff --git a/arch/arc/configs/axs101_defconfig 
b/arch/arc/configs/axs101_defconfig
index 562dac6..405474f 100644
--- a/arch/arc/configs/axs101_defconfig
+++ b/arch/arc/configs/axs101_defconfig
@@ -90,6 +90,11 @@ CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_PLTFM=y
 CONFIG_MMC_DW=y
 CONFIG_MMC_DW_IDMAC=y
+CONFIG_DMADEVICES=y
+CONFIG_DW_DMAC_CORE=y
+CONFIG_DW_DMAC=y
+CONFIG_DMA_ENGINE=y
+CONFIG_DMA_OF=y
 # CONFIG_IOMMU_SUPPORT is not set
 CONFIG_EXT3_FS=y
 CONFIG_EXT4_FS=y
diff --git a/arch/arc/configs/axs103_defconfig 
b/arch/arc/configs/axs103_defconfig
index 83a6d8d..570f06f 100644
--- a/arch/arc/configs/axs103_defconfig
+++ b/arch/arc/configs/axs103_defconfig
@@ -96,6 +96,11 @@ CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_PLTFM=y
 CONFIG_MMC_DW=y
 CONFIG_MMC_DW_IDMAC=y
+CONFIG_DMADEVICES=y
+CONFIG_DW_DMAC_CORE=y
+CONFIG_DW_DMAC=y
+CONFIG_DMA_ENGINE=y
+CONFIG_DMA_OF=y
 # CONFIG_IOMMU_SUPPORT is not set
 CONFIG_EXT3_FS=y
 CONFIG_EXT4_FS=y
diff --git a/arch/arc/configs/axs103_smp_defconfig 
b/arch/arc/configs/axs103_smp_defconfig
index f1e1c84..16cfce8 100644
--- a/arch/arc/configs/axs103_smp_defconfig
+++ b/arch/arc/configs/axs103_smp_defconfig
@@ -97,6 +97,11 @@ CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_PLTFM=y
 CONFIG_MMC_DW=y
 CONFIG_MMC_DW_IDMAC=y
+CONFIG_DMADEVICES=y
+CONFIG_DW_DMAC_CORE=y
+CONFIG_DW_DMAC=y
+CONFIG_DMA_ENGINE=y
+CONFIG_DMA_OF=y
 # CONFIG_IOMMU_SUPPORT is not set
 CONFIG_EXT3_FS=y
 CONFIG_EXT4_FS=y
-- 
2.4.3


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH] ARC: [axs10x] enable DW DMA controller

2015-12-07 Thread Alexey Brodkin
Hi Vineet,

On Sat, 2015-12-05 at 10:14 +, Vineet Gupta wrote:
> On Saturday 05 December 2015 12:52 AM, Alexey Brodkin wrote:
> > From: Nelson Pereira 
> > 
> > ARC SDP baseboard among other peripherals sports
> > DesignWare DMA controller.
> > 
> > This enables support of that device.
> > Note typically DW DMA controller is used with external devices
> > connected to ARC SDP board via HAPS Extension bus.
> 
> Such a board config needs to have it's own defconfig / DT (if needed). 
> There's no
> point in enabling this for rest of the world who don't have a use case for 
> this IP.
> 
> So nack !

I see rationale behind this decision but:
1) How enabled DMA controller hurts other users of the same SDP board
2) That DMA controller exists in SDP anyway - that's not a special flavor of 
ARC SDP
3) Another defconfig and .dts adds another item for verification while
   enabling DW DMA in our current defconfigs allows usage of the same one 
binaries for
   all purposes on ARC SDP.

-Alexey
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH] ARC: [axs10x] cap ethernet phy to 100 Mbit/sec

2015-12-07 Thread Alexey Brodkin
Current ARC SDP boards cannot reliably handle 1Gbit
Ethernet connections due to limitations in hardware.

To make sure networking is stable on the board we're
limiting phy to 100 Mbit.

Signed-off-by: Alexey Brodkin 
Cc: Vineet Gupta 
---
 arch/arc/boot/dts/axs10x_mb.dtsi | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arc/boot/dts/axs10x_mb.dtsi b/arch/arc/boot/dts/axs10x_mb.dtsi
index f3db321..44a578c 100644
--- a/arch/arc/boot/dts/axs10x_mb.dtsi
+++ b/arch/arc/boot/dts/axs10x_mb.dtsi
@@ -46,6 +46,7 @@
snps,pbl = < 32 >;
clocks = <&apbclk>;
clock-names = "stmmaceth";
+   max-speed = <100>;
};
 
ehci@0x4 {
-- 
2.5.0


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: kisskb: FAILED linux-next/axs103_smp_defconfig/arcv2 Thu Dec 10, 17:33

2015-12-10 Thread Alexey Brodkin
Hi Michael,

On Thu, 2015-12-10 at 14:58 +0530, Vineet Gupta wrote:
> On Thursday 10 December 2015 02:34 PM, Michael Ellerman wrote:
> 
> > That is weird. I'll ask it to rebuild it and see if it happens again.
> > 
> > Do you build with -j?
> 
> I did now - but still no error at my end.

I always build our kernels with -j4 or even -j8 depending on the machine I use
and I've never seen issues with parallel building.

Latest I tried was 4.4-rc4.

-Alexey
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH] ARC: fix building for MMU v2

2015-12-18 Thread Alexey Brodkin
ARC700 cores with MMU v2 don't have IC_PTAG AUX register and so we only
define ARC_REG_IC_PTAG for MMU versions >= 3.

But current implementation of cache_line_loop_vX() routines assumes
availability of all of them (v2, v3 and v4) simultaneously.

And given undefined ARC_REG_IC_PTAG if CONFIG_MMU_VER=2 we're seeing
compilation problem:
-->8---
  CC  arch/arc/mm/cache.o
arch/arc/mm/cache.c: In function '__cache_line_loop_v3':
arch/arc/mm/cache.c:270:13: error: 'ARC_REG_IC_PTAG' undeclared (first use in 
this function)
   aux_tag = ARC_REG_IC_PTAG;
 ^
arch/arc/mm/cache.c:270:13: note: each undeclared identifier is reported only 
once for each function it appears in
scripts/Makefile.build:258: recipe for target 'arch/arc/mm/cache.o' failed
-->8---

The simples fix is to have ARC_REG_IC_PTAG defined regardless MMU
version being used.

We don't use it in cache_line_loop_v2() anyways so who cares.

Signed-off-by: Alexey Brodkin 
Cc: Vineet Gupta 
---
 arch/arc/include/asm/cache.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/arc/include/asm/cache.h b/arch/arc/include/asm/cache.h
index abf06e8..210ef3e 100644
--- a/arch/arc/include/asm/cache.h
+++ b/arch/arc/include/asm/cache.h
@@ -62,9 +62,7 @@ extern int ioc_exists;
 #define ARC_REG_IC_IVIC0x10
 #define ARC_REG_IC_CTRL0x11
 #define ARC_REG_IC_IVIL0x19
-#if defined(CONFIG_ARC_MMU_V3) || defined(CONFIG_ARC_MMU_V4)
 #define ARC_REG_IC_PTAG0x1E
-#endif
 #define ARC_REG_IC_PTAG_HI 0x1F
 
 /* Bit val in IC_CTRL */
-- 
2.4.3


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH] arc: Removed local initramfs source file from axs101 configuration.

2016-01-07 Thread Alexey Brodkin
Hi Carlos,

On Mon, 2016-01-04 at 14:55 +, palmi...@synopsys.com wrote:
> From: Carlos Palminha 
> 
> Cannot compile kernel with INITRAMFS SOURCE option.
> Please move this option to a buildroot patch.

First of all if your problem is only related to Buildroot then
there's not much sense in adding linux-snps-arc@lists.infradead.org
which is used for pure Linux kernel discussions.

Then even in case of Buildroot CONFIG_INITRAMFS_SOURCE could be a problem
only if you don't set Buildroot's BR2_TARGET_ROOTFS_INITRAMFS=y, see
how it is done in snps_axs101_defconfig here
https://git.busybox.net/buildroot/tree/configs/snps_axs101_defconfig#n7

What happens if BR2_TARGET_ROOTFS_INITRAMFS=y then existing in kernel's
defconfig CONFIG_INITRAMFS_SOURCE gets overridden with new value, see
https://git.busybox.net/buildroot/tree/linux/linux.mk#n217

Now if you really want to not use built-in kernel initramfs then simplest
thing to do is to run "make linux-menuconfig" from your Buildroot's folder
and disable or set with nothing CONFIG_INITRAMFS_SOURCE.

-Alexey
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH] arc: Removed local initramfs source file from axs101 configuration.

2016-01-11 Thread Alexey Brodkin
Hi Vineet,

On Mon, 2016-01-11 at 07:47 +, Vineet Gupta wrote:
> On Saturday 09 January 2016 05:55 AM, Carlos Palminha wrote:
> > Hi Alexey,
> > 
> > Probably my e-mail comments before the patch mislead you...
> > If you download the kernel source and try to compile it, it won't work 
> > because of the INITRAMFS pointing to a non
> > -existing directory. (check log below)
> > 
> > That's why that option should be removed from the standard kernel.
> 
> Since the axs101 DT cmdline lacks any reference to root device - how does this
> unmodified kernel boot anyways w/o changing DT. Does uboot provide the 
> cmdline for
> rootfs ?

Indeed if initramfs is not built-in vmlinux/uImage then kernel command-line
must be adjusted to point to real root device.

This could be done in 2 ways:

 [1] Manually modify "bootargs" value in arch/arc/boot/dts/axs10{1|3}.dts
 [2] In case of U-Boot it's possible to load device tree blob together with 
uImage
 and in that case U-Boot's "bootargs" env variable will override the one in 
.dtb

-Alexey
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH 2/2] arc770: move arc patches to taregt/linux/generic

2016-01-15 Thread Alexey Brodkin
Hi Felix,

On Fri, 2016-01-15 at 11:45 +0100, Felix Fietkau wrote:
> On 2016-01-15 00:12, Alexey Brodkin wrote:
> > Given those patches are relevant to any ARC platform and even
> > ISA version it makes perfect sense for patches to exist
> > in one place instead of being duplicated for each new ARC-based ASIC.
> > 
> > Note this is a prerequisite for upstreaming of ARC HS38 support in
> > OpenWRT.
> > 
> > Signed-off-by: Alexey Brodkin 
> > Cc: Felix Fietkau 
> > Cc: Jo-Philipp Wich 
> > Cc: Jonas Gorski 
> > --- /dev/null
> > +++ 
> > b/target/linux/generic/patches-4.4/331-arc-remove-dependency-on-DEVTMPFS.patch
> > @@ -0,0 +1,36 @@
> > +From adfbf9e6cad93281cffceab078e7f6f2a8e094f9 Mon Sep 17 00:00:00 2001
> > +From: Alexey Brodkin 
> > +Date: Thu, 13 Aug 2015 01:56:02 +0300
> > +Subject: [PATCH 1/2] openwrt: arc - remove dependency on DEVTMPFS
> > +
> > +OpenWRT builds initramfs so that it doesn't require DEVTMPFS so dropping
> > +this dependency. That helps to escape 2 separate kernel rebuilds with
> > +and without initramfs.
> > +
> > +2 builds happen because OpenWRT first builds kernel and later modules.
> > +When building entire kernel with simple "make" INITRAMFS sets to a real
> > +value and so was triggering DEVTMPFS selection. Then when building only
> > +modules with "make modules" command INITRAMFS is zeroed and so kernel
> > +config was changing that lead to full kernel rebuild.
> > +
> > +Signed-off-by: Alexey Brodkin 
> > +---
> > + arch/arc/Kconfig | 2 --
> > + 1 file changed, 2 deletions(-)
> > +
> > +diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
> > +index 6312f60..a95bab3 100644
> > +--- a/arch/arc/Kconfig
> >  b/arch/arc/Kconfig
> > +@@ -12,8 +12,6 @@ config ARC
> > +   select BUILDTIME_EXTABLE_SORT
> > +   select COMMON_CLK
> > +   select CLONE_BACKWARDS
> > +-  # ARC Busybox based initramfs absolutely relies on DEVTMPFS for /dev
> > +-  select DEVTMPFS if !INITRAMFS_SOURCE=""
> > +   select GENERIC_ATOMIC64
> > +   select GENERIC_CLOCKEVENTS
> > +   select GENERIC_FIND_FIRST_BIT
> Could you please send this one upstream as well?

Adding Vineet so he may comment if that change makes sense upstream.

-Alexey
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: Whats missing in my new FB DRM driver in ARC... waiting for console_lock to return

2016-01-28 Thread Alexey Brodkin
Hi Carlos,

On Thu, 2016-01-21 at 18:30 +, Carlos Palminha wrote:
> hi...
> 
> i just found that its blocking waiting for console_lock...
> @vineet, alexey: i think that console_lock is architecture dependent right? 
> Do you know any issue with console_lock
> for ARC?

I'm not really sure "console_lock" has something to do with ARC architecture.
At least "git grep bconsole_lock" doesn't find anything in "arch/arc".

So I'd assume this is a generic thing.

-Alexey
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH 2/9] ARC: [dts] Introduce Timer bindings

2016-02-02 Thread Alexey Brodkin
Hi Vineet,

On Tue, 2016-02-02 at 16:28 +0530, Vineet Gupta wrote:
> ARC Timers have historically been probed directly.
> As precursor to start probing Timers thru DT introduce these bindings
> 
> Cc: Daniel Lezcano 
> Cc: Rob Herring 
> Cc: devicet...@vger.kernel.org
> Signed-off-by: Vineet Gupta 
> ---

[snip]

> +Required properties:
> +
> +- compatible : should be "snps,arc-timer0"
> +- interrupts : single Interrupt going into parent intc
> +(16 for ARCHS cores, 3 for ARC700 cores)
> +- clocks : phandle to the source clock
> +
> +Optional properties:
> +
> +- interrupt-parent : phandle to parent intc
> +
> +Example:
> +
> + timer0: timer_clkevt {
> + compatible = "snps,arc-timer0";
> + interrupts = <3>;
> + interrupt-parent = <&core_intc>;
> + clocks = <&timer0_clk>;

Even though this is an example maybe we may
use the same "core_clk" as in real .dts below?

-Alexey
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH 7/9] ARC: use fixed frequencies in arc_set_early_base_baud()

2016-02-02 Thread Alexey Brodkin
Adding Christian for Abilis TB10x clocks review.

On Tue, 2016-02-02 at 16:28 +0530, Vineet Gupta wrote:
> From: Alexey Brodkin 
> 
> UARTs usually have fixed clock so we're switching to use of
> constant values instead of something derived from core clock
> frequency.
> 
> Among other things this will allow us to get rid of
> arc_{get|set}_core_freq() and switch to generic clock
> framework later on.
> 
> Signed-off-by: Alexey Brodkin 
> Signed-off-by: Vineet Gupta 
> ---
>  arch/arc/kernel/devtree.c | 6 ++
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/arc/kernel/devtree.c b/arch/arc/kernel/devtree.c
> index 7e844fd8213f..e155126c79b1 100644
> --- a/arch/arc/kernel/devtree.c
> +++ b/arch/arc/kernel/devtree.c
> @@ -28,14 +28,12 @@ unsigned int __init arc_early_base_baud(void)
>  
>  static void __init arc_set_early_base_baud(unsigned long dt_root)
>  {
> - unsigned int core_clk = arc_get_core_freq();
> -
>   if (of_flat_dt_is_compatible(dt_root, "abilis,arc-tb10x"))
> - arc_base_baud = core_clk/3;
> + arc_base_baud = 16667;  /* Fixed 166.7MHz clk (TB10x) */
>   else if (of_flat_dt_is_compatible(dt_root, "snps,arc-sdp"))
>   arc_base_baud = ;   /* Fixed 33MHz clk (AXS10x) */
>   else
> - arc_base_baud = core_clk;
> + arc_base_baud = 5000;   /* Fixed default 50MHz */
>  }
>  #else
>  #define arc_set_early_base_baud(dt_root)

-Alexey
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH 2/9] ARC: [dts] Introduce Timer bindings

2016-02-02 Thread Alexey Brodkin
Hi Vineet,

On Tue, 2016-02-02 at 16:28 +0530, Vineet Gupta wrote:
> ARC Timers have historically been probed directly.
> As precursor to start probing Timers thru DT introduce these bindings
> 
> Cc: Daniel Lezcano 
> Cc: Rob Herring 
> Cc: devicet...@vger.kernel.org
> Signed-off-by: Vineet Gupta 
> ---

[snip]

> diff --git a/Documentation/devicetree/bindings/timer/snps,arc-timer0.txt
> b/Documentation/devicetree/bindings/timer/snps,arc-timer0.txt
> new file mode 100644
> index ..ceb80c72a90b
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/timer/snps,arc-timer0.txt
> @@ -0,0 +1,23 @@
> +Synopsys ARC Local Timer with Interrupt Capabilities
> +- Found on all ARC CPUs (ARC700/ARCHS)
> +- Mandatory clockevent provider
> +
> +Required properties:
> +
> +- compatible : should be "snps,arc-timer0"
> +- interrupts : single Interrupt going into parent intc
> +(16 for ARCHS cores, 3 for ARC700 cores)
> +- clocks : phandle to the source clock

Actually we're not flexible here.
See we have hard-coded "core_clk" in [PATCH 8/9].
We use it directly in show_cpuinfo() for reading clock speed
as well as in axs103_early_init().

So "source clock" here MUST be "core_clk", otherwise
/proc/cpuinfo will report junk instead of meaningful data at least.


> +
> +Optional properties:
> +
> +- interrupt-parent : phandle to parent intc
> +
> +Example:
> +
> + timer0: timer_clkevt {
> + compatible = "snps,arc-timer0";
> + interrupts = <3>;
> + interrupt-parent = <&core_intc>;
> + clocks = <&timer0_clk>;
> + };
> diff --git a/Documentation/devicetree/bindings/timer/snps,arc-timer1.txt
> b/Documentation/devicetree/bindings/timer/snps,arc-timer1.txt
> new file mode 100644
> index ..4886192ce2f2
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/timer/snps,arc-timer1.txt
> @@ -0,0 +1,17 @@
> +Synopsys ARC Free Running Local 32-bit Timer
> +- Found on all ARC CPUs (ARC700/ARCHS)
> +- Mandatory clocksource provider on ARC700
> +- Optional clocksource provider on UP ARC HS CPUs
> +  (and if better timer archs-rtc not available in SoC)
> +
> +Required properties:
> +
> +- compatible : should be "snps,arc-timer1"
> +- clocks : phandle to the source clock
> +
> +Example:
> +
> + timer1: timer_clksrc {
> + compatible = "snps,arc-timer1";
> + clocks = <&timer0_clk>;

Ditto, "clocks = <&core_clk>".

> + };
> diff --git a/Documentation/devicetree/bindings/timer/snps,archs-gfrc.txt
> b/Documentation/devicetree/bindings/timer/snps,archs-gfrc.txt
> new file mode 100644
> index ..cce60e16aa0d
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/timer/snps,archs-gfrc.txt
> @@ -0,0 +1,14 @@
> +Synopsys ARC Free Running 64-bit Global Timer for ARC HS CPUs
> +- clocksourc provider for SMP SoC
> +
> +Required properties:
> +
> +- compatible : should be "snps,archs-gfrc"
> +- clocks : phandle to the source clock
> +
> +Example:
> +
> + timer1: timer_clksrc {
> + compatible = "snps,archs-gfrc";
> + clocks = <&timer0_clk>;

Ditto, "clocks = <&core_clk>".

> + };
> diff --git a/Documentation/devicetree/bindings/timer/snps,archs-rtc.txt
> b/Documentation/devicetree/bindings/timer/snps,archs-rtc.txt
> new file mode 100644
> index ..f3b49938812b
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/timer/snps,archs-rtc.txt
> @@ -0,0 +1,14 @@
> +Synopsys ARC Free Running 64-bit Local Timer for ARC HS CPUs
> +- clocksourc provider for UP SoC
> +
> +Required properties:
> +
> +- compatible : should be "snps,archs-rtc"
> +- clocks : phandle to the source clock
> +
> +Example:
> +
> + timer1: timer_clksrc {
> + compatible = "snps,arc-rtc";
> + clocks = <&timer0_clk>;
> + };
> diff --git a/arch/arc/boot/dts/abilis_tb10x.dtsi 
> b/arch/arc/boot/dts/abilis_tb10x.dtsi
> index cfb5052239a1..f9f138efa92c 100644
> --- a/arch/arc/boot/dts/abilis_tb10x.dtsi
> +++ b/arch/arc/boot/dts/abilis_tb10x.dtsi
> @@ -35,6 +35,18 @@
>   };
>   };
>  
> + timer0: timer_clkevt {
> + compatible = "snps,arc-timer0";
> + interrupts = <3>;
> + interrupt-parent = <&intc>;
> + clocks = <&cpu_clk>;
>
> + };
> +
> + timer1: timer_clksrc {
> + compatible = "snps,arc-timer1";
> + clocks = <&cpu_clk>;
> + };
> +

Hm now that's a question how to fix /proc/cpuinfo output
for Abilis? There's no "core_clk" DTS node for Abilis and so
show_cpuinfo() won't get proper clock value.

Probably we may fix it with modification of their "pll" node
from
>8--
pll0: oscillator {
clock-frequency  = <10>;
};
>8--

to
>8--
core_clk: oscillator {
   

Re: [PATCH 7/9] ARC: use fixed frequencies in arc_set_early_base_baud()

2016-02-02 Thread Alexey Brodkin
Hi Christian,

On Tue, 2016-02-02 at 14:43 +0100, christian.rupp...@alitech.com wrote:
> Alexey Brodkin  wrote on 02.02.2016 13:53:26:
> > 
> > Adding Christian for Abilis TB10x clocks review.
> > 
> > On Tue, 2016-02-02 at 16:28 +0530, Vineet Gupta wrote:
> > > From: Alexey Brodkin 
> > > 
> > > UARTs usually have fixed clock so we're switching to use of
> > > constant values instead of something derived from core clock
> > > frequency.
> > > 
> > > Among other things this will allow us to get rid of
> > > arc_{get|set}_core_freq() and switch to generic clock
> > > framework later on.
> > > 
> > > Signed-off-by: Alexey Brodkin 
> > > Signed-off-by: Vineet Gupta 
> > > ---
> > >  arch/arc/kernel/devtree.c | 6 ++
> > >  1 file changed, 2 insertions(+), 4 deletions(-)
> > > 
> > > diff --git a/arch/arc/kernel/devtree.c b/arch/arc/kernel/devtree.c
> > > index 7e844fd8213f..e155126c79b1 100644
> > > --- a/arch/arc/kernel/devtree.c
> > > +++ b/arch/arc/kernel/devtree.c
> > > @@ -28,14 +28,12 @@ unsigned int __init arc_early_base_baud(void)
> > > 
> > >  static void __init arc_set_early_base_baud(unsigned long dt_root)
> > >  {
> > > -   unsigned int core_clk = arc_get_core_freq();
> > > -
> > > if (of_flat_dt_is_compatible(dt_root, "abilis,arc-tb10x"))
> > > -  arc_base_baud = core_clk/3;
> > > +  arc_base_baud = 16667;   /* Fixed 166.7MHz clk (TB10x) */
> 
> Actually, (int)core_clk/(int)3 is 1 not 16667.
> I seem to remember that this rounding detail did make a difference at some 
> point. Unluckily, the details are long forgotten in the mist of time...

Interesting :)

I did that rounding intentionally hoping for the best.
But so good we've got your valuable input before it's too late.

-Alexey
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH 2/9] ARC: [dts] Introduce Timer bindings

2016-02-02 Thread Alexey Brodkin
Hi Vineet,

On Tue, 2016-02-02 at 19:59 +0530, Vineet Gupta wrote:
> Hi Alexey,
> 
> On Tuesday 02 February 2016 06:45 PM, Alexey Brodkin wrote:
> > Hi Vineet,
> > 
> > On Tue, 2016-02-02 at 16:28 +0530, Vineet Gupta wrote:
> > > +
> > > +Required properties:
> > > +
> > > +- compatible : should be "snps,arc-timer0"
> > > +- interrupts : single Interrupt going into parent intc
> > > +(16 for ARCHS cores, 3 for ARC700 cores)
> > > +- clocks : phandle to the source clock
> > 
> > Actually we're not flexible here.
> > See we have hard-coded "core_clk" in [PATCH 8/9].
> > We use it directly in show_cpuinfo() for reading clock speed
> > as well as in axs103_early_init().
> > 
> > So "source clock" here MUST be "core_clk", otherwise
> > /proc/cpuinfo will report junk instead of meaningful data at least.
> 
> Using hardcoded DT names in generic code is total BS and I slap myself for 
> missing
> that in reviewing 8/9. Please fix it !

But the only other alternative to hard-coded name is use of some internal 
variable
like "arc_timer_freq".

I.e. we make "arc_timer_freq" global and use it for displaying core frequency.

Are you OK with that?

-Alexey
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH 2/9] ARC: [dts] Introduce Timer bindings

2016-02-02 Thread Alexey Brodkin
Hi Vineet,

On Tue, 2016-02-02 at 18:36 +0300, Alexey Brodkin wrote:
> Hi Vineet,
> 
> On Tue, 2016-02-02 at 19:59 +0530, Vineet Gupta wrote:
> > Hi Alexey,
> > 
> > On Tuesday 02 February 2016 06:45 PM, Alexey Brodkin wrote:
> > > Hi Vineet,
> > > 
> > > On Tue, 2016-02-02 at 16:28 +0530, Vineet Gupta wrote:
> > > > +
> > > > +Required properties:
> > > > +
> > > > +- compatible : should be "snps,arc-timer0"
> > > > +- interrupts : single Interrupt going into parent intc
> > > > +  (16 for ARCHS cores, 3 for ARC700 cores)
> > > > +- clocks : phandle to the source clock
> > > 
> > > Actually we're not flexible here.
> > > See we have hard-coded "core_clk" in [PATCH 8/9].
> > > We use it directly in show_cpuinfo() for reading clock speed
> > > as well as in axs103_early_init().
> > > 
> > > So "source clock" here MUST be "core_clk", otherwise
> > > /proc/cpuinfo will report junk instead of meaningful data at least.
> > 
> > Using hardcoded DT names in generic code is total BS and I slap myself for 
> > missing
> > that in reviewing 8/9. Please fix it !
> 
> But the only other alternative to hard-coded name is use of some internal 
> variable
> like "arc_timer_freq".
> 
> I.e. we make "arc_timer_freq" global and use it for displaying core frequency.

Well actually there's another possibility that is used on many other platforms
(ARM both 32 and 64-bit flavors is a good example) - just print bogomips instead
of additional core frequency.

-Alexey
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH 2/9] ARC: [dts] Introduce Timer bindings

2016-02-03 Thread Alexey Brodkin
Hi Mike,

On Wed, 2016-02-03 at 01:57 +0300, Alexey Brodkin wrote:
> Hi Vineet,
> 
> On Tue, 2016-02-02 at 18:36 +0300, Alexey Brodkin wrote:
> > Hi Vineet,
> > 
> > On Tue, 2016-02-02 at 19:59 +0530, Vineet Gupta wrote:
> > > Hi Alexey,
> > > 
> > > On Tuesday 02 February 2016 06:45 PM, Alexey Brodkin wrote:
> > > > Hi Vineet,
> > > > 
> > > > On Tue, 2016-02-02 at 16:28 +0530, Vineet Gupta wrote:
> > > > > +
> > > > > +Required properties:
> > > > > +
> > > > > +- compatible : should be "snps,arc-timer0"
> > > > > +- interrupts : single Interrupt going into parent intc
> > > > > +(16 for ARCHS cores, 3 for ARC700 cores)
> > > > > +- clocks : phandle to the source clock
> > > > 
> > > > Actually we're not flexible here.
> > > > See we have hard-coded "core_clk" in [PATCH 8/9].
> > > > We use it directly in show_cpuinfo() for reading clock speed
> > > > as well as in axs103_early_init().
> > > > 
> > > > So "source clock" here MUST be "core_clk", otherwise
> > > > /proc/cpuinfo will report junk instead of meaningful data at least.
> > > 
> > > Using hardcoded DT names in generic code is total BS and I slap myself 
> > > for missing
> > > that in reviewing 8/9. Please fix it !
> > 
> > But the only other alternative to hard-coded name is use of some internal 
> > variable
> > like "arc_timer_freq".
> > 
> > I.e. we make "arc_timer_freq" global and use it for displaying core 
> > frequency.
> 
> Well actually there's another possibility that is used on many other platforms
> (ARM both 32 and 64-bit flavors is a good example) - just print bogomips 
> instead
> of additional core frequency.

We're in the process of switching ARC to generic clk framework.

One of the problems we're trying to solve now is how to obtain
precise CPU frequency value for outputting it for example by /proc/cpuinfo.

This precise (in terms of what value was set via Device Tree or extracted and 
decoded
from CPU configuration registers) CPU frequency is very useful for example for
benchmarking. In comparison bogomips might be misleading at times.

Before moving to clk framework we used to have 2 ARC-specific calls
arc_get_core_freq() and  arc_set_core_freq() which were basically wrappers for
one variable where we stored CPU frequency.

I took a look at what other architectures do and so far saw these options:
 [1] Just print bogomips (ARM both 32- and 64-bit, m64k, Microblaze, Mips,
  mn10300, openrisc, s390, sh, um, unicore32, )
 [2] Get frequency from some kind of architecture-specific structure or variable
 (Alpha, AVR32, c6x, nios2, powerpc, sparc, tile, xtensa) 
 [3] Get frequency from cpufreq framework (ia64, x86)
 [4] Decode frequency from hardware registers (Blackfin)

Any thoughts on what's the best way to get CPU frequency in run-time
(preferably with use of clk framework so we'll need no arch-specific
variables)?

Regards,
Alexey
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH 2/9] ARC: [dts] Introduce Timer bindings

2016-02-03 Thread Alexey Brodkin
(re-sending because Mike's email @ti is no longer valid)

Hi Mike,

On Wed, 2016-02-03 at 01:57 +0300, Alexey Brodkin wrote:
> Hi Vineet,
> 
> On Tue, 2016-02-02 at 18:36 +0300, Alexey Brodkin wrote:
> > Hi Vineet,
> > 
> > On Tue, 2016-02-02 at 19:59 +0530, Vineet Gupta wrote:
> > > Hi Alexey,
> > > 
> > > On Tuesday 02 February 2016 06:45 PM, Alexey Brodkin wrote:
> > > > Hi Vineet,
> > > > 
> > > > On Tue, 2016-02-02 at 16:28 +0530, Vineet Gupta wrote:
> > > > > +
> > > > > +Required properties:
> > > > > +
> > > > > +- compatible : should be "snps,arc-timer0"
> > > > > +- interrupts : single Interrupt going into parent intc
> > > > > +(16 for ARCHS cores, 3 for ARC700 cores)
> > > > > +- clocks : phandle to the source clock
> > > > 
> > > > Actually we're not flexible here.
> > > > See we have hard-coded "core_clk" in [PATCH 8/9].
> > > > We use it directly in show_cpuinfo() for reading clock speed
> > > > as well as in axs103_early_init().
> > > > 
> > > > So "source clock" here MUST be "core_clk", otherwise
> > > > /proc/cpuinfo will report junk instead of meaningful data at least.
> > > 
> > > Using hardcoded DT names in generic code is total BS and I slap myself 
> > > for missing
> > > that in reviewing 8/9. Please fix it !
> > 
> > But the only other alternative to hard-coded name is use of some internal 
> > variable
> > like "arc_timer_freq".
> > 
> > I.e. we make "arc_timer_freq" global and use it for displaying core 
> > frequency.
> 
> Well actually there's another possibility that is used on many other platforms
> (ARM both 32 and 64-bit flavors is a good example) - just print bogomips 
> instead
> of additional core frequency.

We're in the process of switching ARC to generic clk framework.

One of the problems we're trying to solve now is how to obtain
precise CPU frequency value for outputting it for example by /proc/cpuinfo.

This precise (in terms of what value was set via Device Tree or extracted and 
decoded
from CPU configuration registers) CPU frequency is very useful for example for
benchmarking. In comparison bogomips might be misleading at times.

Before moving to clk framework we used to have 2 ARC-specific calls
arc_get_core_freq() and  arc_set_core_freq() which were basically wrappers for
one variable where we stored CPU frequency.

I took a look at what other architectures do and so far saw these options:
 [1] Just print bogomips (ARM both 32- and 64-bit, m64k, Microblaze, Mips,
  mn10300, openrisc, s390, sh, um, unicore32, )
 [2] Get frequency from some kind of architecture-specific structure or variable
 (Alpha, AVR32, c6x, nios2, powerpc, sparc, tile, xtensa) 
 [3] Get frequency from cpufreq framework (ia64, x86)
 [4] Decode frequency from hardware registers (Blackfin)

Any thoughts on what's the best way to get CPU frequency in run-time
(preferably with use of clk framework so we'll need no arch-specific
variables)?

Regards,
Alexey
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [RFC] perf: fix building for ARCv1

2016-02-03 Thread Alexey Brodkin
Hi Vineet,

On Fri, 2015-10-30 at 06:19 +, Vineet Gupta wrote:
> On Thursday 29 October 2015 09:28 PM, Alexey Brodkin wrote:
> > Hi Vineet,
> > 
> > On Tue, 2015-10-20 at 10:45 +, Vineet Gupta wrote:
> > > On Tuesday 20 October 2015 03:41 PM, Peter Zijlstra wrote:
> > > > > > Can we use existing syscall(s) - again this is what our good old 
> > > > > > pthread library
> > > > > > code did.
> > > > > > 
> > > > > > static void __pthread_acquire(int * spinlock)
> > > > > > {
> > > > > >   int cnt = 0;
> > > > > >   struct timespec tm;
> > > > > > 
> > > > > >   READ_MEMORY_BARRIER();
> > > > > > 
> > > > > >   while (testandset(spinlock)) {   < atomic EXchange
> > > > > > if (cnt < 50) {
> > > > > >   sched_yield();
> > > > > >   cnt++;
> > > > > > } else {
> > > > > >   tm.tv_sec = 0;
> > > > > >   tm.tv_nsec = 201;
> > > > > >   nanosleep(&tm, ((void *)0));
> > > > > >   cnt = 0;
> > > > > > }
> > > > > >   }
> > > > *shudder* that is quite horrible.
> > > > 
> > > > This means all your 'atomics' are broken for anything SCHED_FIFO and the
> > > > like. You simply _cannot_ run a realtime system.
> > > The code above is from uClibc old threading library which we don't use 
> > > anymore.
> > > The NPTL version doesn't have all of this song-n-dance and relies on 
> > > futexes. The
> > > change we are talking about is only for the atomics in perf itself. I do
> > > understand your POV though.
> > > 
> > > > (also, for ACQUIRE you want the READ_MEMORY_BARRIER() _after_ the
> > > > test-and-set control dependency.)
> > > Absolutely and in this case it will have to be added both inside the loop 
> > > and one
> > > at the end to cover both the scenarios !
> > > 
> > I'm wondering what are our plans for now?
> > Are we going to accept proposed fix just for ARC in 4.4 (and to all stables 
> > then)
> > or we'll try to come up with more general solution?
> 
> I agree with the current solution to add -atomic to for arc700 builds.
> Although making that default for arc700 tools will be better but that will 
> not fix
> things before next release of tools etc.
> 
> But we *do* need to improve generic solution
> 1. Add atomics detection in perf to add fall back arch stubs
> 2. ARC needs to add syscall for facilitating atomic r-m-w !

So the most recent ARC GNU tools (2015.12) were just released yesterday
and still atomics are disabled by default for ARCv1.
That means perf will continue to fail on building for now.

Do you think we may apply my initial fix to 4.5 while it is in development and
then to stable trees as well?

-Alexey
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH] arc: make sure __delay() never gets executed with 0 loops

2016-02-15 Thread Alexey Brodkin
Current implementation of __delay() function uses so-called
zero-delay loops. And the only condition to exit that loop is
LP_COUNT (loop count register) = 1 (but not 0 as it might be easily
imagined).

So if our calculation of "loops" gives 0 (and that is pretty possible
given result of multiplication being >> 32) then zero-delay loop
mechanism starts with LP_COUNT=0 and it ends up decrementing LP_COUNT
while staying in the loop effectively producing close to infinite delay
instead of very short one.

I bumped into it with AXS101 + external DDR controller and caches
disabled. In that case I've got very small
loops_per_jiffy=0xf00:
>8
Calibrating delay loop... 0.77 BogoMIPS (lpj=3862)
>8

And on console output delays were way too long.

Signed-off-by: Alexey Brodkin 
Cc: Vineet Gupta 
 Please enter the commit message for your changes. Lines starting
---
 arch/arc/include/asm/delay.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arc/include/asm/delay.h b/arch/arc/include/asm/delay.h
index 08e7e2a..1a7a1dc 100644
--- a/arch/arc/include/asm/delay.h
+++ b/arch/arc/include/asm/delay.h
@@ -57,7 +57,8 @@ static inline void __udelay(unsigned long usecs)
 */
loops = ((u64) usecs * 4295 * HZ * loops_per_jiffy) >> 32;
 
-   __delay(loops);
+   if (loops)
+   __delay(loops);
 }
 
 #define udelay(n) (__builtin_constant_p(n) ? ((n) > 2 ? __bad_udelay() \
-- 
2.4.3


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 3/4] arc: axs10x - add support of ARC PGU

2016-02-19 Thread Alexey Brodkin
Synopsys DesignWare ARC SDP boards sport ARC SDP display
controller attached to ADV7511 HDMI encoder.

That change adds desctiption of both ARC PGU and ADV7511 in
ARC SDP'd base-board Device Tree.

Signed-off-by: Alexey Brodkin 
Cc: Rob Herring 
Cc: Pawel Moll 
Cc: Mark Rutland 
Cc: Ian Campbell 
Cc: Kumar Gala 
Cc: Vineet Gupta 
Cc: devicet...@vger.kernel.org
Cc: linux-snps-arc@lists.infradead.org
---
 arch/arc/boot/dts/axs10x_mb.dtsi | 54 
 1 file changed, 54 insertions(+)

diff --git a/arch/arc/boot/dts/axs10x_mb.dtsi b/arch/arc/boot/dts/axs10x_mb.dtsi
index 44a578c..0d50bc3 100644
--- a/arch/arc/boot/dts/axs10x_mb.dtsi
+++ b/arch/arc/boot/dts/axs10x_mb.dtsi
@@ -147,6 +147,37 @@
clocks = <&i2cclk>;
interrupts = <16>;
 
+   adv7511:adv7511@0x39{
+   compatible="adi,adv7511";
+   reg = <0x39>;
+   interrupts = <23>;
+   adi,input-depth = <8>;
+   adi,input-colorspace = "rgb";
+   adi,input-clock = "1x";
+   adi,clock-delay = <0x03>;
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   /* RGB/YUV input */
+   port@0 {
+   reg = <0>;
+   adv7511_input:endpoint {
+   remote-endpoint = <&pgu_output>;
+   };
+   };
+
+   /* HDMI output */
+   port@1 {
+   reg = <1>;
+   adv7511_output: endpoint {
+   remote-endpoint = 
<&hdmi_connector_in>;
+   };
+   };
+   };
+   };
+
eeprom@0x54{
compatible = "24c01";
reg = <0x54>;
@@ -160,6 +191,16 @@
};
};
 
+   hdmi0: connector {
+   compatible = "hdmi-connector";
+   type = "a";
+   port {
+   hdmi_connector_in: endpoint {
+   remote-endpoint = <&adv7511_output>;
+   };
+   };
+   };
+
gpio0:gpio@13000 {
compatible = "snps,dw-apb-gpio";
reg = <0x13000 0x1000>;
@@ -221,5 +262,18 @@
reg = <2>;
};
};
+
+   pgu@0x17000 {
+   compatible = "snps,arcpgu";
+   reg = <0x17000 0x400>;
+   encoder-slave = <&adv7511>;
+   interrupts = <5>;
+
+   port {
+   pgu_output: endpoint {
+   remote-endpoint = <&adv7511_input>;
+   };
+   };
+   };
};
 };
-- 
2.5.0


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 0/4] drm: Add support of ARC PGU display controller

2016-02-19 Thread Alexey Brodkin
This series add support of ARC PGU display controller.
ARC PGU is a quite simple byte streamer that gets data from the framebuffer
and pushes it to hte connected encoder (DP or HDMI).

It was tested on ARC SDP boards (axs101 in particular).

Alexey Brodkin (4):
  drm: Add support of ARC PGU display controller
  drm: Add DT bindings documentation for ARC PGU display controller
  arc: axs10x - add support of ARC PGU
  MAINTAINERS: Add maintainer for ARC PGU display controller

 .../devicetree/bindings/display/snps,arcpgu.txt|  74 ++
 MAINTAINERS|   6 +
 arch/arc/boot/dts/axs10x_mb.dtsi   |  54 
 drivers/gpu/drm/Kconfig|   2 +
 drivers/gpu/drm/Makefile   |   1 +
 drivers/gpu/drm/arc/Kconfig|  10 +
 drivers/gpu/drm/arc/Makefile   |   2 +
 drivers/gpu/drm/arc/arcpgu.h   |  47 
 drivers/gpu/drm/arc/arcpgu_crtc.c  | 274 +
 drivers/gpu/drm/arc/arcpgu_drv.c   | 239 ++
 drivers/gpu/drm/arc/arcpgu_hdmi.c  | 204 +++
 drivers/gpu/drm/arc/arcpgu_regs.h  |  36 +++
 12 files changed, 949 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/snps,arcpgu.txt
 create mode 100644 drivers/gpu/drm/arc/Kconfig
 create mode 100644 drivers/gpu/drm/arc/Makefile
 create mode 100644 drivers/gpu/drm/arc/arcpgu.h
 create mode 100644 drivers/gpu/drm/arc/arcpgu_crtc.c
 create mode 100644 drivers/gpu/drm/arc/arcpgu_drv.c
 create mode 100644 drivers/gpu/drm/arc/arcpgu_hdmi.c
 create mode 100644 drivers/gpu/drm/arc/arcpgu_regs.h

-- 
2.5.0


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 1/4] drm: Add support of ARC PGU display controller

2016-02-19 Thread Alexey Brodkin
ARC PGU could be found on some development boards from Synopsys.
This is a simple byte streamer that reads data from a framebuffer
and sends data to the single encoder.

Signed-off-by: Alexey Brodkin 
Cc: David Airlie 
Cc: dri-de...@lists.freedesktop.org
Cc: linux-snps-arc@lists.infradead.org
---
 drivers/gpu/drm/Kconfig   |   2 +
 drivers/gpu/drm/Makefile  |   1 +
 drivers/gpu/drm/arc/Kconfig   |  10 ++
 drivers/gpu/drm/arc/Makefile  |   2 +
 drivers/gpu/drm/arc/arcpgu.h  |  47 +++
 drivers/gpu/drm/arc/arcpgu_crtc.c | 274 ++
 drivers/gpu/drm/arc/arcpgu_drv.c  | 239 +
 drivers/gpu/drm/arc/arcpgu_hdmi.c | 204 
 drivers/gpu/drm/arc/arcpgu_regs.h |  36 +
 9 files changed, 815 insertions(+)
 create mode 100644 drivers/gpu/drm/arc/Kconfig
 create mode 100644 drivers/gpu/drm/arc/Makefile
 create mode 100644 drivers/gpu/drm/arc/arcpgu.h
 create mode 100644 drivers/gpu/drm/arc/arcpgu_crtc.c
 create mode 100644 drivers/gpu/drm/arc/arcpgu_drv.c
 create mode 100644 drivers/gpu/drm/arc/arcpgu_hdmi.c
 create mode 100644 drivers/gpu/drm/arc/arcpgu_regs.h

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 08706f0..654a9cb 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -279,3 +279,5 @@ source "drivers/gpu/drm/imx/Kconfig"
 source "drivers/gpu/drm/vc4/Kconfig"
 
 source "drivers/gpu/drm/etnaviv/Kconfig"
+
+source "drivers/gpu/drm/arc/Kconfig"
diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index 6eb94fc..c338d04 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -78,3 +78,4 @@ obj-y += panel/
 obj-y  += bridge/
 obj-$(CONFIG_DRM_FSL_DCU) += fsl-dcu/
 obj-$(CONFIG_DRM_ETNAVIV) += etnaviv/
+obj-$(CONFIG_DRM_ARCPGU)+= arc/
diff --git a/drivers/gpu/drm/arc/Kconfig b/drivers/gpu/drm/arc/Kconfig
new file mode 100644
index 000..f9a13b6
--- /dev/null
+++ b/drivers/gpu/drm/arc/Kconfig
@@ -0,0 +1,10 @@
+config DRM_ARCPGU
+   tristate "ARC PGU"
+   depends on DRM && OF
+   select DRM_KMS_CMA_HELPER
+   select DRM_KMS_FB_HELPER
+   select DRM_KMS_HELPER
+   help
+ Choose this option if you have an ARC PGU controller.
+
+ If M is selected the module will be called arcpgu.
diff --git a/drivers/gpu/drm/arc/Makefile b/drivers/gpu/drm/arc/Makefile
new file mode 100644
index 000..d48fda7
--- /dev/null
+++ b/drivers/gpu/drm/arc/Makefile
@@ -0,0 +1,2 @@
+arcpgu-y := arcpgu_crtc.o arcpgu_hdmi.o arcpgu_drv.o
+obj-$(CONFIG_DRM_ARCPGU) += arcpgu.o
diff --git a/drivers/gpu/drm/arc/arcpgu.h b/drivers/gpu/drm/arc/arcpgu.h
new file mode 100644
index 000..d6a5cf5
--- /dev/null
+++ b/drivers/gpu/drm/arc/arcpgu.h
@@ -0,0 +1,47 @@
+/*
+ * ARC PGU DRM driver.
+ *
+ * Copyright (C) 2016 Synopsys, Inc. (www.synopsys.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 _ARCPGU_H_
+#define _ARCPGU_H_
+
+struct arcpgu_drm_private {
+   void __iomem*regs;
+   struct clk  *clk;
+   struct drm_fbdev_cma*fbdev;
+   struct drm_framebuffer  *fb;
+   struct list_headevent_list;
+   struct drm_crtc crtc;
+   struct drm_plane*plane;
+};
+
+#define crtc_to_arcpgu_priv(x) container_of(x, struct arcpgu_drm_private, crtc)
+
+static inline void arc_pgu_write(struct arcpgu_drm_private *arcpgu,
+unsigned int reg, u32 value)
+{
+   iowrite32(value, arcpgu->regs + reg);
+}
+
+static inline u32 arc_pgu_read(struct arcpgu_drm_private *arcpgu,
+  unsigned int reg)
+{
+   return ioread32(arcpgu->regs + reg);
+}
+
+int arc_pgu_setup_crtc(struct drm_device *dev);
+int arcpgu_drm_hdmi_init(struct drm_device *drm, struct device_node *np);
+
+#endif
diff --git a/drivers/gpu/drm/arc/arcpgu_crtc.c 
b/drivers/gpu/drm/arc/arcpgu_crtc.c
new file mode 100644
index 000..0fe5c8a
--- /dev/null
+++ b/drivers/gpu/drm/arc/arcpgu_crtc.c
@@ -0,0 +1,274 @@
+/*
+ * ARC PGU DRM driver.
+ *
+ * Copyright (C) 2016 Synopsys, Inc. (www.synopsys.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
+ * MERCH

[PATCH 2/4] drm: Add DT bindings documentation for ARC PGU display controller

2016-02-19 Thread Alexey Brodkin
This add DT bindings documentation for ARC PGU display controller.

Signed-off-by: Alexey Brodkin 
Cc: Rob Herring 
Cc: Pawel Moll 
Cc: Mark Rutland 
Cc: Ian Campbell 
Cc: Kumar Gala 
Cc: devicet...@vger.kernel.org
Cc: linux-snps-arc@lists.infradead.org
---
 .../devicetree/bindings/display/snps,arcpgu.txt| 74 ++
 1 file changed, 74 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/snps,arcpgu.txt

diff --git a/Documentation/devicetree/bindings/display/snps,arcpgu.txt 
b/Documentation/devicetree/bindings/display/snps,arcpgu.txt
new file mode 100644
index 000..c8382fb
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/snps,arcpgu.txt
@@ -0,0 +1,74 @@
+ARC PGU
+
+This is a display controller found on several development boards produced
+by Synopsys. The ARC PGU is an RGB streamer that reads the data from a
+framebuffer and sends it to a single digital encoder (usually HDMI).
+
+Required properties:
+  - compatible: "snps,arcpgu"
+  - reg: Physical base address and length of the controller's registers.
+  - clocks: A list of phandle + clock-specifier pairs, one for each
+entry in 'clock-names'.
+  - clock-names: A list of clock names. For ARC PGU it should contain:
+  - "pxlclk" for the clock feeding the output PLL of the controller.
+  - encoder-slave: Phandle of encoder chip.
+
+Required sub-nodes:
+  - port: The PGU connection to an encoder chip. The connection is modelled
+using the OF graph bindings specified in
+Documentation/devicetree/bindings/graph.txt.
+
+Example:
+
+/ {
+   ...
+
+   pgu@0x {
+   compatible = "snps,arcpgu";
+   reg = <0x 0x400>;
+   clocks = <&clock_node>;
+   clock-names = "pxlclk";
+   encoder-slave = <&encoder_node>;
+
+   port {
+   pgu_output: endpoint {
+   remote-endpoint = <&hdmi_enc_input>;
+   };
+   };
+   };
+
+   /* HDMI encoder on I2C bus */
+   i2c@0x {
+   compatible = "...";
+
+   encoder_node:encoder_node@0x{
+   compatible="...";
+
+   ports {
+   port@0 {
+   reg = <0>;
+   hdmi_enc_input:endpoint {
+   remote-endpoint = <&pgu_output>;
+   };
+   };
+
+   port@1 {
+   reg = <1>;
+   hdmi_enc_output:endpoint {
+   remote-endpoint = 
<&hdmi_connector_in>;
+   };
+   };
+   };
+   };
+   }
+
+   hdmi0: connector {
+   compatible = "hdmi-connector";
+
+   port {
+   hdmi_connector_in: endpoint {
+   remote-endpoint = <&hdmi_enc_output>;
+   };
+   };
+   };
+};
-- 
2.5.0


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 4/4] MAINTAINERS: Add maintainer for ARC PGU display controller

2016-02-19 Thread Alexey Brodkin
This updates MAINTEINERS file with information about maintainer of
ARC PGU display controller driver.

Signed-off-by: Alexey Brodkin 
Cc: linux-snps-arc@lists.infradead.org
---
 MAINTAINERS | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 28cd72b..26ac58c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -847,6 +847,12 @@ S: Maintained
 F: drivers/net/arcnet/
 F: include/uapi/linux/if_arcnet.h
 
+ARC PGU DRM DRIVER
+M: Alexey Brodkin 
+S: Supported
+F: drivers/gpu/drm/arc/
+F: Documentation/devicetree/bindings/display/snps,arcpgu.txt
+
 ARM HDLCD DRM DRIVER
 M: Liviu Dudau 
 S: Supported
-- 
2.5.0


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH] arc: get rid of DEVTMPFS dependency on INITRAMFS_SOURCE

2016-02-20 Thread Alexey Brodkin
Even though DEVTMPFS is required when our pre-built initramfs
is used it is not the case in general. It is perfectly possible
to use initramfs with device nodes already populated or there
could be other usages, see discussion below for more detials:
http://thread.gmane.org/gmane.comp.embedded.openwrt.devel/37819/focus=37821

This change removes mentioned dependency from arch/arc/Kconfig
updating instead those defconfigs that are usually used with this
kind of pre-build initramfs.

And while at it all touched defconfigs were regenerated via
savedefconfig and some options were removed:
 * USB is selected by other options implicitly
 * VGA_CONSOLE is disableb for ARC since
   031e29b5877f31676739dc2f847d04c2c0732034
 * EXT3_FS automatically selects EXT4_FS
 * MTDxxx and JFFS2_FS make no sense for AXS because
   AXS NAND controller is not upstreamed
 * NET_OSCI_LAN is not in upstream as well
 * ARCPGU_xxx options make no sense because ARC PGU is not yet
   in upstream and when it gets there all config options would
   be taken from devicetree

Signed-off-by: Alexey Brodkin 
---
 arch/arc/Kconfig   |  2 --
 arch/arc/configs/axs101_defconfig  |  4 +---
 arch/arc/configs/axs103_defconfig  | 10 +-
 arch/arc/configs/axs103_smp_defconfig  | 10 +-
 arch/arc/configs/nsim_700_defconfig|  5 ++---
 arch/arc/configs/nsim_hs_defconfig |  3 +--
 arch/arc/configs/nsim_hs_smp_defconfig |  6 ++
 arch/arc/configs/nsimosci_defconfig|  2 +-
 arch/arc/configs/nsimosci_hs_defconfig |  3 +--
 arch/arc/configs/nsimosci_hs_smp_defconfig | 12 ++--
 arch/arc/configs/tb10x_defconfig   | 18 ++
 11 files changed, 18 insertions(+), 57 deletions(-)

diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index 0655495..b2befa4 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -12,8 +12,6 @@ config ARC
select BUILDTIME_EXTABLE_SORT
select COMMON_CLK
select CLONE_BACKWARDS
-   # ARC Busybox based initramfs absolutely relies on DEVTMPFS for /dev
-   select DEVTMPFS if !INITRAMFS_SOURCE=""
select GENERIC_ATOMIC64
select GENERIC_CLOCKEVENTS
select GENERIC_FIND_FIRST_BIT
diff --git a/arch/arc/configs/axs101_defconfig 
b/arch/arc/configs/axs101_defconfig
index f1ac981..5d4e2a0 100644
--- a/arch/arc/configs/axs101_defconfig
+++ b/arch/arc/configs/axs101_defconfig
@@ -39,6 +39,7 @@ CONFIG_IP_PNP_RARP=y
 # CONFIG_INET_XFRM_MODE_TUNNEL is not set
 # CONFIG_INET_XFRM_MODE_BEET is not set
 # CONFIG_IPV6 is not set
+CONFIG_DEVTMPFS=y
 # CONFIG_STANDALONE is not set
 # CONFIG_PREVENT_FIRMWARE_BUILD is not set
 # CONFIG_FIRMWARE_IN_KERNEL is not set
@@ -73,7 +74,6 @@ CONFIG_I2C_CHARDEV=y
 CONFIG_I2C_DESIGNWARE_PLATFORM=y
 # CONFIG_HWMON is not set
 CONFIG_FB=y
-# CONFIG_VGA_CONSOLE is not set
 CONFIG_FRAMEBUFFER_CONSOLE=y
 CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
 CONFIG_LOGO=y
@@ -91,12 +91,10 @@ CONFIG_MMC_SDHCI_PLTFM=y
 CONFIG_MMC_DW=y
 # CONFIG_IOMMU_SUPPORT is not set
 CONFIG_EXT3_FS=y
-CONFIG_EXT4_FS=y
 CONFIG_MSDOS_FS=y
 CONFIG_VFAT_FS=y
 CONFIG_NTFS_FS=y
 CONFIG_TMPFS=y
-CONFIG_JFFS2_FS=y
 CONFIG_NFS_FS=y
 CONFIG_NLS_CODEPAGE_437=y
 CONFIG_NLS_ISO8859_1=y
diff --git a/arch/arc/configs/axs103_defconfig 
b/arch/arc/configs/axs103_defconfig
index 323486d..87ee46b 100644
--- a/arch/arc/configs/axs103_defconfig
+++ b/arch/arc/configs/axs103_defconfig
@@ -39,14 +39,10 @@ CONFIG_IP_PNP_RARP=y
 # CONFIG_INET_XFRM_MODE_TUNNEL is not set
 # CONFIG_INET_XFRM_MODE_BEET is not set
 # CONFIG_IPV6 is not set
+CONFIG_DEVTMPFS=y
 # CONFIG_STANDALONE is not set
 # CONFIG_PREVENT_FIRMWARE_BUILD is not set
 # CONFIG_FIRMWARE_IN_KERNEL is not set
-CONFIG_MTD=y
-CONFIG_MTD_CMDLINE_PARTS=y
-CONFIG_MTD_BLOCK=y
-CONFIG_MTD_NAND=y
-CONFIG_MTD_NAND_AXS=y
 CONFIG_SCSI=y
 CONFIG_BLK_DEV_SD=y
 CONFIG_NETDEVICES=y
@@ -78,14 +74,12 @@ CONFIG_I2C_CHARDEV=y
 CONFIG_I2C_DESIGNWARE_PLATFORM=y
 # CONFIG_HWMON is not set
 CONFIG_FB=y
-# CONFIG_VGA_CONSOLE is not set
 CONFIG_FRAMEBUFFER_CONSOLE=y
 CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
 CONFIG_LOGO=y
 # CONFIG_LOGO_LINUX_MONO is not set
 # CONFIG_LOGO_LINUX_VGA16 is not set
 # CONFIG_LOGO_LINUX_CLUT224 is not set
-CONFIG_USB=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_EHCI_HCD_PLATFORM=y
 CONFIG_USB_OHCI_HCD=y
@@ -97,12 +91,10 @@ CONFIG_MMC_SDHCI_PLTFM=y
 CONFIG_MMC_DW=y
 # CONFIG_IOMMU_SUPPORT is not set
 CONFIG_EXT3_FS=y
-CONFIG_EXT4_FS=y
 CONFIG_MSDOS_FS=y
 CONFIG_VFAT_FS=y
 CONFIG_NTFS_FS=y
 CONFIG_TMPFS=y
-CONFIG_JFFS2_FS=y
 CONFIG_NFS_FS=y
 CONFIG_NLS_CODEPAGE_437=y
 CONFIG_NLS_ISO8859_1=y
diff --git a/arch/arc/configs/axs103_smp_defconfig 
b/arch/arc/configs/axs103_smp_defconfig
index 66191cd..d80daf4 100644
--- a/arch/arc/configs/axs103_smp_defconfig
+++ b/arch/arc/configs/axs103_smp_defconfig
@@ -40,14 +40,10 @@ CONFIG_IP_PNP_RARP=y
 # CONFIG_INET_XFRM_MODE_TUNNEL is not set
 # CONFIG_INET_XFRM_MODE_BEET is not set
 # CONFIG_IPV6 

Re: [PATCH 2/4 RESEND] ARC: axs10x: Update defconfigs so that audio is enabled

2016-02-24 Thread Alexey Brodkin
Hi Vineet,

On Wed, 2016-02-24 at 04:36 +, Vineet Gupta wrote:
> On Tuesday 23 February 2016 07:22 PM, Jose Abreu wrote:
> > The defconfigs for the AXS boards were updated so that
> > ALSA SoC is enabled and also the audio for the ADV7511
> > HDMI transmitter.
> > 
> > Signed-off-by: Jose Abreu 
> > ---
> >  arch/arc/configs/axs101_defconfig | 3 +++
> >  arch/arc/configs/axs103_defconfig | 5 +
> >  arch/arc/configs/axs103_smp_defconfig | 5 +
> 
> @Alexey, has this been tested on AXS103. Do we have the right PLL / clocks to 
> get
> the audio rates - given the lower master clk.

I think I tried first version of these patches on axs103 as well.
But may assume Jose have no access to axs103 and so this particular
implementation may lack tests on axs103 platform. Still this is easy to
fix - I'll try it myself now.

> Further per out off-list discussion - let us have a seperate config for ARC 
> HS SDP
> which supports the shipping single hardware configuration and add these fancy
> things there as well as bumping the clk rate to 100 MHz . Current axs103* 
> configs
> are more of developer configs and I don't want to bloat their code with 
> things we
> don't build / download 10 times a day !

Agree but first we need to introduce those additional configs.
Let me draft those.

In the meantime it would be helpful if you take a look at existing 
axs10x_defconfigs
and check which option you do want to keep and what are those extra once that 
should
go to new configs with all bells and whistles.


-Alexey
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

Re: [PATCH] arc: make sure __delay() never gets executed with 0 loops

2016-02-24 Thread Alexey Brodkin
Hi Vineet,

On Wed, 2016-02-24 at 05:05 +, Vineet Gupta wrote:
> On Monday 15 February 2016 10:07 PM, Alexey Brodkin wrote:
> > Current implementation of __delay() function uses so-called
> > zero-delay loops. And the only condition to exit that loop is
> > LP_COUNT (loop count register) = 1 (but not 0 as it might be easily
> > imagined).
> 
> So u can fix this better by doing a lp.nz, but
> 
> > So if our calculation of "loops" gives 0 (and that is pretty possible
> > given result of multiplication being >> 32) then zero-delay loop
> > mechanism starts with LP_COUNT=0 and it ends up decrementing LP_COUNT
> > while staying in the loop effectively producing close to infinite delay
> > instead of very short one.
> > 
> > I bumped into it with AXS101 + external DDR controller and caches
> > disabled. In that case I've got very small
> > loops_per_jiffy=0xf00:
> 
> I understand this gives you grief, but the code is doing exactly what it is 
> asked to.
> Since the system is slow, You are getting only 0xf00 (3840) loop iterations 
> in 10ms.
> So if you want say a delay of 1 micro-sec, you will need to loop for 3840 / 
> 1
> ~ 0 loops
> 
> This all assumes our lpj computation is correct - otherwise that needs fixing 
> too.
> 
> Anyways I think for genuine cases where the number of loops is indeed 
> computed to
> 0 because caller was passing too small a value, it is better to wait for 
> looong
> time to catch the bugger rather than silently returning. This is one of the 
> cases
> where disease is better than the cure !

Ok, but see delays (even those for just a few usecs) might be justified by
hardware requirements (i.e. some peripheral need at least 10 usecs between this
and tat operations). So one driver will attempt to use completely correct value
for delay but on slow hardware (or especially in simulation) we'll get kernel
virtually stuck for no obvious reason.

So frankly I don't like proposal to keep existing implementation.
And solution with "lp.nz" looks much better to me.

-Alexey
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH 2/4] drm: Add DT bindings documentation for ARC PGU display controller

2016-03-03 Thread Alexey Brodkin
Hi Rob,

On Tue, 2016-02-23 at 14:38 -0600, Rob Herring wrote:
> On Fri, Feb 19, 2016 at 04:03:52PM +0300, Alexey Brodkin wrote:
> > 
> > This add DT bindings documentation for ARC PGU display controller.
> > 
> > Signed-off-by: Alexey Brodkin 
> > Cc: Rob Herring 
> > Cc: Pawel Moll 
> > Cc: Mark Rutland 
> > Cc: Ian Campbell 
> > Cc: Kumar Gala 
> > Cc: devicet...@vger.kernel.org
> > Cc: linux-snps-arc@lists.infradead.org
> > ---
> >  .../devicetree/bindings/display/snps,arcpgu.txt| 74 
> > ++
> >  1 file changed, 74 insertions(+)
> >  create mode 100644 
> > Documentation/devicetree/bindings/display/snps,arcpgu.txt
> > 
> > diff --git a/Documentation/devicetree/bindings/display/snps,arcpgu.txt
> > b/Documentation/devicetree/bindings/display/snps,arcpgu.txt
> > new file mode 100644
> > index 000..c8382fb
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/display/snps,arcpgu.txt
> > @@ -0,0 +1,74 @@
> > +ARC PGU
> > +
> > +This is a display controller found on several development boards produced
> > +by Synopsys. The ARC PGU is an RGB streamer that reads the data from a
> > +framebuffer and sends it to a single digital encoder (usually HDMI).
> > +
> > +Required properties:
> > +  - compatible: "snps,arcpgu"
> Seems like this should be more specific. Is there some sort or 
> versioning with ARC blocks?

Well as of today there's only one and only version of PGU.
So is there a real need for "snps,arcpgu-1.0"?

> > 
> > +  - reg: Physical base address and length of the controller's registers.
> > +  - clocks: A list of phandle + clock-specifier pairs, one for each
> > +entry in 'clock-names'.
> > +  - clock-names: A list of clock names. For ARC PGU it should contain:
> > +  - "pxlclk" for the clock feeding the output PLL of the controller.
> > +  - encoder-slave: Phandle of encoder chip.
> This is unnecessary with the OF graph.

Do you mean I may drop "encoder-slave" from bindings description?
I actually thought about that because in case of simulation platform where
this device is also used there's no encoder as well as no connector - we're
dealing with memory area which is read by host and then displayed on host's
display.

> > +
> > +/ {
> > +   ...
> > +
> > +   pgu@0x {
> Unit address should not have '0x'

Correct, let me fix it.

> > +
> > +   /* HDMI encoder on I2C bus */
> > +   i2c@0x {
> > +   compatible = "...";
> > +
> > +   encoder_node:encoder_node@0x{
> I2C addresses would be 8-bit only.

Indeed - copy-paste is evil :)

-Alexey

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

[PATCH 2/4 v2] drm: Add DT bindings documentation for ARC PGU display controller

2016-03-03 Thread Alexey Brodkin
This add DT bindings documentation for ARC PGU display controller.

Signed-off-by: Alexey Brodkin 
Cc: Rob Herring 
Cc: Pawel Moll 
Cc: Mark Rutland 
Cc: Ian Campbell 
Cc: Kumar Gala 
Cc: devicet...@vger.kernel.org
Cc: linux-snps-arc@lists.infradead.org
---

Changes v1 -> v2:
 * Clean-up

 .../devicetree/bindings/display/snps,arcpgu.txt| 33 ++
 1 file changed, 33 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/snps,arcpgu.txt

diff --git a/Documentation/devicetree/bindings/display/snps,arcpgu.txt 
b/Documentation/devicetree/bindings/display/snps,arcpgu.txt
new file mode 100644
index 000..57f3bc8
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/snps,arcpgu.txt
@@ -0,0 +1,33 @@
+ARC PGU
+
+This is a display controller found on several development boards produced
+by Synopsys. The ARC PGU is an RGB streamer that reads the data from a
+framebuffer and sends it to a single digital encoder (usually HDMI).
+
+Required properties:
+  - compatible: "snps,arcpgu"
+  - reg: Physical base address and length of the controller's registers.
+  - clocks: A list of phandle + clock-specifier pairs, one for each
+entry in 'clock-names'.
+  - clock-names: A list of clock names. For ARC PGU it should contain:
+  - "pxlclk" for the clock feeding the output PLL of the controller.
+
+Required sub-nodes:
+  - port: The PGU connection to an encoder chip. The connection is modelled
+using the OF graph bindings specified in
+Documentation/devicetree/bindings/graph.txt.
+
+Example:
+
+/ {
+   ...
+
+   pgu@ {
+   compatible = "snps,arcpgu";
+   reg = <0x 0x400>;
+   clocks = <&clock_node>;
+   clock-names = "pxlclk";
+   };
+
+   ...
+};
-- 
2.5.0


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 4/4 v2] MAINTAINERS: Add maintainer for ARC PGU display controller

2016-03-03 Thread Alexey Brodkin
This updates MAINTEINERS file with information about maintainer of
ARC PGU display controller driver.

Signed-off-by: Alexey Brodkin 
Cc: linux-snps-arc@lists.infradead.org
---

No changes since v1.

 MAINTAINERS | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 28cd72b..26ac58c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -847,6 +847,12 @@ S: Maintained
 F: drivers/net/arcnet/
 F: include/uapi/linux/if_arcnet.h
 
+ARC PGU DRM DRIVER
+M: Alexey Brodkin 
+S: Supported
+F: drivers/gpu/drm/arc/
+F: Documentation/devicetree/bindings/display/snps,arcpgu.txt
+
 ARM HDLCD DRM DRIVER
 M: Liviu Dudau 
 S: Supported
-- 
2.5.0


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 1/4 v2] drm: Add support of ARC PGU display controller

2016-03-03 Thread Alexey Brodkin
ARC PGU could be found on some development boards from Synopsys.
This is a simple byte streamer that reads data from a framebuffer
and sends data to the single encoder.

Signed-off-by: Alexey Brodkin 
Cc: David Airlie 
Cc: dri-de...@lists.freedesktop.org
Cc: linux-snps-arc@lists.infradead.org
---

No changes since v1.

 drivers/gpu/drm/Kconfig   |   2 +
 drivers/gpu/drm/Makefile  |   1 +
 drivers/gpu/drm/arc/Kconfig   |  10 ++
 drivers/gpu/drm/arc/Makefile  |   2 +
 drivers/gpu/drm/arc/arcpgu.h  |  47 +++
 drivers/gpu/drm/arc/arcpgu_crtc.c | 274 ++
 drivers/gpu/drm/arc/arcpgu_drv.c  | 239 +
 drivers/gpu/drm/arc/arcpgu_hdmi.c | 204 
 drivers/gpu/drm/arc/arcpgu_regs.h |  36 +
 9 files changed, 815 insertions(+)
 create mode 100644 drivers/gpu/drm/arc/Kconfig
 create mode 100644 drivers/gpu/drm/arc/Makefile
 create mode 100644 drivers/gpu/drm/arc/arcpgu.h
 create mode 100644 drivers/gpu/drm/arc/arcpgu_crtc.c
 create mode 100644 drivers/gpu/drm/arc/arcpgu_drv.c
 create mode 100644 drivers/gpu/drm/arc/arcpgu_hdmi.c
 create mode 100644 drivers/gpu/drm/arc/arcpgu_regs.h

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 08706f0..654a9cb 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -279,3 +279,5 @@ source "drivers/gpu/drm/imx/Kconfig"
 source "drivers/gpu/drm/vc4/Kconfig"
 
 source "drivers/gpu/drm/etnaviv/Kconfig"
+
+source "drivers/gpu/drm/arc/Kconfig"
diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index 6eb94fc..c338d04 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -78,3 +78,4 @@ obj-y += panel/
 obj-y  += bridge/
 obj-$(CONFIG_DRM_FSL_DCU) += fsl-dcu/
 obj-$(CONFIG_DRM_ETNAVIV) += etnaviv/
+obj-$(CONFIG_DRM_ARCPGU)+= arc/
diff --git a/drivers/gpu/drm/arc/Kconfig b/drivers/gpu/drm/arc/Kconfig
new file mode 100644
index 000..f9a13b6
--- /dev/null
+++ b/drivers/gpu/drm/arc/Kconfig
@@ -0,0 +1,10 @@
+config DRM_ARCPGU
+   tristate "ARC PGU"
+   depends on DRM && OF
+   select DRM_KMS_CMA_HELPER
+   select DRM_KMS_FB_HELPER
+   select DRM_KMS_HELPER
+   help
+ Choose this option if you have an ARC PGU controller.
+
+ If M is selected the module will be called arcpgu.
diff --git a/drivers/gpu/drm/arc/Makefile b/drivers/gpu/drm/arc/Makefile
new file mode 100644
index 000..d48fda7
--- /dev/null
+++ b/drivers/gpu/drm/arc/Makefile
@@ -0,0 +1,2 @@
+arcpgu-y := arcpgu_crtc.o arcpgu_hdmi.o arcpgu_drv.o
+obj-$(CONFIG_DRM_ARCPGU) += arcpgu.o
diff --git a/drivers/gpu/drm/arc/arcpgu.h b/drivers/gpu/drm/arc/arcpgu.h
new file mode 100644
index 000..d6a5cf5
--- /dev/null
+++ b/drivers/gpu/drm/arc/arcpgu.h
@@ -0,0 +1,47 @@
+/*
+ * ARC PGU DRM driver.
+ *
+ * Copyright (C) 2016 Synopsys, Inc. (www.synopsys.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 _ARCPGU_H_
+#define _ARCPGU_H_
+
+struct arcpgu_drm_private {
+   void __iomem*regs;
+   struct clk  *clk;
+   struct drm_fbdev_cma*fbdev;
+   struct drm_framebuffer  *fb;
+   struct list_headevent_list;
+   struct drm_crtc crtc;
+   struct drm_plane*plane;
+};
+
+#define crtc_to_arcpgu_priv(x) container_of(x, struct arcpgu_drm_private, crtc)
+
+static inline void arc_pgu_write(struct arcpgu_drm_private *arcpgu,
+unsigned int reg, u32 value)
+{
+   iowrite32(value, arcpgu->regs + reg);
+}
+
+static inline u32 arc_pgu_read(struct arcpgu_drm_private *arcpgu,
+  unsigned int reg)
+{
+   return ioread32(arcpgu->regs + reg);
+}
+
+int arc_pgu_setup_crtc(struct drm_device *dev);
+int arcpgu_drm_hdmi_init(struct drm_device *drm, struct device_node *np);
+
+#endif
diff --git a/drivers/gpu/drm/arc/arcpgu_crtc.c 
b/drivers/gpu/drm/arc/arcpgu_crtc.c
new file mode 100644
index 000..0fe5c8a
--- /dev/null
+++ b/drivers/gpu/drm/arc/arcpgu_crtc.c
@@ -0,0 +1,274 @@
+/*
+ * ARC PGU DRM driver.
+ *
+ * Copyright (C) 2016 Synopsys, Inc. (www.synopsys.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 war

[PATCH 3/4 v2] arc: axs10x - add support of ARC PGU

2016-03-03 Thread Alexey Brodkin
Synopsys DesignWare ARC SDP boards sport ARC SDP display
controller attached to ADV7511 HDMI encoder.

That change adds desctiption of both ARC PGU and ADV7511 in
ARC SDP'd base-board Device Tree.

Signed-off-by: Alexey Brodkin 
Cc: Rob Herring 
Cc: Pawel Moll 
Cc: Mark Rutland 
Cc: Ian Campbell 
Cc: Kumar Gala 
Cc: Vineet Gupta 
Cc: devicet...@vger.kernel.org
Cc: linux-snps-arc@lists.infradead.org
---

Changes v1 -> v2:
 * Added missing "pxlclk" clock in axs10x_mb.dtsi

 arch/arc/boot/dts/axs10x_mb.dtsi | 61 
 1 file changed, 61 insertions(+)

diff --git a/arch/arc/boot/dts/axs10x_mb.dtsi b/arch/arc/boot/dts/axs10x_mb.dtsi
index 44a578c..6e639c9 100644
--- a/arch/arc/boot/dts/axs10x_mb.dtsi
+++ b/arch/arc/boot/dts/axs10x_mb.dtsi
@@ -34,6 +34,12 @@
clock-frequency = <5000>;
#clock-cells = <0>;
};
+
+   pguclk: pguclk {
+   #clock-cells = <0>;
+   compatible = "fixed-clock";
+   clock-frequency = <7444>;
+   };
};
 
ethernet@0x18000 {
@@ -147,6 +153,37 @@
clocks = <&i2cclk>;
interrupts = <16>;
 
+   adv7511:adv7511@0x39{
+   compatible="adi,adv7511";
+   reg = <0x39>;
+   interrupts = <23>;
+   adi,input-depth = <8>;
+   adi,input-colorspace = "rgb";
+   adi,input-clock = "1x";
+   adi,clock-delay = <0x03>;
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   /* RGB/YUV input */
+   port@0 {
+   reg = <0>;
+   adv7511_input:endpoint {
+   remote-endpoint = <&pgu_output>;
+   };
+   };
+
+   /* HDMI output */
+   port@1 {
+   reg = <1>;
+   adv7511_output: endpoint {
+   remote-endpoint = 
<&hdmi_connector_in>;
+   };
+   };
+   };
+   };
+
eeprom@0x54{
compatible = "24c01";
reg = <0x54>;
@@ -160,6 +197,16 @@
};
};
 
+   hdmi0: connector {
+   compatible = "hdmi-connector";
+   type = "a";
+   port {
+   hdmi_connector_in: endpoint {
+   remote-endpoint = <&adv7511_output>;
+   };
+   };
+   };
+
gpio0:gpio@13000 {
compatible = "snps,dw-apb-gpio";
reg = <0x13000 0x1000>;
@@ -221,5 +268,19 @@
reg = <2>;
};
};
+
+   pgu@0x17000 {
+   compatible = "snps,arcpgu";
+   reg = <0x17000 0x400>;
+   encoder-slave = <&adv7511>;
+   clocks = <&pguclk>;
+   clock-names = "pxlclk";
+
+   port {
+   pgu_output: endpoint {
+   remote-endpoint = <&adv7511_input>;
+   };
+   };
+   };
};
 };
-- 
2.5.0


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 0/4 v2] drm: Add support of ARC PGU display controller

2016-03-03 Thread Alexey Brodkin
This series add support of ARC PGU display controller.
ARC PGU is a quite simple byte streamer that gets data from the framebuffer
and pushes it to hte connected encoder (DP or HDMI).

It was tested on ARC SDP boards (axs101 in particular).

Changes v1 -> v2:
 * Clean-up of DT bindings documentation
 * Added missing "pxlclk" clock in axs10x_mb.dtsi

Cc: David Airlie 
Cc: devicet...@vger.kernel.org
Cc: dri-de...@lists.freedesktop.org
Cc: Ian Campbell 
Cc: Kumar Gala 
Cc: linux-snps-arc@lists.infradead.org
Cc: Mark Rutland 
Cc: Pawel Moll 
Cc: Rob Herring 
Cc: Vineet Gupta 

Alexey Brodkin (4):
  drm: Add support of ARC PGU display controller
  drm: Add DT bindings documentation for ARC PGU display controller
  arc: axs10x - add support of ARC PGU
  MAINTAINERS: Add maintainer for ARC PGU display controller

 .../devicetree/bindings/display/snps,arcpgu.txt|  33 +++
 MAINTAINERS|   6 +
 arch/arc/boot/dts/axs10x_mb.dtsi   |  61 +
 drivers/gpu/drm/Kconfig|   2 +
 drivers/gpu/drm/Makefile   |   1 +
 drivers/gpu/drm/arc/Kconfig|  10 +
 drivers/gpu/drm/arc/Makefile   |   2 +
 drivers/gpu/drm/arc/arcpgu.h   |  47 
 drivers/gpu/drm/arc/arcpgu_crtc.c  | 274 +
 drivers/gpu/drm/arc/arcpgu_drv.c   | 239 ++
 drivers/gpu/drm/arc/arcpgu_hdmi.c  | 204 +++
 drivers/gpu/drm/arc/arcpgu_regs.h  |  36 +++
 12 files changed, 915 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/snps,arcpgu.txt
 create mode 100644 drivers/gpu/drm/arc/Kconfig
 create mode 100644 drivers/gpu/drm/arc/Makefile
 create mode 100644 drivers/gpu/drm/arc/arcpgu.h
 create mode 100644 drivers/gpu/drm/arc/arcpgu_crtc.c
 create mode 100644 drivers/gpu/drm/arc/arcpgu_drv.c
 create mode 100644 drivers/gpu/drm/arc/arcpgu_hdmi.c
 create mode 100644 drivers/gpu/drm/arc/arcpgu_regs.h

-- 
2.5.0


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH 2/4 v2] drm: Add DT bindings documentation for ARC PGU display controller

2016-03-07 Thread Alexey Brodkin
Hi Rob,

On Fri, 2016-03-04 at 22:30 -0600, Rob Herring wrote:
> On Thu, Mar 03, 2016 at 05:39:14PM +0300, Alexey Brodkin wrote:
> > 
> > This add DT bindings documentation for ARC PGU display controller.
> > 
> > Signed-off-by: Alexey Brodkin 
> > Cc: Rob Herring 
> > Cc: Pawel Moll 
> > Cc: Mark Rutland 
> > Cc: Ian Campbell 
> > Cc: Kumar Gala 
> > Cc: devicet...@vger.kernel.org
> > Cc: linux-snps-arc@lists.infradead.org
> > ---
> > 
> > Changes v1 -> v2:
> >  * Clean-up
> Not really useful. What we like to see is what changed. Maintainers have 
> short memories and don't remember what they said previously (unless 
> comments are ignored).

That's understood :)

> > 
> > 
> >  .../devicetree/bindings/display/snps,arcpgu.txt| 33 
> > ++
> >  1 file changed, 33 insertions(+)
> >  create mode 100644 
> > Documentation/devicetree/bindings/display/snps,arcpgu.txt
> > 
> > diff --git a/Documentation/devicetree/bindings/display/snps,arcpgu.txt
> > b/Documentation/devicetree/bindings/display/snps,arcpgu.txt
> > new file mode 100644
> > index 000..57f3bc8
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/display/snps,arcpgu.txt
> > @@ -0,0 +1,33 @@
> > +ARC PGU
> > +
> > +This is a display controller found on several development boards produced
> > +by Synopsys. The ARC PGU is an RGB streamer that reads the data from a
> > +framebuffer and sends it to a single digital encoder (usually HDMI).
> > +
> > +Required properties:
> > +  - compatible: "snps,arcpgu"
> > +  - reg: Physical base address and length of the controller's registers.
> > +  - clocks: A list of phandle + clock-specifier pairs, one for each
> > +entry in 'clock-names'.
> > +  - clock-names: A list of clock names. For ARC PGU it should contain:
> > +  - "pxlclk" for the clock feeding the output PLL of the controller.
> > +
> > +Required sub-nodes:
> > +  - port: The PGU connection to an encoder chip. The connection is modelled
> > +using the OF graph bindings specified in
> > +Documentation/devicetree/bindings/graph.txt.
> > +
> > +Example:
> > +
> > +/ {
> > +   ...
> > +
> > +   pgu@ {
> > +   compatible = "snps,arcpgu";
> > +   reg = <0x 0x400>;
> > +   clocks = <&clock_node>;
> > +   clock-names = "pxlclk";
> Where's the port? Didn't you previously say it was optional?

Well I wanted to get rid of anything except bare minimal that is required for
that driver.

What I did miss in that clean-up is description above.
In particular "Required subnodes" section that still lists "port".

And frankly now I'm a bit lost with what should I put in that binding
description and what should not. Any comments here are much appreciated.

-Alexey
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

Re: [PATCH] arc: use little endian accesses

2016-03-09 Thread Alexey Brodkin
Hi Vineet,

On Thu, 2016-03-10 at 05:05 +, Vineet Gupta wrote:
> +CC Noam
> 
> On Wednesday 09 March 2016 10:51 PM, Lada Trimasova wrote:
> > 
> > Memory access primitives should use cpu_to_le16, cpu_to_le32, le16_to_cpu
> > and le32_to_cpu because it is not really guaranteed that drivers handles
> > any ordering themselves.
> That is the driver issue. readxx as API simply returns data in native 
> endianness.
> We've had EZChip running big endian and so far and they didn't need this 
> change.

Let me disagree with you here.
See what is said in "include/asm-generic/io.h":
-->8-
/*
 * __raw_{read,write}{b,w,l,q}() access memory in native endianness.
 *
 * On some architectures memory mapped IO needs to be accessed differently.
 * On the simple architectures, we just read/write the memory location
 * directly.
 */

...

/*
 * {read,write}{b,w,l,q}() access little endian memory and return result in
 * native endianness.
 */
-->8-

And that's an implementation we have for ARC:
-->8-
#define readb(c)({ u8  __v = readb_relaxed(c); __iormb(); __v; 
})
#define readw(c)({ u16 __v = readw_relaxed(c); __iormb(); __v; 
})
#define readl(c)({ u32 __v = readl_relaxed(c); __iormb(); __v; 
})

#define writeb(v,c) ({ __iowmb(); writeb_relaxed(v,c); })
#define writew(v,c) ({ __iowmb(); writew_relaxed(v,c); })
#define writel(v,c) ({ __iowmb(); writel_relaxed(v,c); })

/*
 * Relaxed API for drivers which can handle any ordering themselves
 */
#define readb_relaxed(c)__raw_readb(c)
#define readw_relaxed(c)__raw_readw(c)
#define readl_relaxed(c)__raw_readl(c)

#define writeb_relaxed(v,c) __raw_writeb(v,c)
#define writew_relaxed(v,c) __raw_writew(v,c)
#define writel_relaxed(v,c) __raw_writel(v,c)
-->8-

Which is effectively (related to endianess discussion):
-->8-
#define readX(c)__raw_readX(c)
#define writeX(v,c) __raw_writeX(v,c)
-->8-

That looks IMHO incorrect if we read API description in 
"include/asm-generic/io.h".
BTW description of {read,write}{b,w,l,q}() is a bit misleading in part saying
"... and return result in __native_endianness__".

But real implementation of {read,write}{b,w,l,q}() in "include/asm-generic/io.h"
really shows what was meant - note __leXX_to_cpu() and cpu_to_leXX are used.

> > 
> > For example, serial port driver doesn't work when kernel is build for
> > arc big endian architecture.
> Last I tested Big Endian on SDP with 8250 part + 8250 driver it was working 
> fine.
> I presume this is the systemC model for device and standard 8250 driver and 
> very
> likely the model is not fixed endian or something.

Model is indeed little-endian. We build it only once and than changing
only "nsim_isa_big_endian" property (which changes only CPU core endianess) may 
use
it equally well with little- and big-endian builds of Linux kernel.

-Alexey
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

Re: [PATCH 2/2] ARC: [*defconfig] No need to specify CONFIG_CROSS_COMPILE

2016-03-11 Thread Alexey Brodkin
Hi Vineet,

On Fri, 2016-03-11 at 14:57 +0530, Vineet Gupta wrote:
> The problem is with CONFIG_CPU_BIG_ENDIAN=y we still needed .config
> fixup to override the the defconfig prefix to arceb-linux-
> 
> So remove these from defconfig and let user pass this via CROSS_COMPILE
> environment var or use the default for ENDIAN (per previous patch)
> 
> No other arch carries them in defconfigs anyways !
> 
> Cc: Noam Camus 
> Cc: Alexey Brodkin 
> Cc: Anton Kolesov 
> Signed-off-by: Vineet Gupta 
> ---

Acked-by: Alexey Brodkin 
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH 1/2] ARC: [BE] Select correct CROSS_COMPILE prefix

2016-03-11 Thread Alexey Brodkin
Hi Vineet,

On Fri, 2016-03-11 at 14:57 +0530, Vineet Gupta wrote:
> This allows CONFIG_CPU_BIG_ENDIAN=y to build correctly out of the box,
> w/o any other tweaks.
> 
> Cc: Noam Camus 
> Cc: Alexey Brodkin 
> Cc: Anton Kolesov 
> Signed-off-by: Vineet Gupta 
> ---

Acked-by: Alexey Brodkin 
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 0/4 v3] drm: Add support of ARC PGU display controller

2016-03-11 Thread Alexey Brodkin
This series add support of ARC PGU display controller.
ARC PGU is a quite simple byte streamer that gets data from the framebuffer
and pushes it to hte connected encoder (DP or HDMI).

It was tested on ARC SDP boards (axs101 in particular).

Changes v2 -> v3:
 * Improved failure path if arcpgu_connector wasn't allocated.
 * Fixed driver building as module.
 * Implemented uncached mapping of user-space FB pages.
 * Again updated DT bindings docs.

Changes v1 -> v2:
 * Clean-up of DT bindings documentation.
 * Added missing "pxlclk" clock in axs10x_mb.dtsi.

Cc: David Airlie 
Cc: devicet...@vger.kernel.org
Cc: dri-de...@lists.freedesktop.org
Cc: Ian Campbell 
Cc: Kumar Gala 
Cc: linux-snps-arc@lists.infradead.org
Cc: Mark Rutland 
Cc: Pawel Moll 
Cc: Rob Herring 
Cc: Vineet Gupta 

Alexey Brodkin (4):
  drm: Add support of ARC PGU display controller
  drm: Add DT bindings documentation for ARC PGU display controller
  arc: axs10x - add support of ARC PGU
  MAINTAINERS: Add maintainer for ARC PGU display controller

 .../devicetree/bindings/display/snps,arcpgu.txt|  72 ++
 MAINTAINERS|   6 +
 arch/arc/boot/dts/axs10x_mb.dtsi   |  61 +
 drivers/gpu/drm/Kconfig|   2 +
 drivers/gpu/drm/Makefile   |   1 +
 drivers/gpu/drm/arc/Kconfig|  10 +
 drivers/gpu/drm/arc/Makefile   |   2 +
 drivers/gpu/drm/arc/arcpgu.h   |  50 
 drivers/gpu/drm/arc/arcpgu_crtc.c  | 274 +
 drivers/gpu/drm/arc/arcpgu_drv.c   | 252 +++
 drivers/gpu/drm/arc/arcpgu_fbdev.c | 245 ++
 drivers/gpu/drm/arc/arcpgu_hdmi.c  | 207 
 drivers/gpu/drm/arc/arcpgu_regs.h  |  36 +++
 13 files changed, 1218 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/snps,arcpgu.txt
 create mode 100644 drivers/gpu/drm/arc/Kconfig
 create mode 100644 drivers/gpu/drm/arc/Makefile
 create mode 100644 drivers/gpu/drm/arc/arcpgu.h
 create mode 100644 drivers/gpu/drm/arc/arcpgu_crtc.c
 create mode 100644 drivers/gpu/drm/arc/arcpgu_drv.c
 create mode 100644 drivers/gpu/drm/arc/arcpgu_fbdev.c
 create mode 100644 drivers/gpu/drm/arc/arcpgu_hdmi.c
 create mode 100644 drivers/gpu/drm/arc/arcpgu_regs.h

-- 
2.5.0


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 1/4 v3] drm: Add support of ARC PGU display controller

2016-03-11 Thread Alexey Brodkin
ARC PGU could be found on some development boards from Synopsys.
This is a simple byte streamer that reads data from a framebuffer
and sends data to the single encoder.

Signed-off-by: Alexey Brodkin 
Cc: David Airlie 
Cc: dri-de...@lists.freedesktop.org
Cc: linux-snps-arc@lists.infradead.org
Cc: Jose Abreu 
---

Changes v2 -> v3:
 * Improved failure path if arcpgu_connector wasn't allocated (thanks Jose).
 * Fixed driver building as module (reported by 0-DAY kernel test infrastruct.)
 * Implemented uncached mapping of user-space FB pages.

No changes v1 -> v2.

 drivers/gpu/drm/Kconfig|   2 +
 drivers/gpu/drm/Makefile   |   1 +
 drivers/gpu/drm/arc/Kconfig|  10 ++
 drivers/gpu/drm/arc/Makefile   |   2 +
 drivers/gpu/drm/arc/arcpgu.h   |  50 +++
 drivers/gpu/drm/arc/arcpgu_crtc.c  | 274 +
 drivers/gpu/drm/arc/arcpgu_drv.c   | 252 ++
 drivers/gpu/drm/arc/arcpgu_fbdev.c | 245 +
 drivers/gpu/drm/arc/arcpgu_hdmi.c  | 207 
 drivers/gpu/drm/arc/arcpgu_regs.h  |  36 +
 10 files changed, 1079 insertions(+)
 create mode 100644 drivers/gpu/drm/arc/Kconfig
 create mode 100644 drivers/gpu/drm/arc/Makefile
 create mode 100644 drivers/gpu/drm/arc/arcpgu.h
 create mode 100644 drivers/gpu/drm/arc/arcpgu_crtc.c
 create mode 100644 drivers/gpu/drm/arc/arcpgu_drv.c
 create mode 100644 drivers/gpu/drm/arc/arcpgu_fbdev.c
 create mode 100644 drivers/gpu/drm/arc/arcpgu_hdmi.c
 create mode 100644 drivers/gpu/drm/arc/arcpgu_regs.h

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index f2a74d0..9e4f2f1 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -281,3 +281,5 @@ source "drivers/gpu/drm/imx/Kconfig"
 source "drivers/gpu/drm/vc4/Kconfig"
 
 source "drivers/gpu/drm/etnaviv/Kconfig"
+
+source "drivers/gpu/drm/arc/Kconfig"
diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index 6eb94fc..c338d04 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -78,3 +78,4 @@ obj-y += panel/
 obj-y  += bridge/
 obj-$(CONFIG_DRM_FSL_DCU) += fsl-dcu/
 obj-$(CONFIG_DRM_ETNAVIV) += etnaviv/
+obj-$(CONFIG_DRM_ARCPGU)+= arc/
diff --git a/drivers/gpu/drm/arc/Kconfig b/drivers/gpu/drm/arc/Kconfig
new file mode 100644
index 000..f9a13b6
--- /dev/null
+++ b/drivers/gpu/drm/arc/Kconfig
@@ -0,0 +1,10 @@
+config DRM_ARCPGU
+   tristate "ARC PGU"
+   depends on DRM && OF
+   select DRM_KMS_CMA_HELPER
+   select DRM_KMS_FB_HELPER
+   select DRM_KMS_HELPER
+   help
+ Choose this option if you have an ARC PGU controller.
+
+ If M is selected the module will be called arcpgu.
diff --git a/drivers/gpu/drm/arc/Makefile b/drivers/gpu/drm/arc/Makefile
new file mode 100644
index 000..736ee6f
--- /dev/null
+++ b/drivers/gpu/drm/arc/Makefile
@@ -0,0 +1,2 @@
+arcpgu-y := arcpgu_crtc.o arcpgu_hdmi.o arcpgu_fbdev.o arcpgu_drv.o
+obj-$(CONFIG_DRM_ARCPGU) += arcpgu.o
diff --git a/drivers/gpu/drm/arc/arcpgu.h b/drivers/gpu/drm/arc/arcpgu.h
new file mode 100644
index 000..86574b6
--- /dev/null
+++ b/drivers/gpu/drm/arc/arcpgu.h
@@ -0,0 +1,50 @@
+/*
+ * ARC PGU DRM driver.
+ *
+ * Copyright (C) 2016 Synopsys, Inc. (www.synopsys.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 _ARCPGU_H_
+#define _ARCPGU_H_
+
+struct arcpgu_drm_private {
+   void __iomem*regs;
+   struct clk  *clk;
+   struct drm_fbdev_cma*fbdev;
+   struct drm_framebuffer  *fb;
+   struct list_headevent_list;
+   struct drm_crtc crtc;
+   struct drm_plane*plane;
+};
+
+#define crtc_to_arcpgu_priv(x) container_of(x, struct arcpgu_drm_private, crtc)
+
+static inline void arc_pgu_write(struct arcpgu_drm_private *arcpgu,
+unsigned int reg, u32 value)
+{
+   iowrite32(value, arcpgu->regs + reg);
+}
+
+static inline u32 arc_pgu_read(struct arcpgu_drm_private *arcpgu,
+  unsigned int reg)
+{
+   return ioread32(arcpgu->regs + reg);
+}
+
+int arc_pgu_setup_crtc(struct drm_device *dev);
+int arcpgu_drm_hdmi_init(struct drm_device *drm, struct device_node *np);
+struct drm_fbdev_cma *arcpgu_fbdev_cma_init(struct drm_device *dev,
+   unsigned int preferred_bpp, unsigned int num_crtc,
+   unsigned int max_conn_count);
+
+#endif
diff --git a/drivers/gpu/drm/

[PATCH 3/4 v3] arc: axs10x - add support of ARC PGU

2016-03-11 Thread Alexey Brodkin
Synopsys DesignWare ARC SDP boards sport ARC SDP display
controller attached to ADV7511 HDMI encoder.

That change adds desctiption of both ARC PGU and ADV7511 in
ARC SDP'd base-board Device Tree.

Signed-off-by: Alexey Brodkin 
Cc: Rob Herring 
Cc: Pawel Moll 
Cc: Mark Rutland 
Cc: Ian Campbell 
Cc: Kumar Gala 
Cc: Vineet Gupta 
Cc: David Airlie 
Cc: dri-de...@lists.freedesktop.org
Cc: devicet...@vger.kernel.org
Cc: linux-snps-arc@lists.infradead.org
---

No changes v2 -> v3.

Changes v1 -> v2:
 * Added missing "pxlclk" clock in axs10x_mb.dtsi

 arch/arc/boot/dts/axs10x_mb.dtsi | 61 
 1 file changed, 61 insertions(+)

diff --git a/arch/arc/boot/dts/axs10x_mb.dtsi b/arch/arc/boot/dts/axs10x_mb.dtsi
index 44a578c..6e639c9 100644
--- a/arch/arc/boot/dts/axs10x_mb.dtsi
+++ b/arch/arc/boot/dts/axs10x_mb.dtsi
@@ -34,6 +34,12 @@
clock-frequency = <5000>;
#clock-cells = <0>;
};
+
+   pguclk: pguclk {
+   #clock-cells = <0>;
+   compatible = "fixed-clock";
+   clock-frequency = <7444>;
+   };
};
 
ethernet@0x18000 {
@@ -147,6 +153,37 @@
clocks = <&i2cclk>;
interrupts = <16>;
 
+   adv7511:adv7511@0x39{
+   compatible="adi,adv7511";
+   reg = <0x39>;
+   interrupts = <23>;
+   adi,input-depth = <8>;
+   adi,input-colorspace = "rgb";
+   adi,input-clock = "1x";
+   adi,clock-delay = <0x03>;
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   /* RGB/YUV input */
+   port@0 {
+   reg = <0>;
+   adv7511_input:endpoint {
+   remote-endpoint = <&pgu_output>;
+   };
+   };
+
+   /* HDMI output */
+   port@1 {
+   reg = <1>;
+   adv7511_output: endpoint {
+   remote-endpoint = 
<&hdmi_connector_in>;
+   };
+   };
+   };
+   };
+
eeprom@0x54{
compatible = "24c01";
reg = <0x54>;
@@ -160,6 +197,16 @@
};
};
 
+   hdmi0: connector {
+   compatible = "hdmi-connector";
+   type = "a";
+   port {
+   hdmi_connector_in: endpoint {
+   remote-endpoint = <&adv7511_output>;
+   };
+   };
+   };
+
gpio0:gpio@13000 {
compatible = "snps,dw-apb-gpio";
reg = <0x13000 0x1000>;
@@ -221,5 +268,19 @@
reg = <2>;
};
};
+
+   pgu@0x17000 {
+   compatible = "snps,arcpgu";
+   reg = <0x17000 0x400>;
+   encoder-slave = <&adv7511>;
+   clocks = <&pguclk>;
+   clock-names = "pxlclk";
+
+   port {
+   pgu_output: endpoint {
+   remote-endpoint = <&adv7511_input>;
+   };
+   };
+   };
};
 };
-- 
2.5.0


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 2/4 v3] drm: Add DT bindings documentation for ARC PGU display controller

2016-03-11 Thread Alexey Brodkin
This add DT bindings documentation for ARC PGU display controller.

Signed-off-by: Alexey Brodkin 
Cc: Rob Herring 
Cc: Pawel Moll 
Cc: Mark Rutland 
Cc: Ian Campbell 
Cc: Kumar Gala 
Cc: David Airlie 
Cc: dri-de...@lists.freedesktop.org
Cc: devicet...@vger.kernel.org
Cc: linux-snps-arc@lists.infradead.org
---

Changes v2 -> v3:
 * Reverted back to initial larger version of example
   with minor fixes (thanks Rob for spotting those).

Changes v1 -> v2:
 * Removed everything except PGU node itself.

 .../devicetree/bindings/display/snps,arcpgu.txt| 72 ++
 1 file changed, 72 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/snps,arcpgu.txt

diff --git a/Documentation/devicetree/bindings/display/snps,arcpgu.txt 
b/Documentation/devicetree/bindings/display/snps,arcpgu.txt
new file mode 100644
index 000..b130924
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/snps,arcpgu.txt
@@ -0,0 +1,72 @@
+ARC PGU
+
+This is a display controller found on several development boards produced
+by Synopsys. The ARC PGU is an RGB streamer that reads the data from a
+framebuffer and sends it to a single digital encoder (usually HDMI).
+
+Required properties:
+  - compatible: "snps,arcpgu"
+  - reg: Physical base address and length of the controller's registers.
+  - clocks: A list of phandle + clock-specifier pairs, one for each
+entry in 'clock-names'.
+  - clock-names: A list of clock names. For ARC PGU it should contain:
+  - "pxlclk" for the clock feeding the output PLL of the controller.
+  - encoder-slave: Phandle of encoder chip.
+
+Required sub-nodes:
+  - port: The PGU connection to an encoder chip.
+
+Example:
+
+/ {
+   ...
+
+   pgu@ {
+   compatible = "snps,arcpgu";
+   reg = <0x 0x400>;
+   clocks = <&clock_node>;
+   clock-names = "pxlclk";
+   encoder-slave = <&encoder_node>;
+
+   port {
+   pgu_output: endpoint {
+   remote-endpoint = <&hdmi_enc_input>;
+   };
+   };
+   };
+
+   /* HDMI encoder on I2C bus */
+   i2c@ {
+   compatible = "...";
+
+   encoder_node:encoder_node@0xXX{
+   compatible="...";
+
+   ports {
+   port@0 {
+   reg = <0>;
+   hdmi_enc_input:endpoint {
+   remote-endpoint = <&pgu_output>;
+   };
+   };
+
+   port@1 {
+   reg = <1>;
+   hdmi_enc_output:endpoint {
+   remote-endpoint = 
<&hdmi_connector_in>;
+   };
+   };
+   };
+   };
+   }
+
+   hdmi0: connector {
+   compatible = "hdmi-connector";
+
+   port {
+   hdmi_connector_in: endpoint {
+   remote-endpoint = <&hdmi_enc_output>;
+   };
+   };
+   };
+};
-- 
2.5.0


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 4/4 v3] MAINTAINERS: Add maintainer for ARC PGU display controller

2016-03-11 Thread Alexey Brodkin
This updates MAINTEINERS file with information about maintainer of
ARC PGU display controller driver.

Signed-off-by: Alexey Brodkin 
Cc: linux-snps-arc@lists.infradead.org
Cc: dri-de...@lists.freedesktop.org
---

No changes v2 -> v3.

No changes v1 -> v2.

 MAINTAINERS | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index ea1d1de..0dcba67 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -827,6 +827,12 @@ S: Maintained
 F: drivers/net/arcnet/
 F: include/uapi/linux/if_arcnet.h
 
+ARC PGU DRM DRIVER
+M: Alexey Brodkin 
+S: Supported
+F: drivers/gpu/drm/arc/
+F: Documentation/devicetree/bindings/display/snps,arcpgu.txt
+
 ARM HDLCD DRM DRIVER
 M: Liviu Dudau 
 S: Supported
-- 
2.5.0


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH 1/4 v3] drm: Add support of ARC PGU display controller

2016-03-14 Thread Alexey Brodkin
Hi Daniel,

On Mon, 2016-03-14 at 08:00 +0100, Daniel Vetter wrote:
> On Fri, Mar 11, 2016 at 06:42:36PM +0300, Alexey Brodkin wrote:
> > 
> > ARC PGU could be found on some development boards from Synopsys.
> > This is a simple byte streamer that reads data from a framebuffer
> > and sends data to the single encoder.
> > 
> > Signed-off-by: Alexey Brodkin 
> > Cc: David Airlie 
> > Cc: dri-de...@lists.freedesktop.org
> > Cc: linux-snps-arc@lists.infradead.org
> > Cc: Jose Abreu 
> > ---
> > 
> > Changes v2 -> v3:
> >  * Improved failure path if arcpgu_connector wasn't allocated (thanks Jose).
> >  * Fixed driver building as module (reported by 0-DAY kernel test 
> > infrastruct.)
> >  * Implemented uncached mapping of user-space FB pages.
> > 
> > No changes v1 -> v2.
> > 
> Bunch of comments below to update your driver to latest styles and best
> practices.
> 
> Cheers, Daniel

Thanks for doing that review!

> > +
> > +static void arc_pgu_crtc_atomic_flush(struct drm_crtc *crtc,
> > +     struct drm_crtc_state *state)
> > +{
> > +}
> > +
> > +static bool arc_pgu_crtc_mode_fixup(struct drm_crtc *crtc,
> > +   const struct drm_display_mode *mode,
> > +   struct drm_display_mode *adjusted_mode)
> > +{
> > +   return true;
> > +}
> You can drop the above 2 dummy functions.

Ok will do.

> > 
> > +
> > +static const struct drm_crtc_helper_funcs arc_pgu_crtc_helper_funcs = {
> > +   .mode_fixup = arc_pgu_crtc_mode_fixup,
> > +   .mode_set   = drm_helper_crtc_mode_set,
> > +   .mode_set_base  = drm_helper_crtc_mode_set_base,
> > +   .mode_set_nofb  = arc_pgu_crtc_mode_set_nofb,
> > +   .enable = arc_pgu_crtc_enable,
> > +   .disable= arc_pgu_crtc_disable,
> > +   .prepare= arc_pgu_crtc_disable,
> > +   .commit = arc_pgu_crtc_enable,
> > +   .atomic_check   = arc_pgu_crtc_atomic_check,
> > +   .atomic_begin   = arc_pgu_crtc_atomic_begin,
> > +   .atomic_flush   = arc_pgu_crtc_atomic_flush,
> > +};
> > +
> > +static int arc_pgu_plane_atomic_check(struct drm_plane *plane,
> > +     struct drm_plane_state *state)
> > +{
> > +   return 0;
> > +}
> You don't need dummy functions for this.

Ditto.

> > +
> > +void arc_pgu_crtc_suspend(struct drm_crtc *crtc)
> > +{
> > +   arc_pgu_crtc_disable(crtc);
> > +}
> > +
> > +void arc_pgu_crtc_resume(struct drm_crtc *crtc)
> > +{
> > +   arc_pgu_crtc_enable(crtc);
> > +}
> Please use the atomic suspend/resume helper that Thierry recently merged.
> See the kerneldoc of drm_atomic_helper_suspend as a starting point for how
> it works and how it's supposed to be used.

Well looks like this is a reminder if dummy copy-paste.
We don't support PM in that driver yet, so I'll remove both functions
for now.

> > +static int arcpgu_atomic_commit(struct drm_device *dev,
> > +   struct drm_atomic_state *state, bool async)
> > +{
> > +   return drm_atomic_helper_commit(dev, state, false);
> Note that this isn't really async if you ever get around to implement
> fence support or vblank support. Just fyi.

Ok but for now should I leave it as it is?

> > +static struct drm_driver arcpgu_drm_driver = {
> > +   .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME |
> > +      DRIVER_ATOMIC,
> > +   .preclose = arcpgu_preclose,
> > +   .lastclose = arcpgu_lastclose,
> > +   .name = "drm-arcpgu",
> > +   .desc = "ARC PGU Controller",
> > +   .date = "20160219",
> > +   .major = 1,
> > +   .minor = 0,
> > +   .patchlevel = 0,
> > +   .fops = &arcpgu_drm_ops,
> > +   .load = arcpgu_load,
> > +   .unload = arcpgu_unload,
> Load and unload hooks are deprecated (it's a classic midlayer mistake).
> Please use drm_dev_alloc/register pairs directly instead, and put your
> device setup code in-between. Similar for unloading. There's a bunch of
> example drivers converted already.

Ok I took "atmel-hlcdc" as example.
And that's interesting.

If I put my arcpgu_load() in between drm_dev_alloc() and
drm_dev_register() then I'm getting this on the driver probe:
-->8---
[drm] Initialized drm 1.1.0 20060810
arcpgu e0017000.pgu: arc_pgu ID: 0xabbabaab
[ cut here ]
WARNING: CPU: 0 PID: 1 at li

[PATCH] ARC: axs10x - add Ethernet PHY description in .dts

2016-03-15 Thread Alexey Brodkin
Following commit broke DW GMAC functionality on AXS10x boards:
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=e34d65696d2ef13dc32f2a162556c86c461ed763

That's what happens on eth0 up:
--->8
libphy: PHY stmmac-0: not found
eth0: Could not attach to PHY
stmmac_open: Cannot attach to PHY (error: -19)
--->8

Simplest solution is to add PHY description in board's .dts.
And so we do here.

Signed-off-by: Alexey Brodkin 
Cc: Rob Herring 
Cc: Phil Reid 
Cc: David S. Miller 
Cc: linux-ker...@vger.kernel.org
Cc: net...@vger.kernel.org
Cc: sta...@vger.kernel.org # 4.5.x
---
 arch/arc/boot/dts/axs10x_mb.dtsi | 8 
 1 file changed, 8 insertions(+)

diff --git a/arch/arc/boot/dts/axs10x_mb.dtsi b/arch/arc/boot/dts/axs10x_mb.dtsi
index 44a578c..04b999e 100644
--- a/arch/arc/boot/dts/axs10x_mb.dtsi
+++ b/arch/arc/boot/dts/axs10x_mb.dtsi
@@ -47,6 +47,14 @@
clocks = <&apbclk>;
clock-names = "stmmaceth";
max-speed = <100>;
+   mdio0 {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   compatible = "snps,dwmac-mdio";
+   phy0: ethernet-phy@0 {
+   reg = <1>;
+   };
+   };
};
 
ehci@0x4 {
-- 
2.5.0


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH] ARC: axs10x - add Ethernet PHY description in .dts

2016-03-15 Thread Alexey Brodkin
Hi Sergei,

On Tue, 2016-03-15 at 17:38 +0300, Sergei Shtylyov wrote:
> Hello.
> 
> On 3/15/2016 12:29 PM, Alexey Brodkin wrote:
> 
> > 
> > Following commit broke DW GMAC functionality on AXS10x boards:
> > http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=e34d65696d2ef13dc32f2a162556c86c461ed763
> > 
> > That's what happens on eth0 up:
> > --->8
> > libphy: PHY stmmac-0: not found
> > eth0: Could not attach to PHY
> > stmmac_open: Cannot attach to PHY (error: -19)
> > --->8
> > 
> > Simplest solution is to add PHY description in board's .dts.
> > And so we do here.
> > 
> > Signed-off-by: Alexey Brodkin 
> > Cc: Rob Herring 
> > Cc: Phil Reid 
> > Cc: David S. Miller 
> > Cc: linux-ker...@vger.kernel.org
> > Cc: net...@vger.kernel.org
> > Cc: sta...@vger.kernel.org # 4.5.x
> > ---
> >   arch/arc/boot/dts/axs10x_mb.dtsi | 8 
> >   1 file changed, 8 insertions(+)
> > 
> > diff --git a/arch/arc/boot/dts/axs10x_mb.dtsi 
> > b/arch/arc/boot/dts/axs10x_mb.dtsi
> > index 44a578c..04b999e 100644
> > --- a/arch/arc/boot/dts/axs10x_mb.dtsi
> > +++ b/arch/arc/boot/dts/axs10x_mb.dtsi
> > @@ -47,6 +47,14 @@
> >     clocks = <&apbclk>;
> >     clock-names = "stmmaceth";
> >     max-speed = <100>;
> > +   mdio0 {
> > +   #address-cells = <1>;
> > +   #size-cells = <0>;
> > +   compatible = "snps,dwmac-mdio";
> > +   phy0: ethernet-phy@0 {
> The naming is inconsistent with the "reg" prop specified, should be @1.

Makes sense.
Will re-send it with mentioned fix.

-Alexey
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

Re: [PATCH 1/4 v3] drm: Add support of ARC PGU display controller

2016-03-15 Thread Alexey Brodkin
Hi Daniel,

On Tue, 2016-03-15 at 09:10 +0100, Daniel Vetter wrote:
> On Mon, Mar 14, 2016 at 11:15:59AM +0000, Alexey Brodkin wrote:
> > 
> > On Mon, 2016-03-14 at 08:00 +0100, Daniel Vetter wrote:
> > > 
> > > On Fri, Mar 11, 2016 at 06:42:36PM +0300, Alexey Brodkin wrote:
> > > > 
> > > > +static int arcpgu_atomic_commit(struct drm_device *dev,
> > > > +   struct drm_atomic_state *state, 
> > > > bool async)
> > > > +{
> > > > +   return drm_atomic_helper_commit(dev, state, false);
> > > Note that this isn't really async if you ever get around to implement
> > > fence support or vblank support. Just fyi.
> > Ok but for now should I leave it as it is?
> Yeah ok as-is, hence just fyi.

Thanks. Just wanted to make sure we're on the same page :)

> > 
> > > 
> > > > 
> > > > +static struct drm_driver arcpgu_drm_driver = {
> > > > +   .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME |
> > > > +      DRIVER_ATOMIC,
> > > > +   .preclose = arcpgu_preclose,
> > > > +   .lastclose = arcpgu_lastclose,
> > > > +   .name = "drm-arcpgu",
> > > > +   .desc = "ARC PGU Controller",
> > > > +   .date = "20160219",
> > > > +   .major = 1,
> > > > +   .minor = 0,
> > > > +   .patchlevel = 0,
> > > > +   .fops = &arcpgu_drm_ops,
> > > > +   .load = arcpgu_load,
> > > > +   .unload = arcpgu_unload,
> > > Load and unload hooks are deprecated (it's a classic midlayer mistake).
> > > Please use drm_dev_alloc/register pairs directly instead, and put your
> > > device setup code in-between. Similar for unloading. There's a bunch of
> > > example drivers converted already.
> > Ok I took "atmel-hlcdc" as example.
> > And that's interesting.
> > 
> > If I put my arcpgu_load() in between drm_dev_alloc() and
> > drm_dev_register() then I'm getting this on the driver probe:
> > -->8---
> > [drm] Initialized drm 1.1.0 20060810
> > arcpgu e0017000.pgu: arc_pgu ID: 0xabbabaab
> > [ cut here ]
> > WARNING: CPU: 0 PID: 1 at lib/kobject.c:244 
> > kobject_add_internal+0x17c/0x498()
> > kobject_add_internal failed for card0-HDMI-A-1 (error: -2 parent: card0)
> > Modules linked in:
> > CPU: 0 PID: 1 Comm: swapper Not tainted 4.5.0-rc3-01062-ga447822-dirty #17
> > 
> > Stack Trace:
> >   arc_unwind_core.constprop.1+0xa4/0x110
> >   warn_slowpath_fmt+0x6e/0xfc
> >   kobject_add_internal+0x17c/0x498
> >   kobject_add+0x98/0xe4
> >   device_add+0xc6/0x734
> >   device_create_with_groups+0x12a/0x144
> >   drm_sysfs_connector_add+0x54/0xe8
> >   arcpgu_drm_hdmi_init+0xd4/0x17c
> >   arcpgu_probe+0x138/0x24c
> >   platform_drv_probe+0x2e/0x6c
> >   really_probe+0x212/0x35c
> >   __driver_attach+0x90/0x94
> >   bus_for_each_dev+0x46/0x80
> >   bus_add_driver+0x14e/0x1b4
> >   driver_register+0x64/0x108
> >   do_one_initcall+0x86/0x194
> >   kernel_init_freeable+0xf0/0x188
> > ---[ end trace c67166ad43ddcce2 ]---
> > [drm:drm_sysfs_connector_add] adding "HDMI-A-1" to sysfs
> > [drm:drm_sysfs_connector_add] *ERROR* failed to register connector device: 
> > -2
> > arcpgu e0017000.pgu: failed to regiter DRM connector and helper funcs
> > arcpgu: probe of e0017000.pgu failed with error -2
> > -->8---
> > 
> > But if I move arcpgu_load() after drm_dev_register() then everything
> > starts properly and I may see HDMI screen works perfectly fine.
> > 
> > Any thoughts?
> Oops, yeah missed that detail. If you look at atmel it has a loop to
> register all the drm connectors _after_ calling drm_dev_register().
> Totally forgot about that. Can you pls
> - Extract a new drm_connector_register_all() function
>   (atmel_hlcdc_dc_connector_plug_all seems to be the best template),
>   including kerneldoc.
> - Adjust kerneldoc of drm_dev_register() to mention
>   drm_connector_register_all() and that ordering constraint.
> - Roll that helper out to all the drivers that currently hand-roll it (one
>   patch per driver).
> 
> I know a bit of work but imo not too much, and by doing some small
> refactoring every time someone stumbles over a drm pit

Re: [PATCH v2] ARC: axs10x - add Ethernet PHY description in .dts

2016-03-18 Thread Alexey Brodkin
Hi Sergei,

On Thu, 2016-03-17 at 13:58 +0300, Sergei Shtylyov wrote:
> On 3/17/2016 12:41 PM, Alexey Brodkin wrote:
> 
> > 
> > Following commit broke DW GMAC functionality on AXS10x boards:
> > http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=e34d65696d2ef13dc32f2a162556c86c461ed763
> Note that scripts/checkpatch.pl now enforces certain format for citing 
> commits: commit <12-digit SHA1> ("").

Frankly I haven't run that patch through checkpatch due to patch
simplicity.

But I'll try to not do any assumptions from now on and will try to
use checkpatch for each and every thing I send :)

Thanks for spotting all his!

-Alexey
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

Re: [PATCH 1/4 v3] drm: Add support of ARC PGU display controller

2016-03-19 Thread Alexey Brodkin
Hi Daniel,

On Fri, 2016-03-18 at 09:02 +0100, Daniel Vetter wrote:
> On Thu, Mar 17, 2016 at 08:27:10PM +0000, Alexey Brodkin wrote:
> > 
> > Hi Daniel,
> > 
> > On Tue, 2016-03-15 at 16:59 +0100, Daniel Vetter wrote:
> > > 
> > > On Tue, Mar 15, 2016 at 03:24:46PM +, Alexey Brodkin wrote:
> > > > 
> > > > On Tue, 2016-03-15 at 09:10 +0100, Daniel Vetter wrote:
> > > > > 
> > > > > On Mon, Mar 14, 2016 at 11:15:59AM +, Alexey Brodkin wrote:
> > > > > > 
> > > > > > On Mon, 2016-03-14 at 08:00 +0100, Daniel Vetter wrote:
> > > > > > > 
> > > > > > > On Fri, Mar 11, 2016 at 06:42:36PM +0300, Alexey Brodkin wrote:
> > > > > > > > 
> > > > > > > >  
> > > > > > > > +static struct drm_driver arcpgu_drm_driver = {
> > > > > > > > +   .driver_features = DRIVER_MODESET | DRIVER_GEM | 
> > > > > > > > DRIVER_PRIME |
> > > > > > > > +      DRIVER_ATOMIC,
> > > > > > > > +   .preclose = arcpgu_preclose,
> > > > > > > > +   .lastclose = arcpgu_lastclose,
> > > > > > > > +   .name = "drm-arcpgu",
> > > > > > > > +   .desc = "ARC PGU Controller",
> > > > > > > > +   .date = "20160219",
> > > > > > > > +   .major = 1,
> > > > > > > > +   .minor = 0,
> > > > > > > > +   .patchlevel = 0,
> > > > > > > > +   .fops = &arcpgu_drm_ops,
> > > > > > > > +   .load = arcpgu_load,
> > > > > > > > +   .unload = arcpgu_unload,
> > > > > > > Load and unload hooks are deprecated (it's a classic midlayer 
> > > > > > > mistake).
> > > > > > > Please use drm_dev_alloc/register pairs directly instead, and put 
> > > > > > > your
> > > > > > > device setup code in-between. Similar for unloading. There's a 
> > > > > > > bunch of
> > > > > > > example drivers converted already.
> > > > > > Ok I took "atmel-hlcdc" as example.
> > > > > > And that's interesting.
> > > > > > 
> > > > > > If I put my arcpgu_load() in between drm_dev_alloc() and
> > > > > > drm_dev_register() then I'm getting this on the driver probe:
> > > > > > -->8---
> > > > > > [drm] Initialized drm 1.1.0 20060810
> > > > > > arcpgu e0017000.pgu: arc_pgu ID: 0xabbabaab
> > > > > > [ cut here ]
> > > > > > WARNING: CPU: 0 PID: 1 at lib/kobject.c:244 
> > > > > > kobject_add_internal+0x17c/0x498()
> > > > > > kobject_add_internal failed for card0-HDMI-A-1 (error: -2 parent: 
> > > > > > card0)
> > > > > > Modules linked in:
> > > > > > CPU: 0 PID: 1 Comm: swapper Not tainted 
> > > > > > 4.5.0-rc3-01062-ga447822-dirty #17
> > > > > > 
> > > > > > Stack Trace:
> > > > > >   arc_unwind_core.constprop.1+0xa4/0x110
> > > > > >   warn_slowpath_fmt+0x6e/0xfc
> > > > > >   kobject_add_internal+0x17c/0x498
> > > > > >   kobject_add+0x98/0xe4
> > > > > >   device_add+0xc6/0x734
> > > > > >   device_create_with_groups+0x12a/0x144
> > > > > >   drm_sysfs_connector_add+0x54/0xe8
> > > > > >   arcpgu_drm_hdmi_init+0xd4/0x17c
> > > > > >   arcpgu_probe+0x138/0x24c
> > > > > >   platform_drv_probe+0x2e/0x6c
> > > > > >   really_probe+0x212/0x35c
> > > > > >   __driver_attach+0x90/0x94
> > > > > >   bus_for_each_dev+0x46/0x80
> > > > > >   bus_add_driver+0x14e/0x1b4
> > > > > >   driver_register+0x64/0x108
> > > > > >   do_one_initcall+0x86/0x194
> > > > > >   kernel_init_freeable+0xf0/0x188
> > > > > > ---[ end trace c67166ad43ddcce2 ]---
> > > > > > [drm:drm_sysfs_connector_add] adding "HDMI-A-1" to sysfs
> > > > > > [drm:drm_sysfs_connector_add] *ERROR* failed

Re: [PATCH 1/4 v3] drm: Add support of ARC PGU display controller

2016-03-19 Thread Alexey Brodkin
Hi Daniel,

On Tue, 2016-03-15 at 16:59 +0100, Daniel Vetter wrote:
> On Tue, Mar 15, 2016 at 03:24:46PM +0000, Alexey Brodkin wrote:
> > On Tue, 2016-03-15 at 09:10 +0100, Daniel Vetter wrote:
> > > On Mon, Mar 14, 2016 at 11:15:59AM +0000, Alexey Brodkin wrote:
> > > > On Mon, 2016-03-14 at 08:00 +0100, Daniel Vetter wrote:
> > > > > On Fri, Mar 11, 2016 at 06:42:36PM +0300, Alexey Brodkin wrote:
> > > > > > 
> > > > > > +static struct drm_driver arcpgu_drm_driver = {
> > > > > > +   .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME |
> > > > > > +      DRIVER_ATOMIC,
> > > > > > +   .preclose = arcpgu_preclose,
> > > > > > +   .lastclose = arcpgu_lastclose,
> > > > > > +   .name = "drm-arcpgu",
> > > > > > +   .desc = "ARC PGU Controller",
> > > > > > +   .date = "20160219",
> > > > > > +   .major = 1,
> > > > > > +   .minor = 0,
> > > > > > +   .patchlevel = 0,
> > > > > > +   .fops = &arcpgu_drm_ops,
> > > > > > +   .load = arcpgu_load,
> > > > > > +   .unload = arcpgu_unload,
> > > > > Load and unload hooks are deprecated (it's a classic midlayer 
> > > > > mistake).
> > > > > Please use drm_dev_alloc/register pairs directly instead, and put your
> > > > > device setup code in-between. Similar for unloading. There's a bunch 
> > > > > of
> > > > > example drivers converted already.
> > > > Ok I took "atmel-hlcdc" as example.
> > > > And that's interesting.
> > > > 
> > > > If I put my arcpgu_load() in between drm_dev_alloc() and
> > > > drm_dev_register() then I'm getting this on the driver probe:
> > > > -->8---
> > > > [drm] Initialized drm 1.1.0 20060810
> > > > arcpgu e0017000.pgu: arc_pgu ID: 0xabbabaab
> > > > [ cut here ]
> > > > WARNING: CPU: 0 PID: 1 at lib/kobject.c:244 
> > > > kobject_add_internal+0x17c/0x498()
> > > > kobject_add_internal failed for card0-HDMI-A-1 (error: -2 parent: card0)
> > > > Modules linked in:
> > > > CPU: 0 PID: 1 Comm: swapper Not tainted 4.5.0-rc3-01062-ga447822-dirty 
> > > > #17
> > > > 
> > > > Stack Trace:
> > > >   arc_unwind_core.constprop.1+0xa4/0x110
> > > >   warn_slowpath_fmt+0x6e/0xfc
> > > >   kobject_add_internal+0x17c/0x498
> > > >   kobject_add+0x98/0xe4
> > > >   device_add+0xc6/0x734
> > > >   device_create_with_groups+0x12a/0x144
> > > >   drm_sysfs_connector_add+0x54/0xe8
> > > >   arcpgu_drm_hdmi_init+0xd4/0x17c
> > > >   arcpgu_probe+0x138/0x24c
> > > >   platform_drv_probe+0x2e/0x6c
> > > >   really_probe+0x212/0x35c
> > > >   __driver_attach+0x90/0x94
> > > >   bus_for_each_dev+0x46/0x80
> > > >   bus_add_driver+0x14e/0x1b4
> > > >   driver_register+0x64/0x108
> > > >   do_one_initcall+0x86/0x194
> > > >   kernel_init_freeable+0xf0/0x188
> > > > ---[ end trace c67166ad43ddcce2 ]---
> > > > [drm:drm_sysfs_connector_add] adding "HDMI-A-1" to sysfs
> > > > [drm:drm_sysfs_connector_add] *ERROR* failed to register connector 
> > > > device: -2
> > > > arcpgu e0017000.pgu: failed to regiter DRM connector and helper funcs
> > > > arcpgu: probe of e0017000.pgu failed with error -2
> > > > -->8---
> > > > 
> > > > But if I move arcpgu_load() after drm_dev_register() then everything
> > > > starts properly and I may see HDMI screen works perfectly fine.
> > > > 
> > > > Any thoughts?
> > > Oops, yeah missed that detail. If you look at atmel it has a loop to
> > > register all the drm connectors _after_ calling drm_dev_register().
> > > Totally forgot about that. Can you pls
> > > - Extract a new drm_connector_register_all() function
> > >   (atmel_hlcdc_dc_connector_plug_all seems to be the best template),
> > >   including kerneldoc.
> > > - Adjust kerneldoc of drm_dev_register() to mention
> > >   drm_connector_register_all() and that ordering constraint.
> > > - Roll that helper o

[PATCH v2] ARC: axs10x - add Ethernet PHY description in .dts

2016-03-19 Thread Alexey Brodkin
Following commit broke DW GMAC functionality on AXS10x boards:
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=e34d65696d2ef13dc32f2a162556c86c461ed763

That's what happens on eth0 up:
--->8
libphy: PHY stmmac-0: not found
eth0: Could not attach to PHY
stmmac_open: Cannot attach to PHY (error: -19)
--->8

Simplest solution is to add PHY description in board's .dts.
And so we do here.

Signed-off-by: Alexey Brodkin 
Cc: Rob Herring 
Cc: Phil Reid 
Cc: David S. Miller 
Cc: linux-ker...@vger.kernel.org
Cc: net...@vger.kernel.org
Cc: sta...@vger.kernel.org # 4.5.x
Cc: Sergei Shtylyov 
---

Changes v1 -> v2:
 * PHY node name changed to match real PHY number being used (Sergei)

 arch/arc/boot/dts/axs10x_mb.dtsi | 8 
 1 file changed, 8 insertions(+)

diff --git a/arch/arc/boot/dts/axs10x_mb.dtsi b/arch/arc/boot/dts/axs10x_mb.dtsi
index 44a578c..ab5d570 100644
--- a/arch/arc/boot/dts/axs10x_mb.dtsi
+++ b/arch/arc/boot/dts/axs10x_mb.dtsi
@@ -47,6 +47,14 @@
clocks = <&apbclk>;
clock-names = "stmmaceth";
max-speed = <100>;
+   mdio0 {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   compatible = "snps,dwmac-mdio";
+   phy1: ethernet-phy@1 {
+   reg = <1>;
+   };
+   };
};
 
ehci@0x4 {
-- 
2.5.0


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH v2] ARC: axs10x - add Ethernet PHY description in .dts

2016-03-19 Thread Alexey Brodkin
Hi Sergei,

On Thu, 2016-03-17 at 14:59 +0300, Sergei Shtylyov wrote:
> Hello.
> 
> On 3/17/2016 2:41 PM, Vineet Gupta wrote:
> 
> > 
> > > 
> > > > 
> > > > > 
> > > > > Following commit broke DW GMAC functionality on AXS10x boards:
> > > > > http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=e34d65696d2ef13dc32f2a162556c86c461e
> > > > > d763
> > > >  Note that scripts/checkpatch.pl now enforces certain format for 
> > > > citing
> > > > commits: commit <12-digit SHA1> ("").
> > 
> > > 
> > > Frankly I haven't run that patch through checkpatch due to patch
> > > simplicity.
> > > 
> > > But I'll try to not do any assumptions from now on and will try to
> > > use checkpatch for each and every thing I send :)
> > > 
> > > Thanks for spotting all his!
> > > 
> Sorry for not reporting everything on the 1st review.
> 
> > 
> > > 
> > > -Alexey
> > Sergei, do you mind providing a Ack/Reviewed-by on the patch below
>  >
> 
> Reviewed-by: Sergei Shtylyov 
> 
> The patch here is white space damaged however: tabs were converted to 
> spaces. :-(

Well, I'm not really sure why that substitution happened because my local patch
is indeed with tabs.

That's an output of checkpatch:
>8
./scripts/checkpatch.pl 
0001-ARC-axs10x-add-Ethernet-PHY-description-in-.dts.patch 
[1]+  Donegedit 
0001-ARC-axs10x-add-Ethernet-PHY-description-in-.dts.patch
WARNING: Possible unwrapped commit description (prefer a maximum 75 chars per 
line)
#7: 
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=e34d65696d2ef13dc32f2a162556c86c461ed763

ERROR: Please use git commit description style 'commit <12+ chars of sha1> 
("")' - ie: 'commit e34d65696d2e
("stmmac: create of compatible mdio bus for stmmac driver")'
#7: 
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=e34d65696d2ef13dc32f2a162556c86c461ed763

total: 1 errors, 1 warnings, 14 lines checked

0001-ARC-axs10x-add-Ethernet-PHY-description-in-.dts.patch has style problems, 
please review.
>8

If there were spaces we would see tons of:
>8
ERROR: code indent should use tabs where possible
#43: FILE: arch/arc/boot/dts/axs10x_mb.dtsi:50:
+mdio0 {$
>8
which I didn't see.

-Alexey
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

Re: [PATCH 2/4 v3] drm: Add DT bindings documentation for ARC PGU display controller

2016-03-24 Thread Alexey Brodkin
Hi Rob,

On Mon, 2016-03-21 at 08:04 -0500, Rob Herring wrote:
> On Fri, Mar 11, 2016 at 06:42:37PM +0300, Alexey Brodkin wrote:
> > 
> > This add DT bindings documentation for ARC PGU display controller.
> > 
> > Signed-off-by: Alexey Brodkin 
> > Cc: Rob Herring 
> > Cc: Pawel Moll 
> > Cc: Mark Rutland 
> > Cc: Ian Campbell 
> > Cc: Kumar Gala 
> > Cc: David Airlie 
> > Cc: dri-de...@lists.freedesktop.org
> > Cc: devicet...@vger.kernel.org
> > Cc: linux-snps-arc@lists.infradead.org
> > ---
> > 
> > Changes v2 -> v3:
> >  * Reverted back to initial larger version of example
> >    with minor fixes (thanks Rob for spotting those).
> > 
> > Changes v1 -> v2:
> >  * Removed everything except PGU node itself.
> > 
> >  .../devicetree/bindings/display/snps,arcpgu.txt| 72 
> > ++
> >  1 file changed, 72 insertions(+)
> >  create mode 100644 
> > Documentation/devicetree/bindings/display/snps,arcpgu.txt
> > 
> > diff --git a/Documentation/devicetree/bindings/display/snps,arcpgu.txt
> > b/Documentation/devicetree/bindings/display/snps,arcpgu.txt
> > new file mode 100644
> > index 000..b130924
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/display/snps,arcpgu.txt
> > @@ -0,0 +1,72 @@
> > +ARC PGU
> > +
> > +This is a display controller found on several development boards produced
> > +by Synopsys. The ARC PGU is an RGB streamer that reads the data from a
> > +framebuffer and sends it to a single digital encoder (usually HDMI).
> > +
> > +Required properties:
> > +  - compatible: "snps,arcpgu"
> > +  - reg: Physical base address and length of the controller's registers.
> > +  - clocks: A list of phandle + clock-specifier pairs, one for each
> > +entry in 'clock-names'.
> > +  - clock-names: A list of clock names. For ARC PGU it should contain:
> > +  - "pxlclk" for the clock feeding the output PLL of the controller.
> > +  - encoder-slave: Phandle of encoder chip.
> Drop this as discussed.

Ok I'll do that.
But what about my example below?
Do I need to remove encoder node from it as well?

> > 
> > +
> > +Required sub-nodes:
> > +  - port: The PGU connection to an encoder chip.
> > +
> > +Example:
> > +
> > +/ {
> > +   ...
> > +
> > +   pgu@ {
> > +   compatible = "snps,arcpgu";
> > +   reg = <0x 0x400>;
> > +   clocks = <&clock_node>;
> > +   clock-names = "pxlclk";
> > +   encoder-slave = <&encoder_node>;
> > +
> > +   port {
> > +   pgu_output: endpoint {
> > +   remote-endpoint = <&hdmi_enc_input>;
> > +   };
> > +   };
> > +   };
> > +
> > +   /* HDMI encoder on I2C bus */
> > +   i2c@ {
> > +   compatible = "...";
> > +
> > +   encoder_node:encoder_node@0xXX{
> Don't use underscores in node names. Just "hdmi@xx"

Ok still I may keep label "encoder_node" here, right?

-Alexey
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

[PATCH 3/5 v4] MAINTAINERS: Add maintainer for ARC PGU display controller

2016-03-24 Thread Alexey Brodkin
This updates MAINTEINERS file with information about maintainer of
ARC PGU display controller driver.

Signed-off-by: Alexey Brodkin 
Cc: linux-snps-arc@lists.infradead.org
---

No changes v3 -> v4.

No changes v2 -> v3.

No changes v1 -> v2.

 MAINTAINERS | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index ea1d1de..0dcba67 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -827,6 +827,12 @@ S: Maintained
 F: drivers/net/arcnet/
 F: include/uapi/linux/if_arcnet.h
 
+ARC PGU DRM DRIVER
+M:     Alexey Brodkin 
+S: Supported
+F: drivers/gpu/drm/arc/
+F: Documentation/devicetree/bindings/display/snps,arcpgu.txt
+
 ARM HDLCD DRM DRIVER
 M: Liviu Dudau 
 S: Supported
-- 
2.5.0


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 1/5 v4] drm: Add support of ARC PGU display controller

2016-03-24 Thread Alexey Brodkin
From: Carlos Palminha 

ARC PGU could be found on some development boards from Synopsys.
This is a simple byte streamer that reads data from a framebuffer
and sends data to the single encoder.

Signed-off-by: Carlos Palminha 
Signed-off-by: Alexey Brodkin 
Cc: David Airlie 
Cc: dri-de...@lists.freedesktop.org
Cc: linux-snps-arc@lists.infradead.org
---

Note following series that introduces
drm_connector_register_all()/drm_connector_unregister_all() is a prerequisite
now: https://lkml.org/lkml/2016/3/23/61

Changes v3 -> v4:
 * The driver author is now set properly (thanks Carlos for all your efforts)
 * Implemented correct hsync and vsync setup (thanks Jose)
 * Dummy call-backs were removed (as suggested by Daniel)
 * Obsolete load()/unload() call-backs were removed (as suggested by Daniel)
 * With above in mind we were able to adopt recently introduced
   drm_connector_register_all()/drm_connector_unregister_all()

Changes v2 -> v3:
 * Improved failure path if arcpgu_connector wasn't allocated (thanks Jose).
 * Fixed driver building as module (reported by 0-DAY kernel test infrastruct.)
 * Implemented uncached mapping of user-space FB pages.

No changes v1 -> v2.

 drivers/gpu/drm/Kconfig   |   2 +
 drivers/gpu/drm/Makefile  |   1 +
 drivers/gpu/drm/arc/Kconfig   |  10 ++
 drivers/gpu/drm/arc/Makefile  |   2 +
 drivers/gpu/drm/arc/arcpgu.h  |  50 +++
 drivers/gpu/drm/arc/arcpgu_crtc.c | 257 ++
 drivers/gpu/drm/arc/arcpgu_drv.c  | 282 ++
 drivers/gpu/drm/arc/arcpgu_hdmi.c | 201 +++
 drivers/gpu/drm/arc/arcpgu_regs.h |  40 ++
 9 files changed, 845 insertions(+)
 create mode 100644 drivers/gpu/drm/arc/Kconfig
 create mode 100644 drivers/gpu/drm/arc/Makefile
 create mode 100644 drivers/gpu/drm/arc/arcpgu.h
 create mode 100644 drivers/gpu/drm/arc/arcpgu_crtc.c
 create mode 100644 drivers/gpu/drm/arc/arcpgu_drv.c
 create mode 100644 drivers/gpu/drm/arc/arcpgu_hdmi.c
 create mode 100644 drivers/gpu/drm/arc/arcpgu_regs.h

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index f2a74d0..9e4f2f1 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -281,3 +281,5 @@ source "drivers/gpu/drm/imx/Kconfig"
 source "drivers/gpu/drm/vc4/Kconfig"
 
 source "drivers/gpu/drm/etnaviv/Kconfig"
+
+source "drivers/gpu/drm/arc/Kconfig"
diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index 6eb94fc..c338d04 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -78,3 +78,4 @@ obj-y += panel/
 obj-y  += bridge/
 obj-$(CONFIG_DRM_FSL_DCU) += fsl-dcu/
 obj-$(CONFIG_DRM_ETNAVIV) += etnaviv/
+obj-$(CONFIG_DRM_ARCPGU)+= arc/
diff --git a/drivers/gpu/drm/arc/Kconfig b/drivers/gpu/drm/arc/Kconfig
new file mode 100644
index 000..f9a13b6
--- /dev/null
+++ b/drivers/gpu/drm/arc/Kconfig
@@ -0,0 +1,10 @@
+config DRM_ARCPGU
+   tristate "ARC PGU"
+   depends on DRM && OF
+   select DRM_KMS_CMA_HELPER
+   select DRM_KMS_FB_HELPER
+   select DRM_KMS_HELPER
+   help
+ Choose this option if you have an ARC PGU controller.
+
+ If M is selected the module will be called arcpgu.
diff --git a/drivers/gpu/drm/arc/Makefile b/drivers/gpu/drm/arc/Makefile
new file mode 100644
index 000..d48fda7
--- /dev/null
+++ b/drivers/gpu/drm/arc/Makefile
@@ -0,0 +1,2 @@
+arcpgu-y := arcpgu_crtc.o arcpgu_hdmi.o arcpgu_drv.o
+obj-$(CONFIG_DRM_ARCPGU) += arcpgu.o
diff --git a/drivers/gpu/drm/arc/arcpgu.h b/drivers/gpu/drm/arc/arcpgu.h
new file mode 100644
index 000..86574b6
--- /dev/null
+++ b/drivers/gpu/drm/arc/arcpgu.h
@@ -0,0 +1,50 @@
+/*
+ * ARC PGU DRM driver.
+ *
+ * Copyright (C) 2016 Synopsys, Inc. (www.synopsys.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 _ARCPGU_H_
+#define _ARCPGU_H_
+
+struct arcpgu_drm_private {
+   void __iomem*regs;
+   struct clk  *clk;
+   struct drm_fbdev_cma*fbdev;
+   struct drm_framebuffer  *fb;
+   struct list_headevent_list;
+   struct drm_crtc crtc;
+   struct drm_plane*plane;
+};
+
+#define crtc_to_arcpgu_priv(x) container_of(x, struct arcpgu_drm_private, crtc)
+
+static inline void arc_pgu_write(struct arcpgu_drm_private *arcpgu,
+unsigned int reg, u32 value)
+{
+   iowrite32(value, arcpgu->regs + reg);
+}
+
+static inline u32 arc_pgu_read(struct 

[PATCH 4/5 v4] arc: Add our own implementation of fb_pgprotect()

2016-03-24 Thread Alexey Brodkin
During mmaping of frame-buffer pages to user-space
fb_protect() is called to set proper page settings.

In case of ARC we need to mark pages that are mmaped to
user as uncached because of 2 reasons:
 * Huge amount of data if passing through data cache will
   thrash cache a lot making cache almost useless for other
   less traffic hungry processes.
 * Data written by user in FB will be immediately available for
   hardware (such as PGU etc) without requirements to flush data
   cache regularly.

Signed-off-by: Alexey Brodkin 
Cc: linux-snps-arc@lists.infradead.org
---

Changes v3 -> v4:
 * This change was introduced only in v4.

 arch/arc/include/asm/fb.h | 19 +++
 1 file changed, 19 insertions(+)
 create mode 100644 arch/arc/include/asm/fb.h

diff --git a/arch/arc/include/asm/fb.h b/arch/arc/include/asm/fb.h
new file mode 100644
index 000..bd3f68c
--- /dev/null
+++ b/arch/arc/include/asm/fb.h
@@ -0,0 +1,19 @@
+#ifndef _ASM_FB_H_
+#define _ASM_FB_H_
+
+#include 
+#include 
+#include 
+
+static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
+   unsigned long off)
+{
+   vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
+}
+
+static inline int fb_is_primary_device(struct fb_info *info)
+{
+   return 0;
+}
+
+#endif /* _ASM_FB_H_ */
-- 
2.5.0


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 0/5 v4] drm: Add support of ARC PGU display controller

2016-03-24 Thread Alexey Brodkin
This series add support of ARC PGU display controller.
ARC PGU is a quite simple byte streamer that gets data from the framebuffer
and pushes it to hte connected encoder (DP or HDMI).

It was tested on ARC SDP boards (axs101/103 in particular).

Note following series that introduces
drm_connector_register_all()/drm_connector_unregister_all() is a prerequisite
now: https://lkml.org/lkml/2016/3/23/61

Changes v3 -> v4:
 * Main driver author is now set properly (thanks Carlos for all your efforts)
 * Implemented correct hsync and vsync setup (thanks Jose)
 * Dummy call-backs were removed (as suggested by Daniel)
 * Obsolete load()/unload() call-backs were removed (as suggested by Daniel)
 * With above in mind we were able to adopt recently introduced
   drm_connector_register_all()/drm_connector_unregister_all()
 * Implemented setup of properties (uncached) for FB user-pages
 * Minor clean-up in DT binding docs and axs10x_mb.dtsi

Changes v2 -> v3:
 * Improved failure path if arcpgu_connector wasn't allocated.
 * Fixed driver building as module.
 * Implemented uncached mapping of user-space FB pages.
 * Again updated DT bindings docs.

Changes v1 -> v2:
 * Clean-up of DT bindings documentation.
 * Added missing "pxlclk" clock in axs10x_mb.dtsi.

Cc: David Airlie 
Cc: devicet...@vger.kernel.org
Cc: dri-de...@lists.freedesktop.org
Cc: Ian Campbell 
Cc: Kumar Gala 
Cc: linux-snps-arc@lists.infradead.org
Cc: Mark Rutland 
Cc: Pawel Moll 
Cc: Rob Herring 
Cc: Vineet Gupta 
Cc: Jose Abreu 
Cc: Carlos Palminha 

Alexey Brodkin (4):
  drm: Add DT bindings documentation for ARC PGU display controller
  MAINTAINERS: Add maintainer for ARC PGU display controller
  arc: Add our own implementation of fb_pgprotect()
  arc: axs10x - add support of ARC PGU

Carlos Palminha (1):
  drm: Add support of ARC PGU display controller

 .../devicetree/bindings/display/snps,arcpgu.txt|  71 ++
 MAINTAINERS|   6 +
 arch/arc/boot/dts/axs10x_mb.dtsi   |  61 +
 arch/arc/include/asm/fb.h  |  19 ++
 drivers/gpu/drm/Kconfig|   2 +
 drivers/gpu/drm/Makefile   |   1 +
 drivers/gpu/drm/arc/Kconfig|  10 +
 drivers/gpu/drm/arc/Makefile   |   2 +
 drivers/gpu/drm/arc/arcpgu.h   |  50 
 drivers/gpu/drm/arc/arcpgu_crtc.c  | 257 +++
 drivers/gpu/drm/arc/arcpgu_drv.c   | 282 +
 drivers/gpu/drm/arc/arcpgu_hdmi.c  | 201 +++
 drivers/gpu/drm/arc/arcpgu_regs.h  |  40 +++
 13 files changed, 1002 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/snps,arcpgu.txt
 create mode 100644 arch/arc/include/asm/fb.h
 create mode 100644 drivers/gpu/drm/arc/Kconfig
 create mode 100644 drivers/gpu/drm/arc/Makefile
 create mode 100644 drivers/gpu/drm/arc/arcpgu.h
 create mode 100644 drivers/gpu/drm/arc/arcpgu_crtc.c
 create mode 100644 drivers/gpu/drm/arc/arcpgu_drv.c
 create mode 100644 drivers/gpu/drm/arc/arcpgu_hdmi.c
 create mode 100644 drivers/gpu/drm/arc/arcpgu_regs.h

-- 
2.5.0


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 2/5 v4] drm: Add DT bindings documentation for ARC PGU display controller

2016-03-24 Thread Alexey Brodkin
This add DT bindings documentation for ARC PGU display controller.

Signed-off-by: Alexey Brodkin 
Cc: Rob Herring 
Cc: Pawel Moll 
Cc: Mark Rutland 
Cc: Ian Campbell 
Cc: Kumar Gala 
Cc: devicet...@vger.kernel.org
Cc: linux-snps-arc@lists.infradead.org
---

Changes v3 -> v4: (addressing Rob's comments)
 * Removed "encoder-slave" from required properties
 * Removed "0x" from node names

Changes v2 -> v3:
 * Reverted back to initial larger version of example
   with minor fixes (thanks Rob for spotting those).

Changes v1 -> v2:
 * Removed everything except PGU node itself.

 .../devicetree/bindings/display/snps,arcpgu.txt| 71 ++
 1 file changed, 71 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/snps,arcpgu.txt

diff --git a/Documentation/devicetree/bindings/display/snps,arcpgu.txt 
b/Documentation/devicetree/bindings/display/snps,arcpgu.txt
new file mode 100644
index 000..b126577
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/snps,arcpgu.txt
@@ -0,0 +1,71 @@
+ARC PGU
+
+This is a display controller found on several development boards produced
+by Synopsys. The ARC PGU is an RGB streamer that reads the data from a
+framebuffer and sends it to a single digital encoder (usually HDMI).
+
+Required properties:
+  - compatible: "snps,arcpgu"
+  - reg: Physical base address and length of the controller's registers.
+  - clocks: A list of phandle + clock-specifier pairs, one for each
+entry in 'clock-names'.
+  - clock-names: A list of clock names. For ARC PGU it should contain:
+  - "pxlclk" for the clock feeding the output PLL of the controller.
+
+Required sub-nodes:
+  - port: The PGU connection to an encoder chip.
+
+Example:
+
+/ {
+   ...
+
+   pgu@ {
+   compatible = "snps,arcpgu";
+   reg = <0x 0x400>;
+   clocks = <&clock_node>;
+   clock-names = "pxlclk";
+   encoder-slave = <&encoder_node>;
+
+   port {
+   pgu_output: endpoint {
+   remote-endpoint = <&hdmi_enc_input>;
+   };
+   };
+   };
+
+   /* HDMI encoder on I2C bus */
+   i2c@ {
+   compatible = "...";
+
+   encoder_node:hdmi@XX{
+   compatible="...";
+
+   ports {
+   port@0 {
+   reg = <0>;
+   hdmi_enc_input:endpoint {
+   remote-endpoint = <&pgu_output>;
+   };
+   };
+
+   port@1 {
+   reg = <1>;
+   hdmi_enc_output:endpoint {
+   remote-endpoint = 
<&hdmi_connector_in>;
+   };
+   };
+   };
+   };
+   }
+
+   hdmi0: connector {
+   compatible = "hdmi-connector";
+
+   port {
+   hdmi_connector_in: endpoint {
+   remote-endpoint = <&hdmi_enc_output>;
+   };
+   };
+   };
+};
-- 
2.5.0


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 5/5 v4] arc: axs10x - add support of ARC PGU

2016-03-24 Thread Alexey Brodkin
Synopsys DesignWare ARC SDP boards sport ARC SDP display
controller attached to ADV7511 HDMI encoder.

That change adds desctiption of both ARC PGU and ADV7511 in
ARC SDP'd base-board Device Tree.

Signed-off-by: Alexey Brodkin 
Cc: Rob Herring 
Cc: Pawel Moll 
Cc: Mark Rutland 
Cc: Ian Campbell 
Cc: Kumar Gala 
Cc: Vineet Gupta 
Cc: devicet...@vger.kernel.org
Cc: linux-snps-arc@lists.infradead.org
---

Changes v3 -> v4:
 * Removed "0x" from node names (as suggested by Rob)

No changes v2 -> v3.

Changes v1 -> v2:
 * Added missing "pxlclk" clock in axs10x_mb.dtsi

 arch/arc/boot/dts/axs10x_mb.dtsi | 61 
 1 file changed, 61 insertions(+)

diff --git a/arch/arc/boot/dts/axs10x_mb.dtsi b/arch/arc/boot/dts/axs10x_mb.dtsi
index 44a578c..8fee596 100644
--- a/arch/arc/boot/dts/axs10x_mb.dtsi
+++ b/arch/arc/boot/dts/axs10x_mb.dtsi
@@ -34,6 +34,12 @@
clock-frequency = <5000>;
#clock-cells = <0>;
};
+
+   pguclk: pguclk {
+   #clock-cells = <0>;
+   compatible = "fixed-clock";
+   clock-frequency = <7444>;
+   };
};
 
ethernet@0x18000 {
@@ -147,6 +153,37 @@
clocks = <&i2cclk>;
interrupts = <16>;
 
+   adv7511:adv7511@39{
+   compatible="adi,adv7511";
+   reg = <0x39>;
+   interrupts = <23>;
+   adi,input-depth = <8>;
+   adi,input-colorspace = "rgb";
+   adi,input-clock = "1x";
+   adi,clock-delay = <0x03>;
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   /* RGB/YUV input */
+   port@0 {
+   reg = <0>;
+   adv7511_input:endpoint {
+   remote-endpoint = <&pgu_output>;
+   };
+   };
+
+   /* HDMI output */
+   port@1 {
+   reg = <1>;
+   adv7511_output: endpoint {
+   remote-endpoint = 
<&hdmi_connector_in>;
+   };
+   };
+   };
+   };
+
eeprom@0x54{
compatible = "24c01";
reg = <0x54>;
@@ -160,6 +197,16 @@
};
};
 
+   hdmi0: connector {
+   compatible = "hdmi-connector";
+   type = "a";
+   port {
+   hdmi_connector_in: endpoint {
+   remote-endpoint = <&adv7511_output>;
+   };
+   };
+   };
+
gpio0:gpio@13000 {
compatible = "snps,dw-apb-gpio";
reg = <0x13000 0x1000>;
@@ -221,5 +268,19 @@
reg = <2>;
};
};
+
+   pgu@17000 {
+   compatible = "snps,arcpgu";
+   reg = <0x17000 0x400>;
+   encoder-slave = <&adv7511>;
+   clocks = <&pguclk>;
+   clock-names = "pxlclk";
+
+   port {
+   pgu_output: endpoint {
+   remote-endpoint = <&adv7511_input>;
+   };
+   };
+   };
};
 };
-- 
2.5.0


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH 1/5 v4] drm: Add support of ARC PGU display controller

2016-03-24 Thread Alexey Brodkin
Hello,

On Fri, 2016-03-25 at 01:37 +0800, kbuild test robot wrote:
> Hi Carlos,
> 
> [auto build test ERROR on drm/drm-next]
> [also build test ERROR on v4.5 next-20160324]
> [if your patch is applied to the wrong git tree, please drop us a note to 
> help improving the system]
> 
> url:
> https://github.com/0day-ci/linux/commits/Alexey-Brodkin/drm-Add-support-of-ARC-PGU-display-controller/20160325
> -005345
> base:   git://people.freedesktop.org/~airlied/linux.git drm-next
> config: i386-allmodconfig (attached as .config)
> reproduce:
> # save the attached .config to linux build tree
> make ARCH=i386 
> 
> All errors (new ones prefixed by >>):
>    230goto err_unload;
>    231
>  > 232ret = drm_connector_register_all(drm);

...

>  > 254drm_connector_unregister_all(drm);
>    255drm_dev_unregister(drm);

That problem happens because that change relies on another series that yet
to be accepted in DRM for 4.7 cycle, see https://lkml.org/lkml/2016/3/23/128

Based on Daniel's comment I would assume soon after 4.6-rc1 will be cut
pending prerequisite will be applied to drm-next and that build failure will
go away.

-Alexey
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

[PATCH 0/5 v5] drm: Add support of ARC PGU display controller

2016-03-28 Thread Alexey Brodkin
This series add support of ARC PGU display controller.
ARC PGU is a quite simple byte streamer that gets data from the framebuffer
and pushes it to hte connected encoder (DP or HDMI).

It was tested on ARC SDP boards (axs101/103 in particular).

Note following series that introduces
drm_connector_register_all()/drm_connector_unregister_all() is a prerequisite
now: https://lkml.org/lkml/2016/3/23/61

Changes v4 -> v5:
 * Removed encode node from DT bindings example (as suggested by Rob)

Changes v3 -> v4:
 * Main driver author is now set properly (thanks Carlos for all your efforts)
 * Implemented correct hsync and vsync setup (thanks Jose)
 * Dummy call-backs were removed (as suggested by Daniel)
 * Obsolete load()/unload() call-backs were removed (as suggested by Daniel)
 * With above in mind we were able to adopt recently introduced
   drm_connector_register_all()/drm_connector_unregister_all()
 * Implemented setup of properties (uncached) for FB user-pages
 * Minor clean-up in DT binding docs and axs10x_mb.dtsi

Changes v2 -> v3:
 * Improved failure path if arcpgu_connector wasn't allocated.
 * Fixed driver building as module.
 * Implemented uncached mapping of user-space FB pages.
 * Again updated DT bindings docs.

Changes v1 -> v2:
 * Clean-up of DT bindings documentation.
 * Added missing "pxlclk" clock in axs10x_mb.dtsi.

Cc: David Airlie 
Cc: devicet...@vger.kernel.org
Cc: dri-de...@lists.freedesktop.org
Cc: Ian Campbell 
Cc: Kumar Gala 
Cc: linux-snps-arc@lists.infradead.org
Cc: Mark Rutland 
Cc: Pawel Moll 
Cc: Rob Herring 
Cc: Vineet Gupta 
Cc: Jose Abreu 
Cc: Carlos Palminha 

Alexey Brodkin (4):
  drm: Add DT bindings documentation for ARC PGU display controller
  MAINTAINERS: Add maintainer for ARC PGU display controller
  arc: Add our own implementation of fb_pgprotect()
  arc: axs10x - add support of ARC PGU

Carlos Palminha (1):
  drm: Add support of ARC PGU display controller

 .../devicetree/bindings/display/snps,arcpgu.txt|  35 +++
 MAINTAINERS|   6 +
 arch/arc/boot/dts/axs10x_mb.dtsi   |  61 +
 arch/arc/include/asm/fb.h  |  19 ++
 drivers/gpu/drm/Kconfig|   2 +
 drivers/gpu/drm/Makefile   |   1 +
 drivers/gpu/drm/arc/Kconfig|  10 +
 drivers/gpu/drm/arc/Makefile   |   2 +
 drivers/gpu/drm/arc/arcpgu.h   |  50 
 drivers/gpu/drm/arc/arcpgu_crtc.c  | 257 +++
 drivers/gpu/drm/arc/arcpgu_drv.c   | 282 +
 drivers/gpu/drm/arc/arcpgu_hdmi.c  | 201 +++
 drivers/gpu/drm/arc/arcpgu_regs.h  |  40 +++
 13 files changed, 966 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/snps,arcpgu.txt
 create mode 100644 arch/arc/include/asm/fb.h
 create mode 100644 drivers/gpu/drm/arc/Kconfig
 create mode 100644 drivers/gpu/drm/arc/Makefile
 create mode 100644 drivers/gpu/drm/arc/arcpgu.h
 create mode 100644 drivers/gpu/drm/arc/arcpgu_crtc.c
 create mode 100644 drivers/gpu/drm/arc/arcpgu_drv.c
 create mode 100644 drivers/gpu/drm/arc/arcpgu_hdmi.c
 create mode 100644 drivers/gpu/drm/arc/arcpgu_regs.h

-- 
2.5.0


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 1/5 v5] drm: Add support of ARC PGU display controller

2016-03-28 Thread Alexey Brodkin
From: Carlos Palminha 

ARC PGU could be found on some development boards from Synopsys.
This is a simple byte streamer that reads data from a framebuffer
and sends data to the single encoder.

Signed-off-by: Carlos Palminha 
Signed-off-by: Alexey Brodkin 
Cc: David Airlie 
Cc: dri-de...@lists.freedesktop.org
Cc: linux-snps-arc@lists.infradead.org
---

Note following series that introduces
drm_connector_register_all()/drm_connector_unregister_all() is a prerequisite
now: https://lkml.org/lkml/2016/3/23/61

No changes v4 -> v5.

Changes v3 -> v4:
 * The driver author is now set properly (thanks Carlos for all your efforts)
 * Implemented correct hsync and vsync setup (thanks Jose)
 * Dummy call-backs were removed (as suggested by Daniel)
 * Obsolete load()/unload() call-backs were removed (as suggested by Daniel)
 * With above in mind we were able to adopt recently introduced
   drm_connector_register_all()/drm_connector_unregister_all()

Changes v2 -> v3:
 * Improved failure path if arcpgu_connector wasn't allocated (thanks Jose).
 * Fixed driver building as module (reported by 0-DAY kernel test infrastruct.)
 * Implemented uncached mapping of user-space FB pages.

No changes v1 -> v2.

 drivers/gpu/drm/Kconfig   |   2 +
 drivers/gpu/drm/Makefile  |   1 +
 drivers/gpu/drm/arc/Kconfig   |  10 ++
 drivers/gpu/drm/arc/Makefile  |   2 +
 drivers/gpu/drm/arc/arcpgu.h  |  50 +++
 drivers/gpu/drm/arc/arcpgu_crtc.c | 257 ++
 drivers/gpu/drm/arc/arcpgu_drv.c  | 282 ++
 drivers/gpu/drm/arc/arcpgu_hdmi.c | 201 +++
 drivers/gpu/drm/arc/arcpgu_regs.h |  40 ++
 9 files changed, 845 insertions(+)
 create mode 100644 drivers/gpu/drm/arc/Kconfig
 create mode 100644 drivers/gpu/drm/arc/Makefile
 create mode 100644 drivers/gpu/drm/arc/arcpgu.h
 create mode 100644 drivers/gpu/drm/arc/arcpgu_crtc.c
 create mode 100644 drivers/gpu/drm/arc/arcpgu_drv.c
 create mode 100644 drivers/gpu/drm/arc/arcpgu_hdmi.c
 create mode 100644 drivers/gpu/drm/arc/arcpgu_regs.h

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index f2a74d0..9e4f2f1 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -281,3 +281,5 @@ source "drivers/gpu/drm/imx/Kconfig"
 source "drivers/gpu/drm/vc4/Kconfig"
 
 source "drivers/gpu/drm/etnaviv/Kconfig"
+
+source "drivers/gpu/drm/arc/Kconfig"
diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index 6eb94fc..c338d04 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -78,3 +78,4 @@ obj-y += panel/
 obj-y  += bridge/
 obj-$(CONFIG_DRM_FSL_DCU) += fsl-dcu/
 obj-$(CONFIG_DRM_ETNAVIV) += etnaviv/
+obj-$(CONFIG_DRM_ARCPGU)+= arc/
diff --git a/drivers/gpu/drm/arc/Kconfig b/drivers/gpu/drm/arc/Kconfig
new file mode 100644
index 000..f9a13b6
--- /dev/null
+++ b/drivers/gpu/drm/arc/Kconfig
@@ -0,0 +1,10 @@
+config DRM_ARCPGU
+   tristate "ARC PGU"
+   depends on DRM && OF
+   select DRM_KMS_CMA_HELPER
+   select DRM_KMS_FB_HELPER
+   select DRM_KMS_HELPER
+   help
+ Choose this option if you have an ARC PGU controller.
+
+ If M is selected the module will be called arcpgu.
diff --git a/drivers/gpu/drm/arc/Makefile b/drivers/gpu/drm/arc/Makefile
new file mode 100644
index 000..d48fda7
--- /dev/null
+++ b/drivers/gpu/drm/arc/Makefile
@@ -0,0 +1,2 @@
+arcpgu-y := arcpgu_crtc.o arcpgu_hdmi.o arcpgu_drv.o
+obj-$(CONFIG_DRM_ARCPGU) += arcpgu.o
diff --git a/drivers/gpu/drm/arc/arcpgu.h b/drivers/gpu/drm/arc/arcpgu.h
new file mode 100644
index 000..86574b6
--- /dev/null
+++ b/drivers/gpu/drm/arc/arcpgu.h
@@ -0,0 +1,50 @@
+/*
+ * ARC PGU DRM driver.
+ *
+ * Copyright (C) 2016 Synopsys, Inc. (www.synopsys.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 _ARCPGU_H_
+#define _ARCPGU_H_
+
+struct arcpgu_drm_private {
+   void __iomem*regs;
+   struct clk  *clk;
+   struct drm_fbdev_cma*fbdev;
+   struct drm_framebuffer  *fb;
+   struct list_headevent_list;
+   struct drm_crtc crtc;
+   struct drm_plane*plane;
+};
+
+#define crtc_to_arcpgu_priv(x) container_of(x, struct arcpgu_drm_private, crtc)
+
+static inline void arc_pgu_write(struct arcpgu_drm_private *arcpgu,
+unsigned int reg, u32 value)
+{
+   iowrite32(value, arcpgu->regs 

[PATCH 3/5 v5] MAINTAINERS: Add maintainer for ARC PGU display controller

2016-03-28 Thread Alexey Brodkin
This updates MAINTEINERS file with information about maintainer of
ARC PGU display controller driver.

Signed-off-by: Alexey Brodkin 
Cc: linux-snps-arc@lists.infradead.org
---

No changes v4 -> v5.

No changes v3 -> v4.

No changes v2 -> v3.

No changes v1 -> v2.

 MAINTAINERS | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index ea1d1de..0dcba67 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -827,6 +827,12 @@ S: Maintained
 F: drivers/net/arcnet/
 F: include/uapi/linux/if_arcnet.h
 
+ARC PGU DRM DRIVER
+M: Alexey Brodkin 
+S: Supported
+F: drivers/gpu/drm/arc/
+F: Documentation/devicetree/bindings/display/snps,arcpgu.txt
+
 ARM HDLCD DRM DRIVER
 M: Liviu Dudau 
 S: Supported
-- 
2.5.0


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 5/5 v5] arc: axs10x - add support of ARC PGU

2016-03-28 Thread Alexey Brodkin
Synopsys DesignWare ARC SDP boards sport ARC SDP display
controller attached to ADV7511 HDMI encoder.

That change adds desctiption of both ARC PGU and ADV7511 in
ARC SDP'd base-board Device Tree.

Signed-off-by: Alexey Brodkin 
Cc: Rob Herring 
Cc: Pawel Moll 
Cc: Mark Rutland 
Cc: Ian Campbell 
Cc: Kumar Gala 
Cc: Vineet Gupta 
Cc: devicet...@vger.kernel.org
Cc: linux-snps-arc@lists.infradead.org
---

No changes v4 -> v5.

Changes v3 -> v4:
 * Removed "0x" from node names (as suggested by Rob)

No changes v2 -> v3.

Changes v1 -> v2:
 * Added missing "pxlclk" clock in axs10x_mb.dtsi

 arch/arc/boot/dts/axs10x_mb.dtsi | 61 
 1 file changed, 61 insertions(+)

diff --git a/arch/arc/boot/dts/axs10x_mb.dtsi b/arch/arc/boot/dts/axs10x_mb.dtsi
index 44a578c..8fee596 100644
--- a/arch/arc/boot/dts/axs10x_mb.dtsi
+++ b/arch/arc/boot/dts/axs10x_mb.dtsi
@@ -34,6 +34,12 @@
clock-frequency = <5000>;
#clock-cells = <0>;
};
+
+   pguclk: pguclk {
+   #clock-cells = <0>;
+   compatible = "fixed-clock";
+   clock-frequency = <7444>;
+   };
};
 
ethernet@0x18000 {
@@ -147,6 +153,37 @@
clocks = <&i2cclk>;
interrupts = <16>;
 
+   adv7511:adv7511@39{
+   compatible="adi,adv7511";
+   reg = <0x39>;
+   interrupts = <23>;
+   adi,input-depth = <8>;
+   adi,input-colorspace = "rgb";
+   adi,input-clock = "1x";
+   adi,clock-delay = <0x03>;
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   /* RGB/YUV input */
+   port@0 {
+   reg = <0>;
+   adv7511_input:endpoint {
+   remote-endpoint = <&pgu_output>;
+   };
+   };
+
+   /* HDMI output */
+   port@1 {
+   reg = <1>;
+   adv7511_output: endpoint {
+   remote-endpoint = 
<&hdmi_connector_in>;
+   };
+   };
+   };
+   };
+
eeprom@0x54{
compatible = "24c01";
reg = <0x54>;
@@ -160,6 +197,16 @@
};
};
 
+   hdmi0: connector {
+   compatible = "hdmi-connector";
+   type = "a";
+   port {
+   hdmi_connector_in: endpoint {
+   remote-endpoint = <&adv7511_output>;
+   };
+   };
+   };
+
gpio0:gpio@13000 {
compatible = "snps,dw-apb-gpio";
reg = <0x13000 0x1000>;
@@ -221,5 +268,19 @@
reg = <2>;
};
};
+
+   pgu@17000 {
+   compatible = "snps,arcpgu";
+   reg = <0x17000 0x400>;
+   encoder-slave = <&adv7511>;
+   clocks = <&pguclk>;
+   clock-names = "pxlclk";
+
+   port {
+   pgu_output: endpoint {
+   remote-endpoint = <&adv7511_input>;
+   };
+   };
+   };
};
 };
-- 
2.5.0


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 2/5 v5] drm: Add DT bindings documentation for ARC PGU display controller

2016-03-28 Thread Alexey Brodkin
This add DT bindings documentation for ARC PGU display controller.

Signed-off-by: Alexey Brodkin 
Cc: Rob Herring 
Cc: Pawel Moll 
Cc: Mark Rutland 
Cc: Ian Campbell 
Cc: Kumar Gala 
Cc: devicet...@vger.kernel.org
Cc: linux-snps-arc@lists.infradead.org
Acked-by: Rob Herring 
---

Changes v4 -> v5: (addressing Rob's comment)
 * Added Rob's acked-by
 * Remove "encoder-slave" from the example as well.
   Now only "pgu" node is mentioned in the example.

Changes v3 -> v4: (addressing Rob's comments)
 * Removed "encoder-slave" from required properties
 * Removed "0x" from node names

Changes v2 -> v3:
 * Reverted back to initial larger version of example
   with minor fixes (thanks Rob for spotting those).

Changes v1 -> v2:
 * Removed everything except PGU node itself.

 .../devicetree/bindings/display/snps,arcpgu.txt| 35 ++
 1 file changed, 35 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/snps,arcpgu.txt

diff --git a/Documentation/devicetree/bindings/display/snps,arcpgu.txt 
b/Documentation/devicetree/bindings/display/snps,arcpgu.txt
new file mode 100644
index 000..c5c7dfd
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/snps,arcpgu.txt
@@ -0,0 +1,35 @@
+ARC PGU
+
+This is a display controller found on several development boards produced
+by Synopsys. The ARC PGU is an RGB streamer that reads the data from a
+framebuffer and sends it to a single digital encoder (usually HDMI).
+
+Required properties:
+  - compatible: "snps,arcpgu"
+  - reg: Physical base address and length of the controller's registers.
+  - clocks: A list of phandle + clock-specifier pairs, one for each
+entry in 'clock-names'.
+  - clock-names: A list of clock names. For ARC PGU it should contain:
+  - "pxlclk" for the clock feeding the output PLL of the controller.
+
+Required sub-nodes:
+  - port: The PGU connection to an encoder chip.
+
+Example:
+
+/ {
+   ...
+
+   pgu@ {
+   compatible = "snps,arcpgu";
+   reg = <0x 0x400>;
+   clocks = <&clock_node>;
+   clock-names = "pxlclk";
+
+   port {
+   pgu_output: endpoint {
+   remote-endpoint = <&hdmi_enc_input>;
+   };
+   };
+   };
+};
-- 
2.5.0


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 4/5 v5] arc: Add our own implementation of fb_pgprotect()

2016-03-28 Thread Alexey Brodkin
During mmaping of frame-buffer pages to user-space
fb_protect() is called to set proper page settings.

In case of ARC we need to mark pages that are mmaped to
user as uncached because of 2 reasons:
 * Huge amount of data if passing through data cache will
   thrash cache a lot making cache almost useless for other
   less traffic hungry processes.
 * Data written by user in FB will be immediately available for
   hardware (such as PGU etc) without requirements to flush data
   cache regularly.

Signed-off-by: Alexey Brodkin 
Cc: Vineet Gupta 
Cc: linux-snps-arc@lists.infradead.org
---

No changes v4 -> v5.

Changes v3 -> v4:
 * This change was introduced only in v4.

 arch/arc/include/asm/fb.h | 19 +++
 1 file changed, 19 insertions(+)
 create mode 100644 arch/arc/include/asm/fb.h

diff --git a/arch/arc/include/asm/fb.h b/arch/arc/include/asm/fb.h
new file mode 100644
index 000..bd3f68c
--- /dev/null
+++ b/arch/arc/include/asm/fb.h
@@ -0,0 +1,19 @@
+#ifndef _ASM_FB_H_
+#define _ASM_FB_H_
+
+#include 
+#include 
+#include 
+
+static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
+   unsigned long off)
+{
+   vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
+}
+
+static inline int fb_is_primary_device(struct fb_info *info)
+{
+   return 0;
+}
+
+#endif /* _ASM_FB_H_ */
-- 
2.5.0


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH 2/4] ARC: axs10x: Update defconfigs so that audio is enabled

2016-03-28 Thread Alexey Brodkin
Hi Jose,

On Mon, 2016-03-28 at 10:41 +0100, Jose Abreu wrote:
> The defconfigs for the AXS boards were updated so that
> ALSA SoC is enabled and also the audio for the ADV7511
> HDMI transmitter.
> 
> Signed-off-by: Jose Abreu 
> ---
>  arch/arc/configs/axs101_defconfig | 3 +++
>  arch/arc/configs/axs103_defconfig | 5 +
>  arch/arc/configs/axs103_smp_defconfig | 5 +
>  3 files changed, 13 insertions(+)

As Vineet suggested here 
http://lists.infradead.org/pipermail/linux-snps-arc/2016-February/000595.html
let's not pollute axs10x_defconfigs with new stuff but instead add all new
options to new configs that will cover everything available on ARC SDP boards.

Since those defconfigs for full SDP doesn't exist as of today please drop that 
change
as well as "[PATCH 4/4] ARC: axs10x: Update defconfigs so that I2S is enabled" 
from that
series.

I'll try to come up with mentioed new configs ASAP and then if your series is
already in upstream I'll add bits for audio through HDMI otherwise you'll add it
in some follow-up series.

-Alexey
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

Re: [PATCH 3/4] ASoC: dwc: Add I2S HDMI audio support using custom platform driver

2016-03-28 Thread Alexey Brodkin
Hi Jose,

On Mon, 2016-03-28 at 10:41 +0100, Jose Abreu wrote:
> HDMI audio support was added to the AXS board using an
> I2S cpu driver and a custom platform driver.
> 
> The platform driver supports two channels @ 16 bits with
> rates 32k, 44.1k and 48k. ALSA Simple audio card is used to
> glue the cpu, platform and codec driver (adv7511).
> 
> Signed-off-by: Jose Abreu 
> ---
>  arch/arc/boot/dts/axs10x_mb.dtsi |  20 +-

You should not mix DT bindings for a particular board with generic driver
fixes or improvements.

I think it makes sense to split this patch in 2:
 1) Driver improvements
 2) .dts update for boards that use this driver

>  sound/soc/dwc/Kconfig|   1 +
>  sound/soc/dwc/designware_i2s.c   | 384 
> +--
>  3 files changed, 388 insertions(+), 17 deletions(-)

-Alexey
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

Re: [PATCH 2/3 v2] ASoC: dwc: Add I2S HDMI audio support

2016-03-28 Thread Alexey Brodkin
Hi Jose,

On Mon, 2016-03-28 at 15:36 +0100, Jose Abreu wrote:
> HDMI audio support was added to the AXS board using an
> I2S cpu driver and a custom platform driver.
> 
> The platform driver supports two channels @ 16 bits with
> rates 32k, 44.1k and 48k. ALSA Simple audio card is used to
> glue the cpu, platform and codec driver (adv7511).
> 
> Signed-off-by: Jose Abreu 
> ---
> 
> No changes v1 -> v2.
> 
>  sound/soc/dwc/Kconfig  |   1 +
>  sound/soc/dwc/designware_i2s.c | 385 
> +++--
>  2 files changed, 373 insertions(+), 13 deletions(-)
> 
> diff --git a/sound/soc/dwc/Kconfig b/sound/soc/dwc/Kconfig
> index d50e085..bc3fae7 100644
> --- a/sound/soc/dwc/Kconfig
> +++ b/sound/soc/dwc/Kconfig
> @@ -2,6 +2,7 @@ config SND_DESIGNWARE_I2S
>   tristate "Synopsys I2S Device Driver"
>   depends on CLKDEV_LOOKUP
>   select SND_SOC_GENERIC_DMAENGINE_PCM
> + select SND_SIMPLE_CARD
>   help
>    Say Y or M if you want to add support for I2S driver for
>    Synopsys desigwnware I2S device. The device supports upto
> diff --git a/sound/soc/dwc/designware_i2s.c b/sound/soc/dwc/designware_i2s.c
> index bff258d..0f2f588 100644
> --- a/sound/soc/dwc/designware_i2s.c
> +++ b/sound/soc/dwc/designware_i2s.c
> @@ -84,11 +84,37 @@
>  #define MAX_CHANNEL_NUM  8
>  #define MIN_CHANNEL_NUM  2
>  
> +/* FPGA Version Info */
> +#define FPGA_VER_INFO0xE0011230
> +#define FPGA_VER_27M 0x000FBED9
> +
> +/* PLL registers addresses */
> +#define PLL_IDIV_ADDR0xE00100A0
> +#define PLL_FBDIV_ADDR   0xE00100A4
> +#define PLL_ODIV0_ADDR   0xE00100A8
> +#define PLL_ODIV1_ADDR   0xE00100AC

Well I think all is not acceptable.
See all these FPGA_VER_xxx as well as PLL_xxx
are strictly ARC SDP specific things and have nothing to do with generic driver.

That's so pity we don't have a driver for all clocks/PLLs on ARC SDP yet.
So as of now I may only propose to use hard-coded fixed clocks as I did with
ARC PGU, see "pguclk" here:
http://lists.infradead.org/pipermail/linux-snps-arc/2016-March/000790.html

Again I'll try to implement missing clock driver sometime soon because
more and more stuff requires it but for now let's use a work-around.

> +struct dw_i2s_pll {
> + unsigned int rate;
> + unsigned int data_width;
> + unsigned int idiv;
> + unsigned int fbdiv;
> + unsigned int odiv0;
> + unsigned int odiv1;
> +};
> +
> +static const struct dw_i2s_pll dw_i2s_pll_cfg_27m[] = {
> + /* 27Mhz */
> + { 32000, 16, 0x104, 0x451, 0x10E38, 0x2000 },
> + { 44100, 16, 0x104, 0x596, 0x10D35, 0x2000 },
> + { 48000, 16, 0x208, 0xA28, 0x10B2C, 0x2000 },
> + { 0, 0, 0, 0, 0, 0 },
>  };
>  
> +static const struct dw_i2s_pll dw_i2s_pll_cfg_28m[] = {
> + /* 28.224Mhz */
> + { 32000, 16, 0x82, 0x105, 0x107DF, 0x2000 },
> + { 44100, 16, 0x28A, 0x1, 0x10001, 0x2000 },
> + { 48000, 16, 0xA28, 0x187, 0x10042, 0x2000 },
> + { 0, 0, 0, 0, 0, 0 },
> +};

These 2 hunks as well should go in ARC SDP clocks.

> +static int i2s_pll_cfg(struct i2s_clk_config_data *config)
> +{
> + const struct dw_i2s_pll *pll_cfg;
> + u32 rate = config->sample_rate;
> + u32 data_width = config->data_width;
> + int i;
> +
> + if (readl((void *)FPGA_VER_INFO) <= FPGA_VER_27M)
> + pll_cfg = dw_i2s_pll_cfg_27m;
> + else
> + pll_cfg = dw_i2s_pll_cfg_28m;
> +
> + for (i = 0; pll_cfg[i].rate != 0; i++) {
> + if ((pll_cfg[i].rate == rate) &&
> + (pll_cfg[i].data_width == data_width)) {
> + writel(pll_cfg[i].idiv, (void *)PLL_IDIV_ADDR);
> + writel(pll_cfg[i].fbdiv, (void *)PLL_FBDIV_ADDR);
> + writel(pll_cfg[i].odiv0, (void *)PLL_ODIV0_ADDR);
> + writel(pll_cfg[i].odiv1, (void *)PLL_ODIV1_ADDR);
> + return 0;
> + }
> + }
> +
> + return -EINVAL;
> +}

Ditto.

-Alexey
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

Re: [PATCH] clk/arc: Add I2S PLL clock driver

2016-03-29 Thread Alexey Brodkin
Hi Jose,

On Tue, 2016-03-29 at 11:56 +0100, Jose Abreu wrote:
> The ARC SDP I2S clock can be programmed using a
> specific PLL.
> 
> This patch has the goal of adding a clock driver
> that programs this PLL.
> 
> At this moment the rate values are hardcoded in
> a table but in the future it would be ideal to
> use a function which determines the PLL values
> given the desired rate.
> 
> Signed-off-by: Jose Abreu 
> ---

I believe these kind of patches worth sending to
linux-snps mailing list (at least add it in Cc) so
they won't be lost in time and could be used later as
useful references.

>  arch/arc/boot/dts/axs10x_mb.dtsi |   5 ++
>  drivers/clk/Makefile |   1 +
>  drivers/clk/arc/Makefile |   1 +
>  drivers/clk/arc/i2s_pll_clock.c  | 143 
> +++
>  4 files changed, 150 insertions(+)
>  create mode 100644 drivers/clk/arc/Makefile
>  create mode 100644 drivers/clk/arc/i2s_pll_clock.c
> 
> diff --git a/arch/arc/boot/dts/axs10x_mb.dtsi 
> b/arch/arc/boot/dts/axs10x_mb.dtsi
> index ab5d570..9c68226 100644
> --- a/arch/arc/boot/dts/axs10x_mb.dtsi
> +++ b/arch/arc/boot/dts/axs10x_mb.dtsi
> @@ -23,6 +23,11 @@
>   #clock-cells = <0>;
>   };
>  
> + i2sclk: i2sclk {
> + compatible = "snps,i2s-pll-clock";
> + #clock-cells = <0>;
> + };
> +
>   apbclk: apbclk {
>   compatible = "fixed-clock";
>   clock-frequency = <5000>;
> diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile
> index 46869d6..620e47f 100644
> --- a/drivers/clk/Makefile
> +++ b/drivers/clk/Makefile
> @@ -84,3 +84,4 @@ obj-$(CONFIG_X86)   += x86/
>  obj-$(CONFIG_ARCH_ZX)+= zte/
>  obj-$(CONFIG_ARCH_ZYNQ)  += zynq/
>  obj-$(CONFIG_H8300)  += h8300/
> +obj-$(CONFIG_ARC)+= arc/

Two things here:
 [1] This clock is relevant to only one board but not SoC, CPU core
     or whole architecture, so it makes sense to make it dependent on
     the AXS platform, i.e. CONFIG_ARC_PLAT_AXS10X.

 [2] Something similar is applicable to folder name, I would suggest to
     use "drivers/clk/axs10x"

> diff --git a/drivers/clk/arc/Makefile b/drivers/clk/arc/Makefile
> new file mode 100644
> index 000..01996b8
> --- /dev/null
> +++ b/drivers/clk/arc/Makefile
> @@ -0,0 +1 @@
> +obj-y += i2s_pll_clock.o
> diff --git a/drivers/clk/arc/i2s_pll_clock.c b/drivers/clk/arc/i2s_pll_clock.c
> new file mode 100644
> index 000..8c401f1
> --- /dev/null
> +++ b/drivers/clk/arc/i2s_pll_clock.c
> @@ -0,0 +1,143 @@
> +/*
> + * Synopsys I2S PLL clock driver

Again that's not generic SNPS I2S clock but clock driver for a particular board.

> + *
> + * drivers/clk/arc/i2s_pll_clock.c

BTW not sure why this path could be needed here.
IMHO that might be safely dropped.

> + *
> + * Copyright (C) 2016 Synopsys
> + *
> + * This file is licensed under the terms of the GNU General Public
> + * License version 2. This program is licensed "as is" without any
> + * warranty of any kind, whether express or implied.
> + */
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +/* FPGA Version Info */
> +#define FPGA_VER_INFO0xE0011230
> +#define FPGA_VER_27M 0x000FBED9

This is a little bit tricky.
We'll need to do that check in each and every clock driver for AXS10x
and so it worth putting this code in some common location (I mean common
for all axs10x clock drivers).

> +/* PLL registers addresses */
> +#define PLL_IDIV_ADDR0xE00100A0
> +#define PLL_FBDIV_ADDR   0xE00100A4
> +#define PLL_ODIV0_ADDR   0xE00100A8
> +#define PLL_ODIV1_ADDR   0xE00100AC
>

> +struct i2s_pll_clk {
> + struct clk_hw hw;
> +};
> +
> +struct i2s_pll_cfg {
> + unsigned int rate;
> + unsigned int idiv;
> + unsigned int fbdiv;
> + unsigned int odiv0;
> + unsigned int odiv1;
> +};
> +
> +static const struct i2s_pll_cfg i2s_pll_cfg_27m[] = {
> + /* 27 Mhz */
> + { 1024000, 0x104, 0x451, 0x10E38, 0x2000 },
> + { 1411200, 0x104, 0x596, 0x10D35, 0x2000 },
> + { 1536000, 0x208, 0xA28, 0x10B2C, 0x2000 },
> + { 2048000, 0x82, 0x451, 0x10E38, 0x2000 },
> + { 2822400, 0x82, 0x596, 0x10D35, 0x2000 },
> + { 3072000, 0x104, 0xA28, 0x10B2C, 0x2000 },
> + { 0, 0, 0, 0, 0 },
> +};
> +
> +static const struct i2s_pll_cfg i2s_pll_cfg_28m[] = {
> + /* 28.224 Mhz */
> + { 1024000, 0x82, 0x105, 0x107DF, 0x2000 },
> + { 1411200, 0x28A, 0x1, 0x10001, 0x2000 },
> + { 1536000, 0xA28, 0x187, 0x10042, 0x2000 },
> + { 2048000, 0x41, 0x105, 0x107DF, 0x2000 },
> + { 2822400, 0x145, 0x1, 0x10001, 0x2000 },
> + { 3072000, 0x514, 0x187, 0x10042, 0x2000 },
> + { 0, 0, 0, 0, 0 },
> +};
> +
> +static unsigned long i2s_pll_recalc_rate(struct clk_hw *hw,
> +  

RE: [PATCH 4/5 v5] arc: Add our own implementation of fb_pgprotect()

2016-04-05 Thread Alexey Brodkin
Hi Vineet,

> From: Alexey Brodkin [abrod...@synopsys.com]
> Sent: Monday, March 28, 2016 2:36 PM
> To: dri-de...@lists.freedesktop.org
> Cc: linux-ker...@vger.kernel.org; Alexey Brodkin; Vineet Gupta; 
> linux-snps-arc@lists.infradead.org
> Subject: [PATCH 4/5 v5] arc: Add our own implementation of fb_pgprotect()
> 
> During mmaping of frame-buffer pages to user-space
> fb_protect() is called to set proper page settings.
> 
> In case of ARC we need to mark pages that are mmaped to
> user as uncached because of 2 reasons:
>  * Huge amount of data if passing through data cache will
>thrash cache a lot making cache almost useless for other
> less traffic hungry processes.
>  * Data written by user in FB will be immediately available for
>hardware (such as PGU etc) without requirements to flush data
>    cache regularly.
> 
> Signed-off-by: Alexey Brodkin 
> Cc: Vineet Gupta 
> Cc: linux-snps-arc@lists.infradead.org

Could you please pick up this patch in your tree so in DRM-related series won't 
be external dependencies any longer?

-Alexey

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [RESEND PATCH v4] clk/axs10x: Add I2S PLL clock driver

2016-04-11 Thread Alexey Brodkin
Hi Jose,

On Mon, 2016-04-11 at 11:41 +0100, Jose Abreu wrote:
> The ARC SDP I2S clock can be programmed using a
> specific PLL.
> 
> This patch has the goal of adding a clock driver
> that programs this PLL.
> 
> At this moment the rate values are hardcoded in
> a table but in the future it would be ideal to
> use a function which determines the PLL values
> given the desired rate.
> 
> Signed-off-by: Jose Abreu 
> ---
> 
> Changes v3 -> v4:
> * Added binding document (as suggested by Stephen Boyd)
> * Minor code style fixes (as suggested by Stephen Boyd)
> * Use ioremap (as suggested by Stephen Boyd)
> * Implement round_rate (as suggested by Stephen Boyd)
> * Change to platform driver (as suggested by Stephen Boyd)
> * Use {readl/writel}_relaxed (as suggested by Vineet Gupta)
> 
> Changes v2 -> v3:
> * Implemented recalc_rate
> 
> Changes v1 -> v2:
> * Renamed folder to axs10x (as suggested by Alexey Brodkin)
> * Added more supported rates

[snip]

> diff --git a/Documentation/devicetree/bindings/clock/i2s-pll-clock.txt 
> b/Documentation/devicetree/bindings/clock/i2s-
> pll-clock.txt
> new file mode 100644
> index 000..ff86a41
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/clock/i2s-pll-clock.txt
> @@ -0,0 +1,17 @@
> +Binding for the AXS10X I2S PLL clock
> +
> +This binding uses the common clock binding[1].
> +
> +[1] Documentation/devicetree/bindings/clock/clock-bindings.txt
> +
> +Required properties:
> +- compatible: shall be "snps,i2s-pll-clock"
> +- #clock-cells: from common clock binding; Should always be set to 0.
> +- reg : Address and length of the I2S PLL register set.
> +
> +Example:
> + clock@0x100a0 {

Please remove "0x" from node name.

> + compatible = "snps,i2s-pll-clock";
> + reg = <0x100a0 0x10>;
> + #clock-cells = <0>;
> + };
> diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile
> index 46869d6..2ca62dc6 100644
> --- a/drivers/clk/Makefile
> +++ b/drivers/clk/Makefile
> @@ -84,3 +84,4 @@ obj-$(CONFIG_X86)   += x86/
>  obj-$(CONFIG_ARCH_ZX)+= zte/
>  obj-$(CONFIG_ARCH_ZYNQ)  += zynq/
>  obj-$(CONFIG_H8300)  += h8300/
> +obj-$(CONFIG_ARC_PLAT_AXS10X)+= axs10x/
> diff --git a/drivers/clk/axs10x/Makefile b/drivers/clk/axs10x/Makefile
> new file mode 100644
> index 000..01996b8
> --- /dev/null
> +++ b/drivers/clk/axs10x/Makefile
> @@ -0,0 +1 @@
> +obj-y += i2s_pll_clock.o
> diff --git a/drivers/clk/axs10x/i2s_pll_clock.c 
> b/drivers/clk/axs10x/i2s_pll_clock.c
> new file mode 100644
> index 000..3ba4e2f
> --- /dev/null
> +++ b/drivers/clk/axs10x/i2s_pll_clock.c
> @@ -0,0 +1,217 @@
> +/*
> + * Synopsys AXS10X SDP I2S PLL clock driver
> + *
> + * Copyright (C) 2016 Synopsys
> + *
> + * This file is licensed under the terms of the GNU General Public
> + * License version 2. This program is licensed "as is" without any
> + * warranty of any kind, whether express or implied.
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 

"linux/platform_device.h" includes "linux/device.h" so you may make this list 
of headers
a little bit shorter.

> +#include 
> +#include 
> +#include 

"linux/of_address.h" already includes "linux/of.h".

[snip]

> +
> +static const struct of_device_id i2s_pll_clk_id[] = {
> + { .compatible = "snps,i2s-pll-clock", },

I would think that it makes sense to add the board name in
this compatible string. So something like "snps,axs10x-i2s-pll-clock"
IMHO looks much more informative.

Also adding Rob Herring and DT mailing list in Cc.
Please make sure Rod acks your bindings and corresponding docs.

-Alexey
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

Re: [PATCH v2 02/30] Include generic parity.h in some architectures' bitops.h

2016-04-11 Thread Alexey Brodkin
Hi Zhaoxiu,

On Wed, 2016-04-06 at 16:41 +0800, zengzhao...@163.com wrote:
> From: Zhaoxiu Zeng 
> 
> Use the generic version
> 
> Signed-off-by: Zhaoxiu Zeng 
> ---
>  arch/arc/include/asm/bitops.h  | 1 +
>  arch/arm/include/asm/bitops.h  | 1 +
>  arch/arm64/include/asm/bitops.h| 1 +
>  arch/avr32/include/asm/bitops.h| 1 +
>  arch/c6x/include/asm/bitops.h  | 1 +
>  arch/cris/include/asm/bitops.h | 1 +
>  arch/frv/include/asm/bitops.h  | 1 +
>  arch/h8300/include/asm/bitops.h| 1 +
>  arch/hexagon/include/asm/bitops.h  | 1 +
>  arch/m32r/include/asm/bitops.h | 1 +
>  arch/m68k/include/asm/bitops.h | 1 +
>  arch/metag/include/asm/bitops.h| 1 +
>  arch/mn10300/include/asm/bitops.h  | 1 +
>  arch/openrisc/include/asm/bitops.h | 1 +
>  arch/parisc/include/asm/bitops.h   | 1 +
>  arch/s390/include/asm/bitops.h | 1 +
>  arch/sh/include/asm/bitops.h   | 1 +
>  arch/xtensa/include/asm/bitops.h   | 1 +
>  18 files changed, 18 insertions(+)

Could you please include a changelog below your commit message?
Otherwise it's barely possible to understand what that v2 improves/fixes.

Also it makes sense to send at least cover letter to all people mentioned
at least in one patch of the series. That gives an idea what this series
does and in particular why patch I'm mentioned in is required.

-Alexey
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

Re: [RESEND PATCH v4] clk/axs10x: Add I2S PLL clock driver

2016-04-15 Thread Alexey Brodkin
Hi Stephen,

On Mon, 2016-04-11 at 15:03 -0700, sb...@codeaurora.org wrote:
> On 04/11, Alexey Brodkin wrote:
> > 
> > On Mon, 2016-04-11 at 11:41 +0100, Jose Abreu wrote:
> > > 
> > > + * warranty of any kind, whether express or implied.
> > > + */
> > > +
> > > +#include 
> > > +#include 
> > > +#include 
> > > +#include 
> > > +#include 
> > "linux/platform_device.h" includes "linux/device.h" so you may make this 
> > list of headers
> > a little bit shorter.
> > 
> > > 
> > > +#include 
> > > +#include 
> > > +#include 
> > "linux/of_address.h" already includes "linux/of.h".
> It's ok to include things twice. In fact, its better to avoid any
> implicit includes so that if we ever want to remove includes from
> other headers we can do so without disturbing this driver.

IMHO approach with minimal amount of headers is nice just because
it's easier to check if everything is in place. I mean attempt to compile
will immediately reveal a missing header.

So that's what I do - I remove as many inclusions as I may until stuff compiles.

But with approach of explicit inclusion it's much easier to include
much more headers than really needed. The only way to figure out if header is 
really
required is to manually check all used functions in the current source
which is way too unreliable and probably nobody will do it ever anyways.
And that's how we'll get more stale and pointless inclusions.

-Alexey

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

Allocation of frame buffer at a specific memory range or address

2016-04-15 Thread Alexey Brodkin
Hello,

I'm wondering if there's a way to force kernel to allocate backing
memory for frame buffer in a special location?

A little bit of background below.
I continue to work on DRM driver for ARC PGU, latest
is v5 and available here - https://lkml.org/lkml/2016/3/28/170

In current state everything more or less works but I'd like to
implement one improvement - I'd like to have an ability to specify
where in memory will be allocated frame-buffer's backing storage area.
I.e. buffer which will be read by PGU hardware.

Currently we use whatever DRM susbsystem put in "gem->paddr".
That's a snippet of the code which tells PGU hardware
which memory location to scan for data:
->8
arcpgu = crtc_to_arcpgu_priv(plane->state->crtc);
gem = drm_fb_cma_get_gem_obj(plane->state->fb, 0);

/* Telling PGU hardware where is data to read */
arc_pgu_write(arcpgu, ARCPGU_REG_BUF0_ADDR, gem->paddr);
->8

But we may use a special memory area which works better
for that case, i.e. for example could be accessed faster by both
CPU and PGU hardware (like on-chip SRAM as opposed to external DDR).

And now the question is how to force DRM subsystem or just that driver
to use whatever predefined (say via device tree) location in memory
for data buffer allocation.

All thoughts on this are more than welcome.

-Alexey

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

[PATCH 1/4 v6] drm: Add support of ARC PGU display controller

2016-04-19 Thread Alexey Brodkin
From: Carlos Palminha 

ARC PGU could be found on some development boards from Synopsys.
This is a simple byte streamer that reads data from a framebuffer
and sends data to the single encoder.

Signed-off-by: Carlos Palminha 
Signed-off-by: Alexey Brodkin 
Cc: Daniel Vetter 
Cc: David Airlie 
Cc: dri-de...@lists.freedesktop.org
Cc: linux-snps-arc@lists.infradead.org
---

Note following series (v6) that introduces drm_connector_register_all()
is a prerequisite now: https://lkml.org/lkml/2016/4/19/299

No changes v5 -> v6.

No changes v4 -> v5.

Changes v3 -> v4:
 * The driver author is now set properly (thanks Carlos for all your efforts)
 * Implemented correct hsync and vsync setup (thanks Jose)
 * Dummy call-backs were removed (as suggested by Daniel)
 * Obsolete load()/unload() call-backs were removed (as suggested by Daniel)
 * With above in mind we were able to adopt recently introduced
   drm_connector_register_all()/drm_connector_unregister_all()

Changes v2 -> v3:
 * Improved failure path if arcpgu_connector wasn't allocated (thanks Jose).
 * Fixed driver building as module (reported by 0-DAY kernel test infrastruct.)
 * Implemented uncached mapping of user-space FB pages.

No changes v1 -> v2.

 drivers/gpu/drm/Kconfig   |   2 +
 drivers/gpu/drm/Makefile  |   1 +
 drivers/gpu/drm/arc/Kconfig   |  10 ++
 drivers/gpu/drm/arc/Makefile  |   2 +
 drivers/gpu/drm/arc/arcpgu.h  |  50 +++
 drivers/gpu/drm/arc/arcpgu_crtc.c | 257 ++
 drivers/gpu/drm/arc/arcpgu_drv.c  | 282 ++
 drivers/gpu/drm/arc/arcpgu_hdmi.c | 201 +++
 drivers/gpu/drm/arc/arcpgu_regs.h |  40 ++
 9 files changed, 845 insertions(+)
 create mode 100644 drivers/gpu/drm/arc/Kconfig
 create mode 100644 drivers/gpu/drm/arc/Makefile
 create mode 100644 drivers/gpu/drm/arc/arcpgu.h
 create mode 100644 drivers/gpu/drm/arc/arcpgu_crtc.c
 create mode 100644 drivers/gpu/drm/arc/arcpgu_drv.c
 create mode 100644 drivers/gpu/drm/arc/arcpgu_hdmi.c
 create mode 100644 drivers/gpu/drm/arc/arcpgu_regs.h

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index f2a74d0..9e4f2f1 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -281,3 +281,5 @@ source "drivers/gpu/drm/imx/Kconfig"
 source "drivers/gpu/drm/vc4/Kconfig"
 
 source "drivers/gpu/drm/etnaviv/Kconfig"
+
+source "drivers/gpu/drm/arc/Kconfig"
diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index 6eb94fc..c338d04 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -78,3 +78,4 @@ obj-y += panel/
 obj-y  += bridge/
 obj-$(CONFIG_DRM_FSL_DCU) += fsl-dcu/
 obj-$(CONFIG_DRM_ETNAVIV) += etnaviv/
+obj-$(CONFIG_DRM_ARCPGU)+= arc/
diff --git a/drivers/gpu/drm/arc/Kconfig b/drivers/gpu/drm/arc/Kconfig
new file mode 100644
index 000..f9a13b6
--- /dev/null
+++ b/drivers/gpu/drm/arc/Kconfig
@@ -0,0 +1,10 @@
+config DRM_ARCPGU
+   tristate "ARC PGU"
+   depends on DRM && OF
+   select DRM_KMS_CMA_HELPER
+   select DRM_KMS_FB_HELPER
+   select DRM_KMS_HELPER
+   help
+ Choose this option if you have an ARC PGU controller.
+
+ If M is selected the module will be called arcpgu.
diff --git a/drivers/gpu/drm/arc/Makefile b/drivers/gpu/drm/arc/Makefile
new file mode 100644
index 000..d48fda7
--- /dev/null
+++ b/drivers/gpu/drm/arc/Makefile
@@ -0,0 +1,2 @@
+arcpgu-y := arcpgu_crtc.o arcpgu_hdmi.o arcpgu_drv.o
+obj-$(CONFIG_DRM_ARCPGU) += arcpgu.o
diff --git a/drivers/gpu/drm/arc/arcpgu.h b/drivers/gpu/drm/arc/arcpgu.h
new file mode 100644
index 000..86574b6
--- /dev/null
+++ b/drivers/gpu/drm/arc/arcpgu.h
@@ -0,0 +1,50 @@
+/*
+ * ARC PGU DRM driver.
+ *
+ * Copyright (C) 2016 Synopsys, Inc. (www.synopsys.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 _ARCPGU_H_
+#define _ARCPGU_H_
+
+struct arcpgu_drm_private {
+   void __iomem*regs;
+   struct clk  *clk;
+   struct drm_fbdev_cma*fbdev;
+   struct drm_framebuffer  *fb;
+   struct list_headevent_list;
+   struct drm_crtc crtc;
+   struct drm_plane*plane;
+};
+
+#define crtc_to_arcpgu_priv(x) container_of(x, struct arcpgu_drm_private, crtc)
+
+static inline void arc_pgu_write(struct arcpgu_drm_private *arcpgu,
+unsigned int reg, u32 value)
+{
+   iowrite32(value, arcpgu->re

[PATCH 0/4 v6] drm: Add support of ARC PGU display controller

2016-04-19 Thread Alexey Brodkin
This series add support of ARC PGU display controller.
ARC PGU is a quite simple byte streamer that gets data from the framebuffer
and pushes it to hte connected encoder (DP or HDMI).

It was tested on ARC SDP boards (axs101/103 in particular).

Note following series (v6) that introduces drm_connector_register_all()
is a prerequisite now: https://lkml.org/lkml/2016/4/19/299

Changes v5 -> v6:
 * "arc: Add our own implementation of fb_pgprotect()" was already applied to
   ARC's tree and available in linux-next:
   
http://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/commit/?id=e5e0a65cd20a7a892a87e6bd73bdc3d83726d725

Changes v4 -> v5:
 * Removed encode node from DT bindings example (as suggested by Rob)

Changes v3 -> v4:
 * Main driver author is now set properly (thanks Carlos for all your efforts)
 * Implemented correct hsync and vsync setup (thanks Jose)
 * Dummy call-backs were removed (as suggested by Daniel)
 * Obsolete load()/unload() call-backs were removed (as suggested by Daniel)
 * With above in mind we were able to adopt recently introduced
   drm_connector_register_all()/drm_connector_unregister_all()
 * Implemented setup of properties (uncached) for FB user-pages
 * Minor clean-up in DT binding docs and axs10x_mb.dtsi

Changes v2 -> v3:
 * Improved failure path if arcpgu_connector wasn't allocated.
 * Fixed driver building as module.
 * Implemented uncached mapping of user-space FB pages.
 * Again updated DT bindings docs.

Changes v1 -> v2:
 * Clean-up of DT bindings documentation.
 * Added missing "pxlclk" clock in axs10x_mb.dtsi.

Cc: Daniel Vetter 
Cc: David Airlie 
Cc: devicet...@vger.kernel.org
Cc: dri-de...@lists.freedesktop.org
Cc: Ian Campbell 
Cc: Kumar Gala 
Cc: linux-snps-arc@lists.infradead.org
Cc: Mark Rutland 
Cc: Pawel Moll 
Cc: Rob Herring 
Cc: Vineet Gupta 
Cc: Jose Abreu 
Cc: Carlos Palminha 

Alexey Brodkin (3):
  drm: Add DT bindings documentation for ARC PGU display controller
  MAINTAINERS: Add maintainer for ARC PGU display controller
  arc: axs10x - add support of ARC PGU

Carlos Palminha (1):
  drm: Add support of ARC PGU display controller

 .../devicetree/bindings/display/snps,arcpgu.txt|  35 +++
 MAINTAINERS|   6 +
 arch/arc/boot/dts/axs10x_mb.dtsi   |  61 +
 drivers/gpu/drm/Kconfig|   2 +
 drivers/gpu/drm/Makefile   |   1 +
 drivers/gpu/drm/arc/Kconfig|  10 +
 drivers/gpu/drm/arc/Makefile   |   2 +
 drivers/gpu/drm/arc/arcpgu.h   |  50 
 drivers/gpu/drm/arc/arcpgu_crtc.c  | 257 +++
 drivers/gpu/drm/arc/arcpgu_drv.c   | 282 +
 drivers/gpu/drm/arc/arcpgu_hdmi.c  | 201 +++
 drivers/gpu/drm/arc/arcpgu_regs.h  |  40 +++
 12 files changed, 947 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/snps,arcpgu.txt
 create mode 100644 drivers/gpu/drm/arc/Kconfig
 create mode 100644 drivers/gpu/drm/arc/Makefile
 create mode 100644 drivers/gpu/drm/arc/arcpgu.h
 create mode 100644 drivers/gpu/drm/arc/arcpgu_crtc.c
 create mode 100644 drivers/gpu/drm/arc/arcpgu_drv.c
 create mode 100644 drivers/gpu/drm/arc/arcpgu_hdmi.c
 create mode 100644 drivers/gpu/drm/arc/arcpgu_regs.h

-- 
2.5.5


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 4/4 v6] arc: axs10x - add support of ARC PGU

2016-04-19 Thread Alexey Brodkin
Synopsys DesignWare ARC SDP boards sport ARC SDP display
controller attached to ADV7511 HDMI encoder.

That change adds desctiption of both ARC PGU and ADV7511 in
ARC SDP'd base-board Device Tree.

Signed-off-by: Alexey Brodkin 
Cc: Rob Herring 
Cc: Pawel Moll 
Cc: Mark Rutland 
Cc: Ian Campbell 
Cc: Kumar Gala 
Cc: Vineet Gupta 
Cc: devicet...@vger.kernel.org
Cc: linux-snps-arc@lists.infradead.org
---

No changes v5 -> v6.

No changes v4 -> v5.

Changes v3 -> v4:
 * Removed "0x" from node names (as suggested by Rob)

No changes v2 -> v3.

Changes v1 -> v2:
 * Added missing "pxlclk" clock in axs10x_mb.dtsi

 arch/arc/boot/dts/axs10x_mb.dtsi | 61 
 1 file changed, 61 insertions(+)

diff --git a/arch/arc/boot/dts/axs10x_mb.dtsi b/arch/arc/boot/dts/axs10x_mb.dtsi
index ab5d570..823f15c 100644
--- a/arch/arc/boot/dts/axs10x_mb.dtsi
+++ b/arch/arc/boot/dts/axs10x_mb.dtsi
@@ -34,6 +34,12 @@
clock-frequency = <5000>;
#clock-cells = <0>;
};
+
+   pguclk: pguclk {
+   #clock-cells = <0>;
+   compatible = "fixed-clock";
+   clock-frequency = <7444>;
+   };
};
 
ethernet@0x18000 {
@@ -155,6 +161,37 @@
clocks = <&i2cclk>;
interrupts = <16>;
 
+   adv7511:adv7511@39{
+   compatible="adi,adv7511";
+   reg = <0x39>;
+   interrupts = <23>;
+   adi,input-depth = <8>;
+   adi,input-colorspace = "rgb";
+   adi,input-clock = "1x";
+   adi,clock-delay = <0x03>;
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   /* RGB/YUV input */
+   port@0 {
+   reg = <0>;
+   adv7511_input:endpoint {
+   remote-endpoint = <&pgu_output>;
+   };
+   };
+
+   /* HDMI output */
+   port@1 {
+   reg = <1>;
+   adv7511_output: endpoint {
+   remote-endpoint = 
<&hdmi_connector_in>;
+   };
+   };
+   };
+   };
+
eeprom@0x54{
compatible = "24c01";
reg = <0x54>;
@@ -168,6 +205,16 @@
};
};
 
+   hdmi0: connector {
+   compatible = "hdmi-connector";
+   type = "a";
+   port {
+   hdmi_connector_in: endpoint {
+   remote-endpoint = <&adv7511_output>;
+   };
+   };
+   };
+
gpio0:gpio@13000 {
compatible = "snps,dw-apb-gpio";
reg = <0x13000 0x1000>;
@@ -229,5 +276,19 @@
reg = <2>;
};
};
+
+   pgu@17000 {
+   compatible = "snps,arcpgu";
+   reg = <0x17000 0x400>;
+   encoder-slave = <&adv7511>;
+   clocks = <&pguclk>;
+   clock-names = "pxlclk";
+
+   port {
+   pgu_output: endpoint {
+   remote-endpoint = <&adv7511_input>;
+   };
+   };
+   };
};
 };
-- 
2.5.5


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 3/4 v6] MAINTAINERS: Add maintainer for ARC PGU display controller

2016-04-19 Thread Alexey Brodkin
This updates MAINTEINERS file with information about maintainer of
ARC PGU display controller driver.

Signed-off-by: Alexey Brodkin 
Cc: linux-snps-arc@lists.infradead.org
---

No changes v5 -> v6.

No changes v4 -> v5.

No changes v3 -> v4.

No changes v2 -> v3.

No changes v1 -> v2.

 MAINTAINERS | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 1c32f8a..c5d1e6e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -847,6 +847,12 @@ S: Maintained
 F: drivers/net/arcnet/
 F: include/uapi/linux/if_arcnet.h
 
+ARC PGU DRM DRIVER
+M: Alexey Brodkin 
+S: Supported
+F: drivers/gpu/drm/arc/
+F: Documentation/devicetree/bindings/display/snps,arcpgu.txt
+
 ARM HDLCD DRM DRIVER
 M: Liviu Dudau 
 S: Supported
-- 
2.5.5


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 2/4 v6] drm: Add DT bindings documentation for ARC PGU display controller

2016-04-19 Thread Alexey Brodkin
This add DT bindings documentation for ARC PGU display controller.

Signed-off-by: Alexey Brodkin 
Cc: Pawel Moll 
Cc: Mark Rutland 
Cc: Ian Campbell 
Cc: Kumar Gala 
Cc: devicet...@vger.kernel.org
Cc: linux-snps-arc@lists.infradead.org
Acked-by: Rob Herring 
---

No changes v5 -> v6.

Changes v4 -> v5: (addressing Rob's comment)
 * Added Rob's acked-by
 * Remove "encoder-slave" from the example as well.
   Now only "pgu" node is mentioned in the example.

Changes v3 -> v4: (addressing Rob's comments)
 * Removed "encoder-slave" from required properties
 * Removed "0x" from node names

Changes v2 -> v3:
 * Reverted back to initial larger version of example
   with minor fixes (thanks Rob for spotting those).

Changes v1 -> v2:
 * Removed everything except PGU node itself.

 .../devicetree/bindings/display/snps,arcpgu.txt| 35 ++
 1 file changed, 35 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/snps,arcpgu.txt

diff --git a/Documentation/devicetree/bindings/display/snps,arcpgu.txt 
b/Documentation/devicetree/bindings/display/snps,arcpgu.txt
new file mode 100644
index 000..c5c7dfd
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/snps,arcpgu.txt
@@ -0,0 +1,35 @@
+ARC PGU
+
+This is a display controller found on several development boards produced
+by Synopsys. The ARC PGU is an RGB streamer that reads the data from a
+framebuffer and sends it to a single digital encoder (usually HDMI).
+
+Required properties:
+  - compatible: "snps,arcpgu"
+  - reg: Physical base address and length of the controller's registers.
+  - clocks: A list of phandle + clock-specifier pairs, one for each
+entry in 'clock-names'.
+  - clock-names: A list of clock names. For ARC PGU it should contain:
+  - "pxlclk" for the clock feeding the output PLL of the controller.
+
+Required sub-nodes:
+  - port: The PGU connection to an encoder chip.
+
+Example:
+
+/ {
+   ...
+
+   pgu@ {
+   compatible = "snps,arcpgu";
+   reg = <0x 0x400>;
+   clocks = <&clock_node>;
+   clock-names = "pxlclk";
+
+   port {
+   pgu_output: endpoint {
+   remote-endpoint = <&hdmi_enc_input>;
+   };
+   };
+   };
+};
-- 
2.5.5


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [RESEND PATCH v4] clk/axs10x: Add I2S PLL clock driver

2016-04-20 Thread Alexey Brodkin
Hi Jose, Stephen,

On Wed, 2016-04-20 at 10:47 +0100, Jose Abreu wrote:
> Hi Stephen,
> 
> 
> On 20-04-2016 02:54, Stephen Boyd wrote:
> > 
> > On 04/19, Jose Abreu wrote:
> > > 
> > > @Stephen: can you give some input so that I can submit a v6?
> > > 
> > I don't prefer putting the second register in the same DT node,
> > but that's really up to the DT reviewers to approve such a
> > design. The current binding has been acked by Rob right?
> Yes.
> 
> > 
> > Assuming the new binding is acked/reviewed then that solution is
> > fine.
> Ok, will then use the DT to pass the FPGA version register.

We won't need to know FPGA version at all I think.
Read my comment below.

> > 
> > Otherwise, I still prefer two DTS files for the two different FPGA
> > versions. At the least, please use ioremap for any pointers that
> > you readl/writel here.
> > 
> > Beyond that, we should have a fixed rate source clk somewhere in
> > the software view of the clk tree, because that reflects reality.
> > Hardcoding the parent rate in the structure works, but doesn't
> > properly express the clk tree.
> > 
> Can I use a property in the DT to pass this reference clock? something like 
> this:
> snps,parent-freq = <0xFBED9 2700>, <0x0 28224000>; /* Tuple
> , fpga-version = 0 is default */
> 
> Or use a parent clock? like:
> clk {
> compatible = "fixed-clock";
> clock-frequency = <2700>;
> #clock-cells = <0>;
> snps,fpga-version = <0xFBED9>;
> }
> 
> It is important to distinguish between the different versions automatically, 
> is
> any of these solutions ok?

I do like that solution with a master clock but with some fine-tuning
for simplification.

We'll add master clock node for I2S as a fixed clock like that:
--->8--
i2s_master_clock: clk {
#clock-cells = <0>;
compatible = "fixed-clock";
clock-frequency = <2700>;
};
--->8--

Note there's no mention of MB version, just a value of the frequency.
And in the driver itself value of that master clock will be used for
population of "pll_clk->ref_clk" directly.

These are benefits we'll get with that approach:
 [1] We escape any IOs not related to our clock device (I mean
     "snps,i2s-pll-clock") itself.
 [2] We'll use whatever reference clock value is given.
     I.e. we'll be able to do a fix-up of that reference clock
     value early in platform code depending on HW we're running on.
     That's what people do here and there.
 [3] Remember another clock driver for AXS10x board is right around
     the corner. I mean the one for ARC PGU which uses exactly the same
     master clock. So one fixup as mentioned above will work
     at once for 2 clock drivers.

Let me know if above makes sense.

-Alexey
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

Re: [RESEND PATCH v4] clk/axs10x: Add I2S PLL clock driver

2016-04-21 Thread Alexey Brodkin
Hi Jose,

On Thu, 2016-04-21 at 10:51 +0100, Jose Abreu wrote:
> Hi Alexey,


> > > > Otherwise, I still prefer two DTS files for the two different FPGA
> > > > versions. At the least, please use ioremap for any pointers that
> > > > you readl/writel here.
> > > > 
> > > > Beyond that, we should have a fixed rate source clk somewhere in
> > > > the software view of the clk tree, because that reflects reality.
> > > > Hardcoding the parent rate in the structure works, but doesn't
> > > > properly express the clk tree.
> > > > 
> > > Can I use a property in the DT to pass this reference clock? something 
> > > like this:
> > > snps,parent-freq = <0xFBED9 2700>, <0x0 28224000>; /* Tuple
> > > , fpga-version = 0 is default */
> > > 
> > > Or use a parent clock? like:
> > > clk {
> > > compatible = "fixed-clock";
> > > clock-frequency = <2700>;
> > > #clock-cells = <0>;
> > > snps,fpga-version = <0xFBED9>;
> > > }
> > > 
> > > It is important to distinguish between the different versions 
> > > automatically, is
> > > any of these solutions ok?
> > I do like that solution with a master clock but with some fine-tuning
> > for simplification.
> > 
> > We'll add master clock node for I2S as a fixed clock like that:
> > --->8--
> > i2s_master_clock: clk {
> > #clock-cells = <0>;
> > compatible = "fixed-clock";
> > clock-frequency = <2700>;
> > };
> > --->8--
> > 
> > Note there's no mention of MB version, just a value of the frequency.
> > And in the driver itself value of that master clock will be used for
> > population of "pll_clk->ref_clk" directly.
> > 
> > These are benefits we'll get with that approach:
> >  [1] We escape any IOs not related to our clock device (I mean
> >  "snps,i2s-pll-clock") itself.
> >  [2] We'll use whatever reference clock value is given.
> >  I.e. we'll be able to do a fix-up of that reference clock
> >  value early in platform code depending on HW we're running on.
> >  That's what people do here and there.
> >  [3] Remember another clock driver for AXS10x board is right around
> >  the corner. I mean the one for ARC PGU which uses exactly the same
> >  master clock. So one fixup as mentioned above will work
> >  at once for 2 clock drivers.
> > 
> > Let me know if above makes sense.
> That approach can't be used because the reference clock value will change in 
> the
> next firmware release.  The new release will have a reference clock of 
> 28224000
> Hz instead of the usual 2700 Hz, so we need to have a way to distinguish
> between them. Because of that we can't have only one master clock unless you
> state to users that they have to change the reference clock value when using 
> the
> new firmware release. Stephen suggested to use two DT files (one for each
> firmware release), but as Vineet said this would be annoying to the user so I 
> am
> trying to use another solution so that only one DT file is required.

Ok reference clock will change.
But I may guess we'll still be able to determine at least that new
firmware version in run-time, right? If so we'll update a fix-up in
early axs10x platform code so that reference clock will be set as 28224000 Hz.

And indeed 2 DT files is a no go - we want to run the same one binary
(with built-in .dtb) on all flavors of AXS boards. And fix-up I'm talking about
will actually do transformation of .dtb early on kernel boot process so that 
will
be a complete equivalent of different DT files.

-Alexey
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

Re: [RESEND PATCH v4] clk/axs10x: Add I2S PLL clock driver

2016-04-21 Thread Alexey Brodkin
Hi Jose,

On Thu, 2016-04-21 at 14:10 +0100, Jose Abreu wrote:
> Hi Alexey,
> 
> 
> On 21-04-2016 13:18, Alexey Brodkin wrote:
> > 
> > Hi Jose,
> > 
> > On Thu, 2016-04-21 at 10:51 +0100, Jose Abreu wrote:
> > > 
> > > Hi Alexey,
> > > 
> > Ok reference clock will change.
> > But I may guess we'll still be able to determine at least that new
> > firmware version in run-time, right? If so we'll update a fix-up in
> > early axs10x platform code so that reference clock will be set as 28224000 
> > Hz.
> Yes, there is a register where the FPGA version date is encoded, we can use 
> that
> to check which firmware is used (if date <= old_firmware_date then
> clock=2700; else clock=28224000). If that fix is acceptable it could be a
> good solution without having to use custom parameters in the DT (no need to
> encode the different clocks and we would only use one master clock) but I am 
> not
> sure where and how this can be encoded and I don't know how to change the DT 
> on
> runtime. Can you give me some guidelines?

Take a look here - 
http://git.kernel.org/cgit/linux/kernel/git/vgupta/arc.git/commit/arch/arc/plat-axs10x/axs10x.c?h=for
-next&id=5cd0f5102753a7405548d0c66c11a2a0a05bbf2e

We do something very similar here - we're patching in run-time
core frequency that was specified in .dts.

And in the very same way one will be able to do fix-ups for other
clocks.

Moreover I would propose to think about that fix-up as of completely
separate topic. I.e. in your driver for AXS' I2S clock just use a new
reference "fixed-clock" (that you'll add in "axs10x_mb.dtsi" as a part of
your driver submission). And once your driver gets accepted we'll work on
fix-up in axs10x platform.

This way we'll move with smaller steps and hopefully will get things done
sooner.

> > And indeed 2 DT files is a no go - we want to run the same one binary
> > (with built-in .dtb) on all flavors of AXS boards. And fix-up I'm talking 
> > about
> > will actually do transformation of .dtb early on kernel boot process so 
> > that will
> > be a complete equivalent of different DT files.
> And doing modifications on the DT can cause some misdirections to users.

What do you mean here? What kind of problems do you expect to face?

> Besides, we would have clock specific functions in init procedures which is
> precisely what we are trying to avoid by submitting this driver.

You're talking about fixups above here?

-Alexey
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

Re: [PATCH 2/2 v6] arc: axs10x: Add DT bindings for I2S PLL Clock

2016-04-22 Thread Alexey Brodkin
Hi Jose,

On Thu, 2016-04-21 at 18:19 +0100, Jose Abreu wrote:
> Add device tree bindings for AXS10X I2S PLL Clock driver.
> 
> Signed-off-by: Jose Abreu 
> ---
> 
> Changes v5 -> v6:
> * Added 'clocks' field
> 
> This patch was only introduced in v5.
> 
>  arch/arc/boot/dts/axs10x_mb.dtsi | 13 +
>  1 file changed, 13 insertions(+)
> 
> diff --git a/arch/arc/boot/dts/axs10x_mb.dtsi 
> b/arch/arc/boot/dts/axs10x_mb.dtsi
> index ab5d570..5c6489e 100644
> --- a/arch/arc/boot/dts/axs10x_mb.dtsi
> +++ b/arch/arc/boot/dts/axs10x_mb.dtsi
> @@ -16,7 +16,20 @@
>   ranges = <0x 0xe000 0x1000>;
>   interrupt-parent = <&mb_intc>;
>  
> + i2sclk: i2sclk@100a0 {
> + compatible = "snps,axs10x-i2s-pll-clock";
> + reg = <0x100a0 0x10>;
> + clocks = <&i2spll_clk>;
> + #clock-cells = <0>;
> + };
> +
>   clocks {
> + i2spll_clk: i2spll_clk {
> + compatible = "fixed-clock";
> + clock-frequency = <2700>;
> + #clock-cells = <0>;
> +     };
> +
>   i2cclk: i2cclk {
>   compatible = "fixed-clock";
>   clock-frequency = <5000>;

Acked-by: Alexey Brodkin 
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

Re: [PATCH 0/4 v6] drm: Add support of ARC PGU display controller

2016-04-22 Thread Alexey Brodkin
Hi David,

On Tue, 2016-04-19 at 16:19 +0300, Alexey Brodkin wrote:
> This series add support of ARC PGU display controller.
> ARC PGU is a quite simple byte streamer that gets data from the framebuffer
> and pushes it to hte connected encoder (DP or HDMI).
> 
> It was tested on ARC SDP boards (axs101/103 in particular).
> 
> Note following series (v6) that introduces drm_connector_register_all()
> is a prerequisite now: https://lkml.org/lkml/2016/4/19/299
> 
> Changes v5 -> v6:
>  * "arc: Add our own implementation of fb_pgprotect()" was already applied to
>    ARC's tree and available in linux-next:
>    
> http://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/commit/?id=e5e0a65cd20a7a892a87e6bd73bdc3d83726d725
> 
> Changes v4 -> v5:
>  * Removed encode node from DT bindings example (as suggested by Rob)
> 
> Changes v3 -> v4:
>  * Main driver author is now set properly (thanks Carlos for all your efforts)
>  * Implemented correct hsync and vsync setup (thanks Jose)
>  * Dummy call-backs were removed (as suggested by Daniel)
>  * Obsolete load()/unload() call-backs were removed (as suggested by Daniel)
>  * With above in mind we were able to adopt recently introduced
>    drm_connector_register_all()/drm_connector_unregister_all()
>  * Implemented setup of properties (uncached) for FB user-pages
>  * Minor clean-up in DT binding docs and axs10x_mb.dtsi
> 
> Changes v2 -> v3:
>  * Improved failure path if arcpgu_connector wasn't allocated.
>  * Fixed driver building as module.
>  * Implemented uncached mapping of user-space FB pages.
>  * Again updated DT bindings docs.
> 
> Changes v1 -> v2:
>  * Clean-up of DT bindings documentation.
>  * Added missing "pxlclk" clock in axs10x_mb.dtsi.

That's my first submission of a DRM driver and I'm wondering
which tree/branch should I use as a reference to rebase my
patches and send you a pull request?

Especially given there's a prerequisite which is still only in
linux-next: 
http://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/commit/?id=54d2c2da0946368b96b63e6daed7920f3
681243e

Regards,
Alexey
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

[GIT PULL] drm: Add support of ARC PGU display controller

2016-04-26 Thread Alexey Brodkin
Hi Dave,

This is DRM driver for ARC PGU - simple bitstreamer used on
Synopsys ARC SDP boards (both AXS101 and AXS103).

Those sources are from v6 series floated to mailing list here
https://lists.freedesktop.org/archives/dri-devel/2016-April/105156.html

and based on top of today's drm-next branch.

Best regards,
Alexey

The following changes since commit 027b3f8ba9277410c3191d72d1ed2c6146d8a668:

  drm/modes: stop handling framebuffer special (2016-04-22 10:47:16 +1000)

are available in the git repository at:

  https://github.com/foss-for-synopsys-dwc-arc-processors/linux.git 
topic-arcpgu-v6

for you to fetch changes up to b8c1eca1e089e8f4247b19b73955c875bf7b18ae:

  arc: axs10x - add support of ARC PGU (2016-04-26 18:26:54 +0300)


Alexey Brodkin (3):
  drm: Add DT bindings documentation for ARC PGU display controller
  MAINTAINERS: Add maintainer for ARC PGU display controller
  arc: axs10x - add support of ARC PGU

Carlos Palminha (1):
  drm: Add support of ARC PGU display controller

 Documentation/devicetree/bindings/display/snps,arcpgu.txt |  35 +++
 MAINTAINERS   |   6 ++
 arch/arc/boot/dts/axs10x_mb.dtsi  |  61 
 drivers/gpu/drm/Kconfig   |   2 +
 drivers/gpu/drm/Makefile  |   1 +
 drivers/gpu/drm/arc/Kconfig   |  10 ++
 drivers/gpu/drm/arc/Makefile  |   2 +
 drivers/gpu/drm/arc/arcpgu.h  |  50 ++
 drivers/gpu/drm/arc/arcpgu_crtc.c | 257 
+++
 drivers/gpu/drm/arc/arcpgu_drv.c  | 282 

 drivers/gpu/drm/arc/arcpgu_hdmi.c | 201 
+
 drivers/gpu/drm/arc/arcpgu_regs.h |  40 
 12 files changed, 947 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/snps,arcpgu.txt
 create mode 100644 drivers/gpu/drm/arc/Kconfig
 create mode 100644 drivers/gpu/drm/arc/Makefile
 create mode 100644 drivers/gpu/drm/arc/arcpgu.h
 create mode 100644 drivers/gpu/drm/arc/arcpgu_crtc.c
 create mode 100644 drivers/gpu/drm/arc/arcpgu_drv.c
 create mode 100644 drivers/gpu/drm/arc/arcpgu_hdmi.c
 create mode 100644 drivers/gpu/drm/arc/arcpgu_regs.h
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

[PATCH 0/2] ARC: enable per-device dma and reserved memory in DT

2016-04-26 Thread Alexey Brodkin
This tiny series enbles support of generic per-device coherent dma memory
and ability to specify reserved memory regions to be used in those
per-device mappings.

In particular this allowed us to move frame-buffer memory out of
IOC aperture.

Cc: linux-ker...@vger.kernel.org

Alexey Brodkin (2):
  ARC: support generic per-device coherent dma mem
  ARC: add support for reserved memory defined by device tree

 arch/arc/Kconfig   | 2 ++
 arch/arc/mm/init.c | 4 
 2 files changed, 6 insertions(+)

-- 
2.5.5


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 2/2] ARC: add support for reserved memory defined by device tree

2016-04-26 Thread Alexey Brodkin
Enable reserved memory initialization from device tree.

Signed-off-by: Alexey Brodkin 
Cc: Grant Likely 
Cc: Marek Szyprowski 
Cc: linux-ker...@vger.kernel.org
---
 arch/arc/Kconfig   | 1 +
 arch/arc/mm/init.c | 4 
 2 files changed, 5 insertions(+)

diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index 61d69e6..33c1fc7 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -35,6 +35,7 @@ config ARC
select NO_BOOTMEM
select OF
select OF_EARLY_FLATTREE
+   select OF_RESERVED_MEM
select PERF_USE_VMALLOC
select HAVE_DEBUG_STACKOVERFLOW
select HAVE_GENERIC_DMA_COHERENT
diff --git a/arch/arc/mm/init.c b/arch/arc/mm/init.c
index 7d2c4fb..5487d0b 100644
--- a/arch/arc/mm/init.c
+++ b/arch/arc/mm/init.c
@@ -13,6 +13,7 @@
 #ifdef CONFIG_BLK_DEV_INITRD
 #include 
 #endif
+#include 
 #include 
 #include 
 #include 
@@ -136,6 +137,9 @@ void __init setup_arch_memory(void)
memblock_reserve(__pa(initrd_start), initrd_end - initrd_start);
 #endif
 
+   early_init_fdt_reserve_self();
+   early_init_fdt_scan_reserved_mem();
+
memblock_dump_all();
 
/*- node/zones setup --*/
-- 
2.5.5


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 1/2] ARC: support generic per-device coherent dma mem

2016-04-26 Thread Alexey Brodkin
Signed-off-by: Alexey Brodkin 
Cc: linux-ker...@vger.kernel.org
---
 arch/arc/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index 208aae0..61d69e6 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -37,6 +37,7 @@ config ARC
select OF_EARLY_FLATTREE
select PERF_USE_VMALLOC
select HAVE_DEBUG_STACKOVERFLOW
+   select HAVE_GENERIC_DMA_COHERENT
 
 config MIGHT_HAVE_PCI
bool
-- 
2.5.5


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 0/2] drm/arcpgu: Get use of dedicated memory area for frame buffer

2016-04-27 Thread Alexey Brodkin
This mini-series allows to allocate frame buffer memory in desired
location. Allocation of a frame buffer memory in a special memory region
allows bypassing of so-called IO Coherency aperture which is typically set
as a range 0x8z-0xAz.

I.e. all data traffic to PGU bypasses IO Coherency block
and saves its bandwidth for other peripherals.

Cc: Cc: Dave Airlie 
Cc: Daniel Vetter 
Cc: devicet...@vger.kernel.org

Alexey Brodkin (2):
  drm/arcpgu: use dedicated memory area for frame buffer
  ARC: [axs10x] Specify reserved memory for frame buffer

 arch/arc/boot/dts/axc001.dtsi | 20 +++-
 arch/arc/boot/dts/axc003.dtsi | 14 ++
 arch/arc/boot/dts/axc003_idu.dtsi | 14 ++
 arch/arc/boot/dts/axs10x_mb.dtsi  |  2 +-
 drivers/gpu/drm/arc/arcpgu_drv.c  |  6 ++
 5 files changed, 54 insertions(+), 2 deletions(-)

-- 
2.5.5


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 1/2] drm/arcpgu: use dedicated memory area for frame buffer

2016-04-27 Thread Alexey Brodkin
Now when ARC supports reserved memory areas and
per-device coherent DMA allocations we may switch ARC PGU
to use of those dedicated areas.

One of the benefits we may move frame-buffer area out
from IO Coherency aperture and so significantly
reduce IOC utilization allowing less demanding
peripherals to use all perks of IOC.

Signed-off-by: Alexey Brodkin 
Cc: Dave Airlie 
Cc: Daniel Vetter 
---
 drivers/gpu/drm/arc/arcpgu_drv.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/arc/arcpgu_drv.c b/drivers/gpu/drm/arc/arcpgu_drv.c
index 5b35e5db..76e187a 100644
--- a/drivers/gpu/drm/arc/arcpgu_drv.c
+++ b/drivers/gpu/drm/arc/arcpgu_drv.c
@@ -19,6 +19,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "arcpgu.h"
 #include "arcpgu_regs.h"
@@ -135,6 +136,11 @@ static int arcpgu_load(struct drm_device *drm)
dev_info(drm->dev, "arc_pgu ID: 0x%x\n",
 arc_pgu_read(arcpgu, ARCPGU_REG_ID));
 
+   /* Get the optional framebuffer memory resource */
+   ret = of_reserved_mem_device_init(drm->dev);
+   if (ret && ret != -ENODEV)
+   return ret;
+
if (dma_set_mask_and_coherent(drm->dev, DMA_BIT_MASK(32)))
return -ENODEV;
 
-- 
2.5.5


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 2/2] ARC: [axs10x] Specify reserved memory for frame buffer

2016-04-27 Thread Alexey Brodkin
Allocation of a frame buffer memory in a special memory region
allows bypassing of so-called IO Coherency aperture
which is typically set as a range 0x8z-0xAz.

I.e. all data traffic to PGU bypasses IO Coherency block
and saves its bandwidth for other peripherals.

Even though for AXS101 (which sorts ARC770 CPU) IOC is not
an option for a sake of keeping one DT description for the
base-board (axs10x_mb.dtsi) we're still defining reserved
memory location in the very end of DDR.

Signed-off-by: Alexey Brodkin 
Cc: devicet...@vger.kernel.org
---
 arch/arc/boot/dts/axc001.dtsi | 20 +++-
 arch/arc/boot/dts/axc003.dtsi | 14 ++
 arch/arc/boot/dts/axc003_idu.dtsi | 14 ++
 arch/arc/boot/dts/axs10x_mb.dtsi  |  2 +-
 4 files changed, 48 insertions(+), 2 deletions(-)

diff --git a/arch/arc/boot/dts/axc001.dtsi b/arch/arc/boot/dts/axc001.dtsi
index 420dcfd..ae6162d 100644
--- a/arch/arc/boot/dts/axc001.dtsi
+++ b/arch/arc/boot/dts/axc001.dtsi
@@ -95,6 +95,24 @@
#size-cells = <1>;
ranges = <0x 0x8000 0x4000>;
device_type = "memory";
-   reg = <0x8000 0x2000>;  /* 512MiB */
+   reg = <0x8000 0x1f00>;  /* 512 - 16 MiB */
+   };
+
+   reserved-memory {
+   #address-cells = <1>;
+   #size-cells = <1>;
+   ranges;
+   /*
+* We just move frame buffer area to the very end of
+* available DDR. And even though in case of ARC770 there's
+* no strict requirement for a frame-buffer to be in any
+* particular location it allows us to use the same
+* base board's DT node for ARC PGU as for ARc HS38.
+*/
+   frame_buffer: frame_buffer@9f00 {
+   compatible = "shared-dma-pool";
+   reg = <0x9f00 0x100>;
+   no-map;
+   };
};
 };
diff --git a/arch/arc/boot/dts/axc003.dtsi b/arch/arc/boot/dts/axc003.dtsi
index f90fadf..c7a95c2 100644
--- a/arch/arc/boot/dts/axc003.dtsi
+++ b/arch/arc/boot/dts/axc003.dtsi
@@ -100,4 +100,18 @@
device_type = "memory";
reg = <0x8000 0x2000>;  /* 512MiB */
};
+
+   reserved-memory {
+   #address-cells = <1>;
+   #size-cells = <1>;
+   ranges;
+   /*
+* Move frame buffer out of IOC aperture (0x8z-0xAz).
+*/
+   frame_buffer: frame_buffer@a000 {
+   compatible = "shared-dma-pool";
+   reg = <0xa000 0x100>;
+   no-map;
+   };
+   };
 };
diff --git a/arch/arc/boot/dts/axc003_idu.dtsi 
b/arch/arc/boot/dts/axc003_idu.dtsi
index 06a9f29..929ec8c 100644
--- a/arch/arc/boot/dts/axc003_idu.dtsi
+++ b/arch/arc/boot/dts/axc003_idu.dtsi
@@ -123,4 +123,18 @@
device_type = "memory";
reg = <0x8000 0x2000>;  /* 512MiB */
};
+
+   reserved-memory {
+   #address-cells = <1>;
+   #size-cells = <1>;
+   ranges;
+   /*
+* Move frame buffer out of IOC aperture (0x8z-0xAz).
+*/
+   frame_buffer: frame_buffer@a000 {
+   compatible = "shared-dma-pool";
+   reg = <0xa000 0x100>;
+   no-map;
+   };
+   };
 };
diff --git a/arch/arc/boot/dts/axs10x_mb.dtsi b/arch/arc/boot/dts/axs10x_mb.dtsi
index 823f15c..64b063d 100644
--- a/arch/arc/boot/dts/axs10x_mb.dtsi
+++ b/arch/arc/boot/dts/axs10x_mb.dtsi
@@ -283,7 +283,7 @@
encoder-slave = <&adv7511>;
clocks = <&pguclk>;
clock-names = "pxlclk";
-
+   memory-region = <&frame_buffer>;
port {
pgu_output: endpoint {
remote-endpoint = <&adv7511_input>;
-- 
2.5.5


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH 2/2] ARC: [axs10x] Specify reserved memory for frame buffer

2016-04-28 Thread Alexey Brodkin
Hi Vineet,

On Thu, 2016-04-28 at 09:56 +0530, Vineet Gupta wrote:

[snip]

> > 
> > diff --git a/arch/arc/boot/dts/axc001.dtsi b/arch/arc/boot/dts/axc001.dtsi
> > index 420dcfd..ae6162d 100644
> > --- a/arch/arc/boot/dts/axc001.dtsi
> > +++ b/arch/arc/boot/dts/axc001.dtsi
> > @@ -95,6 +95,24 @@
> >     #size-cells = <1>;
> >     ranges = <0x 0x8000 0x4000>;
> >     device_type = "memory";
> > -   reg = <0x8000 0x2000>;  /* 512MiB */
> > +   reg = <0x8000 0x1f00>;  /* 512 - 16 MiB */
> Is 16MB fixed size or is this a function of display resolution / density etc.

Indeed this value depends on screen resolution and bpp and double-
or even tripple-buffering (once this becomes supported in the driver).

So as of now the corner case would be 1920x1080, 16 bits per pixel
which gives ~4Mb. Now if we add support of triple-buffering we'll
need ~12Mb so I booked a little bit more - 16Mb.

But now I recalled that we also support r8g8b8 mode and in this case
3 bytes are used for color encoding, which effectively gives ~6Mb for
1 FullHD frame. And for tripple-buffering we'll need > 18Mb, so probably
we'll need to go for 24 or even 32 Mb.

[snip]

> > +
> > +   reserved-memory {
> > +   #address-cells = <1>;
> > +   #size-cells = <1>;
> > +   ranges;
> > +   /*
> > +    * Move frame buffer out of IOC aperture (0x8z-0xAz).
> > +    */
> > +   frame_buffer: frame_buffer@bf00 {
> > +   compatible = "shared-dma-pool";
> > +   reg = <0xbf00 0x100>;
> Can this be made a bit more future safe. AXS103 has 1 GB of DDR while kernel
> currently only uses 512M. Once we increase that, this will need fixing too. 
> Better
> to make this as far possible.

Makes sense. Will move it to the very end of 1Gb.

> Note that the IOC start alignment needs to follow
> max(4k, size). What will be maximum size of frame buffer - 16M always !

What do you mean by that?

-Alexey
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

[PATCH 0/2 v2] drm/arcpgu: Get use of dedicated memory area for frame buffer

2016-04-28 Thread Alexey Brodkin
This mini-series allows to allocate frame buffer memory in desired
location. Allocation of a frame buffer memory in a special memory region
allows bypassing of so-called IO Coherency aperture which is typically set
as a range 0x8z-0xAz.

I.e. all data traffic to PGU bypasses IO Coherency block
and saves its bandwidth for other peripherals.

Cc: Dave Airlie 
Cc: Daniel Vetter 
Cc: devicet...@vger.kernel.org

Changes v1 -> v2:
 * Reserved memory size bumped from 16Mb to 32Mb.

 * Reserved area in AXS103 boards moved to the very end of available DDR.

Alexey Brodkin (2):
  drm/arcpgu: use dedicated memory area for frame buffer
  ARC: [axs10x] Specify reserved memory for frame buffer

 arch/arc/boot/dts/axc001.dtsi | 22 --
 arch/arc/boot/dts/axc003.dtsi | 14 ++
 arch/arc/boot/dts/axc003_idu.dtsi | 14 ++
 arch/arc/boot/dts/axs10x_mb.dtsi  |  2 +-
 drivers/gpu/drm/arc/arcpgu_drv.c  |  6 ++
 5 files changed, 55 insertions(+), 3 deletions(-)

-- 
2.5.5


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 1/2 v2] drm/arcpgu: use dedicated memory area for frame buffer

2016-04-28 Thread Alexey Brodkin
Now when ARC supports reserved memory areas and
per-device coherent DMA allocations we may switch ARC PGU
to use of those dedicated areas.

One of the benefits we may move frame-buffer area out
from IO Coherency aperture and so significantly
reduce IOC utilization allowing less demanding
peripherals to use all perks of IOC.

Signed-off-by: Alexey Brodkin 
Cc: Dave Airlie 
Cc: Daniel Vetter 
---

No changes v1 -> v2.

 drivers/gpu/drm/arc/arcpgu_drv.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/arc/arcpgu_drv.c b/drivers/gpu/drm/arc/arcpgu_drv.c
index 5b35e5db..76e187a 100644
--- a/drivers/gpu/drm/arc/arcpgu_drv.c
+++ b/drivers/gpu/drm/arc/arcpgu_drv.c
@@ -19,6 +19,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "arcpgu.h"
 #include "arcpgu_regs.h"
@@ -135,6 +136,11 @@ static int arcpgu_load(struct drm_device *drm)
dev_info(drm->dev, "arc_pgu ID: 0x%x\n",
 arc_pgu_read(arcpgu, ARCPGU_REG_ID));
 
+   /* Get the optional framebuffer memory resource */
+   ret = of_reserved_mem_device_init(drm->dev);
+   if (ret && ret != -ENODEV)
+   return ret;
+
if (dma_set_mask_and_coherent(drm->dev, DMA_BIT_MASK(32)))
return -ENODEV;
 
-- 
2.5.5


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 2/2 v2] ARC: [axs10x] Specify reserved memory for frame buffer

2016-04-28 Thread Alexey Brodkin
Allocation of a frame buffer memory in a special memory region
allows bypassing of so-called IO Coherency aperture
which is typically set as a range 0x8z-0xAz.

I.e. all data traffic to PGU bypasses IO Coherency block
and saves its bandwidth for other peripherals.

Even though for AXS101 (which sorts ARC770 CPU) IOC is not
an option for a sake of keeping one DT description for the
base-board (axs10x_mb.dtsi) we're still defining reserved
memory location in the very end of DDR.

Signed-off-by: Alexey Brodkin 
Cc: Vineet Gupta 
Cc: devicet...@vger.kernel.org
---

Changes v1 -> v2:
 * Reserved memory size bumped from 16Mb to 32Mb.
   Given the corner case 1920x1080x24bpp and tripl-buffering
   we'll need ~18Mb in the future so let's reserve 32Mb today
   and don't think about that any more.

 * Reserved area in AXS103 boards moved to the very end of the first Gb.
   Even though we use only 512Mb for kernel on AXS103 board
   we have 1Gb of DDR really. So let's move reserved area in the very
   end of available mamory. This way we'll be able to keep this mapping
   when we'll want to use > 512Mb in the kernel.

 * And while at it correct "ranges" value for AXS101 board: we do have
   only 512 Mb of DDR on the board so let's not temp users to try to use more.

 arch/arc/boot/dts/axc001.dtsi | 22 --
 arch/arc/boot/dts/axc003.dtsi | 14 ++
 arch/arc/boot/dts/axc003_idu.dtsi | 14 ++
 arch/arc/boot/dts/axs10x_mb.dtsi  |  2 +-
 4 files changed, 49 insertions(+), 3 deletions(-)

diff --git a/arch/arc/boot/dts/axc001.dtsi b/arch/arc/boot/dts/axc001.dtsi
index 420dcfd..262496a 100644
--- a/arch/arc/boot/dts/axc001.dtsi
+++ b/arch/arc/boot/dts/axc001.dtsi
@@ -93,8 +93,26 @@
memory {
#address-cells = <1>;
#size-cells = <1>;
-   ranges = <0x 0x8000 0x4000>;
+   ranges = <0x 0x8000 0x2000>;
device_type = "memory";
-   reg = <0x8000 0x2000>;  /* 512MiB */
+   reg = <0x8000 0x1b00>;  /* (512 - 32) MiB */
+   };
+
+   reserved-memory {
+   #address-cells = <1>;
+   #size-cells = <1>;
+   ranges;
+   /*
+* We just move frame buffer area to the very end of
+* available DDR. And even though in case of ARC770 there's
+* no strict requirement for a frame-buffer to be in any
+* particular location it allows us to use the same
+* base board's DT node for ARC PGU as for ARc HS38.
+*/
+   frame_buffer: frame_buffer@9e00 {
+   compatible = "shared-dma-pool";
+   reg = <0x9e00 0x200>;
+   no-map;
+   };
};
 };
diff --git a/arch/arc/boot/dts/axc003.dtsi b/arch/arc/boot/dts/axc003.dtsi
index f90fadf..35ece04 100644
--- a/arch/arc/boot/dts/axc003.dtsi
+++ b/arch/arc/boot/dts/axc003.dtsi
@@ -100,4 +100,18 @@
device_type = "memory";
reg = <0x8000 0x2000>;  /* 512MiB */
};
+
+   reserved-memory {
+   #address-cells = <1>;
+   #size-cells = <1>;
+   ranges;
+   /*
+* Move frame buffer out of IOC aperture (0x8z-0xAz).
+*/
+   frame_buffer: frame_buffer@be00 {
+   compatible = "shared-dma-pool";
+   reg = <0xbe00 0x200>;
+   no-map;
+   };
+   };
 };
diff --git a/arch/arc/boot/dts/axc003_idu.dtsi 
b/arch/arc/boot/dts/axc003_idu.dtsi
index 06a9f29..df9ddb6 100644
--- a/arch/arc/boot/dts/axc003_idu.dtsi
+++ b/arch/arc/boot/dts/axc003_idu.dtsi
@@ -123,4 +123,18 @@
device_type = "memory";
reg = <0x8000 0x2000>;  /* 512MiB */
};
+
+   reserved-memory {
+   #address-cells = <1>;
+   #size-cells = <1>;
+   ranges;
+   /*
+* Move frame buffer out of IOC aperture (0x8z-0xAz).
+*/
+   frame_buffer: frame_buffer@be00 {
+   compatible = "shared-dma-pool";
+   reg = <0xbe00 0x200>;
+   no-map;
+   };
+   };
 };
diff --git a/arch/arc/boot/dts/axs10x_mb.dtsi b/arch/arc/boot/dts/axs10x_mb.dtsi
index 823f15c..64b063d 100644
--- a/arch/arc/boot/dts/axs10x_mb.dtsi
+++ b/arch/arc/boot/dts/axs10x_mb.dtsi
@@ -283,7 +283,7 @@
encoder-slave = <&adv7511>;
clocks = <&pgu

Re: [PATCH 2/2] ARC: [axs10x] Specify reserved memory for frame buffer

2016-04-28 Thread Alexey Brodkin
Hi Vineet,

On Thu, 2016-04-28 at 19:26 +0530, Vineet Gupta wrote:
> On Thursday 28 April 2016 07:16 PM, Alexey Brodkin wrote:
> > 
> > > 
> > > > 
> > > > Note that the IOC start alignment needs to follow
> > > > max(4k, size). What will be maximum size of frame buffer - 16M always !
> > What do you mean by that?
> For HS38, we intend to bypass the frame buffer traffic from IOC port. So the 
> frame
> buffer start needs to be inside the IOC aperture base address. That value 
> can't be
> arbitrary - it is atleast 4K aligned value and further also needs to be 
> aligned to
> the size of aperture. So if the size is 16M it needs to be 16M aligned etc...

The point is we want to put frame buffer memory OUTSIDE IOC aperture.
So we allocate FB memory in the very end of DDR which is far away from IOC.

And in that case IOC alignment issues are out of the question here.

-Alexey
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[GIT PULL] drm/arcpgu: use dedicated memory area for frame buffer

2016-04-29 Thread Alexey Brodkin
Hi Dave,

Please pull this mini-series that allows ARC PGU to use
dedicated memory location as framebuffer backing storage.

v2 of that series was reviewed here
https://lists.freedesktop.org/archives/dri-devel/2016-April/106279.html

It is based on top of today's drm-next branch.

Best regards,
Alexey

The following changes since commit b89359bdf0f1e95a4c5f92300594ba9dde323fc4:

  Merge branch 'for-next' of http://git.agner.ch/git/linux-drm-fsl-dcu into 
drm-next (2016-04-29 14:57:51 +1000)

are available in the git repository at:

  https://github.com/foss-for-synopsys-dwc-arc-processors/linux.git 
topic-arcpgu-updates

for you to fetch changes up to cb2ad5e5339c5122166265cea579cc6a356d46de:

  ARC: [axs10x] Specify reserved memory for frame buffer (2016-04-29 14:34:13 
+0300)

--------
Alexey Brodkin (2):
  drm/arcpgu: use dedicated memory area for frame buffer
  ARC: [axs10x] Specify reserved memory for frame buffer

 arch/arc/boot/dts/axc001.dtsi | 22 --
 arch/arc/boot/dts/axc003.dtsi | 14 ++
 arch/arc/boot/dts/axc003_idu.dtsi | 14 ++
 arch/arc/boot/dts/axs10x_mb.dtsi  |  2 +-
 drivers/gpu/drm/arc/arcpgu_drv.c  |  6 ++
 5 files changed, 55 insertions(+), 3 deletions(-)

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

Re: [GIT PULL] drm/arcpgu: use dedicated memory area for frame buffer

2016-05-10 Thread Alexey Brodkin
Hi Dave,

On Fri, 2016-04-29 at 11:36 +, Alexey Brodkin wrote:
> Hi Dave,
> 
> Please pull this mini-series that allows ARC PGU to use
> dedicated memory location as framebuffer backing storage.
> 
> v2 of that series was reviewed here
> https://lists.freedesktop.org/archives/dri-devel/2016-April/106279.html
> 
> It is based on top of today's drm-next branch.
> 
> Best regards,
> Alexey
> 
> The following changes since commit b89359bdf0f1e95a4c5f92300594ba9dde323fc4:
> 
>   Merge branch 'for-next' of http://git.agner.ch/git/linux-drm-fsl-dcu into 
> drm-next (2016-04-29 14:57:51 +1000)
> 
> are available in the git repository at:
> 
>   https://github.com/foss-for-synopsys-dwc-arc-processors/linux.git 
> topic-arcpgu-updates
> 
> for you to fetch changes up to cb2ad5e5339c5122166265cea579cc6a356d46de:
> 
>   ARC: [axs10x] Specify reserved memory for frame buffer (2016-04-29 14:34:13 
> +0300)
> 
> 
> Alexey Brodkin (2):
>   drm/arcpgu: use dedicated memory area for frame buffer
>   ARC: [axs10x] Specify reserved memory for frame buffer
> 
>  arch/arc/boot/dts/axc001.dtsi | 22 --
>  arch/arc/boot/dts/axc003.dtsi | 14 ++
>  arch/arc/boot/dts/axc003_idu.dtsi | 14 ++
>  arch/arc/boot/dts/axs10x_mb.dtsi  |  2 +-
>  drivers/gpu/drm/arc/arcpgu_drv.c  |  6 ++
>  5 files changed, 55 insertions(+), 3 deletions(-)

Could you please take a look at this pull request?

-Alexey
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

Re: [GIT PULL] drm/arcpgu: use dedicated memory area for frame buffer

2016-05-16 Thread Alexey Brodkin
Hi Dave,

On Tue, 2016-05-10 at 09:51 +, Alexey Brodkin wrote:
> Hi Dave,
> 
> On Fri, 2016-04-29 at 11:36 +0000, Alexey Brodkin wrote:
> > 
> > Hi Dave,
> > 
> > Please pull this mini-series that allows ARC PGU to use
> > dedicated memory location as framebuffer backing storage.
> > 
> > v2 of that series was reviewed here
> > https://lists.freedesktop.org/archives/dri-devel/2016-April/106279.html
> > 
> > It is based on top of today's drm-next branch.
> > 
> > Best regards,
> > Alexey
> > 
> > The following changes since commit b89359bdf0f1e95a4c5f92300594ba9dde323fc4:
> > 
> >   Merge branch 'for-next' of http://git.agner.ch/git/linux-drm-fsl-dcu into 
> > drm-next (2016-04-29 14:57:51 +1000)
> > 
> > are available in the git repository at:
> > 
> >   https://github.com/foss-for-synopsys-dwc-arc-processors/linux.git 
> > topic-arcpgu-updates
> > 
> > for you to fetch changes up to cb2ad5e5339c5122166265cea579cc6a356d46de:
> > 
> >   ARC: [axs10x] Specify reserved memory for frame buffer (2016-04-29 
> > 14:34:13 +0300)
> > 
> > 
> > Alexey Brodkin (2):
> >   drm/arcpgu: use dedicated memory area for frame buffer
> >   ARC: [axs10x] Specify reserved memory for frame buffer
> > 
> >  arch/arc/boot/dts/axc001.dtsi | 22 --
> >  arch/arc/boot/dts/axc003.dtsi | 14 ++
> >  arch/arc/boot/dts/axc003_idu.dtsi | 14 ++
> >  arch/arc/boot/dts/axs10x_mb.dtsi  |  2 +-
> >  drivers/gpu/drm/arc/arcpgu_drv.c  |  6 ++
> >  5 files changed, 55 insertions(+), 3 deletions(-)
> Could you please take a look at this pull request?

Another polite reminder.

-Alexey
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

[PATCH] arc: axs103_smp: Fix CPU frequency to 100MHz for dual-core

2016-05-16 Thread Alexey Brodkin
The most recent release of AXS103 [v1.1] is proven to work
at 100 MHz in dual-core mode so this change uses mentioned feature.
For that we:
 * Update axc003_idu.dtsi with mention of really-used CPU clock freq
 * Remove clock override in AXS platform code for dual-core HW

Note we're still leaving a hack for clock "downgrade" on early boot
for quad-core hardware.

Also note this change will break functionality of AXS103 v1.0 hardware.
That means all users of AXS103 __must__ upgrade their boards with the
most recent firmware.

Signed-off-by: Alexey Brodkin 
---
 arch/arc/boot/dts/axc003_idu.dtsi | 2 +-
 arch/arc/plat-axs10x/axs10x.c | 2 --
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/arc/boot/dts/axc003_idu.dtsi 
b/arch/arc/boot/dts/axc003_idu.dtsi
index 8955881d..ed1674b 100644
--- a/arch/arc/boot/dts/axc003_idu.dtsi
+++ b/arch/arc/boot/dts/axc003_idu.dtsi
@@ -28,7 +28,7 @@
core_clk: core_clk {
#clock-cells = <0>;
compatible = "fixed-clock";
-   clock-frequency = <9000>;
+   clock-frequency = <1>;
};
 
core_intc: archs-intc@cpu {
diff --git a/arch/arc/plat-axs10x/axs10x.c b/arch/arc/plat-axs10x/axs10x.c
index 9701c93..8654870 100644
--- a/arch/arc/plat-axs10x/axs10x.c
+++ b/arch/arc/plat-axs10x/axs10x.c
@@ -410,8 +410,6 @@ static void __init axs103_early_init(void)
unsigned int num_cores = (read_aux_reg(ARC_REG_MCIP_BCR) >> 16) & 0x3F;
if (num_cores > 2)
freq = 50;
-   else if (num_cores == 2)
-   freq = 75;
 #endif
 
switch (freq) {
-- 
2.5.5


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


  1   2   3   4   5   6   7   >