Re: [U-Boot] [PATCH v2 07/12] dm: x86: video: Add a driver-model driver for ivybridge graphics

2016-10-07 Thread Bin Meng
On Sat, Oct 8, 2016 at 10:33 AM, Bin Meng  wrote:
> On Thu, Oct 6, 2016 at 10:42 AM, Simon Glass  wrote:
>> At present we use the legacy vesa driver for graphics. Add a driver which
>> supports driver model. This can be probed only when needed, removing the
>> need to start up the display if it is not used.
>>
>> Signed-off-by: Simon Glass 
>> ---
>>
>> Changes in v2:
>> - Drop invalid '1' at start of file
>> - Comment that no details are available about the magic values
>>
>>  drivers/video/Kconfig |  12 +
>>  drivers/video/Makefile|   1 +
>>  drivers/video/ivybridge_igd.c | 843 
>> ++
>>  3 files changed, 856 insertions(+)
>>  create mode 100644 drivers/video/ivybridge_igd.c
>>
>
> Reviewed-by: Bin Meng 

Move this patch after patch#9 in this series, and applied to u-boot-x86, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 07/12] dm: x86: video: Add a driver-model driver for ivybridge graphics

2016-10-07 Thread Bin Meng
On Thu, Oct 6, 2016 at 10:42 AM, Simon Glass  wrote:
> At present we use the legacy vesa driver for graphics. Add a driver which
> supports driver model. This can be probed only when needed, removing the
> need to start up the display if it is not used.
>
> Signed-off-by: Simon Glass 
> ---
>
> Changes in v2:
> - Drop invalid '1' at start of file
> - Comment that no details are available about the magic values
>
>  drivers/video/Kconfig |  12 +
>  drivers/video/Makefile|   1 +
>  drivers/video/ivybridge_igd.c | 843 
> ++
>  3 files changed, 856 insertions(+)
>  create mode 100644 drivers/video/ivybridge_igd.c
>

Reviewed-by: Bin Meng 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 07/12] dm: x86: video: Add a driver-model driver for ivybridge graphics

2016-10-05 Thread Simon Glass
At present we use the legacy vesa driver for graphics. Add a driver which
supports driver model. This can be probed only when needed, removing the
need to start up the display if it is not used.

Signed-off-by: Simon Glass 
---

Changes in v2:
- Drop invalid '1' at start of file
- Comment that no details are available about the magic values

 drivers/video/Kconfig |  12 +
 drivers/video/Makefile|   1 +
 drivers/video/ivybridge_igd.c | 843 ++
 3 files changed, 856 insertions(+)
 create mode 100644 drivers/video/ivybridge_igd.c

diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 97dbb64..fd26690 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -374,6 +374,18 @@ config VIDEO_BROADWELL_IGD
  a special tool which configures the VGA ROM, but the graphics
  resolution can be selected in U-Boot.
 
+config VIDEO_IVYBRIDGE_IGD
+   bool "Enable Intel Ivybridge integration graphics support"
+   depends on X86
+   help
+ This enables support for integrated graphics on Intel ivybridge
+ devices. Initialisation is mostly performed by a VGA boot ROM, with
+ some setup handled by U-Boot itself. The graphics adaptor works as
+ a VESA device and supports LCD panels, eDP and LVDS outputs.
+ Configuration of most aspects of device operation is performed using
+ a special tool which configures the VGA ROM, but the graphics
+ resolution can be selected in U-Boot.
+
 config VIDEO_ROCKCHIP
bool "Enable Rockchip video support"
depends on DM_VIDEO
diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index 3f045fe..b888e99 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -20,6 +20,7 @@ obj-$(CONFIG_CONSOLE_TRUETYPE) += console_truetype.o fonts/
 endif
 
 obj-$(CONFIG_VIDEO_BROADWELL_IGD) += broadwell_igd.o
+obj-$(CONFIG_VIDEO_IVYBRIDGE_IGD) += ivybridge_igd.o
 
 obj-$(CONFIG_ATI_RADEON_FB) += ati_radeon_fb.o videomodes.o
 obj-$(CONFIG_ATMEL_HLCD) += atmel_hlcdfb.o
diff --git a/drivers/video/ivybridge_igd.c b/drivers/video/ivybridge_igd.c
new file mode 100644
index 000..94db3dd
--- /dev/null
+++ b/drivers/video/ivybridge_igd.c
@@ -0,0 +1,843 @@
+/*
+ * Copyright (C) 2016 Google, Inc
+ *
+ * SPDX-License-Identifier:GPL-2.0
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+struct gt_powermeter {
+   u16 reg;
+   u32 value;
+};
+
+/* These are magic values - unfortunately the meaning is unknown */
+static const struct gt_powermeter snb_pm_gt1[] = {
+   { 0xa200, 0xcc00 },
+   { 0xa204, 0x0740 },
+   { 0xa208, 0xfe00 },
+   { 0xa20c, 0x },
+   { 0xa210, 0x1700 },
+   { 0xa214, 0x0021 },
+   { 0xa218, 0x0817fe19 },
+   { 0xa21c, 0x },
+   { 0xa220, 0x },
+   { 0xa224, 0xcc00 },
+   { 0xa228, 0x0740 },
+   { 0xa22c, 0xfe00 },
+   { 0xa230, 0x },
+   { 0xa234, 0x1700 },
+   { 0xa238, 0x0021 },
+   { 0xa23c, 0x0817fe19 },
+   { 0xa240, 0x },
+   { 0xa244, 0x },
+   { 0xa248, 0x8000421e },
+   { 0 }
+};
+
+static const struct gt_powermeter snb_pm_gt2[] = {
+   { 0xa200, 0x33a6 },
+   { 0xa204, 0x402d0031 },
+   { 0xa208, 0x00165f83 },
+   { 0xa20c, 0xf100 },
+   { 0xa210, 0x },
+   { 0xa214, 0x00160016 },
+   { 0xa218, 0x002a002b },
+   { 0xa21c, 0x },
+   { 0xa220, 0x },
+   { 0xa224, 0x33a6 },
+   { 0xa228, 0x402d0031 },
+   { 0xa22c, 0x00165f83 },
+   { 0xa230, 0xf100 },
+   { 0xa234, 0x },
+   { 0xa238, 0x00160016 },
+   { 0xa23c, 0x002a002b },
+   { 0xa240, 0x },
+   { 0xa244, 0x },
+   { 0xa248, 0x8000421e },
+   { 0 }
+};
+
+static const struct gt_powermeter ivb_pm_gt1[] = {
+   { 0xa800, 0x },
+   { 0xa804, 0x00021c00 },
+   { 0xa808, 0x0403 },
+   { 0xa80c, 0x02001700 },
+   { 0xa810, 0x05000200 },
+   { 0xa814, 0x },
+   { 0xa818, 0x00690500 },
+   { 0xa81c, 0x007f },
+   { 0xa820, 0x01002501 },
+   { 0xa824, 0x0300 },
+   { 0xa828, 0x01000331 },
+   { 0xa82c, 0x000c },
+   { 0xa830, 0x00010016 },
+   { 0xa834, 0x01100101 },
+   { 0xa838, 0x00010103 },
+   { 0xa83c, 0x00041300 },
+   { 0xa840, 0x0b30 },
+   { 0xa844, 0x },
+   { 0xa848, 0x7f00 },
+   { 0xa84c, 0x0508 },
+   { 0xa850, 0x0001 },
+   { 0xa854, 0x0004 },
+   { 0xa858, 0x0007 },
+   { 0xa85c, 0x },
+   { 0xa860, 0x0001 },
+   { 0xa248, 0x221e },
+   { 0xa900, 0x },
+   { 0xa904, 0x1c00 },
+   { 0xa908, 0x },