* [PATCH 01/17] fdt: Add function to look up a phandle's register address
[not found] ` <1326588449-1794-1-git-send-email-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
@ 2012-01-15 0:47 ` Simon Glass
2012-01-15 0:47 ` [PATCH 02/17] fdt: Add header guard to fdtdec.h Simon Glass
` (3 subsequent siblings)
4 siblings, 0 replies; 5+ messages in thread
From: Simon Glass @ 2012-01-15 0:47 UTC (permalink / raw)
To: U-Boot Mailing List; +Cc: Devicetree Discuss, Tom Warren, Jerry Van Baren
This is a commonly-used requirement, so add a function to support it
easily.
Signed-off-by: Simon Glass <sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
---
include/fdtdec.h | 13 +++++++++++++
lib/fdtdec.c | 11 +++++++++++
2 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/include/fdtdec.h b/include/fdtdec.h
index e705124..81ce3f6 100644
--- a/include/fdtdec.h
+++ b/include/fdtdec.h
@@ -239,6 +239,19 @@ const char *fdtdec_get_compatible(enum fdt_compat_id id);
int fdtdec_lookup_phandle(const void *blob, int node, const char *prop_name);
/**
+ * Look up a phandle and follow it to its node. Then return the register
+ * address of that node as a pointer. This can be used to access the
+ * peripheral directly.
+ *
+ * @param blob FDT blob
+ * @param node node to examine
+ * @param prop_name name of property to find
+ * @return pointer to node's register address
+ */
+void *fdtdec_lookup_phandle_reg(const void *blob, int node,
+ const char *prop_name);
+
+/**
* Look up a property in a node and return its contents in an integer
* array of given length. The property must have at least enough data for
* the array (4*count bytes). It may have more, but this will be ignored.
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index 48abf02..bcb2343 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -311,6 +311,17 @@ int fdtdec_lookup_phandle(const void *blob, int node, const char *prop_name)
return lookup;
}
+void *fdtdec_lookup_phandle_reg(const void *blob, int node,
+ const char *prop_name)
+{
+ int lookup;
+
+ lookup = fdtdec_lookup_phandle(blob, node, prop_name);
+ if (lookup < 0)
+ return NULL;
+ return (void *)fdtdec_get_addr(blob, lookup, "reg");
+}
+
/**
* Look up a property in a node and check that it has a minimum length.
*
--
1.7.7.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 02/17] fdt: Add header guard to fdtdec.h
[not found] ` <1326588449-1794-1-git-send-email-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2012-01-15 0:47 ` [PATCH 01/17] fdt: Add function to look up a phandle's register address Simon Glass
@ 2012-01-15 0:47 ` Simon Glass
2012-01-15 0:47 ` [PATCH 03/17] fdt: Correct GPIO name access in fdtdec Simon Glass
` (2 subsequent siblings)
4 siblings, 0 replies; 5+ messages in thread
From: Simon Glass @ 2012-01-15 0:47 UTC (permalink / raw)
To: U-Boot Mailing List; +Cc: Devicetree Discuss, Tom Warren, Jerry Van Baren
This makes it easier to include this header from other headers.
Signed-off-by: Simon Glass <sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
---
include/fdtdec.h | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/include/fdtdec.h b/include/fdtdec.h
index 81ce3f6..f60c969 100644
--- a/include/fdtdec.h
+++ b/include/fdtdec.h
@@ -19,6 +19,8 @@
* MA 02111-1307 USA
*/
+#ifndef __fdtdec_h
+#define __fdtdec_h
/*
* This file contains convenience functions for decoding useful and
@@ -371,3 +373,4 @@ int fdtdec_get_byte_array(const void *blob, int node, const char *prop_name,
*/
const u8 *fdtdec_locate_byte_array(const void *blob, int node,
const char *prop_name, int count);
+#endif
--
1.7.7.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 03/17] fdt: Correct GPIO name access in fdtdec
[not found] ` <1326588449-1794-1-git-send-email-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2012-01-15 0:47 ` [PATCH 01/17] fdt: Add function to look up a phandle's register address Simon Glass
2012-01-15 0:47 ` [PATCH 02/17] fdt: Add header guard to fdtdec.h Simon Glass
@ 2012-01-15 0:47 ` Simon Glass
2012-01-15 0:47 ` [PATCH 05/17] tegra: fdt: Add LCD definitions for Tegra Simon Glass
2012-01-15 0:47 ` [PATCH 15/17] tegra: fdt: Add LCD definitions for Seaboard Simon Glass
4 siblings, 0 replies; 5+ messages in thread
From: Simon Glass @ 2012-01-15 0:47 UTC (permalink / raw)
To: U-Boot Mailing List; +Cc: Devicetree Discuss, Tom Warren, Jerry Van Baren
This was missing an fdt32_to_cpu() call so got the name pointer wrong.
If the GPIO module looks at it, this would cause a problem.
Signed-off-by: Simon Glass <sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
---
lib/fdtdec.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index bcb2343..f7d0c95 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -418,7 +418,7 @@ static int fdtdec_decode_gpios(const void *blob, int node,
}
/* We will use the name to tag the GPIO */
- name = fdt_string(blob, prop->nameoff);
+ name = fdt_string(blob, fdt32_to_cpu(prop->nameoff));
cell = (u32 *)prop->data;
len /= sizeof(u32) * 3; /* 3 cells per GPIO record */
if (len > max_count) {
@@ -444,6 +444,7 @@ int fdtdec_decode_gpio(const void *blob, int node, const char *prop_name,
debug("%s: %s\n", __func__, prop_name);
gpio->gpio = FDT_GPIO_NONE;
+ gpio->name = NULL;
err = fdtdec_decode_gpios(blob, node, prop_name, gpio, 1);
return err == 1 ? 0 : err;
}
--
1.7.7.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 05/17] tegra: fdt: Add LCD definitions for Tegra
[not found] ` <1326588449-1794-1-git-send-email-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
` (2 preceding siblings ...)
2012-01-15 0:47 ` [PATCH 03/17] fdt: Correct GPIO name access in fdtdec Simon Glass
@ 2012-01-15 0:47 ` Simon Glass
2012-01-15 0:47 ` [PATCH 15/17] tegra: fdt: Add LCD definitions for Seaboard Simon Glass
4 siblings, 0 replies; 5+ messages in thread
From: Simon Glass @ 2012-01-15 0:47 UTC (permalink / raw)
To: U-Boot Mailing List; +Cc: Devicetree Discuss, Tom Warren, Jerry Van Baren
Add LCD definitions and also a proposed binding for LCD displays.
The PWFM is in progress on the device-tree-discuss list, so only a
very basic binding is offered here.
Signed-off-by: Simon Glass <sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
---
arch/arm/dts/tegra20.dtsi | 25 ++++++
doc/device-tree-bindings/video/nvidia-video.txt | 92 +++++++++++++++++++++++
2 files changed, 117 insertions(+), 0 deletions(-)
create mode 100644 doc/device-tree-bindings/video/nvidia-video.txt
diff --git a/arch/arm/dts/tegra20.dtsi b/arch/arm/dts/tegra20.dtsi
index 3d435aa..85c8bf6 100644
--- a/arch/arm/dts/tegra20.dtsi
+++ b/arch/arm/dts/tegra20.dtsi
@@ -221,4 +221,29 @@
compatible = "nvidia,tegra20-kbc";
reg = <0x7000e200 0x0078>;
};
+
+ pwfm0: pwm@7000a000 {
+ compatible = "nvidia,tegra20-pwfm";
+ reg = <0x7000a000 0x4>;
+ };
+
+ pwfm1: pwm@7000a010 {
+ compatible = "nvidia,tegra20-pwfm";
+ reg = <0x7000a010 0x4>;
+ };
+
+ pwfm2: pwm@7000a020 {
+ compatible = "nvidia,tegra20-pwfm";
+ reg = <0x7000a020 0x4>;
+ };
+
+ pwfm3: pwm@7000a030 {
+ compatible = "nvidia,tegra20-pwfm";
+ reg = <0x7000a030 0x4>;
+ };
+
+ display1: display@0x54200000 {
+ compatible = "nvidia,tegra20-display";
+ reg = <0x54200000 0x40000>;
+ };
};
diff --git a/doc/device-tree-bindings/video/nvidia-video.txt b/doc/device-tree-bindings/video/nvidia-video.txt
new file mode 100644
index 0000000..ede9260
--- /dev/null
+++ b/doc/device-tree-bindings/video/nvidia-video.txt
@@ -0,0 +1,92 @@
+LCD Display
+-----------
+
+(there isn't yet a generic binding in Linux, so this describes what is in
+U-Boot)
+
+The device node for a display device is as described in the document
+"Open Firmware Recommended Practice : Universal Serial Bus" with the
+following modifications and additions :
+
+Required properties :
+ - compatible : Should be "nvidia,tegra20-display"
+ - pwfm: phandle of PWFM to use for backlight
+
+Note: This is just a phande and provides no information, nor a backlight
+node. The PWM is still under discussion I think:
+ http://patchwork.ozlabs.org/patch/132386/
+
+We don't support any parameters as yet - the setting is hard-coded.
+
+ - width: width of display in pixels
+ - height: height of display in pixels
+ - bits-per-pixel: number of bits per pixel (depth)
+ - pixel-clock : Pixel clock in Hz
+ - horiz-timing; horizontal timing: ref_to_sync, sync_width. back_porch,
+ front_porch
+ - vert-timing; vertical timing: ref_to_sync, sync_width. back_porch,
+ front_porch
+
+This node should sit inside its controller.
+
+
+Nvidia Tegra2x Display Controller
+---------------------------------
+
+The device node for a NAND flash controller is as described in the document
+"Open Firmware Recommended Practice : Universal Serial Bus" with the
+following modifications and additions :
+
+Required properties:
+ - compatible: should be "tegra20-display"
+ - panel-timings: 4 cells containing required timings in ms:
+ * delay between panel_vdd-rise and data-rise
+ * delay between data-rise and backlight_vdd-rise
+ * delay between backlight_vdd and pwm-rise
+ * delay between pwm-rise and backlight_en-rise
+
+(should we use us here, or perhaps call it panel-timings-ms?)
+
+Optional properties:
+ - frame-buffer: address of frame buffer (if omitted it will be calculated)
+ - This may be useful to share an address between U-Boot and Linux and
+ avoid boot-time corruption / flicker
+
+Optional GPIO properies all have (phandle, GPIO number, flags):
+ - backlight-enable-gpio: backlight enable GPIO
+ - lvds-shutdown-gpio: LVDS power shutdown GPIO
+ - backlight-vdd-gpio: backlight power GPIO
+ - panel-vdd-gpio: panel power GPIO
+
+(should those have an "nvidia," prefix? Perhap use polariy bit so that
+lvds-shutdown becomes lvds-enable?)
+
+I have put these into the display controller since I don't think they are
+generic enough to go in the lcd node.
+
+Example:
+
+display@0x54200000 {
+ pwfm = <&pwfm2>;
+
+ /* frame-buffer location to share with Linux */
+ frame-buffer = <0x2f680000>;
+
+ /* Parameter 3 bit 0:1=output, 0=input; bit 1:1=high, 0=low */
+ backlight-enable = <&gpio 28 0>; /* PD4 */
+ lvds-shutdown = <&gpio 10 0>; /* PB2 */
+ backlight-vdd = <&gpio 176 0>; /* PW0 */
+ panel-vdd = <&gpio 22 0>; /* PC6 */
+ panel-timings = <4 203 17 15>;
+
+ lcd {
+ compatible = "generic,lcd";
+ width = <1366>;
+ height = <768>;
+ bits-per-pixel = <16>;
+ pixel-clock = <70600000>;
+
+ horiz-timing = <11 58 58 58>;
+ vert-timing = <1 4 4 4>;
+ };
+};
--
1.7.7.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 15/17] tegra: fdt: Add LCD definitions for Seaboard
[not found] ` <1326588449-1794-1-git-send-email-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
` (3 preceding siblings ...)
2012-01-15 0:47 ` [PATCH 05/17] tegra: fdt: Add LCD definitions for Tegra Simon Glass
@ 2012-01-15 0:47 ` Simon Glass
4 siblings, 0 replies; 5+ messages in thread
From: Simon Glass @ 2012-01-15 0:47 UTC (permalink / raw)
To: U-Boot Mailing List; +Cc: Devicetree Discuss, Tom Warren, Jerry Van Baren
The Seaboard has a 1366x768 16bpp LCD. The backlight is controlled
by one of the PWMs.
Signed-off-by: Simon Glass <sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
---
board/nvidia/dts/tegra2-seaboard.dts | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/board/nvidia/dts/tegra2-seaboard.dts b/board/nvidia/dts/tegra2-seaboard.dts
index b847215..710b254 100644
--- a/board/nvidia/dts/tegra2-seaboard.dts
+++ b/board/nvidia/dts/tegra2-seaboard.dts
@@ -210,4 +210,25 @@
00 00 00 11 00 00 00 00
00 00 00 00 00 00 00 00];
};
+
+ display@0x54200000 {
+ pwfm = <&pwfm2>;
+ frame-buffer = <0x2f680000>;
+ backlight-enable-gpio = <&gpio 28 0>; /* PD4 */
+ lvds-shutdown-gpio = <&gpio 10 0>; /* PB2 */
+ backlight-vdd-gpio = <&gpio 176 0>; /* PW0 */
+ panel-vdd-gpio = <&gpio 22 0>; /* PC6 */
+ panel-timings = <4 203 17 15>;
+
+ lcd {
+ compatible = "generic,lcd";
+ width = <1366>;
+ height = <768>;
+ bits-per-pixel = <16>;
+ pixel-clock = <70600000>;
+
+ horiz-timing = <11 58 58 58>;
+ vert-timing = <1 4 4 4>;
+ };
+ };
};
--
1.7.7.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-01-15 0:47 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1326588449-1794-1-git-send-email-sjg@chromium.org>
[not found] ` <1326588449-1794-1-git-send-email-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2012-01-15 0:47 ` [PATCH 01/17] fdt: Add function to look up a phandle's register address Simon Glass
2012-01-15 0:47 ` [PATCH 02/17] fdt: Add header guard to fdtdec.h Simon Glass
2012-01-15 0:47 ` [PATCH 03/17] fdt: Correct GPIO name access in fdtdec Simon Glass
2012-01-15 0:47 ` [PATCH 05/17] tegra: fdt: Add LCD definitions for Tegra Simon Glass
2012-01-15 0:47 ` [PATCH 15/17] tegra: fdt: Add LCD definitions for Seaboard Simon Glass
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).