2017.11 RC2, rebase patch set
This commit is contained in:
parent
f5a26b4e68
commit
d1eb73c597
File diff suppressed because it is too large
Load Diff
|
@ -1,70 +0,0 @@
|
|||
From patchwork Wed Oct 4 16:29:57 2017
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: [U-Boot] disk: part_dos: Use the original allocation scheme for the
|
||||
SPL case
|
||||
X-Patchwork-Submitter: Fabio Estevam <fabio.estevam@nxp.com>
|
||||
X-Patchwork-Id: 821393
|
||||
Message-Id: <1507134597-6831-1-git-send-email-fabio.estevam@nxp.com>
|
||||
To: <trini@konsulko.com>
|
||||
Cc: u-boot@lists.denx.de, pjones@redhat.com,
|
||||
Fabio Estevam <fabio.estevam@nxp.com>
|
||||
Date: Wed, 4 Oct 2017 13:29:57 -0300
|
||||
From: Fabio Estevam <fabio.estevam@nxp.com>
|
||||
List-Id: U-Boot discussion <u-boot.lists.denx.de>
|
||||
|
||||
Since commit ff98cb90514d ("part: extract MBR signature from partitions")
|
||||
SPL boot on i.MX6 starts to fail:
|
||||
|
||||
U-Boot SPL 2017.09-00221-g0d6ab32 (Oct 02 2017 - 15:13:19)
|
||||
Trying to boot from MMC1
|
||||
(keep in loop)
|
||||
|
||||
Use the original allocation scheme for the SPL case, so that MX6 boards
|
||||
can boot again.
|
||||
|
||||
This is a temporary solution to avoid the boot regression.
|
||||
|
||||
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
|
||||
Acked-by: Rob Clark <robdclark@gmail.com>
|
||||
---
|
||||
Hi Tom,
|
||||
|
||||
I do not have time this week to further investigate and narrow down
|
||||
this problem.
|
||||
|
||||
Using the old allocation scheme fixes the mx6 SPL boot problem.
|
||||
|
||||
|
||||
disk/part_dos.c | 10 ++++++++++
|
||||
1 file changed, 10 insertions(+)
|
||||
|
||||
diff --git a/disk/part_dos.c b/disk/part_dos.c
|
||||
index 1a36be0..6dd2c2d 100644
|
||||
--- a/disk/part_dos.c
|
||||
+++ b/disk/part_dos.c
|
||||
@@ -89,6 +89,7 @@ static int test_block_type(unsigned char *buffer)
|
||||
|
||||
static int part_test_dos(struct blk_desc *dev_desc)
|
||||
{
|
||||
+#ifndef CONFIG_SPL_BUILD
|
||||
ALLOC_CACHE_ALIGN_BUFFER(legacy_mbr, mbr, dev_desc->blksz);
|
||||
|
||||
if (blk_dread(dev_desc, 0, 1, (ulong *)mbr) != 1)
|
||||
@@ -102,6 +103,15 @@ static int part_test_dos(struct blk_desc *dev_desc)
|
||||
dev_desc->sig_type = SIG_TYPE_MBR;
|
||||
dev_desc->mbr_sig = mbr->unique_mbr_signature;
|
||||
}
|
||||
+#else
|
||||
+ ALLOC_CACHE_ALIGN_BUFFER(unsigned char, buffer, dev_desc->blksz);
|
||||
+
|
||||
+ if (blk_dread(dev_desc, 0, 1, (ulong *)buffer) != 1)
|
||||
+ return -1;
|
||||
+
|
||||
+ if (test_block_type(buffer) != DOS_MBR)
|
||||
+ return -1;
|
||||
+#endif
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -1,434 +0,0 @@
|
|||
From patchwork Wed Sep 13 22:12:20 2017
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: [U-Boot,1/3] dm: video: Fix cache flushes
|
||||
X-Patchwork-Submitter: Rob Clark <robdclark@gmail.com>
|
||||
X-Patchwork-Id: 813662
|
||||
X-Patchwork-Delegate: sjg@chromium.org
|
||||
Message-Id: <20170913221227.21091-2-robdclark@gmail.com>
|
||||
To: U-Boot Mailing List <u-boot@lists.denx.de>
|
||||
Date: Wed, 13 Sep 2017 18:12:20 -0400
|
||||
From: Rob Clark <robdclark@gmail.com>
|
||||
List-Id: U-Boot discussion <u-boot.lists.denx.de>
|
||||
|
||||
Content can come to screen via putc() and we cannot always rely on
|
||||
updates ending with a puts(). This is the case with efi_console output
|
||||
to vidconsole. Fixes corruption with Shell.efi.
|
||||
|
||||
Signed-off-by: Rob Clark <robdclark@gmail.com>
|
||||
---
|
||||
drivers/video/vidconsole-uclass.c | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c
|
||||
index b5afd72227..e081d5a0ee 100644
|
||||
--- a/drivers/video/vidconsole-uclass.c
|
||||
+++ b/drivers/video/vidconsole-uclass.c
|
||||
@@ -163,6 +163,7 @@ static void vidconsole_putc(struct stdio_dev *sdev, const char ch)
|
||||
struct udevice *dev = sdev->priv;
|
||||
|
||||
vidconsole_put_char(dev, ch);
|
||||
+ video_sync(dev->parent);
|
||||
}
|
||||
|
||||
static void vidconsole_puts(struct stdio_dev *sdev, const char *s)
|
||||
@@ -260,6 +261,8 @@ static int do_video_puts(cmd_tbl_t *cmdtp, int flag, int argc,
|
||||
for (s = argv[1]; *s; s++)
|
||||
vidconsole_put_char(dev, *s);
|
||||
|
||||
+ video_sync(dev->parent);
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
From patchwork Wed Sep 13 22:12:21 2017
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: [U-Boot,2/3] dm: video: Add basic ANSI escape sequence support
|
||||
X-Patchwork-Submitter: Rob Clark <robdclark@gmail.com>
|
||||
X-Patchwork-Id: 813649
|
||||
X-Patchwork-Delegate: sjg@chromium.org
|
||||
Message-Id: <20170913221227.21091-3-robdclark@gmail.com>
|
||||
To: U-Boot Mailing List <u-boot@lists.denx.de>
|
||||
Date: Wed, 13 Sep 2017 18:12:21 -0400
|
||||
From: Rob Clark <robdclark@gmail.com>
|
||||
List-Id: U-Boot discussion <u-boot.lists.denx.de>
|
||||
|
||||
Really just the subset that is needed by efi_console. Perhaps more will
|
||||
be added later, for example color support would be useful to implement
|
||||
efi_cout_set_attribute().
|
||||
|
||||
Signed-off-by: Rob Clark <robdclark@gmail.com>
|
||||
Reviewed-by: Simon Glass <sjg@chromium.org>
|
||||
---
|
||||
drivers/video/Kconfig | 8 +++
|
||||
drivers/video/vidconsole-uclass.c | 109 ++++++++++++++++++++++++++++++++++++++
|
||||
drivers/video/video-uclass.c | 4 +-
|
||||
include/video.h | 7 +++
|
||||
include/video_console.h | 11 ++++
|
||||
5 files changed, 136 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
|
||||
index 082cc4a528..add156cb70 100644
|
||||
--- a/drivers/video/Kconfig
|
||||
+++ b/drivers/video/Kconfig
|
||||
@@ -44,6 +44,14 @@ config VIDEO_BPP32
|
||||
this option, such displays will not be supported and console output
|
||||
will be empty.
|
||||
|
||||
+config VIDEO_ANSI
|
||||
+ bool "Support ANSI escape sequences in video console"
|
||||
+ depends on DM_VIDEO
|
||||
+ default y if DM_VIDEO
|
||||
+ help
|
||||
+ Enable ANSI escape sequence decoding for a more fully functional
|
||||
+ console.
|
||||
+
|
||||
config CONSOLE_NORMAL
|
||||
bool "Support a simple text console"
|
||||
depends on DM_VIDEO
|
||||
diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c
|
||||
index e081d5a0ee..0a88cc0a42 100644
|
||||
--- a/drivers/video/vidconsole-uclass.c
|
||||
+++ b/drivers/video/vidconsole-uclass.c
|
||||
@@ -9,6 +9,7 @@
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
+#include <linux/ctype.h>
|
||||
#include <dm.h>
|
||||
#include <video.h>
|
||||
#include <video_console.h>
|
||||
@@ -107,12 +108,120 @@ static void vidconsole_newline(struct udevice *dev)
|
||||
video_sync(dev->parent);
|
||||
}
|
||||
|
||||
+static char *parsenum(char *s, int *num)
|
||||
+{
|
||||
+ char *end;
|
||||
+ *num = simple_strtol(s, &end, 10);
|
||||
+ return end;
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * Process a character while accumulating an escape string. Chars are
|
||||
+ * accumulated into escape_buf until the end of escape sequence is
|
||||
+ * found, at which point the sequence is parsed and processed.
|
||||
+ */
|
||||
+static void vidconsole_escape_char(struct udevice *dev, char ch)
|
||||
+{
|
||||
+ struct vidconsole_priv *priv = dev_get_uclass_priv(dev);
|
||||
+
|
||||
+ if (!IS_ENABLED(CONFIG_VIDEO_ANSI))
|
||||
+ goto error;
|
||||
+
|
||||
+ /* Sanity checking for bogus ESC sequences: */
|
||||
+ if (priv->escape_len >= sizeof(priv->escape_buf))
|
||||
+ goto error;
|
||||
+ if (priv->escape_len == 0 && ch != '[')
|
||||
+ goto error;
|
||||
+
|
||||
+ priv->escape_buf[priv->escape_len++] = ch;
|
||||
+
|
||||
+ /*
|
||||
+ * Escape sequences are terminated by a letter, so keep
|
||||
+ * accumulating until we get one:
|
||||
+ */
|
||||
+ if (!isalpha(ch))
|
||||
+ return;
|
||||
+
|
||||
+ /*
|
||||
+ * clear escape mode first, otherwise things will get highly
|
||||
+ * surprising if you hit any debug prints that come back to
|
||||
+ * this console.
|
||||
+ */
|
||||
+ priv->escape = 0;
|
||||
+
|
||||
+ switch (ch) {
|
||||
+ case 'H':
|
||||
+ case 'f': {
|
||||
+ int row, col;
|
||||
+ char *s = priv->escape_buf;
|
||||
+
|
||||
+ /*
|
||||
+ * Set cursor position: [%d;%df or [%d;%dH
|
||||
+ */
|
||||
+ s++; /* [ */
|
||||
+ s = parsenum(s, &row);
|
||||
+ s++; /* ; */
|
||||
+ s = parsenum(s, &col);
|
||||
+
|
||||
+ priv->ycur = row * priv->y_charsize;
|
||||
+ priv->xcur_frac = priv->xstart_frac +
|
||||
+ VID_TO_POS(col * priv->x_charsize);
|
||||
+
|
||||
+ break;
|
||||
+ }
|
||||
+ case 'J': {
|
||||
+ int mode;
|
||||
+
|
||||
+ /*
|
||||
+ * Clear part/all screen:
|
||||
+ * [J or [0J - clear screen from cursor down
|
||||
+ * [1J - clear screen from cursor up
|
||||
+ * [2J - clear entire screen
|
||||
+ *
|
||||
+ * TODO we really only handle entire-screen case, others
|
||||
+ * probably require some additions to video-uclass (and
|
||||
+ * are not really needed yet by efi_console)
|
||||
+ */
|
||||
+ parsenum(priv->escape_buf + 1, &mode);
|
||||
+
|
||||
+ if (mode == 2) {
|
||||
+ video_clear(dev->parent);
|
||||
+ video_sync(dev->parent);
|
||||
+ priv->ycur = 0;
|
||||
+ priv->xcur_frac = priv->xstart_frac;
|
||||
+ } else {
|
||||
+ debug("unsupported clear mode: %d\n", mode);
|
||||
+ }
|
||||
+ break;
|
||||
+ }
|
||||
+ default:
|
||||
+ debug("unrecognized escape sequence: %*s\n",
|
||||
+ priv->escape_len, priv->escape_buf);
|
||||
+ }
|
||||
+
|
||||
+ return;
|
||||
+
|
||||
+error:
|
||||
+ /* something went wrong, just revert to normal mode: */
|
||||
+ priv->escape = 0;
|
||||
+ return;
|
||||
+}
|
||||
+
|
||||
int vidconsole_put_char(struct udevice *dev, char ch)
|
||||
{
|
||||
struct vidconsole_priv *priv = dev_get_uclass_priv(dev);
|
||||
int ret;
|
||||
|
||||
+ if (priv->escape) {
|
||||
+ vidconsole_escape_char(dev, ch);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
switch (ch) {
|
||||
+ case '\x1b':
|
||||
+ priv->escape_len = 0;
|
||||
+ priv->escape = 1;
|
||||
+ break;
|
||||
case '\a':
|
||||
/* beep */
|
||||
break;
|
||||
diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c
|
||||
index 3036e3a1f2..0163039821 100644
|
||||
--- a/drivers/video/video-uclass.c
|
||||
+++ b/drivers/video/video-uclass.c
|
||||
@@ -87,7 +87,7 @@ int video_reserve(ulong *addrp)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static int video_clear(struct udevice *dev)
|
||||
+void video_clear(struct udevice *dev)
|
||||
{
|
||||
struct video_priv *priv = dev_get_uclass_priv(dev);
|
||||
|
||||
@@ -100,8 +100,6 @@ static int video_clear(struct udevice *dev)
|
||||
} else {
|
||||
memset(priv->fb, priv->colour_bg, priv->fb_size);
|
||||
}
|
||||
-
|
||||
- return 0;
|
||||
}
|
||||
|
||||
/* Flush video activity to the caches */
|
||||
diff --git a/include/video.h b/include/video.h
|
||||
index 5b4e78b182..61ff653121 100644
|
||||
--- a/include/video.h
|
||||
+++ b/include/video.h
|
||||
@@ -115,6 +115,13 @@ struct video_ops {
|
||||
int video_reserve(ulong *addrp);
|
||||
|
||||
/**
|
||||
+ * video_clear() - Clear a device's frame buffer to background color.
|
||||
+ *
|
||||
+ * @dev: Device to clear
|
||||
+ */
|
||||
+void video_clear(struct udevice *dev);
|
||||
+
|
||||
+/**
|
||||
* video_sync() - Sync a device's frame buffer with its hardware
|
||||
*
|
||||
* Some frame buffers are cached or have a secondary frame buffer. This
|
||||
diff --git a/include/video_console.h b/include/video_console.h
|
||||
index 26047934da..9dce234bd9 100644
|
||||
--- a/include/video_console.h
|
||||
+++ b/include/video_console.h
|
||||
@@ -29,6 +29,9 @@
|
||||
* @xsize_frac: Width of the display in fractional units
|
||||
* @xstart_frac: Left margin for the text console in fractional units
|
||||
* @last_ch: Last character written to the text console on this line
|
||||
+ * @escape: TRUE if currently accumulating an ANSI escape sequence
|
||||
+ * @escape_len: Length of accumulated escape sequence so far
|
||||
+ * @escape_buf: Buffer to accumulate escape sequence
|
||||
*/
|
||||
struct vidconsole_priv {
|
||||
struct stdio_dev sdev;
|
||||
@@ -42,6 +45,14 @@ struct vidconsole_priv {
|
||||
int xsize_frac;
|
||||
int xstart_frac;
|
||||
int last_ch;
|
||||
+ /*
|
||||
+ * ANSI escape sequences are accumulated character by character,
|
||||
+ * starting after the ESC char (0x1b) until the entire sequence
|
||||
+ * is consumed at which point it is acted upon.
|
||||
+ */
|
||||
+ int escape;
|
||||
+ int escape_len;
|
||||
+ char escape_buf[32];
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
From patchwork Wed Sep 13 22:12:22 2017
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: [U-Boot,3/3] dm: video: Add color ANSI escape sequence support
|
||||
X-Patchwork-Submitter: Rob Clark <robdclark@gmail.com>
|
||||
X-Patchwork-Id: 813661
|
||||
X-Patchwork-Delegate: sjg@chromium.org
|
||||
Message-Id: <20170913221227.21091-4-robdclark@gmail.com>
|
||||
To: U-Boot Mailing List <u-boot@lists.denx.de>
|
||||
Date: Wed, 13 Sep 2017 18:12:22 -0400
|
||||
From: Rob Clark <robdclark@gmail.com>
|
||||
List-Id: U-Boot discussion <u-boot.lists.denx.de>
|
||||
|
||||
Note that this doesn't differentiate (due to lack of information in
|
||||
video_priv) between different possible component orders for 32bpp.
|
||||
But the main user at this point is efi_loader, and GOP expects xBGR
|
||||
so any video drivers that this is incorrect for already have problems.
|
||||
(Also, conveniently, this matches what simple-framebuffer bindings
|
||||
expect for kernels that use the simple-framebuffer DT binding to
|
||||
take over the bootloader display.)
|
||||
|
||||
Signed-off-by: Rob Clark <robdclark@gmail.com>
|
||||
---
|
||||
drivers/video/vidconsole-uclass.c | 94 +++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 94 insertions(+)
|
||||
|
||||
diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c
|
||||
index 0a88cc0a42..820540b1bf 100644
|
||||
--- a/drivers/video/vidconsole-uclass.c
|
||||
+++ b/drivers/video/vidconsole-uclass.c
|
||||
@@ -108,6 +108,41 @@ static void vidconsole_newline(struct udevice *dev)
|
||||
video_sync(dev->parent);
|
||||
}
|
||||
|
||||
+static const struct {
|
||||
+ unsigned r;
|
||||
+ unsigned g;
|
||||
+ unsigned b;
|
||||
+} colors[] = {
|
||||
+ { 0x00, 0x00, 0x00 }, /* black */
|
||||
+ { 0xff, 0x00, 0x00 }, /* red */
|
||||
+ { 0x00, 0xff, 0x00 }, /* green */
|
||||
+ { 0xff, 0xff, 0x00 }, /* yellow */
|
||||
+ { 0x00, 0x00, 0xff }, /* blue */
|
||||
+ { 0xff, 0x00, 0xff }, /* magenta */
|
||||
+ { 0x00, 0xff, 0xff }, /* cyan */
|
||||
+ { 0xff, 0xff, 0xff }, /* white */
|
||||
+};
|
||||
+
|
||||
+static void set_color(struct video_priv *priv, unsigned idx, unsigned *c)
|
||||
+{
|
||||
+ switch (priv->bpix) {
|
||||
+ case VIDEO_BPP16:
|
||||
+ *c = ((colors[idx].r >> 3) << 0) |
|
||||
+ ((colors[idx].g >> 2) << 5) |
|
||||
+ ((colors[idx].b >> 3) << 11);
|
||||
+ break;
|
||||
+ case VIDEO_BPP32:
|
||||
+ *c = 0xff000000 |
|
||||
+ (colors[idx].r << 0) |
|
||||
+ (colors[idx].g << 8) |
|
||||
+ (colors[idx].b << 16);
|
||||
+ break;
|
||||
+ default:
|
||||
+ /* unsupported, leave current color in place */
|
||||
+ break;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static char *parsenum(char *s, int *num)
|
||||
{
|
||||
char *end;
|
||||
@@ -194,6 +229,65 @@ static void vidconsole_escape_char(struct udevice *dev, char ch)
|
||||
}
|
||||
break;
|
||||
}
|
||||
+ case 'm': {
|
||||
+ struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent);
|
||||
+ char *s = priv->escape_buf;
|
||||
+ char *end = &priv->escape_buf[priv->escape_len];
|
||||
+
|
||||
+ /*
|
||||
+ * Set graphics mode: [%d;...;%dm
|
||||
+ *
|
||||
+ * Currently only supports the color attributes:
|
||||
+ *
|
||||
+ * Foreground Colors:
|
||||
+ *
|
||||
+ * 30 Black
|
||||
+ * 31 Red
|
||||
+ * 32 Green
|
||||
+ * 33 Yellow
|
||||
+ * 34 Blue
|
||||
+ * 35 Magenta
|
||||
+ * 36 Cyan
|
||||
+ * 37 White
|
||||
+ *
|
||||
+ * Background Colors:
|
||||
+ *
|
||||
+ * 40 Black
|
||||
+ * 41 Red
|
||||
+ * 42 Green
|
||||
+ * 43 Yellow
|
||||
+ * 44 Blue
|
||||
+ * 45 Magenta
|
||||
+ * 46 Cyan
|
||||
+ * 47 White
|
||||
+ */
|
||||
+
|
||||
+ s++; /* [ */
|
||||
+ while (s < end) {
|
||||
+ int val;
|
||||
+
|
||||
+ s = parsenum(s, &val);
|
||||
+ s++;
|
||||
+
|
||||
+ switch (val) {
|
||||
+ case 30 ... 37:
|
||||
+ /* fg color */
|
||||
+ set_color(vid_priv, val - 30,
|
||||
+ (unsigned *)&vid_priv->colour_fg);
|
||||
+ break;
|
||||
+ case 40 ... 47:
|
||||
+ /* bg color */
|
||||
+ set_color(vid_priv, val - 40,
|
||||
+ (unsigned *)&vid_priv->colour_bg);
|
||||
+ break;
|
||||
+ default:
|
||||
+ /* unknown/unsupported */
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ break;
|
||||
+ }
|
||||
default:
|
||||
debug("unrecognized escape sequence: %*s\n",
|
||||
priv->escape_len, priv->escape_buf);
|
|
@ -103,361 +103,6 @@ index 7746622dda..0d3b7a35f4 100644
|
|||
--
|
||||
2.13.3
|
||||
|
||||
From 03569f3ef44fd1208a68030c1740d7347bcf3fa3 Mon Sep 17 00:00:00 2001
|
||||
From: Rob Clark <robdclark@gmail.com>
|
||||
Date: Fri, 23 Jun 2017 15:36:33 -0400
|
||||
Subject: [PATCH 03/23] dm: core: also parse chosen node
|
||||
|
||||
This is the node that would contain, for example, the framebuffer setup
|
||||
by an earlier stage.
|
||||
|
||||
Signed-off-by: Rob Clark <robdclark@gmail.com>
|
||||
---
|
||||
drivers/core/root.c | 22 +++++++++++++++++++++-
|
||||
1 file changed, 21 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/drivers/core/root.c b/drivers/core/root.c
|
||||
index d691d6ff94..5e6b2da248 100644
|
||||
--- a/drivers/core/root.c
|
||||
+++ b/drivers/core/root.c
|
||||
@@ -266,6 +266,26 @@ static int dm_scan_fdt_node(struct udevice *parent, const void *blob,
|
||||
for (offset = fdt_first_subnode(blob, offset);
|
||||
offset > 0;
|
||||
offset = fdt_next_subnode(blob, offset)) {
|
||||
+ ofnode node = offset_to_ofnode(offset);
|
||||
+
|
||||
+ /* "chosen" node isn't a device itself but may contain some: */
|
||||
+ if (strcmp(ofnode_get_name(node), "chosen") == 0) {
|
||||
+ dm_dbg("parsing subnodes of \"chosen\"\n");
|
||||
+
|
||||
+ for (node = ofnode_first_subnode(node);
|
||||
+ ofnode_valid(node);
|
||||
+ node = ofnode_next_subnode(node)) {
|
||||
+ dm_dbg("subnode: %s\n", ofnode_get_name(node));
|
||||
+ err = lists_bind_fdt(parent, node, NULL);
|
||||
+ if (err && !ret) {
|
||||
+ ret = err;
|
||||
+ dm_dbg("%s: ret=%d\n", ofnode_get_name(node), ret);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
if (pre_reloc_only &&
|
||||
!dm_fdt_pre_reloc(blob, offset))
|
||||
continue;
|
||||
@@ -273,7 +293,7 @@ static int dm_scan_fdt_node(struct udevice *parent, const void *blob,
|
||||
dm_dbg(" - ignoring disabled device\n");
|
||||
continue;
|
||||
}
|
||||
- err = lists_bind_fdt(parent, offset_to_ofnode(offset), NULL);
|
||||
+ err = lists_bind_fdt(parent, node, NULL);
|
||||
if (err && !ret) {
|
||||
ret = err;
|
||||
debug("%s: ret=%d\n", fdt_get_name(blob, offset, NULL),
|
||||
--
|
||||
2.13.3
|
||||
|
||||
From 9f99ca35c96d4b564062bb86ddc62f7421632906 Mon Sep 17 00:00:00 2001
|
||||
From: Rob Clark <robdclark@gmail.com>
|
||||
Date: Thu, 22 Jun 2017 16:17:00 -0400
|
||||
Subject: [PATCH 04/23] video: simplefb
|
||||
|
||||
Not really qcom specific, but for now qcom/lk is the one firmware that
|
||||
is (afaiu) setting up the appropriate dt node for pre-configured
|
||||
display. Uses the generic simple-framebuffer DT bindings so this should
|
||||
be useful on other platforms.
|
||||
|
||||
Signed-off-by: Rob Clark <robdclark@gmail.com>
|
||||
---
|
||||
drivers/video/Kconfig | 10 +++++++
|
||||
drivers/video/Makefile | 2 +-
|
||||
drivers/video/simplefb.c | 71 ++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
3 files changed, 82 insertions(+), 1 deletion(-)
|
||||
create mode 100644 drivers/video/simplefb.c
|
||||
|
||||
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
|
||||
index 61dfed8c06..8eb0359231 100644
|
||||
--- a/drivers/video/Kconfig
|
||||
+++ b/drivers/video/Kconfig
|
||||
@@ -628,4 +628,14 @@ config VIDEO_DW_HDMI
|
||||
rather requires a SoC-specific glue driver to call it), it
|
||||
can not be enabled from the configuration menu.
|
||||
|
||||
+config VIDEO_SIMPLE
|
||||
+ bool "Simple display driver for preconfigured display"
|
||||
+ help
|
||||
+ Enables a simple generic display driver which utilizes the
|
||||
+ simple-framebuffer devicetree bindings.
|
||||
+
|
||||
+ This driver assumes that the display hardware has been initialized
|
||||
+ before u-boot starts, and u-boot will simply render to the pre-
|
||||
+ allocated frame buffer surface.
|
||||
+
|
||||
endmenu
|
||||
diff --git a/drivers/video/Makefile b/drivers/video/Makefile
|
||||
index ac5371f2ae..52f50f647b 100644
|
||||
--- a/drivers/video/Makefile
|
||||
+++ b/drivers/video/Makefile
|
||||
@@ -57,7 +57,7 @@ obj-$(CONFIG_FORMIKE) += formike.o
|
||||
obj-$(CONFIG_LG4573) += lg4573.o
|
||||
obj-$(CONFIG_AM335X_LCD) += am335x-fb.o
|
||||
obj-$(CONFIG_VIDEO_DW_HDMI) += dw_hdmi.o
|
||||
-
|
||||
+obj-$(CONFIG_VIDEO_SIMPLE) += simplefb.o
|
||||
obj-${CONFIG_VIDEO_TEGRA124} += tegra124/
|
||||
obj-${CONFIG_EXYNOS_FB} += exynos/
|
||||
obj-${CONFIG_VIDEO_ROCKCHIP} += rockchip/
|
||||
diff --git a/drivers/video/simplefb.c b/drivers/video/simplefb.c
|
||||
new file mode 100644
|
||||
index 0000000000..035a9761b9
|
||||
--- /dev/null
|
||||
+++ b/drivers/video/simplefb.c
|
||||
@@ -0,0 +1,71 @@
|
||||
+/*
|
||||
+ * (C) Copyright 2017 Rob Clark
|
||||
+ *
|
||||
+ * SPDX-License-Identifier: GPL-2.0+
|
||||
+ */
|
||||
+
|
||||
+#include <common.h>
|
||||
+#include <dm.h>
|
||||
+#include <fdtdec.h>
|
||||
+#include <fdt_support.h>
|
||||
+#include <video.h>
|
||||
+
|
||||
+static int simple_video_probe(struct udevice *dev)
|
||||
+{
|
||||
+ struct video_uc_platdata *plat = dev_get_uclass_platdata(dev);
|
||||
+ struct video_priv *uc_priv = dev_get_uclass_priv(dev);
|
||||
+ const void *blob = gd->fdt_blob;
|
||||
+ const int node = dev_of_offset(dev);
|
||||
+ const char *format;
|
||||
+ fdt_addr_t base;
|
||||
+ fdt_size_t size;
|
||||
+
|
||||
+ base = fdtdec_get_addr_size_auto_parent(blob, dev_of_offset(dev->parent),
|
||||
+ node, "reg", 0, &size, false);
|
||||
+ if (base == FDT_ADDR_T_NONE) {
|
||||
+ debug("%s: Failed to decode memory region\n", __func__);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ debug("%s: base=%llx, size=%llu\n", __func__, base, size);
|
||||
+
|
||||
+ // TODO is there some way to reserve the framebuffer
|
||||
+ // region so it isn't clobbered?
|
||||
+ plat->base = base;
|
||||
+ plat->size = size;
|
||||
+
|
||||
+ video_set_flush_dcache(dev, true);
|
||||
+
|
||||
+ debug("%s: Query resolution...\n", __func__);
|
||||
+
|
||||
+ uc_priv->xsize = fdtdec_get_uint(blob, node, "width", 0);
|
||||
+ uc_priv->ysize = fdtdec_get_uint(blob, node, "height", 0);
|
||||
+ uc_priv->rot = 0;
|
||||
+
|
||||
+ format = fdt_getprop(blob, node, "format", NULL);
|
||||
+ debug("%s: %dx%d@%s\n", __func__, uc_priv->xsize, uc_priv->ysize, format);
|
||||
+
|
||||
+ if (strcmp(format, "r5g6b5") == 0) {
|
||||
+ uc_priv->bpix = VIDEO_BPP16;
|
||||
+ } else if (strcmp(format, "a8b8g8r8") == 0) {
|
||||
+ uc_priv->bpix = VIDEO_BPP32;
|
||||
+ } else {
|
||||
+ printf("%s: invalid format: %s\n", __func__, format);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct udevice_id simple_video_ids[] = {
|
||||
+ { .compatible = "simple-framebuffer" },
|
||||
+ { }
|
||||
+};
|
||||
+
|
||||
+U_BOOT_DRIVER(simple_video) = {
|
||||
+ .name = "simple_video",
|
||||
+ .id = UCLASS_VIDEO,
|
||||
+ .of_match = simple_video_ids,
|
||||
+ .probe = simple_video_probe,
|
||||
+ .flags = DM_FLAG_PRE_RELOC,
|
||||
+};
|
||||
--
|
||||
2.13.3
|
||||
|
||||
From 1d6f9273461ba5afa7f04cb8ea00fd87272642f8 Mon Sep 17 00:00:00 2001
|
||||
From: Rob Clark <robdclark@gmail.com>
|
||||
Date: Tue, 4 Jul 2017 09:16:08 -0400
|
||||
Subject: [PATCH 05/23] video: add config option to skip framebuffer clear
|
||||
|
||||
The use-case is that the thing that loaded u-boot already put a splash
|
||||
image on screen. And we want to preserve that until grub boot menu
|
||||
takes over.
|
||||
|
||||
Signed-off-by: Rob Clark <robdclark@gmail.com>
|
||||
---
|
||||
drivers/video/Kconfig | 8 ++++++++
|
||||
drivers/video/cfb_console.c | 3 ++-
|
||||
drivers/video/video-uclass.c | 4 +++-
|
||||
3 files changed, 13 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
|
||||
index 8eb0359231..7b56b20344 100644
|
||||
--- a/drivers/video/Kconfig
|
||||
+++ b/drivers/video/Kconfig
|
||||
@@ -98,6 +98,14 @@ config SYS_WHITE_ON_BLACK
|
||||
better in low-light situations or to reduce eye strain in some
|
||||
cases.
|
||||
|
||||
+config NO_FB_CLEAR
|
||||
+ bool "Skip framebuffer clear"
|
||||
+ help
|
||||
+ If firmware (whatever loads u-boot) has already put a splash image
|
||||
+ on screen, you might want to preserve it until whatever u-boots
|
||||
+ loads takes over the screen. This, for example, can be used to
|
||||
+ keep splash image on screen until grub graphical boot menu starts.
|
||||
+
|
||||
source "drivers/video/fonts/Kconfig"
|
||||
|
||||
config VIDCONSOLE_AS_LCD
|
||||
diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c
|
||||
index f54802052e..85fa5b0cae 100644
|
||||
--- a/drivers/video/cfb_console.c
|
||||
+++ b/drivers/video/cfb_console.c
|
||||
@@ -2091,7 +2091,8 @@ static int cfg_video_init(void)
|
||||
}
|
||||
eorx = fgx ^ bgx;
|
||||
|
||||
- video_clear();
|
||||
+ if (!CONFIG_IS_ENABLED(NO_FB_CLEAR))
|
||||
+ video_clear();
|
||||
|
||||
#ifdef CONFIG_VIDEO_LOGO
|
||||
/* Plot the logo and get start point of console */
|
||||
diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c
|
||||
index 3036e3a1f2..dfa39b0d1b 100644
|
||||
--- a/drivers/video/video-uclass.c
|
||||
+++ b/drivers/video/video-uclass.c
|
||||
@@ -199,7 +199,9 @@ static int video_post_probe(struct udevice *dev)
|
||||
#else
|
||||
priv->colour_bg = 0xffffff;
|
||||
#endif
|
||||
- video_clear(dev);
|
||||
+
|
||||
+ if (!CONFIG_IS_ENABLED(NO_FB_CLEAR))
|
||||
+ video_clear(dev);
|
||||
|
||||
/*
|
||||
* Create a text console device. For now we always do this, although
|
||||
--
|
||||
2.13.3
|
||||
|
||||
From d031c039a18b3a76a4ef16fb4ff8581a79f42fe3 Mon Sep 17 00:00:00 2001
|
||||
From: Rob Clark <robdclark@gmail.com>
|
||||
Date: Thu, 3 Aug 2017 09:52:14 -0400
|
||||
Subject: [PATCH 06/23] fdtdec: allow board to provide fdt for
|
||||
CONFIG_OF_SEPARATE
|
||||
|
||||
Similar to CONFIG_OF_BOARD, but in this case the fdt is still built by
|
||||
u-boot build. This allows the board to patch the fdt, etc.
|
||||
|
||||
In the specific case of dragonboard 410c, we pass the u-boot generated
|
||||
fdt to the previous stage of bootloader (by embedding it in the
|
||||
u-boot.img that is loaded by lk/aboot), which patches the fdt and passes
|
||||
it back to u-boot.
|
||||
|
||||
Signed-off-by: Rob Clark <robdclark@gmail.com>
|
||||
---
|
||||
include/fdtdec.h | 3 ++-
|
||||
lib/fdtdec.c | 45 ++++++++++++++++++++++++++-------------------
|
||||
2 files changed, 28 insertions(+), 20 deletions(-)
|
||||
|
||||
diff --git a/include/fdtdec.h b/include/fdtdec.h
|
||||
index 4a0947c626..b9acec735a 100644
|
||||
--- a/include/fdtdec.h
|
||||
+++ b/include/fdtdec.h
|
||||
@@ -986,7 +986,8 @@ int fdtdec_setup(void);
|
||||
|
||||
/**
|
||||
* Board-specific FDT initialization. Returns the address to a device tree blob.
|
||||
- * Called when CONFIG_OF_BOARD is defined.
|
||||
+ * Called when CONFIG_OF_BOARD is defined, or if CONFIG_OF_SEPARATE is defined
|
||||
+ * and the board implements it.
|
||||
*/
|
||||
void *board_fdt_blob_setup(void);
|
||||
|
||||
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
|
||||
index d2dbd0f122..07c458673c 100644
|
||||
--- a/lib/fdtdec.c
|
||||
+++ b/lib/fdtdec.c
|
||||
@@ -1203,34 +1203,41 @@ int fdtdec_setup_memory_banksize(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
-int fdtdec_setup(void)
|
||||
+#ifdef CONFIG_OF_SEPARATE
|
||||
+/*
|
||||
+ * For CONFIG_OF_SEPARATE, the board may optionally implement this to
|
||||
+ * provide and/or fixup the fdt.
|
||||
+ */
|
||||
+__weak void *board_fdt_blob_setup(void)
|
||||
{
|
||||
-#if CONFIG_IS_ENABLED(OF_CONTROL)
|
||||
-# ifdef CONFIG_OF_EMBED
|
||||
- /* Get a pointer to the FDT */
|
||||
- gd->fdt_blob = __dtb_dt_begin;
|
||||
-# elif defined CONFIG_OF_SEPARATE
|
||||
-# ifdef CONFIG_SPL_BUILD
|
||||
+ void *fdt_blob = NULL;
|
||||
+#ifdef CONFIG_SPL_BUILD
|
||||
/* FDT is at end of BSS unless it is in a different memory region */
|
||||
if (IS_ENABLED(CONFIG_SPL_SEPARATE_BSS))
|
||||
- gd->fdt_blob = (ulong *)&_image_binary_end;
|
||||
+ fdt_blob = (ulong *)&_image_binary_end;
|
||||
else
|
||||
- gd->fdt_blob = (ulong *)&__bss_end;
|
||||
+ fdt_blob = (ulong *)&__bss_end;
|
||||
|
||||
-# elif defined CONFIG_FIT_EMBED
|
||||
- gd->fdt_blob = locate_dtb_in_fit(&_end);
|
||||
+#elif defined CONFIG_FIT_EMBED
|
||||
+ fdt_blob = locate_dtb_in_fit(&_end);
|
||||
|
||||
- if (gd->fdt_blob == NULL || gd->fdt_blob <= ((void *)&_end)) {
|
||||
+ if (fdt_blob == NULL || fdt_blob <= ((void *)&_end))
|
||||
puts("Failed to find proper dtb in embedded FIT Image\n");
|
||||
- return -1;
|
||||
- }
|
||||
-
|
||||
-# else
|
||||
+#else
|
||||
/* FDT is at end of image */
|
||||
- gd->fdt_blob = (ulong *)&_end;
|
||||
+ fdt_blob = (ulong *)&_end;
|
||||
# endif
|
||||
-# elif defined(CONFIG_OF_BOARD)
|
||||
- /* Allow the board to override the fdt address. */
|
||||
+ return fdt_blob;
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
+int fdtdec_setup(void)
|
||||
+{
|
||||
+#if CONFIG_IS_ENABLED(OF_CONTROL)
|
||||
+# ifdef CONFIG_OF_EMBED
|
||||
+ /* Get a pointer to the FDT */
|
||||
+ gd->fdt_blob = __dtb_dt_begin;
|
||||
+# elif defined(CONFIG_OF_SEPARATE) || defined(CONFIG_OF_BOARD)
|
||||
gd->fdt_blob = board_fdt_blob_setup();
|
||||
# elif defined(CONFIG_OF_HOSTFILE)
|
||||
if (sandbox_read_fdt_from_file()) {
|
||||
--
|
||||
2.13.3
|
||||
|
||||
From 7f0491168cf31c9935dede6fb1f560ef33cfb739 Mon Sep 17 00:00:00 2001
|
||||
From: Rob Clark <robdclark@gmail.com>
|
||||
Date: Fri, 23 Jun 2017 07:52:08 -0400
|
||||
|
@ -589,32 +234,6 @@ index 0d3b7a35f4..a47b95264c 100644
|
|||
--
|
||||
2.13.3
|
||||
|
||||
From 47f22a41df082c62411389ab5bf6e9ae26d93083 Mon Sep 17 00:00:00 2001
|
||||
From: Rob Clark <robdclark@gmail.com>
|
||||
Date: Wed, 19 Jul 2017 10:39:12 -0400
|
||||
Subject: [PATCH 13/23] usb: kbd: add missing \n
|
||||
|
||||
Signed-off-by: Rob Clark <robdclark@gmail.com>
|
||||
---
|
||||
common/usb_kbd.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/common/usb_kbd.c b/common/usb_kbd.c
|
||||
index 703dd748f5..92d5e96d01 100644
|
||||
--- a/common/usb_kbd.c
|
||||
+++ b/common/usb_kbd.c
|
||||
@@ -655,7 +655,7 @@ static int usb_kbd_remove(struct udevice *dev)
|
||||
|
||||
return 0;
|
||||
err:
|
||||
- printf("%s: warning, ret=%d", __func__, ret);
|
||||
+ printf("%s: warning, ret=%d\n", __func__, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
--
|
||||
2.13.3
|
||||
|
||||
From 54997f67cc935704cab36025d98d27eaf5a4aa7c Mon Sep 17 00:00:00 2001
|
||||
From: Rob Clark <robdclark@gmail.com>
|
||||
Date: Mon, 26 Jun 2017 10:29:40 -0400
|
||||
|
@ -656,34 +275,29 @@ diff --git a/configs/dragonboard410c_defconfig b/configs/dragonboard410c_defconf
|
|||
index 2224b3850a..32efdfa46b 100644
|
||||
--- a/configs/dragonboard410c_defconfig
|
||||
+++ b/configs/dragonboard410c_defconfig
|
||||
@@ -10,6 +10,7 @@ CONFIG_BOOTARGS="console=ttyMSM0,115200n8"
|
||||
@@ -9,6 +9,7 @@ CONFIG_BOOTARGS="console=ttyMSM0,115200n8"
|
||||
# CONFIG_DISPLAY_BOARDINFO is not set
|
||||
CONFIG_SYS_PROMPT="dragonboard410c => "
|
||||
# CONFIG_CMD_IMI is not set
|
||||
# CONFIG_CMD_IMLS is not set
|
||||
+CONFIG_CMD_POWEROFF=y
|
||||
CONFIG_CMD_MD5SUM=y
|
||||
CONFIG_CMD_MEMINFO=y
|
||||
CONFIG_CMD_UNZIP=y
|
||||
@@ -22,11 +23,14 @@ CONFIG_CMD_TIMER=y
|
||||
CONFIG_CMD_GPIO=y
|
||||
@@ -20,6 +21,8 @@ CONFIG_CMD_TIMER=y
|
||||
CONFIG_CLK=y
|
||||
CONFIG_MSM_GPIO=y
|
||||
CONFIG_PM8916_GPIO=y
|
||||
+CONFIG_DM_KEYBOARD=y
|
||||
+CONFIG_DM_ETH=y
|
||||
CONFIG_LED=y
|
||||
CONFIG_LED_GPIO=y
|
||||
CONFIG_DM_MMC=y
|
||||
CONFIG_MMC_SDHCI=y
|
||||
CONFIG_MMC_SDHCI_MSM=y
|
||||
+CONFIG_DM_ETH=y
|
||||
+# CONFIG_NETDEVICES is not set
|
||||
CONFIG_DM_PMIC=y
|
||||
CONFIG_PMIC_PM8916=y
|
||||
CONFIG_MSM_SERIAL=y
|
||||
@@ -39,9 +43,17 @@ CONFIG_USB_EHCI_MSM=y
|
||||
@@ -36,10 +39,18 @@ CONFIG_USB_EHCI_HCD=y
|
||||
CONFIG_USB_EHCI_MSM=y
|
||||
CONFIG_USB_ULPI_VIEWPORT=y
|
||||
CONFIG_USB_ULPI=y
|
||||
CONFIG_USB_STORAGE=y
|
||||
+CONFIG_USB_KEYBOARD=y
|
||||
CONFIG_USB_STORAGE=y
|
||||
CONFIG_USB_HOST_ETHER=y
|
||||
CONFIG_USB_ETHER_ASIX=y
|
||||
CONFIG_USB_ETHER_ASIX88179=y
|
||||
|
@ -699,4 +313,3 @@ index 2224b3850a..32efdfa46b 100644
|
|||
CONFIG_OF_LIBFDT_OVERLAY=y
|
||||
--
|
||||
2.13.5
|
||||
|
||||
|
|
|
@ -1,895 +0,0 @@
|
|||
From patchwork Tue Sep 19 20:18:03 2017
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: [U-Boot, v2,
|
||||
1/6] pci: Add helper for implementing memory-mapped config space
|
||||
accesses
|
||||
X-Patchwork-Submitter: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
|
||||
X-Patchwork-Id: 815808
|
||||
Message-Id: <20170919201808.11433-2-tuomas.tynkkynen@iki.fi>
|
||||
To: u-boot@lists.denx.de
|
||||
Cc: Tom Rini <trini@konsulko.com>
|
||||
Date: Tue, 19 Sep 2017 23:18:03 +0300
|
||||
From: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
|
||||
List-Id: U-Boot discussion <u-boot.lists.denx.de>
|
||||
|
||||
This sort of pattern for implementing memory-mapped PCI config space
|
||||
accesses appears in U-Boot twice already, and a third user is coming up.
|
||||
So add helper functions to avoid code duplication, similar to how Linux
|
||||
has pci_generic_config_write and pci_generic_config_read.
|
||||
|
||||
Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
|
||||
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
|
||||
---
|
||||
drivers/pci/pci-uclass.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
include/pci.h | 51 ++++++++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 109 insertions(+)
|
||||
|
||||
diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c
|
||||
index 86df141d60..5a24eb6428 100644
|
||||
--- a/drivers/pci/pci-uclass.c
|
||||
+++ b/drivers/pci/pci-uclass.c
|
||||
@@ -518,6 +518,64 @@ int pci_auto_config_devices(struct udevice *bus)
|
||||
return sub_bus;
|
||||
}
|
||||
|
||||
+int pci_generic_mmap_write_config(
|
||||
+ struct udevice *bus,
|
||||
+ int (*addr_f)(struct udevice *bus, pci_dev_t bdf, uint offset, void **addrp),
|
||||
+ pci_dev_t bdf,
|
||||
+ uint offset,
|
||||
+ ulong value,
|
||||
+ enum pci_size_t size)
|
||||
+{
|
||||
+ void *address;
|
||||
+
|
||||
+ if (addr_f(bus, bdf, offset, &address) < 0)
|
||||
+ return 0;
|
||||
+
|
||||
+ switch (size) {
|
||||
+ case PCI_SIZE_8:
|
||||
+ writeb(value, address);
|
||||
+ return 0;
|
||||
+ case PCI_SIZE_16:
|
||||
+ writew(value, address);
|
||||
+ return 0;
|
||||
+ case PCI_SIZE_32:
|
||||
+ writel(value, address);
|
||||
+ return 0;
|
||||
+ default:
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+int pci_generic_mmap_read_config(
|
||||
+ struct udevice *bus,
|
||||
+ int (*addr_f)(struct udevice *bus, pci_dev_t bdf, uint offset, void **addrp),
|
||||
+ pci_dev_t bdf,
|
||||
+ uint offset,
|
||||
+ ulong *valuep,
|
||||
+ enum pci_size_t size)
|
||||
+{
|
||||
+ void *address;
|
||||
+
|
||||
+ if (addr_f(bus, bdf, offset, &address) < 0) {
|
||||
+ *valuep = pci_get_ff(size);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ switch (size) {
|
||||
+ case PCI_SIZE_8:
|
||||
+ *valuep = readb(address);
|
||||
+ return 0;
|
||||
+ case PCI_SIZE_16:
|
||||
+ *valuep = readw(address);
|
||||
+ return 0;
|
||||
+ case PCI_SIZE_32:
|
||||
+ *valuep = readl(address);
|
||||
+ return 0;
|
||||
+ default:
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
int dm_pci_hose_probe_bus(struct udevice *bus)
|
||||
{
|
||||
int sub_bus;
|
||||
diff --git a/include/pci.h b/include/pci.h
|
||||
index c8ef997d0d..7adc04301c 100644
|
||||
--- a/include/pci.h
|
||||
+++ b/include/pci.h
|
||||
@@ -1086,6 +1086,57 @@ int pci_read_config32(pci_dev_t pcidev, int offset, u32 *valuep);
|
||||
int pci_read_config16(pci_dev_t pcidev, int offset, u16 *valuep);
|
||||
int pci_read_config8(pci_dev_t pcidev, int offset, u8 *valuep);
|
||||
|
||||
+/**
|
||||
+ * pci_generic_mmap_write_config() - Generic helper for writing to
|
||||
+ * memory-mapped PCI configuration space.
|
||||
+ * @bus: Pointer to the PCI bus
|
||||
+ * @addr_f: Callback for calculating the config space address
|
||||
+ * @bdf: Identifies the PCI device to access
|
||||
+ * @offset: The offset into the device's configuration space
|
||||
+ * @value: The value to write
|
||||
+ * @size: Indicates the size of access to perform
|
||||
+ *
|
||||
+ * Write the value @value of size @size from offset @offset within the
|
||||
+ * configuration space of the device identified by the bus, device & function
|
||||
+ * numbers in @bdf on the PCI bus @bus. The callback function @addr_f is
|
||||
+ * responsible for calculating the CPU address of the respective configuration
|
||||
+ * space offset.
|
||||
+ *
|
||||
+ * Return: 0 on success, else -EINVAL
|
||||
+ */
|
||||
+int pci_generic_mmap_write_config(
|
||||
+ struct udevice *bus,
|
||||
+ int (*addr_f)(struct udevice *bus, pci_dev_t bdf, uint offset, void **addrp),
|
||||
+ pci_dev_t bdf,
|
||||
+ uint offset,
|
||||
+ ulong value,
|
||||
+ enum pci_size_t size);
|
||||
+
|
||||
+/**
|
||||
+ * pci_generic_mmap_read_config() - Generic helper for reading from
|
||||
+ * memory-mapped PCI configuration space.
|
||||
+ * @bus: Pointer to the PCI bus
|
||||
+ * @addr_f: Callback for calculating the config space address
|
||||
+ * @bdf: Identifies the PCI device to access
|
||||
+ * @offset: The offset into the device's configuration space
|
||||
+ * @valuep: A pointer at which to store the read value
|
||||
+ * @size: Indicates the size of access to perform
|
||||
+ *
|
||||
+ * Read a value of size @size from offset @offset within the configuration
|
||||
+ * space of the device identified by the bus, device & function numbers in @bdf
|
||||
+ * on the PCI bus @bus. The callback function @addr_f is responsible for
|
||||
+ * calculating the CPU address of the respective configuration space offset.
|
||||
+ *
|
||||
+ * Return: 0 on success, else -EINVAL
|
||||
+ */
|
||||
+int pci_generic_mmap_read_config(
|
||||
+ struct udevice *bus,
|
||||
+ int (*addr_f)(struct udevice *bus, pci_dev_t bdf, uint offset, void **addrp),
|
||||
+ pci_dev_t bdf,
|
||||
+ uint offset,
|
||||
+ ulong *valuep,
|
||||
+ enum pci_size_t size);
|
||||
+
|
||||
#ifdef CONFIG_DM_PCI_COMPAT
|
||||
/* Compatibility with old naming */
|
||||
static inline int pci_write_config_dword(pci_dev_t pcidev, int offset,
|
||||
|
||||
From patchwork Tue Sep 19 20:18:04 2017
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: [U-Boot, v2, 2/6] pci: xilinx: Use pci_generic_mmap_{read,
|
||||
write}_config()
|
||||
X-Patchwork-Submitter: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
|
||||
X-Patchwork-Id: 815813
|
||||
Message-Id: <20170919201808.11433-3-tuomas.tynkkynen@iki.fi>
|
||||
To: u-boot@lists.denx.de
|
||||
Cc: Tom Rini <trini@konsulko.com>
|
||||
Date: Tue, 19 Sep 2017 23:18:04 +0300
|
||||
From: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
|
||||
List-Id: U-Boot discussion <u-boot.lists.denx.de>
|
||||
|
||||
Use the new helper function to avoid boilerplate in the driver.
|
||||
|
||||
Note that this changes __raw_writel et al. to writel. AFAICT this is
|
||||
no problem because:
|
||||
|
||||
- The Linux driver for the same hardware uses the non-__raw variants as
|
||||
well (via pci_generic_config_write()).
|
||||
- This driver seems to be used only on MIPS so far, where the __raw and
|
||||
non-__raw accessors are the same.
|
||||
|
||||
Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
|
||||
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
|
||||
---
|
||||
drivers/pci/pcie_xilinx.c | 53 +++++++----------------------------------------
|
||||
1 file changed, 7 insertions(+), 46 deletions(-)
|
||||
|
||||
diff --git a/drivers/pci/pcie_xilinx.c b/drivers/pci/pcie_xilinx.c
|
||||
index 08e2e93445..d788552fed 100644
|
||||
--- a/drivers/pci/pcie_xilinx.c
|
||||
+++ b/drivers/pci/pcie_xilinx.c
|
||||
@@ -43,7 +43,7 @@ static bool pcie_xilinx_link_up(struct xilinx_pcie *pcie)
|
||||
|
||||
/**
|
||||
* pcie_xilinx_config_address() - Calculate the address of a config access
|
||||
- * @pcie: Pointer to the PCI controller state
|
||||
+ * @udev: Pointer to the PCI bus
|
||||
* @bdf: Identifies the PCIe device to access
|
||||
* @offset: The offset into the device's configuration space
|
||||
* @paddress: Pointer to the pointer to write the calculates address to
|
||||
@@ -57,9 +57,10 @@ static bool pcie_xilinx_link_up(struct xilinx_pcie *pcie)
|
||||
*
|
||||
* Return: 0 on success, else -ENODEV
|
||||
*/
|
||||
-static int pcie_xilinx_config_address(struct xilinx_pcie *pcie, pci_dev_t bdf,
|
||||
+static int pcie_xilinx_config_address(struct udevice *udev, pci_dev_t bdf,
|
||||
uint offset, void **paddress)
|
||||
{
|
||||
+ struct xilinx_pcie *pcie = dev_get_priv(udev);
|
||||
unsigned int bus = PCI_BUS(bdf);
|
||||
unsigned int dev = PCI_DEV(bdf);
|
||||
unsigned int func = PCI_FUNC(bdf);
|
||||
@@ -103,29 +104,8 @@ static int pcie_xilinx_read_config(struct udevice *bus, pci_dev_t bdf,
|
||||
uint offset, ulong *valuep,
|
||||
enum pci_size_t size)
|
||||
{
|
||||
- struct xilinx_pcie *pcie = dev_get_priv(bus);
|
||||
- void *address;
|
||||
- int err;
|
||||
-
|
||||
- err = pcie_xilinx_config_address(pcie, bdf, offset, &address);
|
||||
- if (err < 0) {
|
||||
- *valuep = pci_get_ff(size);
|
||||
- return 0;
|
||||
- }
|
||||
-
|
||||
- switch (size) {
|
||||
- case PCI_SIZE_8:
|
||||
- *valuep = __raw_readb(address);
|
||||
- return 0;
|
||||
- case PCI_SIZE_16:
|
||||
- *valuep = __raw_readw(address);
|
||||
- return 0;
|
||||
- case PCI_SIZE_32:
|
||||
- *valuep = __raw_readl(address);
|
||||
- return 0;
|
||||
- default:
|
||||
- return -EINVAL;
|
||||
- }
|
||||
+ return pci_generic_mmap_read_config(bus, pcie_xilinx_config_address,
|
||||
+ bdf, offset, valuep, size);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -146,27 +126,8 @@ static int pcie_xilinx_write_config(struct udevice *bus, pci_dev_t bdf,
|
||||
uint offset, ulong value,
|
||||
enum pci_size_t size)
|
||||
{
|
||||
- struct xilinx_pcie *pcie = dev_get_priv(bus);
|
||||
- void *address;
|
||||
- int err;
|
||||
-
|
||||
- err = pcie_xilinx_config_address(pcie, bdf, offset, &address);
|
||||
- if (err < 0)
|
||||
- return 0;
|
||||
-
|
||||
- switch (size) {
|
||||
- case PCI_SIZE_8:
|
||||
- __raw_writeb(value, address);
|
||||
- return 0;
|
||||
- case PCI_SIZE_16:
|
||||
- __raw_writew(value, address);
|
||||
- return 0;
|
||||
- case PCI_SIZE_32:
|
||||
- __raw_writel(value, address);
|
||||
- return 0;
|
||||
- default:
|
||||
- return -EINVAL;
|
||||
- }
|
||||
+ return pci_generic_mmap_write_config(bus, pcie_xilinx_config_address,
|
||||
+ bdf, offset, value, size);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
From patchwork Tue Sep 19 20:18:05 2017
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: [U-Boot, v2, 3/6] pci: layerscape: Use pci_generic_mmap_{read,
|
||||
write}_config
|
||||
X-Patchwork-Submitter: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
|
||||
X-Patchwork-Id: 815814
|
||||
Message-Id: <20170919201808.11433-4-tuomas.tynkkynen@iki.fi>
|
||||
To: u-boot@lists.denx.de
|
||||
Cc: Tom Rini <trini@konsulko.com>
|
||||
Date: Tue, 19 Sep 2017 23:18:05 +0300
|
||||
From: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
|
||||
List-Id: U-Boot discussion <u-boot.lists.denx.de>
|
||||
|
||||
Use the new helpers to avoid boilerplate in the driver.
|
||||
|
||||
Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
|
||||
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
|
||||
---
|
||||
drivers/pci/pcie_layerscape.c | 68 +++++++++++--------------------------------
|
||||
1 file changed, 17 insertions(+), 51 deletions(-)
|
||||
|
||||
diff --git a/drivers/pci/pcie_layerscape.c b/drivers/pci/pcie_layerscape.c
|
||||
index 610f85c4e8..0cb7f6d564 100644
|
||||
--- a/drivers/pci/pcie_layerscape.c
|
||||
+++ b/drivers/pci/pcie_layerscape.c
|
||||
@@ -241,14 +241,19 @@ static int ls_pcie_addr_valid(struct ls_pcie *pcie, pci_dev_t bdf)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-void *ls_pcie_conf_address(struct ls_pcie *pcie, pci_dev_t bdf,
|
||||
- int offset)
|
||||
+int ls_pcie_conf_address(struct udevice *bus, pci_dev_t bdf,
|
||||
+ uint offset, void **paddress)
|
||||
{
|
||||
- struct udevice *bus = pcie->bus;
|
||||
+ struct ls_pcie *pcie = dev_get_priv(bus);
|
||||
u32 busdev;
|
||||
|
||||
- if (PCI_BUS(bdf) == bus->seq)
|
||||
- return pcie->dbi + offset;
|
||||
+ if (ls_pcie_addr_valid(pcie, bdf))
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ if (PCI_BUS(bdf) == bus->seq) {
|
||||
+ *paddress = pcie->dbi + offset;
|
||||
+ return 0;
|
||||
+ }
|
||||
|
||||
busdev = PCIE_ATU_BUS(PCI_BUS(bdf)) |
|
||||
PCIE_ATU_DEV(PCI_DEV(bdf)) |
|
||||
@@ -256,67 +261,28 @@ void *ls_pcie_conf_address(struct ls_pcie *pcie, pci_dev_t bdf,
|
||||
|
||||
if (PCI_BUS(bdf) == bus->seq + 1) {
|
||||
ls_pcie_cfg0_set_busdev(pcie, busdev);
|
||||
- return pcie->cfg0 + offset;
|
||||
+ *paddress = pcie->cfg0 + offset;
|
||||
} else {
|
||||
ls_pcie_cfg1_set_busdev(pcie, busdev);
|
||||
- return pcie->cfg1 + offset;
|
||||
+ *paddress = pcie->cfg1 + offset;
|
||||
}
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
static int ls_pcie_read_config(struct udevice *bus, pci_dev_t bdf,
|
||||
uint offset, ulong *valuep,
|
||||
enum pci_size_t size)
|
||||
{
|
||||
- struct ls_pcie *pcie = dev_get_priv(bus);
|
||||
- void *address;
|
||||
-
|
||||
- if (ls_pcie_addr_valid(pcie, bdf)) {
|
||||
- *valuep = pci_get_ff(size);
|
||||
- return 0;
|
||||
- }
|
||||
-
|
||||
- address = ls_pcie_conf_address(pcie, bdf, offset);
|
||||
-
|
||||
- switch (size) {
|
||||
- case PCI_SIZE_8:
|
||||
- *valuep = readb(address);
|
||||
- return 0;
|
||||
- case PCI_SIZE_16:
|
||||
- *valuep = readw(address);
|
||||
- return 0;
|
||||
- case PCI_SIZE_32:
|
||||
- *valuep = readl(address);
|
||||
- return 0;
|
||||
- default:
|
||||
- return -EINVAL;
|
||||
- }
|
||||
+ return pci_generic_mmap_read_config(bus, ls_pcie_conf_address,
|
||||
+ bdf, offset, valuep, size);
|
||||
}
|
||||
|
||||
static int ls_pcie_write_config(struct udevice *bus, pci_dev_t bdf,
|
||||
uint offset, ulong value,
|
||||
enum pci_size_t size)
|
||||
{
|
||||
- struct ls_pcie *pcie = dev_get_priv(bus);
|
||||
- void *address;
|
||||
-
|
||||
- if (ls_pcie_addr_valid(pcie, bdf))
|
||||
- return 0;
|
||||
-
|
||||
- address = ls_pcie_conf_address(pcie, bdf, offset);
|
||||
-
|
||||
- switch (size) {
|
||||
- case PCI_SIZE_8:
|
||||
- writeb(value, address);
|
||||
- return 0;
|
||||
- case PCI_SIZE_16:
|
||||
- writew(value, address);
|
||||
- return 0;
|
||||
- case PCI_SIZE_32:
|
||||
- writel(value, address);
|
||||
- return 0;
|
||||
- default:
|
||||
- return -EINVAL;
|
||||
- }
|
||||
+ return pci_generic_mmap_write_config(bus, ls_pcie_conf_address,
|
||||
+ bdf, offset, value, size);
|
||||
}
|
||||
|
||||
/* Clear multi-function bit */
|
||||
|
||||
From patchwork Tue Sep 19 20:18:06 2017
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: [U-Boot, v2,
|
||||
4/6] PCI: Add driver for a 'pci-host-ecam-generic' host controller
|
||||
X-Patchwork-Submitter: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
|
||||
X-Patchwork-Id: 815817
|
||||
Message-Id: <20170919201808.11433-5-tuomas.tynkkynen@iki.fi>
|
||||
To: u-boot@lists.denx.de
|
||||
Cc: Tom Rini <trini@konsulko.com>
|
||||
Date: Tue, 19 Sep 2017 23:18:06 +0300
|
||||
From: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
|
||||
List-Id: U-Boot discussion <u-boot.lists.denx.de>
|
||||
|
||||
QEMU emulates such a device with '-machine virt,highmem=off' on ARM.
|
||||
The 'highmem=off' part is required for things to work as the PCI code
|
||||
in U-Boot doesn't seem to support 64-bit BARs.
|
||||
|
||||
Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
|
||||
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
|
||||
---
|
||||
v2:
|
||||
- no 'default n'
|
||||
- remove unnecessary non-DM struct field (inherited from the Xilinx driver)
|
||||
- fix doc comment problems (inherited from the Xilinx driver)
|
||||
- use the new generic memory mapped config space helpers
|
||||
---
|
||||
drivers/pci/Kconfig | 8 +++
|
||||
drivers/pci/Makefile | 1 +
|
||||
drivers/pci/pcie_ecam_generic.c | 143 ++++++++++++++++++++++++++++++++++++++++
|
||||
3 files changed, 152 insertions(+)
|
||||
create mode 100644 drivers/pci/pcie_ecam_generic.c
|
||||
|
||||
diff --git a/drivers/pci/Kconfig b/drivers/pci/Kconfig
|
||||
index e2a1c0a409..648dff7543 100644
|
||||
--- a/drivers/pci/Kconfig
|
||||
+++ b/drivers/pci/Kconfig
|
||||
@@ -33,6 +33,14 @@ config PCI_PNP
|
||||
help
|
||||
Enable PCI memory and I/O space resource allocation and assignment.
|
||||
|
||||
+config PCIE_ECAM_GENERIC
|
||||
+ bool "Generic ECAM-based PCI host controller support"
|
||||
+ default n
|
||||
+ depends on DM_PCI
|
||||
+ help
|
||||
+ Say Y here if you want to enable support for generic ECAM-based
|
||||
+ PCIe host controllers, such as the one emulated by QEMU.
|
||||
+
|
||||
config PCIE_DW_MVEBU
|
||||
bool "Enable Armada-8K PCIe driver (DesignWare core)"
|
||||
default n
|
||||
diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile
|
||||
index ad44e83996..5eb12efbf5 100644
|
||||
--- a/drivers/pci/Makefile
|
||||
+++ b/drivers/pci/Makefile
|
||||
@@ -17,6 +17,7 @@ obj-$(CONFIG_PCI) += pci.o pci_auto_old.o
|
||||
endif
|
||||
obj-$(CONFIG_PCI) += pci_auto_common.o pci_common.o
|
||||
|
||||
+obj-$(CONFIG_PCIE_ECAM_GENERIC) += pcie_ecam_generic.o
|
||||
obj-$(CONFIG_FSL_PCI_INIT) += fsl_pci_init.o
|
||||
obj-$(CONFIG_PCI_INDIRECT_BRIDGE) += pci_indirect.o
|
||||
obj-$(CONFIG_PCI_GT64120) += pci_gt64120.o
|
||||
diff --git a/drivers/pci/pcie_ecam_generic.c b/drivers/pci/pcie_ecam_generic.c
|
||||
new file mode 100644
|
||||
index 0000000000..2758f90de1
|
||||
--- /dev/null
|
||||
+++ b/drivers/pci/pcie_ecam_generic.c
|
||||
@@ -0,0 +1,143 @@
|
||||
+/*
|
||||
+ * Generic PCIE host provided by e.g. QEMU
|
||||
+ *
|
||||
+ * Heavily based on drivers/pci/pcie_xilinx.c
|
||||
+ *
|
||||
+ * Copyright (C) 2016 Imagination Technologies
|
||||
+ *
|
||||
+ * SPDX-License-Identifier: GPL-2.0
|
||||
+ */
|
||||
+
|
||||
+#include <common.h>
|
||||
+#include <dm.h>
|
||||
+#include <pci.h>
|
||||
+
|
||||
+#include <asm/io.h>
|
||||
+
|
||||
+/**
|
||||
+ * struct generic_ecam_pcie - generic_ecam PCIe controller state
|
||||
+ * @cfg_base: The base address of memory mapped configuration space
|
||||
+ */
|
||||
+struct generic_ecam_pcie {
|
||||
+ void *cfg_base;
|
||||
+};
|
||||
+
|
||||
+/**
|
||||
+ * pci_generic_ecam_conf_address() - Calculate the address of a config access
|
||||
+ * @bus: Pointer to the PCI bus
|
||||
+ * @bdf: Identifies the PCIe device to access
|
||||
+ * @offset: The offset into the device's configuration space
|
||||
+ * @paddress: Pointer to the pointer to write the calculates address to
|
||||
+ *
|
||||
+ * Calculates the address that should be accessed to perform a PCIe
|
||||
+ * configuration space access for a given device identified by the PCIe
|
||||
+ * controller device @pcie and the bus, device & function numbers in @bdf. If
|
||||
+ * access to the device is not valid then the function will return an error
|
||||
+ * code. Otherwise the address to access will be written to the pointer pointed
|
||||
+ * to by @paddress.
|
||||
+ */
|
||||
+static int pci_generic_ecam_conf_address(struct udevice *bus, pci_dev_t bdf,
|
||||
+ uint offset, void **paddress)
|
||||
+{
|
||||
+ struct generic_ecam_pcie *pcie = dev_get_priv(bus);
|
||||
+ void *addr;
|
||||
+
|
||||
+ addr = pcie->cfg_base;
|
||||
+ addr += PCI_BUS(bdf) << 20;
|
||||
+ addr += PCI_DEV(bdf) << 15;
|
||||
+ addr += PCI_FUNC(bdf) << 12;
|
||||
+ addr += offset;
|
||||
+ *paddress = addr;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ * pci_generic_ecam_read_config() - Read from configuration space
|
||||
+ * @bus: Pointer to the PCI bus
|
||||
+ * @bdf: Identifies the PCIe device to access
|
||||
+ * @offset: The offset into the device's configuration space
|
||||
+ * @valuep: A pointer at which to store the read value
|
||||
+ * @size: Indicates the size of access to perform
|
||||
+ *
|
||||
+ * Read a value of size @size from offset @offset within the configuration
|
||||
+ * space of the device identified by the bus, device & function numbers in @bdf
|
||||
+ * on the PCI bus @bus.
|
||||
+ */
|
||||
+static int pci_generic_ecam_read_config(struct udevice *bus, pci_dev_t bdf,
|
||||
+ uint offset, ulong *valuep,
|
||||
+ enum pci_size_t size)
|
||||
+{
|
||||
+ return pci_generic_mmap_read_config(bus, pci_generic_ecam_conf_address,
|
||||
+ bdf, offset, valuep, size);
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ * pci_generic_ecam_write_config() - Write to configuration space
|
||||
+ * @bus: Pointer to the PCI bus
|
||||
+ * @bdf: Identifies the PCIe device to access
|
||||
+ * @offset: The offset into the device's configuration space
|
||||
+ * @value: The value to write
|
||||
+ * @size: Indicates the size of access to perform
|
||||
+ *
|
||||
+ * Write the value @value of size @size from offset @offset within the
|
||||
+ * configuration space of the device identified by the bus, device & function
|
||||
+ * numbers in @bdf on the PCI bus @bus.
|
||||
+ */
|
||||
+static int pci_generic_ecam_write_config(struct udevice *bus, pci_dev_t bdf,
|
||||
+ uint offset, ulong value,
|
||||
+ enum pci_size_t size)
|
||||
+{
|
||||
+ return pci_generic_mmap_write_config(bus, pci_generic_ecam_conf_address,
|
||||
+ bdf, offset, value, size);
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ * pci_generic_ecam_ofdata_to_platdata() - Translate from DT to device state
|
||||
+ * @dev: A pointer to the device being operated on
|
||||
+ *
|
||||
+ * Translate relevant data from the device tree pertaining to device @dev into
|
||||
+ * state that the driver will later make use of. This state is stored in the
|
||||
+ * device's private data structure.
|
||||
+ *
|
||||
+ * Return: 0 on success, else -EINVAL
|
||||
+ */
|
||||
+static int pci_generic_ecam_ofdata_to_platdata(struct udevice *dev)
|
||||
+{
|
||||
+ struct generic_ecam_pcie *pcie = dev_get_priv(dev);
|
||||
+ struct fdt_resource reg_res;
|
||||
+ DECLARE_GLOBAL_DATA_PTR;
|
||||
+ int err;
|
||||
+
|
||||
+ err = fdt_get_resource(gd->fdt_blob, dev_of_offset(dev), "reg",
|
||||
+ 0, ®_res);
|
||||
+ if (err < 0) {
|
||||
+ error("\"reg\" resource not found\n");
|
||||
+ return err;
|
||||
+ }
|
||||
+
|
||||
+ pcie->cfg_base = map_physmem(reg_res.start,
|
||||
+ fdt_resource_size(®_res),
|
||||
+ MAP_NOCACHE);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct dm_pci_ops pci_generic_ecam_ops = {
|
||||
+ .read_config = pci_generic_ecam_read_config,
|
||||
+ .write_config = pci_generic_ecam_write_config,
|
||||
+};
|
||||
+
|
||||
+static const struct udevice_id pci_generic_ecam_ids[] = {
|
||||
+ { .compatible = "pci-host-ecam-generic" },
|
||||
+ { }
|
||||
+};
|
||||
+
|
||||
+U_BOOT_DRIVER(pci_generic_ecam) = {
|
||||
+ .name = "pci_generic_ecam",
|
||||
+ .id = UCLASS_PCI,
|
||||
+ .of_match = pci_generic_ecam_ids,
|
||||
+ .ops = &pci_generic_ecam_ops,
|
||||
+ .ofdata_to_platdata = pci_generic_ecam_ofdata_to_platdata,
|
||||
+ .priv_auto_alloc_size = sizeof(struct generic_ecam_pcie),
|
||||
+};
|
||||
|
||||
From patchwork Tue Sep 19 20:18:07 2017
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: [U-Boot, v2,
|
||||
5/6] ARM: Add a new arch + board for QEMU's 'virt' machine
|
||||
X-Patchwork-Submitter: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
|
||||
X-Patchwork-Id: 815816
|
||||
Message-Id: <20170919201808.11433-6-tuomas.tynkkynen@iki.fi>
|
||||
To: u-boot@lists.denx.de
|
||||
Cc: Tom Rini <trini@konsulko.com>
|
||||
Date: Tue, 19 Sep 2017 23:18:07 +0300
|
||||
From: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
|
||||
List-Id: U-Boot discussion <u-boot.lists.denx.de>
|
||||
|
||||
This board builds an U-Boot binary that is bootable with QEMU's 'virt'
|
||||
machine on ARM. The minimal QEMU command line is:
|
||||
|
||||
qemu-system-arm -machine virt,highmem=off -bios u-boot.bin
|
||||
|
||||
(Note that the 'highmem=off' parameter to the 'virt' machine is required for
|
||||
PCI to work in U-Boot.) This command line enables the following:
|
||||
- u-boot.bin loaded and executing in the emulated flash at address 0x0
|
||||
- A generated device tree blob placed at the start of RAM
|
||||
- A freely configurable amount of RAM, described by the DTB
|
||||
- A PL011 serial port, discoverable via the DTB
|
||||
- An ARMv7 architected timer
|
||||
- PSCI for rebooting the system
|
||||
- A generic ECAM-based PCI host controller, discoverable via the DTB
|
||||
|
||||
Additionally, QEMU allows plugging a bunch of useful peripherals to the PCI bus.
|
||||
The following ones are supported by both U-Boot and Linux:
|
||||
|
||||
- To add a Serial ATA disk via an Intel ICH9 AHCI controller, pass e.g.:
|
||||
-drive if=none,file=disk.img,id=mydisk -device ich9-ahci,id=ahci -device ide-drive,drive=mydisk,bus=ahci.0
|
||||
- To add an Intel E1000 network adapter, pass e.g.:
|
||||
-net nic,model=e1000 -net user
|
||||
- To add an EHCI-compliant USB host controller, pass e.g.:
|
||||
-device usb-ehci,id=ehci
|
||||
- To add a NVMe disk, pass e.g.:
|
||||
-drive if=none,file=disk.img,id=mydisk -device nvme,drive=mydisk,serial=foo
|
||||
|
||||
Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
|
||||
---
|
||||
v2:
|
||||
- enable CONFIG_NVME
|
||||
- alphasort correctly
|
||||
- remove unnecessary gd declaration
|
||||
- move board under board/emulation
|
||||
- add MAINTAINERS
|
||||
---
|
||||
arch/arm/Kconfig | 10 +++++++
|
||||
arch/arm/mach-qemu/Kconfig | 12 ++++++++
|
||||
board/emulation/qemu-arm/MAINTAINERS | 6 ++++
|
||||
board/emulation/qemu-arm/Makefile | 5 ++++
|
||||
board/emulation/qemu-arm/qemu-arm.c | 33 ++++++++++++++++++++
|
||||
configs/qemu_arm_defconfig | 28 +++++++++++++++++
|
||||
include/configs/qemu-arm.h | 58 ++++++++++++++++++++++++++++++++++++
|
||||
7 files changed, 152 insertions(+)
|
||||
create mode 100644 arch/arm/mach-qemu/Kconfig
|
||||
create mode 100644 board/emulation/qemu-arm/MAINTAINERS
|
||||
create mode 100644 board/emulation/qemu-arm/Makefile
|
||||
create mode 100644 board/emulation/qemu-arm/qemu-arm.c
|
||||
create mode 100644 configs/qemu_arm_defconfig
|
||||
create mode 100644 include/configs/qemu-arm.h
|
||||
|
||||
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
|
||||
index 53eae8953e..1de5be7a72 100644
|
||||
--- a/arch/arm/Kconfig
|
||||
+++ b/arch/arm/Kconfig
|
||||
@@ -630,6 +630,14 @@ config ARCH_MX5
|
||||
select CPU_V7
|
||||
select BOARD_EARLY_INIT_F
|
||||
|
||||
+config ARCH_QEMU
|
||||
+ bool "QEMU Virtual Platform"
|
||||
+ select CPU_V7
|
||||
+ select ARCH_SUPPORT_PSCI
|
||||
+ select DM
|
||||
+ select DM_SERIAL
|
||||
+ select OF_CONTROL
|
||||
+
|
||||
config ARCH_RMOBILE
|
||||
bool "Renesas ARM SoCs"
|
||||
select DM
|
||||
@@ -1142,6 +1150,8 @@ source "arch/arm/mach-rmobile/Kconfig"
|
||||
|
||||
source "arch/arm/mach-meson/Kconfig"
|
||||
|
||||
+source "arch/arm/mach-qemu/Kconfig"
|
||||
+
|
||||
source "arch/arm/mach-rockchip/Kconfig"
|
||||
|
||||
source "arch/arm/mach-s5pc1xx/Kconfig"
|
||||
diff --git a/arch/arm/mach-qemu/Kconfig b/arch/arm/mach-qemu/Kconfig
|
||||
new file mode 100644
|
||||
index 0000000000..3500b56cb0
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/mach-qemu/Kconfig
|
||||
@@ -0,0 +1,12 @@
|
||||
+if ARCH_QEMU
|
||||
+
|
||||
+config SYS_VENDOR
|
||||
+ default "emulation"
|
||||
+
|
||||
+config SYS_BOARD
|
||||
+ default "qemu-arm"
|
||||
+
|
||||
+config SYS_CONFIG_NAME
|
||||
+ default "qemu-arm"
|
||||
+
|
||||
+endif
|
||||
diff --git a/board/emulation/qemu-arm/MAINTAINERS b/board/emulation/qemu-arm/MAINTAINERS
|
||||
new file mode 100644
|
||||
index 0000000000..a803061ff4
|
||||
--- /dev/null
|
||||
+++ b/board/emulation/qemu-arm/MAINTAINERS
|
||||
@@ -0,0 +1,6 @@
|
||||
+QEMU ARM 'VIRT' BOARD
|
||||
+M: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
|
||||
+S: Maintained
|
||||
+F: board/emulation/qemu-arm/
|
||||
+F: include/configs/qemu-arm.h
|
||||
+F: configs/qemu_arm_defconfig
|
||||
diff --git a/board/emulation/qemu-arm/Makefile b/board/emulation/qemu-arm/Makefile
|
||||
new file mode 100644
|
||||
index 0000000000..716a6e9c28
|
||||
--- /dev/null
|
||||
+++ b/board/emulation/qemu-arm/Makefile
|
||||
@@ -0,0 +1,5 @@
|
||||
+#
|
||||
+# SPDX-License-Identifier: GPL-2.0+
|
||||
+#
|
||||
+
|
||||
+obj-y += qemu-arm.o
|
||||
diff --git a/board/emulation/qemu-arm/qemu-arm.c b/board/emulation/qemu-arm/qemu-arm.c
|
||||
new file mode 100644
|
||||
index 0000000000..e29ba4630f
|
||||
--- /dev/null
|
||||
+++ b/board/emulation/qemu-arm/qemu-arm.c
|
||||
@@ -0,0 +1,33 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2017 Tuomas Tynkkynen
|
||||
+ *
|
||||
+ * SPDX-License-Identifier: GPL-2.0+
|
||||
+ */
|
||||
+#include <common.h>
|
||||
+#include <fdtdec.h>
|
||||
+
|
||||
+int board_init(void)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+int dram_init(void)
|
||||
+{
|
||||
+ if (fdtdec_setup_memory_size() != 0)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+int dram_init_banksize(void)
|
||||
+{
|
||||
+ fdtdec_setup_memory_banksize();
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+void *board_fdt_blob_setup(void)
|
||||
+{
|
||||
+ /* QEMU loads a generated DTB for us at the start of RAM. */
|
||||
+ return (void *)CONFIG_SYS_SDRAM_BASE;
|
||||
+}
|
||||
diff --git a/configs/qemu_arm_defconfig b/configs/qemu_arm_defconfig
|
||||
new file mode 100644
|
||||
index 0000000000..2a8594d472
|
||||
--- /dev/null
|
||||
+++ b/configs/qemu_arm_defconfig
|
||||
@@ -0,0 +1,28 @@
|
||||
+CONFIG_ARM=y
|
||||
+CONFIG_ARM_SMCCC=y
|
||||
+CONFIG_ARCH_QEMU=y
|
||||
+CONFIG_AHCI=y
|
||||
+CONFIG_DISTRO_DEFAULTS=y
|
||||
+# CONFIG_DISPLAY_CPUINFO is not set
|
||||
+# CONFIG_DISPLAY_BOARDINFO is not set
|
||||
+# CONFIG_CMD_IMLS is not set
|
||||
+CONFIG_CMD_PCI=y
|
||||
+CONFIG_CMD_USB=y
|
||||
+CONFIG_OF_BOARD=y
|
||||
+CONFIG_AHCI_PCI=y
|
||||
+CONFIG_BLK=y
|
||||
+# CONFIG_MMC is not set
|
||||
+CONFIG_DM_ETH=y
|
||||
+CONFIG_E1000=y
|
||||
+CONFIG_NVME=y
|
||||
+CONFIG_PCI=y
|
||||
+CONFIG_DM_PCI=y
|
||||
+CONFIG_PCIE_ECAM_GENERIC=y
|
||||
+CONFIG_SCSI=y
|
||||
+CONFIG_DM_SCSI=y
|
||||
+CONFIG_SYSRESET=y
|
||||
+CONFIG_SYSRESET_PSCI=y
|
||||
+CONFIG_USB=y
|
||||
+CONFIG_DM_USB=y
|
||||
+CONFIG_USB_EHCI_HCD=y
|
||||
+CONFIG_USB_EHCI_PCI=y
|
||||
diff --git a/include/configs/qemu-arm.h b/include/configs/qemu-arm.h
|
||||
new file mode 100644
|
||||
index 0000000000..4376a24787
|
||||
--- /dev/null
|
||||
+++ b/include/configs/qemu-arm.h
|
||||
@@ -0,0 +1,58 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2017 Tuomas Tynkkynen
|
||||
+ *
|
||||
+ * SPDX-License-Identifier: GPL-2.0+
|
||||
+ */
|
||||
+
|
||||
+#ifndef __CONFIG_H
|
||||
+#define __CONFIG_H
|
||||
+
|
||||
+#include <linux/sizes.h>
|
||||
+
|
||||
+/* Physical memory map */
|
||||
+#define CONFIG_SYS_TEXT_BASE 0x00000000
|
||||
+
|
||||
+#define CONFIG_NR_DRAM_BANKS 1
|
||||
+#define CONFIG_SYS_SDRAM_BASE 0x40000000
|
||||
+
|
||||
+/* The DTB generated by QEMU is placed at start of RAM, stay away from there */
|
||||
+#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_SDRAM_BASE + SZ_2M)
|
||||
+#define CONFIG_SYS_LOAD_ADDR (CONFIG_SYS_SDRAM_BASE + SZ_2M)
|
||||
+#define CONFIG_SYS_MALLOC_LEN SZ_16M
|
||||
+
|
||||
+/* QEMU's PL011 serial port is detected via FDT using the device model */
|
||||
+#define CONFIG_PL01X_SERIAL
|
||||
+
|
||||
+/* QEMU implements a 62.5MHz architected timer */
|
||||
+/* FIXME: can we rely on CNTFREQ instead of hardcoding this fact here? */
|
||||
+#define CONFIG_SYS_ARCH_TIMER
|
||||
+#define CONFIG_SYS_HZ 1000
|
||||
+#define CONFIG_SYS_HZ_CLOCK 62500000
|
||||
+
|
||||
+/* For block devices, QEMU emulates an ICH9 AHCI controller over PCI */
|
||||
+#define CONFIG_SYS_SCSI_MAX_SCSI_ID 6
|
||||
+#define CONFIG_SCSI_AHCI
|
||||
+#define CONFIG_LIBATA
|
||||
+
|
||||
+/* Environment options */
|
||||
+#define CONFIG_ENV_SIZE SZ_64K
|
||||
+
|
||||
+#include <config_distro_defaults.h>
|
||||
+
|
||||
+#define BOOT_TARGET_DEVICES(func) \
|
||||
+ func(SCSI, scsi, 0)
|
||||
+
|
||||
+#include <config_distro_bootcmd.h>
|
||||
+
|
||||
+#define CONFIG_PREBOOT "pci enum"
|
||||
+#define CONFIG_EXTRA_ENV_SETTINGS \
|
||||
+ "fdt_high=0xffffffff\0" \
|
||||
+ "initrd_high=0xffffffff\0" \
|
||||
+ "fdt_addr=0x40000000\0" \
|
||||
+ "scriptaddr=0x40200000\0" \
|
||||
+ "pxefile_addr_r=0x40300000\0" \
|
||||
+ "kernel_addr_r=0x40400000\0" \
|
||||
+ "ramdisk_addr_r=0x44000000\0" \
|
||||
+ BOOTENV
|
||||
+
|
||||
+#endif /* __CONFIG_H */
|
||||
|
2
sources
2
sources
|
@ -1 +1 @@
|
|||
SHA512 (u-boot-2017.09.tar.bz2) = dff6e793f135e7d6cb9d85d6ef8e4aa7ed5c1e20eece4f434e8c0a6039eb75c3f2cb7bc550121b1f5a5709e943c7cc5d6d8590e05a47a6b0d0d8f05185fe7ec6
|
||||
SHA512 (u-boot-2017.11-rc2.tar.bz2) = 881c53e2888a591046d033e06631a2011aef3afb9e809b3419653e2595ebc362b855c43efbb67813fb815673df1e7692f27ce11334353527cb0cb94bc2057672
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,541 +0,0 @@
|
|||
From patchwork Fri Sep 22 07:26:27 2017
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: [U-Boot,1/9] sunxi: rename Bananapi M3 dts file name
|
||||
X-Patchwork-Submitter: Chen-Yu Tsai <wens@csie.org>
|
||||
X-Patchwork-Id: 817346
|
||||
X-Patchwork-Delegate: jagannadh.teki@gmail.com
|
||||
Message-Id: <20170922072635.32105-2-wens@csie.org>
|
||||
To: u-boot@lists.denx.de
|
||||
Cc: Joe Hershberger <joe.hershberger@ni.com>, Jagan Teki <jagan@openedev.com>,
|
||||
Maxime Ripard <maxime.ripard@free-electrons.com>
|
||||
Date: Fri, 22 Sep 2017 15:26:27 +0800
|
||||
From: Chen-Yu Tsai <wens@csie.org>
|
||||
List-Id: U-Boot discussion <u-boot.lists.denx.de>
|
||||
|
||||
The upstream (Linux) device tree file for the Bananapi M3 follows the
|
||||
convention of using the well known brand name, instead of the vendor
|
||||
name, for naming. The file was recently added to upstream in commit
|
||||
359b5a1e1c2d ("ARM: sun8i: a83t: Add device tree for Sinovoip Bananapi
|
||||
BPI-M3")
|
||||
|
||||
Rename the device tree file in U-boot to match.
|
||||
|
||||
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
|
||||
---
|
||||
arch/arm/dts/Makefile | 4 ++--
|
||||
.../{sun8i-a83t-sinovoip-bpi-m3.dts => sun8i-a83t-bananapi-m3.dts} | 0
|
||||
configs/Sinovoip_BPI_M3_defconfig | 2 +-
|
||||
3 files changed, 3 insertions(+), 3 deletions(-)
|
||||
rename arch/arm/dts/{sun8i-a83t-sinovoip-bpi-m3.dts => sun8i-a83t-bananapi-m3.dts} (100%)
|
||||
|
||||
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
|
||||
index 762429c463d1..b7550104c340 100644
|
||||
--- a/arch/arm/dts/Makefile
|
||||
+++ b/arch/arm/dts/Makefile
|
||||
@@ -307,8 +307,8 @@ dtb-$(CONFIG_MACH_SUN8I_A33) += \
|
||||
sun8i-r16-parrot.dtb
|
||||
dtb-$(CONFIG_MACH_SUN8I_A83T) += \
|
||||
sun8i-a83t-allwinner-h8homlet-v2.dtb \
|
||||
- sun8i-a83t-cubietruck-plus.dtb \
|
||||
- sun8i-a83t-sinovoip-bpi-m3.dtb
|
||||
+ sun8i-a83t-bananapi-m3.dtb \
|
||||
+ sun8i-a83t-cubietruck-plus.dtb
|
||||
dtb-$(CONFIG_MACH_SUN8I_H3) += \
|
||||
sun8i-h2-plus-orangepi-zero.dtb \
|
||||
sun8i-h3-bananapi-m2-plus.dtb \
|
||||
diff --git a/arch/arm/dts/sun8i-a83t-sinovoip-bpi-m3.dts b/arch/arm/dts/sun8i-a83t-bananapi-m3.dts
|
||||
similarity index 100%
|
||||
rename from arch/arm/dts/sun8i-a83t-sinovoip-bpi-m3.dts
|
||||
rename to arch/arm/dts/sun8i-a83t-bananapi-m3.dts
|
||||
diff --git a/configs/Sinovoip_BPI_M3_defconfig b/configs/Sinovoip_BPI_M3_defconfig
|
||||
index 04d81693ebd8..f321d94e04eb 100644
|
||||
--- a/configs/Sinovoip_BPI_M3_defconfig
|
||||
+++ b/configs/Sinovoip_BPI_M3_defconfig
|
||||
@@ -13,7 +13,7 @@ CONFIG_USB0_ID_DET="PH11"
|
||||
CONFIG_USB1_VBUS_PIN="PD24"
|
||||
CONFIG_AXP_GPIO=y
|
||||
CONFIG_SATAPWR="PD25"
|
||||
-CONFIG_DEFAULT_DEVICE_TREE="sun8i-a83t-sinovoip-bpi-m3"
|
||||
+CONFIG_DEFAULT_DEVICE_TREE="sun8i-a83t-bananapi-m3"
|
||||
# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
|
||||
CONFIG_CONSOLE_MUX=y
|
||||
CONFIG_SPL=y
|
||||
|
||||
From patchwork Fri Sep 22 07:26:28 2017
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: [U-Boot,2/9] sunxi: Enable eMMC on Cubietruck Plus
|
||||
X-Patchwork-Submitter: Chen-Yu Tsai <wens@csie.org>
|
||||
X-Patchwork-Id: 817342
|
||||
X-Patchwork-Delegate: jagannadh.teki@gmail.com
|
||||
Message-Id: <20170922072635.32105-3-wens@csie.org>
|
||||
To: u-boot@lists.denx.de
|
||||
Cc: Joe Hershberger <joe.hershberger@ni.com>, Jagan Teki <jagan@openedev.com>,
|
||||
Maxime Ripard <maxime.ripard@free-electrons.com>
|
||||
Date: Fri, 22 Sep 2017 15:26:28 +0800
|
||||
From: Chen-Yu Tsai <wens@csie.org>
|
||||
List-Id: U-Boot discussion <u-boot.lists.denx.de>
|
||||
|
||||
Set CONFIG_MMC_SUNXI_SLOT_EXTRA=2 to enable the eMMC controller to
|
||||
access eMMC on the board.
|
||||
|
||||
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
|
||||
---
|
||||
configs/Cubietruck_plus_defconfig | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/configs/Cubietruck_plus_defconfig b/configs/Cubietruck_plus_defconfig
|
||||
index 34444ec0bd09..3d999192cbc1 100644
|
||||
--- a/configs/Cubietruck_plus_defconfig
|
||||
+++ b/configs/Cubietruck_plus_defconfig
|
||||
@@ -4,6 +4,7 @@ CONFIG_MACH_SUN8I_A83T=y
|
||||
CONFIG_DRAM_CLK=672
|
||||
CONFIG_DRAM_ZQ=15355
|
||||
CONFIG_DRAM_ODT_EN=y
|
||||
+CONFIG_MMC_SUNXI_SLOT_EXTRA=2
|
||||
CONFIG_USB0_VBUS_PIN="AXP0-VBUS-ENABLE"
|
||||
CONFIG_USB0_VBUS_DET="AXP0-VBUS-DETECT"
|
||||
CONFIG_USB0_ID_DET="PH11"
|
||||
|
||||
From patchwork Fri Sep 22 07:26:29 2017
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: [U-Boot,3/9] sunxi: Fix USB PHY control register offset for A83T
|
||||
X-Patchwork-Submitter: Chen-Yu Tsai <wens@csie.org>
|
||||
X-Patchwork-Id: 817341
|
||||
X-Patchwork-Delegate: jagannadh.teki@gmail.com
|
||||
Message-Id: <20170922072635.32105-4-wens@csie.org>
|
||||
To: u-boot@lists.denx.de
|
||||
Cc: Joe Hershberger <joe.hershberger@ni.com>, Jagan Teki <jagan@openedev.com>,
|
||||
Maxime Ripard <maxime.ripard@free-electrons.com>
|
||||
Date: Fri, 22 Sep 2017 15:26:29 +0800
|
||||
From: Chen-Yu Tsai <wens@csie.org>
|
||||
List-Id: U-Boot discussion <u-boot.lists.denx.de>
|
||||
|
||||
It was recently discovered that the USB PHY control register offset on
|
||||
the A83T is 0x410 like on the A33, not 0x404. Fix it.
|
||||
|
||||
Fixes: 0c935acb9e5d ("sunxi: usb_phy: Add support for A83T USB PHYs")
|
||||
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
|
||||
---
|
||||
arch/arm/mach-sunxi/usb_phy.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/arch/arm/mach-sunxi/usb_phy.c b/arch/arm/mach-sunxi/usb_phy.c
|
||||
index 9bf0b5633d4a..3fbef0050e3f 100644
|
||||
--- a/arch/arm/mach-sunxi/usb_phy.c
|
||||
+++ b/arch/arm/mach-sunxi/usb_phy.c
|
||||
@@ -19,7 +19,7 @@
|
||||
#include <errno.h>
|
||||
|
||||
#define SUNXI_USB_PMU_IRQ_ENABLE 0x800
|
||||
-#ifdef CONFIG_MACH_SUN8I_A33
|
||||
+#if defined CONFIG_MACH_SUN8I_A33 || defined CONFIG_MACH_SUN8I_A83T
|
||||
#define SUNXI_USB_CSR 0x410
|
||||
#else
|
||||
#define SUNXI_USB_CSR 0x404
|
||||
|
||||
From patchwork Fri Sep 22 07:26:30 2017
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: [U-Boot,4/9] sunxi: Switch MUSB to gadget mode on the Bananapi M3
|
||||
X-Patchwork-Submitter: Chen-Yu Tsai <wens@csie.org>
|
||||
X-Patchwork-Id: 817348
|
||||
X-Patchwork-Delegate: jagannadh.teki@gmail.com
|
||||
Message-Id: <20170922072635.32105-5-wens@csie.org>
|
||||
To: u-boot@lists.denx.de
|
||||
Cc: Joe Hershberger <joe.hershberger@ni.com>, Jagan Teki <jagan@openedev.com>,
|
||||
Maxime Ripard <maxime.ripard@free-electrons.com>
|
||||
Date: Fri, 22 Sep 2017 15:26:30 +0800
|
||||
From: Chen-Yu Tsai <wens@csie.org>
|
||||
List-Id: U-Boot discussion <u-boot.lists.denx.de>
|
||||
|
||||
The Bananapi M3 has a micro-USB OTG port. It supports both host and
|
||||
gadget mode. Having the OTG port operate in gadget mode is more useful,
|
||||
as we can use it for fastboot or Ethernet over USB.
|
||||
|
||||
The board has 2 other USB host ports that are supported. These can be
|
||||
used for connecting peripherals.
|
||||
|
||||
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
|
||||
---
|
||||
configs/Sinovoip_BPI_M3_defconfig | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/configs/Sinovoip_BPI_M3_defconfig b/configs/Sinovoip_BPI_M3_defconfig
|
||||
index f321d94e04eb..e48983fc3310 100644
|
||||
--- a/configs/Sinovoip_BPI_M3_defconfig
|
||||
+++ b/configs/Sinovoip_BPI_M3_defconfig
|
||||
@@ -27,5 +27,5 @@ CONFIG_AXP_DCDC5_VOLT=1200
|
||||
CONFIG_AXP_DLDO3_VOLT=2500
|
||||
CONFIG_AXP_SW_ON=y
|
||||
CONFIG_USB_EHCI_HCD=y
|
||||
-CONFIG_USB_MUSB_HOST=y
|
||||
+CONFIG_USB_MUSB_GADGET=y
|
||||
CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE=y
|
||||
|
||||
From patchwork Fri Sep 22 07:26:31 2017
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: [U-Boot, 5/9] sunxi: Switch MUSB to gadget mode on the Cubietruck Plus
|
||||
X-Patchwork-Submitter: Chen-Yu Tsai <wens@csie.org>
|
||||
X-Patchwork-Id: 817344
|
||||
X-Patchwork-Delegate: jagannadh.teki@gmail.com
|
||||
Message-Id: <20170922072635.32105-6-wens@csie.org>
|
||||
To: u-boot@lists.denx.de
|
||||
Cc: Joe Hershberger <joe.hershberger@ni.com>, Jagan Teki <jagan@openedev.com>,
|
||||
Maxime Ripard <maxime.ripard@free-electrons.com>
|
||||
Date: Fri, 22 Sep 2017 15:26:31 +0800
|
||||
From: Chen-Yu Tsai <wens@csie.org>
|
||||
List-Id: U-Boot discussion <u-boot.lists.denx.de>
|
||||
|
||||
The Cubietruck Plus has a micro-USB OTG port. It supports both host and
|
||||
gadget mode. Having the OTG port operate in gadget mode is more useful,
|
||||
as we can use it for fastboot or Ethernet over USB.
|
||||
|
||||
The board has 2 other USB host ports that are supported. These can be
|
||||
used for connecting peripherals.
|
||||
|
||||
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
|
||||
---
|
||||
configs/Cubietruck_plus_defconfig | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/configs/Cubietruck_plus_defconfig b/configs/Cubietruck_plus_defconfig
|
||||
index 3d999192cbc1..3aefcc58413c 100644
|
||||
--- a/configs/Cubietruck_plus_defconfig
|
||||
+++ b/configs/Cubietruck_plus_defconfig
|
||||
@@ -26,5 +26,5 @@ CONFIG_AXP_DLDO3_VOLT=2500
|
||||
CONFIG_AXP_DLDO4_VOLT=3300
|
||||
CONFIG_AXP_FLDO1_VOLT=1200
|
||||
CONFIG_USB_EHCI_HCD=y
|
||||
-CONFIG_USB_MUSB_HOST=y
|
||||
+CONFIG_USB_MUSB_GADGET=y
|
||||
CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE=y
|
||||
|
||||
From patchwork Fri Sep 22 07:26:32 2017
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: [U-Boot,6/9] net: sun8i_emac: Support RX/TX delay chains
|
||||
X-Patchwork-Submitter: Chen-Yu Tsai <wens@csie.org>
|
||||
X-Patchwork-Id: 817350
|
||||
X-Patchwork-Delegate: jagannadh.teki@gmail.com
|
||||
Message-Id: <20170922072635.32105-7-wens@csie.org>
|
||||
To: u-boot@lists.denx.de
|
||||
Cc: Joe Hershberger <joe.hershberger@ni.com>, Jagan Teki <jagan@openedev.com>,
|
||||
Maxime Ripard <maxime.ripard@free-electrons.com>
|
||||
Date: Fri, 22 Sep 2017 15:26:32 +0800
|
||||
From: Chen-Yu Tsai <wens@csie.org>
|
||||
List-Id: U-Boot discussion <u-boot.lists.denx.de>
|
||||
|
||||
The EMAC syscon has configurable RX/TX delay chains for use with RGMII
|
||||
PHYs.
|
||||
|
||||
This adds support for configuring them via device tree properties. The
|
||||
property names and format were defined in Linux's dwmac-sun8i binding
|
||||
that was merged at one point.
|
||||
|
||||
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
|
||||
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
|
||||
---
|
||||
drivers/net/sun8i_emac.c | 25 +++++++++++++++++++++++++
|
||||
1 file changed, 25 insertions(+)
|
||||
|
||||
diff --git a/drivers/net/sun8i_emac.c b/drivers/net/sun8i_emac.c
|
||||
index 09bbb2cdb5ca..5fa1b4c170d7 100644
|
||||
--- a/drivers/net/sun8i_emac.c
|
||||
+++ b/drivers/net/sun8i_emac.c
|
||||
@@ -56,6 +56,10 @@
|
||||
#define H3_EPHY_SELECT BIT(15) /* 1: internal PHY, 0: external PHY */
|
||||
|
||||
#define SC_RMII_EN BIT(13)
|
||||
+#define SC_TXDC_SHIFT 10
|
||||
+#define SC_TXDC_MASK GENMASK(2, 0)
|
||||
+#define SC_RXDC_SHIFT 5
|
||||
+#define SC_RXDC_MASK GENMASK(4, 0)
|
||||
#define SC_EPIT BIT(2) /* 1: RGMII, 0: MII */
|
||||
#define SC_ETCS_MASK GENMASK(1, 0)
|
||||
#define SC_ETCS_EXT_GMII 0x1
|
||||
@@ -125,6 +129,8 @@ struct emac_eth_dev {
|
||||
u32 addr;
|
||||
u32 tx_slot;
|
||||
bool use_internal_phy;
|
||||
+ u32 tx_delay;
|
||||
+ u32 rx_delay;
|
||||
|
||||
enum emac_variant variant;
|
||||
void *mac_reg;
|
||||
@@ -290,6 +296,12 @@ static int sun8i_emac_set_syscon(struct emac_eth_dev *priv)
|
||||
if (priv->variant == H3_EMAC || priv->variant == A64_EMAC)
|
||||
reg &= ~SC_RMII_EN;
|
||||
|
||||
+ /* Configure RX/TX delay chains */
|
||||
+ reg &= ~(SC_RXDC_MASK << SC_RXDC_SHIFT);
|
||||
+ reg &= ~(SC_TXDC_MASK << SC_TXDC_SHIFT);
|
||||
+ reg |= (priv->rx_delay & SC_RXDC_MASK) << SC_RXDC_SHIFT;
|
||||
+ reg |= (priv->tx_delay & SC_TXDC_MASK) << SC_TXDC_SHIFT;
|
||||
+
|
||||
switch (priv->interface) {
|
||||
case PHY_INTERFACE_MODE_MII:
|
||||
/* default */
|
||||
@@ -836,6 +848,19 @@ static int sun8i_emac_eth_ofdata_to_platdata(struct udevice *dev)
|
||||
}
|
||||
#endif
|
||||
|
||||
+ /* Get RX/TX delays for RGMII */
|
||||
+ priv->rx_delay = fdtdec_get_uint(gd->fdt_blob, dev_of_offset(dev),
|
||||
+ "allwinner,rx-delay-ps", 0);
|
||||
+ if (priv->rx_delay % 100 || priv->rx_delay > 3100)
|
||||
+ debug("%s: invalid rx delay value\n", __func__);
|
||||
+ priv->rx_delay /= 100;
|
||||
+
|
||||
+ priv->tx_delay = fdtdec_get_uint(gd->fdt_blob, dev_of_offset(dev),
|
||||
+ "allwinner,tx-delay-ps", 0);
|
||||
+ if (priv->tx_delay % 100 || priv->tx_delay > 800)
|
||||
+ debug("%s: invalid tx delay value\n", __func__);
|
||||
+ priv->tx_delay /= 100;
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
From patchwork Fri Sep 22 07:26:33 2017
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: [U-Boot,7/9] net: sun8i_emac: Fix build for non-H3/H5 SoCs
|
||||
X-Patchwork-Submitter: Chen-Yu Tsai <wens@csie.org>
|
||||
X-Patchwork-Id: 817349
|
||||
X-Patchwork-Delegate: jagannadh.teki@gmail.com
|
||||
Message-Id: <20170922072635.32105-8-wens@csie.org>
|
||||
To: u-boot@lists.denx.de
|
||||
Cc: Joe Hershberger <joe.hershberger@ni.com>, Jagan Teki <jagan@openedev.com>,
|
||||
Maxime Ripard <maxime.ripard@free-electrons.com>
|
||||
Date: Fri, 22 Sep 2017 15:26:33 +0800
|
||||
From: Chen-Yu Tsai <wens@csie.org>
|
||||
List-Id: U-Boot discussion <u-boot.lists.denx.de>
|
||||
|
||||
Only the H3/H5 SoCs have an internal PHY and its related clock and
|
||||
reset controls.
|
||||
|
||||
Use an #ifdef to guard the internal PHY control code block so it
|
||||
can be built for other SoCs, such as the A83T or A64.
|
||||
|
||||
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
|
||||
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
|
||||
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
|
||||
---
|
||||
drivers/net/sun8i_emac.c | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/drivers/net/sun8i_emac.c b/drivers/net/sun8i_emac.c
|
||||
index 5fa1b4c170d7..0a98a04967da 100644
|
||||
--- a/drivers/net/sun8i_emac.c
|
||||
+++ b/drivers/net/sun8i_emac.c
|
||||
@@ -616,6 +616,8 @@ static void sun8i_emac_board_setup(struct emac_eth_dev *priv)
|
||||
{
|
||||
struct sunxi_ccm_reg *ccm = (struct sunxi_ccm_reg *)SUNXI_CCM_BASE;
|
||||
|
||||
+#ifdef CONFIG_MACH_SUNXI_H3_H5
|
||||
+ /* Only H3/H5 have clock controls for internal EPHY */
|
||||
if (priv->use_internal_phy) {
|
||||
/* Set clock gating for ephy */
|
||||
setbits_le32(&ccm->bus_gate4, BIT(AHB_GATE_OFFSET_EPHY));
|
||||
@@ -623,6 +625,7 @@ static void sun8i_emac_board_setup(struct emac_eth_dev *priv)
|
||||
/* Deassert EPHY */
|
||||
setbits_le32(&ccm->ahb_reset2_cfg, BIT(AHB_RESET_OFFSET_EPHY));
|
||||
}
|
||||
+#endif
|
||||
|
||||
/* Set clock gating for emac */
|
||||
setbits_le32(&ccm->ahb_gate0, BIT(AHB_GATE_OFFSET_GMAC));
|
||||
|
||||
From patchwork Fri Sep 22 07:26:34 2017
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: [U-Boot,8/9] sunxi: Enable EMAC on the Cubietruck Plus
|
||||
X-Patchwork-Submitter: Chen-Yu Tsai <wens@csie.org>
|
||||
X-Patchwork-Id: 817345
|
||||
X-Patchwork-Delegate: jagannadh.teki@gmail.com
|
||||
Message-Id: <20170922072635.32105-9-wens@csie.org>
|
||||
To: u-boot@lists.denx.de
|
||||
Cc: Joe Hershberger <joe.hershberger@ni.com>, Jagan Teki <jagan@openedev.com>,
|
||||
Maxime Ripard <maxime.ripard@free-electrons.com>
|
||||
Date: Fri, 22 Sep 2017 15:26:34 +0800
|
||||
From: Chen-Yu Tsai <wens@csie.org>
|
||||
List-Id: U-Boot discussion <u-boot.lists.denx.de>
|
||||
|
||||
The Cubietruck Plus has an RTL8211E PHY connected to the EMAC using
|
||||
RGMII. The PHY is powered by DLDO4 @ 3.3V, while the I/O pins are
|
||||
powered by DLDO3 @ 2.5V.
|
||||
|
||||
This patch adds a U-boot specific dtsi file for the board adding
|
||||
an enabled EMAC node, and enables the EMAC driver in the defconfig.
|
||||
The binding used here is the old revision currently supported in
|
||||
U-boot. There is no stable binding nor support in upstream Linux
|
||||
at this time.
|
||||
|
||||
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
|
||||
---
|
||||
.../arm/dts/sun8i-a83t-cubietruck-plus-u-boot.dtsi | 39 ++++++++++++++++++++++
|
||||
configs/Cubietruck_plus_defconfig | 1 +
|
||||
2 files changed, 40 insertions(+)
|
||||
create mode 100644 arch/arm/dts/sun8i-a83t-cubietruck-plus-u-boot.dtsi
|
||||
|
||||
diff --git a/arch/arm/dts/sun8i-a83t-cubietruck-plus-u-boot.dtsi b/arch/arm/dts/sun8i-a83t-cubietruck-plus-u-boot.dtsi
|
||||
new file mode 100644
|
||||
index 000000000000..b4e216c14264
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/dts/sun8i-a83t-cubietruck-plus-u-boot.dtsi
|
||||
@@ -0,0 +1,39 @@
|
||||
+#include "sunxi-u-boot.dtsi"
|
||||
+
|
||||
+/ {
|
||||
+ aliases {
|
||||
+ ethernet0 = &emac;
|
||||
+ };
|
||||
+
|
||||
+ soc {
|
||||
+ emac: ethernet@01c30000 {
|
||||
+ compatible = "allwinner,sun8i-a83t-emac";
|
||||
+ reg = <0x01c30000 0x2000>, <0x01c00030 0x4>;
|
||||
+ reg-names = "emac", "syscon";
|
||||
+ interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&rgmii_pins>;
|
||||
+ phy-mode = "rgmii";
|
||||
+ phy = <&phy1>;
|
||||
+ status = "okay";
|
||||
+
|
||||
+ phy1: ethernet-phy@1 {
|
||||
+ reg = <1>;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&pio {
|
||||
+ rgmii_pins: rgmii_pins {
|
||||
+ allwinner,pins = "PD8", "PD9", "PD10", "PD11",
|
||||
+ "PD12", "PD13", "PD15",
|
||||
+ "PD16", "PD17", "PD18", "PD19",
|
||||
+ "PD20", "PD21", "PD22", "PD23";
|
||||
+ allwinner,function = "emac";
|
||||
+ allwinner,drive = <3>;
|
||||
+ allwinner,pull = <0>;
|
||||
+ };
|
||||
+};
|
||||
diff --git a/configs/Cubietruck_plus_defconfig b/configs/Cubietruck_plus_defconfig
|
||||
index 3aefcc58413c..ee8b901d0d08 100644
|
||||
--- a/configs/Cubietruck_plus_defconfig
|
||||
+++ b/configs/Cubietruck_plus_defconfig
|
||||
@@ -22,6 +22,7 @@ CONFIG_SPL=y
|
||||
# CONFIG_SPL_DOS_PARTITION is not set
|
||||
# CONFIG_SPL_ISO_PARTITION is not set
|
||||
# CONFIG_SPL_EFI_PARTITION is not set
|
||||
+CONFIG_SUN8I_EMAC=y
|
||||
CONFIG_AXP_DLDO3_VOLT=2500
|
||||
CONFIG_AXP_DLDO4_VOLT=3300
|
||||
CONFIG_AXP_FLDO1_VOLT=1200
|
||||
|
||||
From patchwork Fri Sep 22 07:26:35 2017
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: [U-Boot,9/9] sunxi: Enable EMAC on the Bananapi M3
|
||||
X-Patchwork-Submitter: Chen-Yu Tsai <wens@csie.org>
|
||||
X-Patchwork-Id: 817347
|
||||
X-Patchwork-Delegate: jagannadh.teki@gmail.com
|
||||
Message-Id: <20170922072635.32105-10-wens@csie.org>
|
||||
To: u-boot@lists.denx.de
|
||||
Cc: Joe Hershberger <joe.hershberger@ni.com>, Jagan Teki <jagan@openedev.com>,
|
||||
Maxime Ripard <maxime.ripard@free-electrons.com>
|
||||
Date: Fri, 22 Sep 2017 15:26:35 +0800
|
||||
From: Chen-Yu Tsai <wens@csie.org>
|
||||
List-Id: U-Boot discussion <u-boot.lists.denx.de>
|
||||
|
||||
The Bananapi M3 has an RTL8211E PHY connected to the EMAC using
|
||||
RGMII. The PHY is powered by DCDC1 through SW @ 3.3V.
|
||||
|
||||
This patch adds a U-boot specific dtsi file for the board adding
|
||||
an enabled EMAC node, and enables the EMAC driver in the defconfig.
|
||||
The binding used here is the old revision currently supported in
|
||||
U-boot. There is no stable binding nor support in upstream Linux
|
||||
at this time.
|
||||
|
||||
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
|
||||
---
|
||||
arch/arm/dts/sun8i-a83t-bananapi-m3-u-boot.dtsi | 41 +++++++++++++++++++++++++
|
||||
configs/Sinovoip_BPI_M3_defconfig | 1 +
|
||||
2 files changed, 42 insertions(+)
|
||||
create mode 100644 arch/arm/dts/sun8i-a83t-bananapi-m3-u-boot.dtsi
|
||||
|
||||
diff --git a/arch/arm/dts/sun8i-a83t-bananapi-m3-u-boot.dtsi b/arch/arm/dts/sun8i-a83t-bananapi-m3-u-boot.dtsi
|
||||
new file mode 100644
|
||||
index 000000000000..9c7977e67b92
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/dts/sun8i-a83t-bananapi-m3-u-boot.dtsi
|
||||
@@ -0,0 +1,41 @@
|
||||
+#include "sunxi-u-boot.dtsi"
|
||||
+
|
||||
+/ {
|
||||
+ aliases {
|
||||
+ ethernet0 = &emac;
|
||||
+ };
|
||||
+
|
||||
+ soc {
|
||||
+ emac: ethernet@01c30000 {
|
||||
+ compatible = "allwinner,sun8i-a83t-emac";
|
||||
+ reg = <0x01c30000 0x2000>, <0x01c00030 0x4>;
|
||||
+ reg-names = "emac", "syscon";
|
||||
+ interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&rgmii_pins>;
|
||||
+ phy-mode = "rgmii";
|
||||
+ phy = <&phy1>;
|
||||
+ allwinner,rx-delay-ps = <700>;
|
||||
+ allwinner,tx-delay-ps = <700>;
|
||||
+ status = "okay";
|
||||
+
|
||||
+ phy1: ethernet-phy@1 {
|
||||
+ reg = <1>;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&pio {
|
||||
+ rgmii_pins: rgmii_pins {
|
||||
+ allwinner,pins = "PD8", "PD9", "PD10", "PD11",
|
||||
+ "PD12", "PD13", "PD15",
|
||||
+ "PD16", "PD17", "PD18", "PD19",
|
||||
+ "PD20", "PD21", "PD22", "PD23";
|
||||
+ allwinner,function = "emac";
|
||||
+ allwinner,drive = <3>;
|
||||
+ allwinner,pull = <0>;
|
||||
+ };
|
||||
+};
|
||||
diff --git a/configs/Sinovoip_BPI_M3_defconfig b/configs/Sinovoip_BPI_M3_defconfig
|
||||
index e48983fc3310..efdf3c7396fd 100644
|
||||
--- a/configs/Sinovoip_BPI_M3_defconfig
|
||||
+++ b/configs/Sinovoip_BPI_M3_defconfig
|
||||
@@ -23,6 +23,7 @@ CONFIG_SPL=y
|
||||
# CONFIG_SPL_DOS_PARTITION is not set
|
||||
# CONFIG_SPL_ISO_PARTITION is not set
|
||||
# CONFIG_SPL_EFI_PARTITION is not set
|
||||
+CONFIG_SUN8I_EMAC=y
|
||||
CONFIG_AXP_DCDC5_VOLT=1200
|
||||
CONFIG_AXP_DLDO3_VOLT=2500
|
||||
CONFIG_AXP_SW_ON=y
|
|
@ -1,8 +1,8 @@
|
|||
#global candidate rc4
|
||||
%global candidate rc2
|
||||
|
||||
Name: uboot-tools
|
||||
Version: 2017.09
|
||||
Release: 4%{?candidate:.%{candidate}}%{?dist}
|
||||
Version: 2017.11
|
||||
Release: 0.1%{?candidate:.%{candidate}}%{?dist}
|
||||
Summary: U-Boot utilities
|
||||
License: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+
|
||||
URL: http://www.denx.de/wiki/U-Boot
|
||||
|
@ -14,23 +14,17 @@ Source3: aarch64-boards
|
|||
Source4: aarch64-chromebooks
|
||||
Source5: 10-devicetree.install
|
||||
|
||||
# Fedoraisms patches, general fixes
|
||||
Patch1: uefi-vsprintf.patch
|
||||
Patch2: uefi-improve-fat.patch
|
||||
Patch3: uefi-efi_loader-enough-UEFI-for-standard-distro-boot.patch
|
||||
Patch4: uefi-use-Fedora-specific-path-name.patch
|
||||
Patch5: dm-video-enhancements-for-Shell.efi.patch
|
||||
Patch6: usb-kbd-fixes.patch
|
||||
Patch7: disk-part_dos-Use-the-original-allocation-scheme-for-the-SPL-case.patch
|
||||
Patch8: uefi-distro-load-FDT-from-any-partition-on-boot-device.patch
|
||||
Patch9: uefi-efi_loader-Fix-disk-dp-s-for-pre-DM-legacy-devices.patch
|
||||
# Fedoraisms patches
|
||||
Patch1: uefi-use-Fedora-specific-path-name.patch
|
||||
|
||||
# general fixes
|
||||
Patch2: uefi-distro-load-FDT-from-any-partition-on-boot-device.patch
|
||||
Patch3: usb-kbd-fixes.patch
|
||||
# Patch4: fdt-fixes.patch
|
||||
|
||||
# Board fixes and enablement
|
||||
Patch10: dragonboard-fixes.patch
|
||||
Patch11: qemu-machine-virt-ARM.patch
|
||||
Patch12: sti-STiH410-B2260-support.patch
|
||||
Patch13: bcm283x-device-tree-sources-to-Linux-4.14-state.patch
|
||||
Patch14: sunxi-A83T-improvements.patch
|
||||
Patch15: rockchips-3399-atf.patch
|
||||
# Patch14: mvebu-enable-generic-distro-boot-config.patch
|
||||
# Patch15: mx6-Initial-Hummingboard-2-support.patch
|
||||
|
||||
|
@ -290,6 +284,9 @@ cp -p board/warp7/README builds/docs/README.warp7
|
|||
%endif
|
||||
|
||||
%changelog
|
||||
* Tue Oct 17 2017 Peter Robinson <pbrobinson@fedoraproject.org> 2017.11-0.1.rc2
|
||||
- 2017.11 RC2
|
||||
|
||||
* Tue Oct 10 2017 Peter Robinson <pbrobinson@fedoraproject.org> 2017.09-4
|
||||
- Improve uEFI partition detection for some devices
|
||||
|
||||
|
|
|
@ -1,185 +0,0 @@
|
|||
From patchwork Sun Oct 8 15:33:08 2017
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: [U-Boot] efi_loader: Fix disk dp's for pre-DM/legacy devices
|
||||
X-Patchwork-Submitter: Rob Clark <robdclark@gmail.com>
|
||||
X-Patchwork-Id: 823012
|
||||
Message-Id: <20171008153310.25350-1-robdclark@gmail.com>
|
||||
To: U-Boot Mailing List <u-boot@lists.denx.de>
|
||||
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>, =?utf-8?q?Andreas_F=C3=A4rbe?=
|
||||
=?utf-8?q?r?= <afaerber@suse.de>
|
||||
Date: Sun, 8 Oct 2017 11:33:08 -0400
|
||||
From: Rob Clark <robdclark@gmail.com>
|
||||
List-Id: U-Boot discussion <u-boot.lists.denx.de>
|
||||
|
||||
This fixes an issue with OpenBSD's bootloader, and I think should also
|
||||
fix a similar issue with grub2 on legacy devices. In the legacy case
|
||||
we were creating disk objects for the partitions, but not also the
|
||||
parent device.
|
||||
|
||||
Reported-by: Jonathan Gray <jsg@jsg.id.au>
|
||||
Signed-off-by: Rob Clark <robdclark@gmail.com>
|
||||
---
|
||||
lib/efi_loader/efi_disk.c | 11 +++++++++++
|
||||
1 file changed, 11 insertions(+)
|
||||
|
||||
diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
|
||||
index eb9ce772d1..47b487aa30 100644
|
||||
--- a/lib/efi_loader/efi_disk.c
|
||||
+++ b/lib/efi_loader/efi_disk.c
|
||||
@@ -340,6 +340,8 @@ int efi_disk_register(void)
|
||||
for (i = 0; i < 4; i++) {
|
||||
struct blk_desc *desc;
|
||||
char devname[32] = { 0 }; /* dp->str is u16[32] long */
|
||||
+ disk_partition_t info;
|
||||
+ int part = 1;
|
||||
|
||||
desc = blk_get_devnum_by_type(if_type, i);
|
||||
if (!desc)
|
||||
@@ -349,6 +351,15 @@ int efi_disk_register(void)
|
||||
|
||||
snprintf(devname, sizeof(devname), "%s%d",
|
||||
if_typename, i);
|
||||
+
|
||||
+ /* add devices for each partition: */
|
||||
+ while (!part_get_info(desc, part, &info)) {
|
||||
+ efi_disk_add_dev(devname, if_typename, desc,
|
||||
+ i, 0, part);
|
||||
+ part++;
|
||||
+ }
|
||||
+
|
||||
+ /* ... and add block device: */
|
||||
efi_disk_add_dev(devname, if_typename, desc, i, 0, 0);
|
||||
disks++;
|
||||
|
||||
From patchwork Tue Oct 10 02:55:26 2017
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: [U-Boot] efi_loader: search all possible disk partitions
|
||||
X-Patchwork-Submitter: Jonathan Gray <jsg@jsg.id.au>
|
||||
X-Patchwork-Id: 823664
|
||||
X-Patchwork-Delegate: agraf@suse.de
|
||||
Message-Id: <20171010025526.85329-1-jsg@jsg.id.au>
|
||||
To: u-boot@lists.denx.de
|
||||
Date: Tue, 10 Oct 2017 13:55:26 +1100
|
||||
From: Jonathan Gray <jsg@jsg.id.au>
|
||||
List-Id: U-Boot discussion <u-boot.lists.denx.de>
|
||||
|
||||
When searching for partitions don't stop if a partition is not present
|
||||
for a given partition number as there may be valid partitions after.
|
||||
|
||||
Search for up to MAX_SEARCH_PARTITIONS matching the other callers of
|
||||
part_get_info().
|
||||
|
||||
This allows OpenBSD to boot via the efi_loader on rpi_3 again after
|
||||
changes made after U-Boot 2017.09. With MBR partitioning OpenBSD will
|
||||
by default use the fourth partition for the 0xA6 (OpenBSD) partition.
|
||||
|
||||
Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
|
||||
---
|
||||
lib/efi_loader/efi_disk.c | 20 ++++++++++++--------
|
||||
1 file changed, 12 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
|
||||
index 47b487aa30..6b192701a8 100644
|
||||
--- a/lib/efi_loader/efi_disk.c
|
||||
+++ b/lib/efi_loader/efi_disk.c
|
||||
@@ -254,18 +254,19 @@ static int efi_disk_create_eltorito(struct blk_desc *desc,
|
||||
#if CONFIG_IS_ENABLED(ISO_PARTITION)
|
||||
char devname[32] = { 0 }; /* dp->str is u16[32] long */
|
||||
disk_partition_t info;
|
||||
- int part = 1;
|
||||
+ int part;
|
||||
|
||||
if (desc->part_type != PART_TYPE_ISO)
|
||||
return 0;
|
||||
|
||||
/* and devices for each partition: */
|
||||
- while (!part_get_info(desc, part, &info)) {
|
||||
+ for (part = 1; part <= MAX_SEARCH_PARTITIONS; part++) {
|
||||
+ if (part_get_info(desc, part, &info))
|
||||
+ continue;
|
||||
snprintf(devname, sizeof(devname), "%s:%d", pdevname,
|
||||
part);
|
||||
efi_disk_add_dev(devname, if_typename, desc, diskid,
|
||||
info.start, part);
|
||||
- part++;
|
||||
disks++;
|
||||
}
|
||||
|
||||
@@ -299,15 +300,16 @@ int efi_disk_register(void)
|
||||
struct blk_desc *desc = dev_get_uclass_platdata(dev);
|
||||
const char *if_typename = dev->driver->name;
|
||||
disk_partition_t info;
|
||||
- int part = 1;
|
||||
+ int part;
|
||||
|
||||
printf("Scanning disk %s...\n", dev->name);
|
||||
|
||||
/* add devices for each partition: */
|
||||
- while (!part_get_info(desc, part, &info)) {
|
||||
+ for (part = 1; part <= MAX_SEARCH_PARTITIONS; part++) {
|
||||
+ if (part_get_info(desc, part, &info))
|
||||
+ continue;
|
||||
efi_disk_add_dev(dev->name, if_typename, desc,
|
||||
desc->devnum, 0, part);
|
||||
- part++;
|
||||
}
|
||||
|
||||
/* ... and add block device: */
|
||||
@@ -341,7 +343,7 @@ int efi_disk_register(void)
|
||||
struct blk_desc *desc;
|
||||
char devname[32] = { 0 }; /* dp->str is u16[32] long */
|
||||
disk_partition_t info;
|
||||
- int part = 1;
|
||||
+ int part;
|
||||
|
||||
desc = blk_get_devnum_by_type(if_type, i);
|
||||
if (!desc)
|
||||
@@ -353,7 +355,9 @@ int efi_disk_register(void)
|
||||
if_typename, i);
|
||||
|
||||
/* add devices for each partition: */
|
||||
- while (!part_get_info(desc, part, &info)) {
|
||||
+ for (part = 1; part <= MAX_SEARCH_PARTITIONS; part++) {
|
||||
+ if (part_get_info(desc, part, &info))
|
||||
+ continue;
|
||||
efi_disk_add_dev(devname, if_typename, desc,
|
||||
i, 0, part);
|
||||
part++;
|
||||
From patchwork Tue Oct 10 10:32:29 2017
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: [U-Boot] efi_loader: don't increment part twice per loop
|
||||
X-Patchwork-Submitter: Jonathan Gray <jsg@jsg.id.au>
|
||||
X-Patchwork-Id: 823787
|
||||
Message-Id: <20171010103229.71768-1-jsg@jsg.id.au>
|
||||
To: u-boot@lists.denx.de
|
||||
Date: Tue, 10 Oct 2017 21:32:29 +1100
|
||||
From: Jonathan Gray <jsg@jsg.id.au>
|
||||
List-Id: U-Boot discussion <u-boot.lists.denx.de>
|
||||
|
||||
Correct a mistake in the part number handling of
|
||||
16a73b249d138fedeb188710533902ed7aac1ddc and only increment part once
|
||||
per loop.
|
||||
|
||||
Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
|
||||
---
|
||||
lib/efi_loader/efi_disk.c | 1 -
|
||||
1 file changed, 1 deletion(-)
|
||||
|
||||
diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
|
||||
index 6b192701a8..e61dbc8058 100644
|
||||
--- a/lib/efi_loader/efi_disk.c
|
||||
+++ b/lib/efi_loader/efi_disk.c
|
||||
@@ -360,7 +360,6 @@ int efi_disk_register(void)
|
||||
continue;
|
||||
efi_disk_add_dev(devname, if_typename, desc,
|
||||
i, 0, part);
|
||||
- part++;
|
||||
}
|
||||
|
||||
/* ... and add block device: */
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,544 +0,0 @@
|
|||
From 4a85663ec7eddd955d22f1b0f34a9708eac82314 Mon Sep 17 00:00:00 2001
|
||||
From: Rob Clark <robdclark@gmail.com>
|
||||
Date: Sat, 9 Sep 2017 06:47:39 -0400
|
||||
Subject: [PATCH 002/105] kbuild: Enable -fshort-wchar
|
||||
|
||||
EFI_LOADER really wants UTF-16 strings (ie. %ls and L"string" are 16bit
|
||||
chars instead of 32bit chars). But rather than enabling -fshort-wchar
|
||||
conditionally if EFI_LOADER is enabled, it was deemed preferrable to
|
||||
globally switch.
|
||||
|
||||
Signed-off-by: Rob Clark <robdclark@gmail.com>
|
||||
Acked-by: Masahiro Yamada <yamada.masahiro@socionext.com>
|
||||
---
|
||||
Makefile | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index 8086f3c93e..8250b3409a 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -360,6 +360,7 @@ KBUILD_CPPFLAGS := -D__KERNEL__ -D__UBOOT__
|
||||
KBUILD_CFLAGS := -Wall -Wstrict-prototypes \
|
||||
-Wno-format-security \
|
||||
-fno-builtin -ffreestanding
|
||||
+KBUILD_CFLAGS += -fshort-wchar
|
||||
KBUILD_AFLAGS := -D__ASSEMBLY__
|
||||
|
||||
# Read UBOOTRELEASE from include/config/uboot.release (if it exists)
|
||||
--
|
||||
2.13.5
|
||||
|
||||
From 78178bb0c9dfe2a91a636a411291d8bab50e8a7d Mon Sep 17 00:00:00 2001
|
||||
From: Rob Clark <robdclark@gmail.com>
|
||||
Date: Sat, 9 Sep 2017 06:47:40 -0400
|
||||
Subject: [PATCH 003/105] lib: add some utf16 handling helpers
|
||||
|
||||
We'll eventually want these in a few places in efi_loader, and also
|
||||
vsprintf.
|
||||
|
||||
Signed-off-by: Rob Clark <robdclark@gmail.com>
|
||||
---
|
||||
include/charset.h | 65 ++++++++++++++++++++++++++++
|
||||
lib/Makefile | 1 +
|
||||
lib/charset.c | 101 +++++++++++++++++++++++++++++++++++++++++++
|
||||
lib/efi_loader/efi_console.c | 17 ++------
|
||||
4 files changed, 170 insertions(+), 14 deletions(-)
|
||||
create mode 100644 include/charset.h
|
||||
create mode 100644 lib/charset.c
|
||||
|
||||
diff --git a/include/charset.h b/include/charset.h
|
||||
new file mode 100644
|
||||
index 0000000000..39279f746a
|
||||
--- /dev/null
|
||||
+++ b/include/charset.h
|
||||
@@ -0,0 +1,65 @@
|
||||
+/*
|
||||
+ * charset conversion utils
|
||||
+ *
|
||||
+ * Copyright (c) 2017 Rob Clark
|
||||
+ *
|
||||
+ * SPDX-License-Identifier: GPL-2.0+
|
||||
+ */
|
||||
+
|
||||
+#ifndef __CHARSET_H_
|
||||
+#define __CHARSET_H_
|
||||
+
|
||||
+#define MAX_UTF8_PER_UTF16 4
|
||||
+
|
||||
+/**
|
||||
+ * utf16_strlen() - Get the length of an utf16 string
|
||||
+ *
|
||||
+ * Returns the number of 16 bit characters in an utf16 string, not
|
||||
+ * including the terminating NULL character.
|
||||
+ *
|
||||
+ * @in the string to measure
|
||||
+ * @return the string length
|
||||
+ */
|
||||
+size_t utf16_strlen(const uint16_t *in);
|
||||
+
|
||||
+/**
|
||||
+ * utf16_strnlen() - Get the length of a fixed-size utf16 string.
|
||||
+ *
|
||||
+ * Returns the number of 16 bit characters in an utf16 string,
|
||||
+ * not including the terminating NULL character, but at most
|
||||
+ * 'count' number of characters. In doing this, utf16_strnlen()
|
||||
+ * looks at only the first 'count' characters.
|
||||
+ *
|
||||
+ * @in the string to measure
|
||||
+ * @count the maximum number of characters to count
|
||||
+ * @return the string length, up to a maximum of 'count'
|
||||
+ */
|
||||
+size_t utf16_strnlen(const uint16_t *in, size_t count);
|
||||
+
|
||||
+/**
|
||||
+ * utf16_strcpy() - UTF16 equivalent of strcpy()
|
||||
+ */
|
||||
+uint16_t *utf16_strcpy(uint16_t *dest, const uint16_t *src);
|
||||
+
|
||||
+/**
|
||||
+ * utf16_strdup() - UTF16 equivalent of strdup()
|
||||
+ */
|
||||
+uint16_t *utf16_strdup(const uint16_t *s);
|
||||
+
|
||||
+/**
|
||||
+ * utf16_to_utf8() - Convert an utf16 string to utf8
|
||||
+ *
|
||||
+ * Converts 'size' characters of the utf16 string 'src' to utf8
|
||||
+ * written to the 'dest' buffer.
|
||||
+ *
|
||||
+ * NOTE that a single utf16 character can generate up to 4 utf8
|
||||
+ * characters. See MAX_UTF8_PER_UTF16.
|
||||
+ *
|
||||
+ * @dest the destination buffer to write the utf8 characters
|
||||
+ * @src the source utf16 string
|
||||
+ * @size the number of utf16 characters to convert
|
||||
+ * @return the pointer to the first unwritten byte in 'dest'
|
||||
+ */
|
||||
+uint8_t *utf16_to_utf8(uint8_t *dest, const uint16_t *src, size_t size);
|
||||
+
|
||||
+#endif /* __CHARSET_H_ */
|
||||
diff --git a/lib/Makefile b/lib/Makefile
|
||||
index da6a11aca3..15bba9eac2 100644
|
||||
--- a/lib/Makefile
|
||||
+++ b/lib/Makefile
|
||||
@@ -18,6 +18,7 @@ obj-$(CONFIG_OF_LIVE) += of_live.o
|
||||
obj-$(CONFIG_CMD_DHRYSTONE) += dhry/
|
||||
|
||||
obj-$(CONFIG_AES) += aes.o
|
||||
+obj-y += charset.o
|
||||
obj-$(CONFIG_USB_TTY) += circbuf.o
|
||||
obj-y += crc7.o
|
||||
obj-y += crc8.o
|
||||
diff --git a/lib/charset.c b/lib/charset.c
|
||||
new file mode 100644
|
||||
index 0000000000..ff76e88c77
|
||||
--- /dev/null
|
||||
+++ b/lib/charset.c
|
||||
@@ -0,0 +1,101 @@
|
||||
+/*
|
||||
+ * charset conversion utils
|
||||
+ *
|
||||
+ * Copyright (c) 2017 Rob Clark
|
||||
+ *
|
||||
+ * SPDX-License-Identifier: GPL-2.0+
|
||||
+ */
|
||||
+
|
||||
+#include <common.h>
|
||||
+#include <charset.h>
|
||||
+#include <malloc.h>
|
||||
+
|
||||
+/*
|
||||
+ * utf8/utf16 conversion mostly lifted from grub
|
||||
+ */
|
||||
+
|
||||
+size_t utf16_strlen(const uint16_t *in)
|
||||
+{
|
||||
+ size_t i;
|
||||
+ for (i = 0; in[i]; i++);
|
||||
+ return i;
|
||||
+}
|
||||
+
|
||||
+size_t utf16_strnlen(const uint16_t *in, size_t count)
|
||||
+{
|
||||
+ size_t i;
|
||||
+ for (i = 0; count-- && in[i]; i++);
|
||||
+ return i;
|
||||
+}
|
||||
+
|
||||
+uint16_t *utf16_strcpy(uint16_t *dest, const uint16_t *src)
|
||||
+{
|
||||
+ uint16_t *tmp = dest;
|
||||
+
|
||||
+ while ((*dest++ = *src++) != '\0')
|
||||
+ /* nothing */;
|
||||
+ return tmp;
|
||||
+
|
||||
+}
|
||||
+
|
||||
+uint16_t *utf16_strdup(const uint16_t *s)
|
||||
+{
|
||||
+ uint16_t *new;
|
||||
+ if (!s || !(new = malloc((utf16_strlen(s) + 1) * 2)))
|
||||
+ return NULL;
|
||||
+ utf16_strcpy(new, s);
|
||||
+ return new;
|
||||
+}
|
||||
+
|
||||
+/* Convert UTF-16 to UTF-8. */
|
||||
+uint8_t *utf16_to_utf8(uint8_t *dest, const uint16_t *src, size_t size)
|
||||
+{
|
||||
+ uint32_t code_high = 0;
|
||||
+
|
||||
+ while (size--) {
|
||||
+ uint32_t code = *src++;
|
||||
+
|
||||
+ if (code_high) {
|
||||
+ if (code >= 0xDC00 && code <= 0xDFFF) {
|
||||
+ /* Surrogate pair. */
|
||||
+ code = ((code_high - 0xD800) << 10) + (code - 0xDC00) + 0x10000;
|
||||
+
|
||||
+ *dest++ = (code >> 18) | 0xF0;
|
||||
+ *dest++ = ((code >> 12) & 0x3F) | 0x80;
|
||||
+ *dest++ = ((code >> 6) & 0x3F) | 0x80;
|
||||
+ *dest++ = (code & 0x3F) | 0x80;
|
||||
+ } else {
|
||||
+ /* Error... */
|
||||
+ *dest++ = '?';
|
||||
+ /* *src may be valid. Don't eat it. */
|
||||
+ src--;
|
||||
+ }
|
||||
+
|
||||
+ code_high = 0;
|
||||
+ } else {
|
||||
+ if (code <= 0x007F) {
|
||||
+ *dest++ = code;
|
||||
+ } else if (code <= 0x07FF) {
|
||||
+ *dest++ = (code >> 6) | 0xC0;
|
||||
+ *dest++ = (code & 0x3F) | 0x80;
|
||||
+ } else if (code >= 0xD800 && code <= 0xDBFF) {
|
||||
+ code_high = code;
|
||||
+ continue;
|
||||
+ } else if (code >= 0xDC00 && code <= 0xDFFF) {
|
||||
+ /* Error... */
|
||||
+ *dest++ = '?';
|
||||
+ } else if (code < 0x10000) {
|
||||
+ *dest++ = (code >> 12) | 0xE0;
|
||||
+ *dest++ = ((code >> 6) & 0x3F) | 0x80;
|
||||
+ *dest++ = (code & 0x3F) | 0x80;
|
||||
+ } else {
|
||||
+ *dest++ = (code >> 18) | 0xF0;
|
||||
+ *dest++ = ((code >> 12) & 0x3F) | 0x80;
|
||||
+ *dest++ = ((code >> 6) & 0x3F) | 0x80;
|
||||
+ *dest++ = (code & 0x3F) | 0x80;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return dest;
|
||||
+}
|
||||
diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c
|
||||
index 5ebce4b544..3fc82b8726 100644
|
||||
--- a/lib/efi_loader/efi_console.c
|
||||
+++ b/lib/efi_loader/efi_console.c
|
||||
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
+#include <charset.h>
|
||||
#include <efi_loader.h>
|
||||
|
||||
static bool console_size_queried;
|
||||
@@ -138,20 +139,8 @@ static efi_status_t EFIAPI efi_cout_reset(
|
||||
|
||||
static void print_unicode_in_utf8(u16 c)
|
||||
{
|
||||
- char utf8[4] = { 0 };
|
||||
- char *b = utf8;
|
||||
-
|
||||
- if (c < 0x80) {
|
||||
- *(b++) = c;
|
||||
- } else if (c < 0x800) {
|
||||
- *(b++) = 192 + c / 64;
|
||||
- *(b++) = 128 + c % 64;
|
||||
- } else {
|
||||
- *(b++) = 224 + c / 4096;
|
||||
- *(b++) = 128 + c / 64 % 64;
|
||||
- *(b++) = 128 + c % 64;
|
||||
- }
|
||||
-
|
||||
+ char utf8[MAX_UTF8_PER_UTF16] = { 0 };
|
||||
+ utf16_to_utf8((u8 *)utf8, &c, 1);
|
||||
puts(utf8);
|
||||
}
|
||||
|
||||
--
|
||||
2.13.5
|
||||
|
||||
From 274325c50951dd16ad2a6f45e79dc062ad47011b Mon Sep 17 00:00:00 2001
|
||||
From: Rob Clark <robdclark@gmail.com>
|
||||
Date: Sat, 9 Sep 2017 06:47:41 -0400
|
||||
Subject: [PATCH 004/105] vsprintf.c: add UTF-16 string (%ls) support
|
||||
|
||||
This is convenient for efi_loader which deals a lot with UTF-16. Only
|
||||
enabled with CC_SHORT_WCHAR, leaving room to add a UTF-32 version when
|
||||
CC_SHORT_WCHAR is not enabled.
|
||||
|
||||
Signed-off-by: Rob Clark <robdclark@gmail.com>
|
||||
Reviewed-by: Simon Glass <sjg@chromium.org>
|
||||
Reviewed-by: Simon Glass <sjg@chromium.org>
|
||||
---
|
||||
examples/api/Makefile | 1 +
|
||||
lib/vsprintf.c | 30 ++++++++++++++++++++++++++++--
|
||||
2 files changed, 29 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/examples/api/Makefile b/examples/api/Makefile
|
||||
index dab6398bab..87c15d0f68 100644
|
||||
--- a/examples/api/Makefile
|
||||
+++ b/examples/api/Makefile
|
||||
@@ -34,6 +34,7 @@ EXT_COBJ-y += lib/div64.o
|
||||
EXT_COBJ-y += lib/string.o
|
||||
EXT_COBJ-y += lib/time.o
|
||||
EXT_COBJ-y += lib/vsprintf.o
|
||||
+EXT_COBJ-y += lib/charset.o
|
||||
EXT_SOBJ-$(CONFIG_PPC) += arch/powerpc/lib/ppcstring.o
|
||||
ifeq ($(ARCH),arm)
|
||||
EXT_SOBJ-$(CONFIG_USE_ARCH_MEMSET) += arch/arm/lib/memset.o
|
||||
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
|
||||
index 874a2951f7..97bed9d36d 100644
|
||||
--- a/lib/vsprintf.c
|
||||
+++ b/lib/vsprintf.c
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <linux/ctype.h>
|
||||
|
||||
#include <common.h>
|
||||
+#include <charset.h>
|
||||
|
||||
#include <div64.h>
|
||||
#define noinline __attribute__((noinline))
|
||||
@@ -270,6 +271,26 @@ static char *string(char *buf, char *end, char *s, int field_width,
|
||||
return buf;
|
||||
}
|
||||
|
||||
+static char *string16(char *buf, char *end, u16 *s, int field_width,
|
||||
+ int precision, int flags)
|
||||
+{
|
||||
+ u16 *str = s ? s : L"<NULL>";
|
||||
+ int utf16_len = utf16_strnlen(str, precision);
|
||||
+ u8 utf8[utf16_len * MAX_UTF8_PER_UTF16];
|
||||
+ int utf8_len, i;
|
||||
+
|
||||
+ utf8_len = utf16_to_utf8(utf8, str, utf16_len) - utf8;
|
||||
+
|
||||
+ if (!(flags & LEFT))
|
||||
+ while (utf8_len < field_width--)
|
||||
+ ADDCH(buf, ' ');
|
||||
+ for (i = 0; i < utf8_len; ++i)
|
||||
+ ADDCH(buf, utf8[i]);
|
||||
+ while (utf8_len < field_width--)
|
||||
+ ADDCH(buf, ' ');
|
||||
+ return buf;
|
||||
+}
|
||||
+
|
||||
#ifdef CONFIG_CMD_NET
|
||||
static const char hex_asc[] = "0123456789abcdef";
|
||||
#define hex_asc_lo(x) hex_asc[((x) & 0x0f)]
|
||||
@@ -528,8 +549,13 @@ repeat:
|
||||
continue;
|
||||
|
||||
case 's':
|
||||
- str = string(str, end, va_arg(args, char *),
|
||||
- field_width, precision, flags);
|
||||
+ if (qualifier == 'l' && !IS_ENABLED(CONFIG_SPL_BUILD)) {
|
||||
+ str = string16(str, end, va_arg(args, u16 *),
|
||||
+ field_width, precision, flags);
|
||||
+ } else {
|
||||
+ str = string(str, end, va_arg(args, char *),
|
||||
+ field_width, precision, flags);
|
||||
+ }
|
||||
continue;
|
||||
|
||||
case 'p':
|
||||
--
|
||||
2.13.5
|
||||
|
||||
From 22ada0c8e6d50281af72176eecdfc356c794639c Mon Sep 17 00:00:00 2001
|
||||
From: Rob Clark <robdclark@gmail.com>
|
||||
Date: Sat, 9 Sep 2017 06:47:42 -0400
|
||||
Subject: [PATCH 005/105] vsprintf.c: add GUID printing
|
||||
|
||||
This works (roughly) the same way as linux's, but we currently always
|
||||
print lower-case (ie. we just keep %pUB and %pUL for compat with linux),
|
||||
mostly just because that is what uuid_bin_to_str() supports.
|
||||
|
||||
%pUb: 01020304-0506-0708-090a-0b0c0d0e0f10
|
||||
%pUl: 04030201-0605-0807-090a-0b0c0d0e0f10
|
||||
|
||||
It will be used by a later efi_loader paths for efi variables and for
|
||||
device-path-to-text protocol, and also quite useful for debug prints
|
||||
of protocol GUIDs.
|
||||
|
||||
Signed-off-by: Rob Clark <robdclark@gmail.com>
|
||||
Tested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
|
||||
Reviewed-by: Simon Glass <sjg@chromium.org>
|
||||
---
|
||||
examples/api/Makefile | 1 +
|
||||
include/config_fallbacks.h | 1 +
|
||||
lib/vsprintf.c | 46 ++++++++++++++++++++++++++++++++++++++++++++--
|
||||
3 files changed, 46 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/examples/api/Makefile b/examples/api/Makefile
|
||||
index 87c15d0f68..899527267d 100644
|
||||
--- a/examples/api/Makefile
|
||||
+++ b/examples/api/Makefile
|
||||
@@ -35,6 +35,7 @@ EXT_COBJ-y += lib/string.o
|
||||
EXT_COBJ-y += lib/time.o
|
||||
EXT_COBJ-y += lib/vsprintf.o
|
||||
EXT_COBJ-y += lib/charset.o
|
||||
+EXT_COBJ-$(CONFIG_LIB_UUID) += lib/uuid.o
|
||||
EXT_SOBJ-$(CONFIG_PPC) += arch/powerpc/lib/ppcstring.o
|
||||
ifeq ($(ARCH),arm)
|
||||
EXT_SOBJ-$(CONFIG_USE_ARCH_MEMSET) += arch/arm/lib/memset.o
|
||||
diff --git a/include/config_fallbacks.h b/include/config_fallbacks.h
|
||||
index 46b7a2a6f2..2c4d43d672 100644
|
||||
--- a/include/config_fallbacks.h
|
||||
+++ b/include/config_fallbacks.h
|
||||
@@ -58,6 +58,7 @@
|
||||
|
||||
#if (CONFIG_IS_ENABLED(PARTITION_UUIDS) || \
|
||||
CONFIG_IS_ENABLED(EFI_PARTITION) || \
|
||||
+ CONFIG_IS_ENABLED(EFI_LOADER) || \
|
||||
defined(CONFIG_RANDOM_UUID) || \
|
||||
defined(CONFIG_CMD_UUID) || \
|
||||
defined(CONFIG_BOOTP_PXE)) && \
|
||||
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
|
||||
index 97bed9d36d..dd572d2868 100644
|
||||
--- a/lib/vsprintf.c
|
||||
+++ b/lib/vsprintf.c
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
#include <common.h>
|
||||
#include <charset.h>
|
||||
+#include <uuid.h>
|
||||
|
||||
#include <div64.h>
|
||||
#define noinline __attribute__((noinline))
|
||||
@@ -366,6 +367,40 @@ static char *ip4_addr_string(char *buf, char *end, u8 *addr, int field_width,
|
||||
}
|
||||
#endif
|
||||
|
||||
+#ifdef CONFIG_LIB_UUID
|
||||
+/*
|
||||
+ * This works (roughly) the same way as linux's, but we currently always
|
||||
+ * print lower-case (ie. we just keep %pUB and %pUL for compat with linux),
|
||||
+ * mostly just because that is what uuid_bin_to_str() supports.
|
||||
+ *
|
||||
+ * %pUb: 01020304-0506-0708-090a-0b0c0d0e0f10
|
||||
+ * %pUl: 04030201-0605-0807-090a-0b0c0d0e0f10
|
||||
+ */
|
||||
+static char *uuid_string(char *buf, char *end, u8 *addr, int field_width,
|
||||
+ int precision, int flags, const char *fmt)
|
||||
+{
|
||||
+ char uuid[UUID_STR_LEN + 1];
|
||||
+ int str_format = UUID_STR_FORMAT_STD;
|
||||
+
|
||||
+ switch (*(++fmt)) {
|
||||
+ case 'L':
|
||||
+ case 'l':
|
||||
+ str_format = UUID_STR_FORMAT_GUID;
|
||||
+ break;
|
||||
+ case 'B':
|
||||
+ case 'b':
|
||||
+ /* this is the default */
|
||||
+ break;
|
||||
+ default:
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ uuid_bin_to_str(addr, uuid, str_format);
|
||||
+
|
||||
+ return string(buf, end, uuid, field_width, precision, flags);
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
/*
|
||||
* Show a '%p' thing. A kernel extension is that the '%p' is followed
|
||||
* by an extra set of alphanumeric characters that are extended format
|
||||
@@ -399,8 +434,8 @@ static char *pointer(const char *fmt, char *buf, char *end, void *ptr,
|
||||
flags);
|
||||
#endif
|
||||
|
||||
-#ifdef CONFIG_CMD_NET
|
||||
switch (*fmt) {
|
||||
+#ifdef CONFIG_CMD_NET
|
||||
case 'a':
|
||||
flags |= SPECIAL | ZEROPAD;
|
||||
|
||||
@@ -430,8 +465,15 @@ static char *pointer(const char *fmt, char *buf, char *end, void *ptr,
|
||||
precision, flags);
|
||||
flags &= ~SPECIAL;
|
||||
break;
|
||||
- }
|
||||
#endif
|
||||
+#ifdef CONFIG_LIB_UUID
|
||||
+ case 'U':
|
||||
+ return uuid_string(buf, end, ptr, field_width, precision,
|
||||
+ flags, fmt);
|
||||
+#endif
|
||||
+ default:
|
||||
+ break;
|
||||
+ }
|
||||
flags |= SMALL;
|
||||
if (field_width == -1) {
|
||||
field_width = 2*sizeof(void *);
|
||||
--
|
||||
2.13.5
|
||||
|
||||
From 7e3e20560784b048ff19e90cd36b6680626b1ab3 Mon Sep 17 00:00:00 2001
|
||||
From: Rob Clark <robdclark@gmail.com>
|
||||
Date: Sat, 9 Sep 2017 06:47:43 -0400
|
||||
Subject: [PATCH 006/105] examples: add fallback memcpy
|
||||
|
||||
Solves build issue:
|
||||
|
||||
Building current source for 134 boards (12 threads, 1 job per thread)
|
||||
arm: + lsxhl
|
||||
+examples/api/vsprintf.o: In function `string16':
|
||||
+lib/vsprintf.c:278: undefined reference to `memcpy'
|
||||
+examples/api/uuid.o: In function `uuid_bin_to_str':
|
||||
+lib/uuid.c:197: undefined reference to `memcpy'
|
||||
+lib/uuid.c:199: undefined reference to `memcpy'
|
||||
+make[3]: *** [examples/api/demo] Error 1
|
||||
+make[2]: *** [examples/api] Error 2
|
||||
+make[1]: *** [examples] Error 2
|
||||
+make: *** [sub-make] Error 2
|
||||
133 0 1 /134 sheevaplug
|
||||
|
||||
Signed-off-by: Rob Clark <robdclark@gmail.com>
|
||||
---
|
||||
examples/api/glue.c | 12 ++++++++++++
|
||||
1 file changed, 12 insertions(+)
|
||||
|
||||
diff --git a/examples/api/glue.c b/examples/api/glue.c
|
||||
index 8aabf32c89..575c1e55f3 100644
|
||||
--- a/examples/api/glue.c
|
||||
+++ b/examples/api/glue.c
|
||||
@@ -416,3 +416,15 @@ void ub_display_clear(void)
|
||||
{
|
||||
syscall(API_DISPLAY_CLEAR, NULL);
|
||||
}
|
||||
+
|
||||
+__weak void *memcpy(void *dest, const void *src, size_t size)
|
||||
+{
|
||||
+ unsigned char *dptr = dest;
|
||||
+ const unsigned char *ptr = src;
|
||||
+ const unsigned char *end = src + size;
|
||||
+
|
||||
+ while (ptr < end)
|
||||
+ *dptr++ = *ptr++;
|
||||
+
|
||||
+ return dest;
|
||||
+}
|
||||
--
|
||||
2.13.5
|
||||
|
|
@ -182,3 +182,29 @@ index 4c3ad95fca..82ad93f6ca 100644
|
|||
}
|
||||
|
||||
#ifndef CONFIG_DM_USB
|
||||
|
||||
From 47f22a41df082c62411389ab5bf6e9ae26d93083 Mon Sep 17 00:00:00 2001
|
||||
From: Rob Clark <robdclark@gmail.com>
|
||||
Date: Wed, 19 Jul 2017 10:39:12 -0400
|
||||
Subject: [PATCH 13/23] usb: kbd: add missing \n
|
||||
|
||||
Signed-off-by: Rob Clark <robdclark@gmail.com>
|
||||
---
|
||||
common/usb_kbd.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/common/usb_kbd.c b/common/usb_kbd.c
|
||||
index 703dd748f5..92d5e96d01 100644
|
||||
--- a/common/usb_kbd.c
|
||||
+++ b/common/usb_kbd.c
|
||||
@@ -655,7 +655,7 @@ static int usb_kbd_remove(struct udevice *dev)
|
||||
|
||||
return 0;
|
||||
err:
|
||||
- printf("%s: warning, ret=%d", __func__, ret);
|
||||
+ printf("%s: warning, ret=%d\n", __func__, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
--
|
||||
2.13.3
|
||||
|
|
Loading…
Reference in New Issue