diff mbox

[PATCHv0,1/1] fbdev: add Intel FPGA FRAME BUFFER driver

Message ID 1479287278-5192-1-git-send-email-hean.loong.ong@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Hean-Loong, Ong Nov. 16, 2016, 9:07 a.m. UTC
From: Ong Hean Loong <hean.loong.ong@intel.com>

	This patch enables the display port IP driver for
	Intel Arria 10 SOCFPGA Golden Hardware
	Reference Design (GHRD).

	The driver requires enabling the options such as
	Coheherent Memory Allocation,
	Intel FPGA Frame Buffer, Frame Buffer Conasole

Signed-off-by: Ong Hean Loong <hean.loong.ong@intel.com>
---
 .../devicetree/bindings/video/intelfpgavipfb.txt   |   22 ++
 MAINTAINERS                                        |    6 +
 drivers/video/fbdev/Kconfig                        |   15 +
 drivers/video/fbdev/Makefile                       |    1 +
 drivers/video/fbdev/intelfpgavipfb.c               |  302 ++++++++++++++++++++
 5 files changed, 346 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/video/intelfpgavipfb.txt
 create mode 100644 drivers/video/fbdev/intelfpgavipfb.c

Comments

kernel test robot Nov. 16, 2016, 12:45 p.m. UTC | #1
Hi Ong,

[auto build test ERROR on linus/master]
[also build test ERROR on v4.9-rc5 next-20161116]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Ong-Hean-Loong/fbdev-add-Intel-FPGA-FRAME-BUFFER-driver/20161116-173833
config: blackfin-allmodconfig (attached as .config)
compiler: bfin-uclinux-gcc (GCC) 6.2.0
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=blackfin 

All errors (new ones prefixed by >>):

   mm/compaction.c: In function 'isolate_migratepages_block':
>> mm/compaction.c:821:9: error: implicit declaration of function 'isolate_movable_page' [-Werror=implicit-function-declaration]
        if (isolate_movable_page(page, isolate_mode))
            ^~~~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors
--
   In file included from mm/cma.c:28:0:
>> include/linux/memblock.h:425:15: error: unknown type name 'phys_addr_t'
    static inline phys_addr_t memblock_alloc(phys_addr_t size, phys_addr_t align)
                  ^~~~~~~~~~~
   include/linux/memblock.h:425:42: error: unknown type name 'phys_addr_t'
    static inline phys_addr_t memblock_alloc(phys_addr_t size, phys_addr_t align)
                                             ^~~~~~~~~~~
   include/linux/memblock.h:425:60: error: unknown type name 'phys_addr_t'
    static inline phys_addr_t memblock_alloc(phys_addr_t size, phys_addr_t align)
                                                               ^~~~~~~~~~~
   mm/cma.c: In function 'cma_init_reserved_mem':
>> mm/cma.c:182:16: error: implicit declaration of function 'memblock_is_region_reserved' [-Werror=implicit-function-declaration]
     if (!size || !memblock_is_region_reserved(base, size))
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   mm/cma.c: In function 'cma_declare_contiguous':
>> mm/cma.c:234:29: error: implicit declaration of function 'memblock_end_of_DRAM' [-Werror=implicit-function-declaration]
     phys_addr_t memblock_end = memblock_end_of_DRAM();
                                ^~~~~~~~~~~~~~~~~~~~
>> mm/cma.c:305:7: error: implicit declaration of function 'memblock_reserve' [-Werror=implicit-function-declaration]
          memblock_reserve(base, size) < 0) {
          ^~~~~~~~~~~~~~~~
>> mm/cma.c:319:11: error: implicit declaration of function 'memblock_alloc_range' [-Werror=implicit-function-declaration]
       addr = memblock_alloc_range(size, alignment,
              ^~~~~~~~~~~~~~~~~~~~
>> mm/cma.c:321:11: error: 'MEMBLOCK_NONE' undeclared (first use in this function)
              MEMBLOCK_NONE);
              ^~~~~~~~~~~~~
   mm/cma.c:321:11: note: each undeclared identifier is reported only once for each function it appears in
   cc1: some warnings being treated as errors

vim +/isolate_movable_page +821 mm/compaction.c

bda807d4 Minchan Kim     2016-07-26  805  		 * It's possible to migrate LRU and non-lru movable pages.
bda807d4 Minchan Kim     2016-07-26  806  		 * Skip any other type of page
bda807d4 Minchan Kim     2016-07-26  807  		 */
bda807d4 Minchan Kim     2016-07-26  808  		if (!PageLRU(page)) {
bda807d4 Minchan Kim     2016-07-26  809  			/*
bda807d4 Minchan Kim     2016-07-26  810  			 * __PageMovable can return false positive so we need
bda807d4 Minchan Kim     2016-07-26  811  			 * to verify it under page_lock.
bda807d4 Minchan Kim     2016-07-26  812  			 */
bda807d4 Minchan Kim     2016-07-26  813  			if (unlikely(__PageMovable(page)) &&
bda807d4 Minchan Kim     2016-07-26  814  					!PageIsolated(page)) {
bda807d4 Minchan Kim     2016-07-26  815  				if (locked) {
a52633d8 Mel Gorman      2016-07-28  816  					spin_unlock_irqrestore(zone_lru_lock(zone),
bda807d4 Minchan Kim     2016-07-26  817  									flags);
bda807d4 Minchan Kim     2016-07-26  818  					locked = false;
bda807d4 Minchan Kim     2016-07-26  819  				}
bda807d4 Minchan Kim     2016-07-26  820  
bda807d4 Minchan Kim     2016-07-26 @821  				if (isolate_movable_page(page, isolate_mode))
bda807d4 Minchan Kim     2016-07-26  822  					goto isolate_success;
bda807d4 Minchan Kim     2016-07-26  823  			}
bda807d4 Minchan Kim     2016-07-26  824  
fdd048e1 Vlastimil Babka 2016-05-19  825  			goto isolate_fail;
bda807d4 Minchan Kim     2016-07-26  826  		}
29c0dde8 Vlastimil Babka 2015-09-08  827  
119d6d59 David Rientjes  2014-04-03  828  		/*
119d6d59 David Rientjes  2014-04-03  829  		 * Migration will fail if an anonymous page is pinned in memory,

:::::: The code at line 821 was first introduced by commit
:::::: bda807d4445414e8e77da704f116bb0880fe0c76 mm: migrate: support non-lru movable page migration

:::::: TO: Minchan Kim <minchan@kernel.org>
:::::: CC: Linus Torvalds <torvalds@linux-foundation.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
kernel test robot Nov. 16, 2016, 1:33 p.m. UTC | #2
Hi Ong,

[auto build test WARNING on linus/master]
[also build test WARNING on v4.9-rc5 next-20161116]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Ong-Hean-Loong/fbdev-add-Intel-FPGA-FRAME-BUFFER-driver/20161116-173833
config: s390-allmodconfig (attached as .config)
compiler: s390x-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=s390 

All warnings (new ones prefixed by >>):

warning: (DRM_KMS_FB_HELPER && FB_INTEL_FPGA_VIP) selects FRAMEBUFFER_CONSOLE which has unmet direct dependencies (HAS_IOMEM && VT && FB && !UML)
warning: (DRM_KMS_FB_HELPER && FB_INTEL_FPGA_VIP) selects FRAMEBUFFER_CONSOLE_DETECT_PRIMARY which has unmet direct dependencies (HAS_IOMEM && VT && FRAMEBUFFER_CONSOLE)

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
Rob Herring (Arm) Nov. 18, 2016, 2:09 p.m. UTC | #3
On Wed, Nov 16, 2016 at 05:07:58PM +0800, Ong, Hean Loong wrote:
> From: Ong Hean Loong <hean.loong.ong@intel.com>
> 
> 	This patch enables the display port IP driver for
> 	Intel Arria 10 SOCFPGA Golden Hardware
> 	Reference Design (GHRD).
> 
> 	The driver requires enabling the options such as
> 	Coheherent Memory Allocation,
> 	Intel FPGA Frame Buffer, Frame Buffer Conasole
> 
> Signed-off-by: Ong Hean Loong <hean.loong.ong@intel.com>
> ---
>  .../devicetree/bindings/video/intelfpgavipfb.txt   |   22 ++

bindings/display/

It is preferred that bindings are a separate patch.

>  MAINTAINERS                                        |    6 +
>  drivers/video/fbdev/Kconfig                        |   15 +
>  drivers/video/fbdev/Makefile                       |    1 +
>  drivers/video/fbdev/intelfpgavipfb.c               |  302 ++++++++++++++++++++

AIUI, we're not taking new FB drivers. This should be a DRM driver 
instead.

>  5 files changed, 346 insertions(+), 0 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/video/intelfpgavipfb.txt
>  create mode 100644 drivers/video/fbdev/intelfpgavipfb.c
> 
> diff --git a/Documentation/devicetree/bindings/video/intelfpgavipfb.txt b/Documentation/devicetree/bindings/video/intelfpgavipfb.txt
> new file mode 100644
> index 0000000..8928c99
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/video/intelfpgavipfb.txt
> @@ -0,0 +1,22 @@
> +Intel FPGA Video and Image Processing(VIP) Frame Buffer bindings
> +
> +Required properties:
> +- compatible: "intel,vip-frame-buffer2"

Should be something like 'intel,arria10-vip'. Describe the h/w block, 
frame-buffer is a Linux term.

> +- reg: Physical base address and length of the framebuffer controller's
> +  registers.
> +- max-width: The width of the framebuffer in pixels.
> +- max-height: The height of the framebuffer in pixels.
> +- bits-per-color: only "8" is currently supported

These are not h/w properties.

> +- mem-word-width = the bus width of the avalon master port on the frame reader

Needs a vendor prefix.

> +
> +Example:
> +
> +alt_vip_vfr_0: vip@0xff260000 {
> +	compatible = "intel,vip-frame-buffer2";
> +	reg = <0xff260000 0x00000080>;
> +	max-width = <1024>;
> +	max-height = <768>;
> +	bits-per-color = <8>;
> +	mem-word-width = <128>;
> +};
> +
--
To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Alan Cox Nov. 18, 2016, 2:15 p.m. UTC | #4
> AIUI, we're not taking new FB drivers. This should be a DRM driver 
> instead.

Yes - clone one of the dumb DRM drivers, or if you've got any little bits
of acceleration (even rolling the display) then it's possibly worth
accelerating for text mode.

> > +- max-width: The width of the framebuffer in pixels.
> > +- max-height: The height of the framebuffer in pixels.
> > +- bits-per-color: only "8" is currently supported  
> 
> These are not h/w properties.

How are the max ones not hardware properties ?

Alan
--
To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Rob Herring (Arm) Nov. 18, 2016, 6:56 p.m. UTC | #5
On Fri, Nov 18, 2016 at 8:15 AM, One Thousand Gnomes
<gnomes@lxorguk.ukuu.org.uk> wrote:
>> AIUI, we're not taking new FB drivers. This should be a DRM driver
>> instead.
>
> Yes - clone one of the dumb DRM drivers, or if you've got any little bits
> of acceleration (even rolling the display) then it's possibly worth
> accelerating for text mode.
>
>> > +- max-width: The width of the framebuffer in pixels.
>> > +- max-height: The height of the framebuffer in pixels.
>> > +- bits-per-color: only "8" is currently supported
>>
>> These are not h/w properties.
>
> How are the max ones not hardware properties ?

Because the way they are used is setting the mode, not some check of
the max when the mode is set. If this is synthesized for only one
size, then that would be different, but we have bindings for modes.

Rob
--
To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Hean-Loong, Ong Nov. 21, 2016, 2:41 a.m. UTC | #6
On Fri, 2016-11-18 at 12:56 -0600, Rob Herring wrote:
> On Fri, Nov 18, 2016 at 8:15 AM, One Thousand Gnomes
> <gnomes@lxorguk.ukuu.org.uk> wrote:
> > 
> > > 
> > > AIUI, we're not taking new FB drivers. This should be a DRM
> > > driver
> > > instead.
> > Yes - clone one of the dumb DRM drivers, or if you've got any
> > little bits
> > of acceleration (even rolling the display) then it's possibly worth
> > accelerating for text mode.
> > 
> > > 
> > > > 
> > > > +- max-width: The width of the framebuffer in pixels.
> > > > +- max-height: The height of the framebuffer in pixels.
> > > > +- bits-per-color: only "8" is currently supported
> > > These are not h/w properties.
> > How are the max ones not hardware properties ?
> Because the way they are used is setting the mode, not some check of
> the max when the mode is set. If this is synthesized for only one
> size, then that would be different, but we have bindings for modes.
> 
> Rob

Currently the idea is to just synthesize the display to just 1920 x
1080. Therefore we came to a conclusion that it should be part of the
HW properties.

HeanLoong
--
To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Tomi Valkeinen Nov. 23, 2016, 7:30 a.m. UTC | #7
Hi,

On 16/11/16 11:07, Ong, Hean Loong wrote:
> From: Ong Hean Loong <hean.loong.ong@intel.com>
> 
> 	This patch enables the display port IP driver for
> 	Intel Arria 10 SOCFPGA Golden Hardware
> 	Reference Design (GHRD).
> 
> 	The driver requires enabling the options such as
> 	Coheherent Memory Allocation,
> 	Intel FPGA Frame Buffer, Frame Buffer Conasole
> 
> Signed-off-by: Ong Hean Loong <hean.loong.ong@intel.com>
> ---
>  .../devicetree/bindings/video/intelfpgavipfb.txt   |   22 ++
>  MAINTAINERS                                        |    6 +
>  drivers/video/fbdev/Kconfig                        |   15 +
>  drivers/video/fbdev/Makefile                       |    1 +
>  drivers/video/fbdev/intelfpgavipfb.c               |  302 ++++++++++++++++++++
>  5 files changed, 346 insertions(+), 0 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/video/intelfpgavipfb.txt
>  create mode 100644 drivers/video/fbdev/intelfpgavipfb.c

As mentioned by Rob and Alan, no new fbdev drivers please. Write a DRM
driver for this.

 Tomi
diff mbox

Patch

diff --git a/Documentation/devicetree/bindings/video/intelfpgavipfb.txt b/Documentation/devicetree/bindings/video/intelfpgavipfb.txt
new file mode 100644
index 0000000..8928c99
--- /dev/null
+++ b/Documentation/devicetree/bindings/video/intelfpgavipfb.txt
@@ -0,0 +1,22 @@ 
+Intel FPGA Video and Image Processing(VIP) Frame Buffer bindings
+
+Required properties:
+- compatible: "intel,vip-frame-buffer2"
+- reg: Physical base address and length of the framebuffer controller's
+  registers.
+- max-width: The width of the framebuffer in pixels.
+- max-height: The height of the framebuffer in pixels.
+- bits-per-color: only "8" is currently supported
+- mem-word-width = the bus width of the avalon master port on the frame reader
+
+Example:
+
+alt_vip_vfr_0: vip@0xff260000 {
+	compatible = "intel,vip-frame-buffer2";
+	reg = <0xff260000 0x00000080>;
+	max-width = <1024>;
+	max-height = <768>;
+	bits-per-color = <8>;
+	mem-word-width = <128>;
+};
+
diff --git a/MAINTAINERS b/MAINTAINERS
index 4012c2f..bfc2687 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -6314,6 +6314,12 @@  L:	linux-fbdev@vger.kernel.org
 S:	Maintained
 F:	drivers/video/fbdev/i810/
 
+INTEL FPGA FRAMEBUFFER DRIVER
+M:	Ong, Hean Loong <hean.loong.ong@intel.com>
+L:	linux-fbdev@vger.kernel.org
+S:	Maintained
+F:	drivers/video/fbdev/intvipfb.c
+
 INTEL MENLOW THERMAL DRIVER
 M:	Sujith Thomas <sujith.thomas@intel.com>
 L:	platform-driver-x86@vger.kernel.org
diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig
index 5d3b0db..5c9d674 100644
--- a/drivers/video/fbdev/Kconfig
+++ b/drivers/video/fbdev/Kconfig
@@ -228,6 +228,21 @@  config FB_TILEBLITTING
 comment "Frame buffer hardware drivers"
 	depends on FB
 
+config FB_INTEL_FPGA_VIP
+       	tristate "Intel FPGA VIP framebuffer support"
+	depends on FB
+       	select CMA
+       	select FB_CFB_FILLRECT
+       	select FB_CFB_COPYAREA
+       	select FB_CFB_IMAGEBLIT
+       	select FRAMEBUFFER_CONSOLE
+	select FRAMEBUFFER_CONSOLE_DETECT_PRIMARY if  FRAMEBUFFER_CONSOLE
+	---help---
+	The FB_INTEL_FPGA_VIP driver supports the formerly Altera Video and Image Processing(VIP)
+	Frame Buffer II. Requires CONFIG_CMA and Frame Buffer Console to
+	be enabled as well. The driver currently only supports ARRIA 10 board from the Intel
+	FPGA Reference Design board family.
+
 config FB_GRVGA
 	tristate "Aeroflex Gaisler framebuffer support"
 	depends on FB && SPARC
diff --git a/drivers/video/fbdev/Makefile b/drivers/video/fbdev/Makefile
index ee8c814..6c30549 100644
--- a/drivers/video/fbdev/Makefile
+++ b/drivers/video/fbdev/Makefile
@@ -10,6 +10,7 @@  obj-$(CONFIG_FB_MACMODES)      += macmodes.o
 obj-$(CONFIG_FB_WMT_GE_ROPS)   += wmt_ge_rops.o
 
 # Hardware specific drivers go first
+obj-$(CONFIG_FB_INTEL_FPGA_VIP)   += intelfpgavipfb.o
 obj-$(CONFIG_FB_AMIGA)            += amifb.o c2p_planar.o
 obj-$(CONFIG_FB_ARC)              += arcfb.o
 obj-$(CONFIG_FB_CLPS711X)	  += clps711x-fb.o
diff --git a/drivers/video/fbdev/intelfpgavipfb.c b/drivers/video/fbdev/intelfpgavipfb.c
new file mode 100644
index 0000000..9f5ca26
--- /dev/null
+++ b/drivers/video/fbdev/intelfpgavipfb.c
@@ -0,0 +1,302 @@ 
+/*
+ * Copyright (C) 2016 Intel Corporation. All rights reserved
+ *
+ * intelfpgavipfb.c -- Intel Video and Image Processing(VIP)
+ * Frame Buffer II driver
+ *
+ * This is based on a driver made by Thomas Chou <thomas@wytron.com.tw> and
+ * Winteler Goossens <wintelergoossens@home.nl> This driver supports the
+ * Intel VIP Frame Buffer II component.  More info on the hardware can be
+ * found in the Intel Video and Image Processing Suite User Guide at
+ * http://www.intelera.com/literature/ug/ug_vip.pdf.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope 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.
+ *
+ */
+
+#include <linux/dma-mapping.h>
+#include <linux/fb.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+
+#define PALETTE_SIZE	256
+#define DRIVER_NAME	"intelvipfb"
+
+/* control registers */
+#define INTVIPFB2_CONTROL			0
+#define INTVIPFB2_STATUS			0x4
+#define INTVIPFB2_INTERRUPT			0x8
+#define INTVIPFB2_FRAME_COUNTER		0xC
+#define INTVIPFB2_FRAME_DROP		0x10
+#define INTVIPFB2_FRAME_INFO		0x14
+#define INTVIPFB2_FRAME_START		0x18
+#define INTVIPFB2_FRAME_READER		0x1C
+
+#define BITS_PER_PIXEL		32
+
+struct intelvipfb_dev {
+	struct platform_device *pdev;
+	struct fb_info info;
+	struct resource *reg_res;
+	void __iomem *base;
+	int mem_word_width;
+	u32 pseudo_palette[PALETTE_SIZE];
+};
+
+static int intelvipfb_setcolreg(unsigned int regno, unsigned int red,
+				unsigned int green, unsigned int blue,
+				unsigned int transp, struct fb_info *info)
+{
+	/*
+	 *  Set a single color register. The values supplied have a 32 bit
+	 *  magnitude.
+	 *  Return != 0 for invalid regno.
+	 */
+
+	if (regno > 255)
+		return 1;
+
+	red >>= 8;
+	green >>= 8;
+	blue >>= 8;
+	if (regno < 255) {
+		((u32 *)info->pseudo_palette)[regno] =
+		((red & 255) << 16) | ((green & 255) << 8) | (blue & 255);
+	}
+
+	return 0;
+}
+
+static struct fb_ops intelvipfb_ops = {
+	.owner = THIS_MODULE,
+	.fb_fillrect = cfb_fillrect,
+	.fb_copyarea = cfb_copyarea,
+	.fb_imageblit = cfb_imageblit,
+	.fb_setcolreg = intelvipfb_setcolreg,
+};
+
+static int intelvipfb_of_setup(struct intelvipfb_dev *fbdev)
+{
+	struct device_node *np = fbdev->pdev->dev.of_node;
+	int ret;
+	u32 bits_per_color;
+
+	ret = of_property_read_u32(np, "max-width", &fbdev->info.var.xres);
+	if (ret) {
+		dev_err(&fbdev->pdev->dev,
+			"Missing required parameter 'max-width'");
+		return ret;
+	}
+	fbdev->info.var.xres_virtual = fbdev->info.var.xres,
+
+	ret = of_property_read_u32(np, "max-height", &fbdev->info.var.yres);
+	if (ret) {
+		dev_err(&fbdev->pdev->dev,
+			"Missing required parameter 'max-height'");
+		return ret;
+	}
+	fbdev->info.var.yres_virtual = fbdev->info.var.yres;
+
+	ret = of_property_read_u32(np, "bits-per-color", &bits_per_color);
+	if (ret) {
+		dev_err(&fbdev->pdev->dev,
+			"Missing required parameter 'bits-per-color'");
+		return ret;
+	}
+	if (bits_per_color != 8) {
+		dev_err(&fbdev->pdev->dev,
+			"bits-per-color is set to %i.  Currently only 8 is supported.",
+			bits_per_color);
+		return -ENODEV;
+	}
+	fbdev->info.var.bits_per_pixel = BITS_PER_PIXEL;
+
+	ret = of_property_read_u32(np, "mem-word-width",
+				   &fbdev->mem_word_width);
+	if (ret) {
+		dev_err(&fbdev->pdev->dev,
+			"Missing required parameter 'mem-word-width'");
+		return ret;
+	}
+	if (!(fbdev->mem_word_width >= BITS_PER_PIXEL &&
+	      fbdev->mem_word_width % BITS_PER_PIXEL == 0)) {
+		dev_err(&fbdev->pdev->dev,
+			"mem-word-width is set to %i.  must be >= 32 and multiple of 32.",
+			fbdev->mem_word_width);
+		return -ENODEV;
+	}
+
+	return 0;
+}
+
+static void intelvipfb_start_hw(struct intelvipfb_dev *fbdev)
+{
+	/*
+	 * The frameinfo variable has to correspond to the size of the VIP Suite
+	 * Frame Reader register 7 which will determine the maximum size used
+	 * in this frameinfo
+	 */
+	u32 frameinfo = readl(fbdev->base +
+				INTVIPFB2_FRAME_READER) & 0x00ffffff;
+
+	writel(frameinfo, fbdev->base + INTVIPFB2_FRAME_INFO);
+	writel(fbdev->info.fix.smem_start, fbdev->base + INTVIPFB2_FRAME_START);
+	/* Finally set the control register to 1 to start streaming */
+	writel(1, fbdev->base + INTVIPFB2_CONTROL);
+}
+
+static void intelvipfb_disable_hw(struct intelvipfb_dev *fbdev)
+{
+	/* set the control register to 0 to stop streaming */
+	writel(0, fbdev->base + INTVIPFB2_CONTROL);
+}
+
+static int intelvipfb_setup_fb_info(struct intelvipfb_dev *fbdev)
+{
+	struct fb_info *info = &fbdev->info;
+	int ret;
+
+	strcpy(info->fix.id, DRIVER_NAME);
+	info->fix.type = FB_TYPE_PACKED_PIXELS;
+	info->fix.visual = FB_VISUAL_TRUECOLOR;
+	info->fix.accel = FB_ACCEL_NONE;
+
+	info->fbops = &intelvipfb_ops;
+	info->var.activate = FB_ACTIVATE_NOW;
+	info->var.height = -1;
+	info->var.width = -1;
+	info->var.vmode = FB_VMODE_NONINTERLACED;
+
+	ret = intelvipfb_of_setup(fbdev);
+	if (ret)
+		return ret;
+
+	/* settings for 32bit pixels */
+	info->var.red.offset = 16;
+	info->var.red.length = 8;
+	info->var.red.msb_right = 0;
+	info->var.green.offset = 8;
+	info->var.green.length = 8;
+	info->var.green.msb_right = 0;
+	info->var.blue.offset = 0;
+	info->var.blue.length = 8;
+	info->var.blue.msb_right = 0;
+
+	info->fix.line_length = (info->var.xres *
+		(info->var.bits_per_pixel >> 3));
+	info->fix.smem_len = info->fix.line_length * info->var.yres;
+
+	info->pseudo_palette = fbdev->pseudo_palette;
+	info->flags = FBINFO_FLAG_DEFAULT;
+
+	return 0;
+}
+
+static int intelvipfb_probe(struct platform_device *pdev)
+{
+	int retval;
+	void *fbmem_virt;
+	struct intelvipfb_dev *fbdev;
+
+	fbdev = devm_kzalloc(&pdev->dev, sizeof(*fbdev), GFP_KERNEL);
+	if (!fbdev)
+		return -ENOMEM;
+
+	fbdev->pdev = pdev;
+	fbdev->reg_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!fbdev->reg_res)
+		return -ENODEV;
+
+	fbdev->base = devm_ioremap_resource(&pdev->dev, fbdev->reg_res);
+	if (IS_ERR(fbdev->base)) {
+		dev_err(&pdev->dev, "devm_ioremap_resource failed\n");
+		retval = PTR_ERR(fbdev->base);
+		return -ENODEV;
+	}
+
+	retval = intelvipfb_setup_fb_info(fbdev);
+
+	fbmem_virt = dma_alloc_coherent(NULL,
+					fbdev->info.fix.smem_len,
+					(void *)&fbdev->info.fix.smem_start,
+					GFP_KERNEL);
+	if (!fbmem_virt) {
+		dev_err(&pdev->dev,
+			"intelvipfb: unable to allocate %d Bytes fb memory\n",
+			fbdev->info.fix.smem_len);
+		return retval;
+	}
+
+	fbdev->info.screen_base = fbmem_virt;
+
+	retval = fb_alloc_cmap(&fbdev->info.cmap, PALETTE_SIZE, 0);
+	if (retval < 0)
+		goto err_dma_free;
+
+	platform_set_drvdata(pdev, fbdev);
+
+	intelvipfb_start_hw(fbdev);
+
+	retval = register_framebuffer(&fbdev->info);
+	if (retval < 0)
+		goto err_dealloc_cmap;
+
+	dev_info(&pdev->dev, "fb%d: %s frame buffer device at 0x%x+0x%x\n",
+		 fbdev->info.node, fbdev->info.fix.id,
+		 (unsigned int)fbdev->info.fix.smem_start,
+		 fbdev->info.fix.smem_len);
+
+	return 0;
+
+err_dealloc_cmap:
+	fb_dealloc_cmap(&fbdev->info.cmap);
+err_dma_free:
+	dma_free_coherent(NULL, fbdev->info.fix.smem_len, fbmem_virt,
+			  fbdev->info.fix.smem_start);
+	return retval;
+}
+
+static int intelvipfb_remove(struct platform_device *dev)
+{
+	struct intelvipfb_dev *fbdev = platform_get_drvdata(dev);
+
+	if (fbdev) {
+		unregister_framebuffer(&fbdev->info);
+		fb_dealloc_cmap(&fbdev->info.cmap);
+		dma_free_coherent(NULL, fbdev->info.fix.smem_len,
+				  fbdev->info.screen_base,
+				  fbdev->info.fix.smem_start);
+		intelvipfb_disable_hw(fbdev);
+	}
+	return 0;
+}
+
+static const struct of_device_id intelvipfb_match[] = {
+	{ .compatible = "intel,vip-frame-buffer2" },
+	{},
+};
+MODULE_DEVICE_TABLE(of, intelvipfb_match);
+
+static struct platform_driver intelvipfb_driver = {
+	.probe = intelvipfb_probe,
+	.remove = intelvipfb_remove,
+	.driver = {
+		.name = DRIVER_NAME,
+		.of_match_table = intelvipfb_match,
+	},
+};
+module_platform_driver(intelvipfb_driver);
+
+MODULE_DESCRIPTION("Intel VIP Frame Buffer II driver");
+MODULE_AUTHOR("Chris Rauer <christopher.rauer@intel.com>");
+MODULE_LICENSE("GPL v2");
+