* [PATCH v2 0/4] Update P2020RDB board support to allow NFS booting.
@ 2013-09-03 14:54 Renaud Barbier
2013-09-03 14:54 ` [PATCH 1/4] of: base: import of_find_node_by_type Renaud Barbier
` (4 more replies)
0 siblings, 5 replies; 10+ messages in thread
From: Renaud Barbier @ 2013-09-03 14:54 UTC (permalink / raw)
To: barebox
This patchset addresses all the comments regarding the initial patch [2/4].
The comments in respect of the function fdt_stdout_setup have been addressed
by:
- Removing the check on the existence of the /chosen node.
- Returning an errno value instead of 1.
The comments in respect of the MAC fixup function have been addressed by:
- Removing the fixup function from the initial patch.
- Updating eth_of_fixup to set the MAC address based on the Ethernet device
node alias.
Since eth_of_fixup is conditionally compiled, the P2020RDB configuration file
in patch [4/4] is updated to enable CONFIG_OFDEVICE.
Renaud Barbier (4):
of: base: import of_find_node_by_type
ppc: add and update device tree fixup functions
ppc: bootm: relocate fdt to valid boot memory
ppc: P2020RDB configuration update
arch/ppc/boards/freescale-p2020rdb/env/bin/init | 3 +
arch/ppc/boards/freescale-p2020rdb/env/config | 2 +
arch/ppc/boards/freescale-p2020rdb/p2020rdb.c | 7 +
arch/ppc/configs/p2020rdb_defconfig | 14 ++-
arch/ppc/include/asm/processor.h | 2 +
arch/ppc/lib/ppclinux.c | 49 ++++++++-
arch/ppc/mach-mpc85xx/Makefile | 1 +
arch/ppc/mach-mpc85xx/fdt.c | 146 +++++++++++++++++++++++
drivers/of/base.c | 29 +++++
include/of.h | 2 +
net/eth.c | 20 ++--
11 files changed, 264 insertions(+), 11 deletions(-)
create mode 100644 arch/ppc/boards/freescale-p2020rdb/env/bin/init
create mode 100644 arch/ppc/boards/freescale-p2020rdb/env/config
create mode 100644 arch/ppc/mach-mpc85xx/fdt.c
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/4] of: base: import of_find_node_by_type
2013-09-03 14:54 [PATCH v2 0/4] Update P2020RDB board support to allow NFS booting Renaud Barbier
@ 2013-09-03 14:54 ` Renaud Barbier
2013-09-03 14:54 ` [PATCH 2/4] ppc: add and update device tree fixup functions Renaud Barbier
` (3 subsequent siblings)
4 siblings, 0 replies; 10+ messages in thread
From: Renaud Barbier @ 2013-09-03 14:54 UTC (permalink / raw)
To: barebox
Import of_find_node_by_type from Linux drivers/of/base.c -
commit id d8dfad3.
This function retrieves a node pointer based on the "device_type"
property of the node.
This is used by device tree update functions in PPC support.
Signed-off-by: Renaud Barbier <renaud.barbier@ge.com>
---
drivers/of/base.c | 29 +++++++++++++++++++++++++++++
include/of.h | 2 ++
2 files changed, 31 insertions(+), 0 deletions(-)
diff --git a/drivers/of/base.c b/drivers/of/base.c
index c2fb712..a261435 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -401,6 +401,35 @@ struct device_node *of_find_node_by_name(struct device_node *from,
EXPORT_SYMBOL(of_find_node_by_name);
/**
+ * of_find_node_by_type - Find a node by its "device_type" property
+ * @from: The node to start searching from, or NULL to start searching
+ * the entire device tree. The node you pass will not be
+ * searched, only the next one will; typically, you pass
+ * what the previous call returned.
+ * @type: The type string to match against.
+ *
+ * Returns a pointer to the node found or NULL.
+ */
+struct device_node *of_find_node_by_type(struct device_node *from,
+ const char *type)
+{
+ struct device_node *np;
+ const char *device_type;
+ int ret;
+
+ if (!from)
+ from = root_node;
+
+ of_tree_for_each_node_from(np, from) {
+ ret = of_property_read_string(np, "device_type", &device_type);
+ if (!ret && !of_node_cmp(device_type, type))
+ return np;
+ }
+ return NULL;
+}
+EXPORT_SYMBOL(of_find_node_by_type)
+
+/**
* of_find_compatible_node - Find a node based on type and one of the
* tokens in its "compatible" property
* @from: The node to start searching from or NULL, the node
diff --git a/include/of.h b/include/of.h
index 2c77ee6..e5cd750 100644
--- a/include/of.h
+++ b/include/of.h
@@ -124,6 +124,8 @@ extern struct device_node *of_find_node_by_path_from(struct device_node *from,
const char *path);
extern struct device_node *of_find_node_by_path(const char *path);
extern struct device_node *of_find_node_by_phandle(phandle phandle);
+extern struct device_node *of_find_node_by_type(struct device_node *from,
+ const char *type);
extern struct device_node *of_find_compatible_node(struct device_node *from,
const char *type, const char *compat);
extern const struct of_device_id *of_match_node(
--
1.7.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 2/4] ppc: add and update device tree fixup functions
2013-09-03 14:54 [PATCH v2 0/4] Update P2020RDB board support to allow NFS booting Renaud Barbier
2013-09-03 14:54 ` [PATCH 1/4] of: base: import of_find_node_by_type Renaud Barbier
@ 2013-09-03 14:54 ` Renaud Barbier
2013-09-03 14:54 ` [PATCH 3/4] ppc: bootm: relocate fdt to valid boot memory Renaud Barbier
` (2 subsequent siblings)
4 siblings, 0 replies; 10+ messages in thread
From: Renaud Barbier @ 2013-09-03 14:54 UTC (permalink / raw)
To: barebox
This adds support for populating derived properties of the mpc85xx SOC
which are not typically included in the dtb directly.
This update is based on U-Boot code from common/fdt_support.c
and arch/powerpc/cpu/mpc85xx/fdt.c - version git-2b26201.
The function eth_of_fixup is also updated so that the MAC address can
be assigned to an Ethernet device node based on its alias retrieved
from the device tree.
Signed-off-by: Renaud Barbier <renaud.barbier@ge.com>
---
arch/ppc/include/asm/processor.h | 1 +
arch/ppc/mach-mpc85xx/Makefile | 1 +
arch/ppc/mach-mpc85xx/fdt.c | 146 ++++++++++++++++++++++++++++++++++++++
net/eth.c | 20 +++---
4 files changed, 159 insertions(+), 9 deletions(-)
create mode 100644 arch/ppc/mach-mpc85xx/fdt.c
diff --git a/arch/ppc/include/asm/processor.h b/arch/ppc/include/asm/processor.h
index 29e0622..04cfb60 100644
--- a/arch/ppc/include/asm/processor.h
+++ b/arch/ppc/include/asm/processor.h
@@ -845,6 +845,7 @@
/* Some parts define SVR[0:23] as the SOC version */
#define SVR_SOC_VER(svr) (((svr) >> 8) & 0xFFFFFF) /* SOC Version fields */
+#define IS_E_PROCESSOR(svr) ((svr) & 0x80000)
/*
* SVR_VER() Version Values
diff --git a/arch/ppc/mach-mpc85xx/Makefile b/arch/ppc/mach-mpc85xx/Makefile
index cc412c5..81d6853 100644
--- a/arch/ppc/mach-mpc85xx/Makefile
+++ b/arch/ppc/mach-mpc85xx/Makefile
@@ -5,4 +5,5 @@ obj-y += fsl_law.o
obj-y += speed.o
obj-y +=time.o
obj-$(CONFIG_MP) += mp.o
+obj-$(CONFIG_OFTREE) += fdt.o
obj-$(CONFIG_DRIVER_NET_GIANFAR) += eth-devices.o
diff --git a/arch/ppc/mach-mpc85xx/fdt.c b/arch/ppc/mach-mpc85xx/fdt.c
new file mode 100644
index 0000000..4feae44
--- /dev/null
+++ b/arch/ppc/mach-mpc85xx/fdt.c
@@ -0,0 +1,146 @@
+/*
+ * Copyright 2013 GE Intelligent Platforms, Inc.
+ * Copyright 2007-2011 Freescale Semiconductor, Inc.
+ *
+ * (C) Copyright 2000
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * Based on U-Boot arch/powerpc/cpu/mpc85xx/fdt.c and
+ * common/fdt_support.c - version git-2b26201.
+ */
+#include <common.h>
+#include <init.h>
+#include <errno.h>
+#include <environment.h>
+#include <asm/processor.h>
+#include <mach/clock.h>
+#include <of.h>
+
+static void of_setup_crypto_node(void *blob)
+{
+ struct device_node *crypto_node;
+
+ crypto_node = of_find_compatible_node(blob, NULL, "fsl,sec2.0");
+ if (crypto_node == NULL)
+ return;
+
+ of_delete_node(crypto_node);
+}
+
+/* These properties specify whether the hardware supports the stashing
+ * of buffer descriptors in L2 cache.
+ */
+static void fdt_add_enet_stashing(void *fdt)
+{
+ struct device_node *node;
+
+ node = of_find_compatible_node(fdt, NULL, "gianfar");
+ while (node) {
+ of_set_property(node, "bd-stash", NULL, 0, 1);
+ of_property_write_u32(node, "rx-stash-len", 96);
+ of_property_write_u32(node, "rx-stash-idx", 0);
+ node = of_find_compatible_node(node, NULL, "gianfar");
+ }
+}
+
+static int fdt_stdout_setup(struct device_node *blob)
+{
+ struct device_node *node, *alias;
+ char sername[9] = { 0 };
+ const char *prop;
+ struct console_device *cdev;
+ int len;
+
+ node = of_create_node(blob, "/chosen");
+ if (node == NULL) {
+ pr_err("%s: could not open /chosen node\n", __func__);
+ goto error;
+ }
+
+ for_each_console(cdev)
+ if ((cdev->f_active & (CONSOLE_STDIN | CONSOLE_STDOUT)))
+ break;
+ if (cdev)
+ sprintf(sername, "serial%d", cdev->dev->id);
+ else
+ sprintf(sername, "serial%d", 0);
+
+ alias = of_find_node_by_path_from(blob, "/aliases");
+ if (!alias) {
+ pr_err("%s: could not get aliases node.\n", __func__);
+ goto error;
+ }
+ prop = of_get_property(alias, sername, &len);
+ of_set_property(node, "linux,stdout-path", prop, len, 1);
+
+ return 0;
+error:
+ return -ENODEV;
+}
+
+static int fdt_cpu_setup(struct device_node *blob)
+{
+ struct device_node *node;
+ struct sys_info sysinfo;
+
+ /* delete crypto node if not on an E-processor */
+ if (!IS_E_PROCESSOR(get_svr()))
+ of_setup_crypto_node(blob);
+
+ fdt_add_enet_stashing(blob);
+ fsl_get_sys_info(&sysinfo);
+
+ node = of_find_node_by_type(blob, "cpu");
+ while (node) {
+ const uint32_t *reg;
+
+ of_property_write_u32(node, "timebase-frequency",
+ fsl_get_timebase_clock());
+ of_property_write_u32(node, "bus-frequency",
+ sysinfo.freqSystemBus);
+ reg = of_get_property(node, "reg", NULL);
+ of_property_write_u32(node, "clock-frequency",
+ sysinfo.freqProcessor[*reg]);
+ node = of_find_node_by_type(node, "cpu");
+ }
+
+ node = of_find_node_by_type(blob, "soc");
+ if (node)
+ of_property_write_u32(node, "bus-frequency",
+ sysinfo.freqSystemBus);
+
+ node = of_find_compatible_node(blob, NULL, "fsl,elbc");
+ if (node)
+ of_property_write_u32(node, "bus-frequency",
+ sysinfo.freqLocalBus);
+
+ node = of_find_compatible_node(blob, NULL, "ns16550");
+ while (node) {
+ of_property_write_u32(node, "clock-frequency",
+ sysinfo.freqSystemBus);
+ node = of_find_compatible_node(node, NULL, "ns16550");
+ }
+
+ fdt_stdout_setup(blob);
+
+ return 0;
+}
+
+static int of_register_mpc85xx_fixup(void)
+{
+ return of_register_fixup(fdt_cpu_setup);
+}
+late_initcall(of_register_mpc85xx_fixup);
diff --git a/net/eth.c b/net/eth.c
index e94689a..52ce466 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -285,21 +285,23 @@ static int eth_of_fixup(struct device_node *root)
* find a nodepath for and which has a valid mac address.
*/
list_for_each_entry(edev, &netdev_list, list) {
- if (!edev->nodepath) {
- dev_dbg(&edev->dev, "%s: no node to fixup\n", __func__);
+ if (!is_valid_ether_addr(edev->ethaddr)) {
+ dev_dbg(&edev->dev,
+ "%s: no valid mac address, cannot fixup\n",
+ __func__);
continue;
}
- if (!is_valid_ether_addr(edev->ethaddr)) {
- dev_dbg(&edev->dev, "%s: no valid mac address, cannot fixup\n",
- __func__);
- continue;
+ if (edev->nodepath) {
+ node = of_find_node_by_path_from(root, edev->nodepath);
+ } else {
+ char eth[12];
+ sprintf(eth, "ethernet%d", edev->dev.id);
+ node = of_find_node_by_alias(root, eth);
}
- node = of_find_node_by_path_from(root, edev->nodepath);
if (!node) {
- dev_dbg(&edev->dev, "%s: fixup node %s not found\n",
- __func__, edev->nodepath);
+ dev_dbg(&edev->dev, "%s: no node to fixup\n", __func__);
continue;
}
--
1.7.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 3/4] ppc: bootm: relocate fdt to valid boot memory
2013-09-03 14:54 [PATCH v2 0/4] Update P2020RDB board support to allow NFS booting Renaud Barbier
2013-09-03 14:54 ` [PATCH 1/4] of: base: import of_find_node_by_type Renaud Barbier
2013-09-03 14:54 ` [PATCH 2/4] ppc: add and update device tree fixup functions Renaud Barbier
@ 2013-09-03 14:54 ` Renaud Barbier
2013-09-05 12:21 ` Sascha Hauer
2013-09-03 14:54 ` [PATCH 4/4] ppc: P2020RDB configuration update Renaud Barbier
2013-09-04 6:46 ` [PATCH v2 0/4] Update P2020RDB board support to allow NFS booting Sascha Hauer
4 siblings, 1 reply; 10+ messages in thread
From: Renaud Barbier @ 2013-09-03 14:54 UTC (permalink / raw)
To: barebox
For the MPC85xx family of SOCs Linux expects any boot firmware
information to be passed in the first 64MiB of memory. This adds support
to ensure that the device tree is relocated to a valid location if it is
outside that address range.
Signed-off-by: Renaud Barbier <renaud.barbier@ge.com>
---
arch/ppc/include/asm/processor.h | 1 +
arch/ppc/lib/ppclinux.c | 49 +++++++++++++++++++++++++++++++++++++-
2 files changed, 49 insertions(+), 1 deletions(-)
diff --git a/arch/ppc/include/asm/processor.h b/arch/ppc/include/asm/processor.h
index 04cfb60..6b9b7dd 100644
--- a/arch/ppc/include/asm/processor.h
+++ b/arch/ppc/include/asm/processor.h
@@ -966,6 +966,7 @@ struct cpu_type {
struct cpu_type *identify_cpu(u32 ver);
#if defined(CONFIG_MPC85xx)
+#define LINUX_TLB1_MAX_ADDR ((void *)(64 << 20))
#define CPU_TYPE_ENTRY(n, v, nc) \
{ .name = #n, .soc_ver = SVR_##v, .num_cores = (nc), }
#endif
diff --git a/arch/ppc/lib/ppclinux.c b/arch/ppc/lib/ppclinux.c
index ef69ead..7c30ac3 100644
--- a/arch/ppc/lib/ppclinux.c
+++ b/arch/ppc/lib/ppclinux.c
@@ -4,12 +4,45 @@
#include <command.h>
#include <image.h>
#include <init.h>
+#include <malloc.h>
#include <environment.h>
#include <asm/bitops.h>
+#include <asm/processor.h>
#include <boot.h>
#include <errno.h>
#include <fs.h>
+static int bootm_relocate_fdt(void *addr, struct image_data *data)
+{
+ if (addr < LINUX_TLB1_MAX_ADDR) {
+ /* The kernel is within the boot TLB mapping.
+ * Put the DTB above if there is no space
+ * below.
+ */
+ if (addr < (void *)data->oftree->totalsize) {
+ addr = (void *)PAGE_ALIGN((phys_addr_t)addr +
+ data->os->header.ih_size);
+ addr += data->oftree->totalsize;
+ if (addr < LINUX_TLB1_MAX_ADDR)
+ addr = LINUX_TLB1_MAX_ADDR;
+ }
+ }
+
+ if (addr > LINUX_TLB1_MAX_ADDR) {
+ pr_crit("Unable to relocate DTB to Linux TLB\n");
+ return 1;
+ }
+
+ addr = (void *)PAGE_ALIGN_DOWN((phys_addr_t)addr -
+ data->oftree->totalsize);
+ memcpy(addr, data->oftree, data->oftree->totalsize);
+ free(data->oftree);
+ data->oftree = addr;
+
+ pr_info("Relocating device tree to 0x%p\n", addr);
+ return 0;
+}
+
static int do_bootm_linux(struct image_data *data)
{
void (*kernel)(void *, void *, unsigned long,
@@ -24,6 +57,20 @@ static int do_bootm_linux(struct image_data *data)
return -EINVAL;
}
+ /* Relocate the device tree if outside the initial
+ * Linux mapped TLB.
+ */
+ if (IS_ENABLED(CONFIG_MPC85xx)) {
+ void *addr = data->oftree;
+
+ if ((addr + data->oftree->totalsize) > LINUX_TLB1_MAX_ADDR) {
+ addr = (void *)data->os_address;
+
+ if (bootm_relocate_fdt(addr, data))
+ goto error;
+ }
+ }
+
fdt_add_reserve_map(data->oftree);
kernel = (void *)(data->os_address + data->os_entry);
@@ -40,7 +87,7 @@ static int do_bootm_linux(struct image_data *data)
reset_cpu(0);
- /* not reached */
+error:
return -1;
}
--
1.7.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 4/4] ppc: P2020RDB configuration update
2013-09-03 14:54 [PATCH v2 0/4] Update P2020RDB board support to allow NFS booting Renaud Barbier
` (2 preceding siblings ...)
2013-09-03 14:54 ` [PATCH 3/4] ppc: bootm: relocate fdt to valid boot memory Renaud Barbier
@ 2013-09-03 14:54 ` Renaud Barbier
2013-09-04 6:46 ` [PATCH v2 0/4] Update P2020RDB board support to allow NFS booting Sascha Hauer
4 siblings, 0 replies; 10+ messages in thread
From: Renaud Barbier @ 2013-09-03 14:54 UTC (permalink / raw)
To: barebox
The P2020rdb defconfig has been updated to include
device tree, environment and boot command support for
booting Linux.
Also the P2020RDB board support defines a flash area to
store its environment for users to configure the boot process.
Signed-off-by: Renaud Barbier <renaud.barbier@ge.com>
---
arch/ppc/boards/freescale-p2020rdb/env/bin/init | 3 +++
arch/ppc/boards/freescale-p2020rdb/env/config | 2 ++
arch/ppc/boards/freescale-p2020rdb/p2020rdb.c | 7 +++++++
arch/ppc/configs/p2020rdb_defconfig | 14 +++++++++++++-
4 files changed, 25 insertions(+), 1 deletions(-)
create mode 100644 arch/ppc/boards/freescale-p2020rdb/env/bin/init
create mode 100644 arch/ppc/boards/freescale-p2020rdb/env/config
diff --git a/arch/ppc/boards/freescale-p2020rdb/env/bin/init b/arch/ppc/boards/freescale-p2020rdb/env/bin/init
new file mode 100644
index 0000000..6bd125c
--- /dev/null
+++ b/arch/ppc/boards/freescale-p2020rdb/env/bin/init
@@ -0,0 +1,3 @@
+#!/bin/sh
+export PATH=/env/bin
+source /env/config
diff --git a/arch/ppc/boards/freescale-p2020rdb/env/config b/arch/ppc/boards/freescale-p2020rdb/env/config
new file mode 100644
index 0000000..26b1a9a
--- /dev/null
+++ b/arch/ppc/boards/freescale-p2020rdb/env/config
@@ -0,0 +1,2 @@
+#!/bin/sh
+export bootargs="root=/dev/nfs rw ip=bootp panic=10"
diff --git a/arch/ppc/boards/freescale-p2020rdb/p2020rdb.c b/arch/ppc/boards/freescale-p2020rdb/p2020rdb.c
index 4d2ff22..bc36b28 100644
--- a/arch/ppc/boards/freescale-p2020rdb/p2020rdb.c
+++ b/arch/ppc/boards/freescale-p2020rdb/p2020rdb.c
@@ -92,6 +92,13 @@ static int devices_init(void)
fsl_eth_init(2, &gfar_info[0]);
fsl_eth_init(3, &gfar_info[1]);
+ /* The env0 offset 0x770000 is from the base address of the alternate
+ * boot area where barebox boots from. Programming barebox in the
+ * primary boot area in place of U-Boot may lead to loss of data when
+ * saving the environment.
+ */
+ devfs_add_partition("nor0", 0x770000, 0x10000, DEVFS_PARTITION_FIXED,
+ "env0");
devfs_add_partition("nor0", 0xf80000, 0x80000, DEVFS_PARTITION_FIXED,
"self0");
return 0;
diff --git a/arch/ppc/configs/p2020rdb_defconfig b/arch/ppc/configs/p2020rdb_defconfig
index 0f77903..8907511 100644
--- a/arch/ppc/configs/p2020rdb_defconfig
+++ b/arch/ppc/configs/p2020rdb_defconfig
@@ -5,10 +5,18 @@ CONFIG_LONGHELP=y
CONFIG_GLOB=y
CONFIG_CMDLINE_EDITING=y
CONFIG_AUTO_COMPLETE=y
+CONFIG_CMD_PARTITION=y
CONFIG_CMD_SLEEP=y
CONFIG_CMD_FLASH=y
CONFIG_CMD_RESET=y
CONFIG_CMD_GO=y
+CONFIG_DEFAULT_ENVIRONMENT_GENERIC=n
+CONFIG_DEFAULT_ENVIRONMENT_PATH="arch/ppc/boards/freescale-p2020rdb/env"
+CONFIG_CMD_LOADENV=y
+CONFIG_CMD_SAVEENV=y
+CONFIG_CMD_PRINTENV=y
+CONFIG_CMD_EXPORT=y
+CONFIG_CMD_EDIT=y
CONFIG_FSL_ELBC=y
CONFIG_DRIVER_CFI=y
CONFIG_DRIVER_CFI_AMD=y
@@ -17,7 +25,7 @@ CONFIG_DRIVER_CFI_BANK_WIDTH_1=n
CONFIG_DRIVER_CFI_BANK_WIDTH_2=y
CONFIG_DRIVER_CFI_BANK_WIDTH_4=n
CONFIG_MTD=y
-CONFIG_MALLOC_SIZE=0x200000
+CONFIG_MALLOC_SIZE=0x800000
CONFIG_BAUDRATE=115200
CONFIG_DRIVER_SERIAL_NS16550=y
CONFIG_RELOCATABLE=y
@@ -32,3 +40,7 @@ CONFIG_I2C=y
CONFIG_I2C_IMX=y
CONFIG_CMD_I2C=y
CONFIG_CMD_MIITOOL=y
+CONFIG_ZLIB=y
+CONFIG_OFTREE=y
+CONFIG_CMD_OFTREE=y
+CONFIG_OFDEVICE=y
--
1.7.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 0/4] Update P2020RDB board support to allow NFS booting.
2013-09-03 14:54 [PATCH v2 0/4] Update P2020RDB board support to allow NFS booting Renaud Barbier
` (3 preceding siblings ...)
2013-09-03 14:54 ` [PATCH 4/4] ppc: P2020RDB configuration update Renaud Barbier
@ 2013-09-04 6:46 ` Sascha Hauer
4 siblings, 0 replies; 10+ messages in thread
From: Sascha Hauer @ 2013-09-04 6:46 UTC (permalink / raw)
To: Renaud Barbier; +Cc: barebox
On Tue, Sep 03, 2013 at 03:54:23PM +0100, Renaud Barbier wrote:
> This patchset addresses all the comments regarding the initial patch [2/4].
> The comments in respect of the function fdt_stdout_setup have been addressed
> by:
> - Removing the check on the existence of the /chosen node.
> - Returning an errno value instead of 1.
>
> The comments in respect of the MAC fixup function have been addressed by:
> - Removing the fixup function from the initial patch.
> - Updating eth_of_fixup to set the MAC address based on the Ethernet device
> node alias.
>
> Since eth_of_fixup is conditionally compiled, the P2020RDB configuration file
> in patch [4/4] is updated to enable CONFIG_OFDEVICE.
>
> Renaud Barbier (4):
> of: base: import of_find_node_by_type
> ppc: add and update device tree fixup functions
> ppc: bootm: relocate fdt to valid boot memory
> ppc: P2020RDB configuration update
Applied, thanks
I splitted up 2/4 into two patches because then we have one patch for
networking and one ppc specific patch.
Sascha
>
> arch/ppc/boards/freescale-p2020rdb/env/bin/init | 3 +
> arch/ppc/boards/freescale-p2020rdb/env/config | 2 +
> arch/ppc/boards/freescale-p2020rdb/p2020rdb.c | 7 +
> arch/ppc/configs/p2020rdb_defconfig | 14 ++-
> arch/ppc/include/asm/processor.h | 2 +
> arch/ppc/lib/ppclinux.c | 49 ++++++++-
> arch/ppc/mach-mpc85xx/Makefile | 1 +
> arch/ppc/mach-mpc85xx/fdt.c | 146 +++++++++++++++++++++++
> drivers/of/base.c | 29 +++++
> include/of.h | 2 +
> net/eth.c | 20 ++--
> 11 files changed, 264 insertions(+), 11 deletions(-)
> create mode 100644 arch/ppc/boards/freescale-p2020rdb/env/bin/init
> create mode 100644 arch/ppc/boards/freescale-p2020rdb/env/config
> create mode 100644 arch/ppc/mach-mpc85xx/fdt.c
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 3/4] ppc: bootm: relocate fdt to valid boot memory
2013-09-03 14:54 ` [PATCH 3/4] ppc: bootm: relocate fdt to valid boot memory Renaud Barbier
@ 2013-09-05 12:21 ` Sascha Hauer
2013-09-06 10:53 ` Renaud Barbier
0 siblings, 1 reply; 10+ messages in thread
From: Sascha Hauer @ 2013-09-05 12:21 UTC (permalink / raw)
To: Renaud Barbier; +Cc: barebox
Hi Renaud,
On Tue, Sep 03, 2013 at 03:54:26PM +0100, Renaud Barbier wrote:
> For the MPC85xx family of SOCs Linux expects any boot firmware
> information to be passed in the first 64MiB of memory. This adds support
> to ensure that the device tree is relocated to a valid location if it is
> outside that address range.
>
> Signed-off-by: Renaud Barbier <renaud.barbier@ge.com>
> ---
> arch/ppc/include/asm/processor.h | 1 +
> arch/ppc/lib/ppclinux.c | 49 +++++++++++++++++++++++++++++++++++++-
> 2 files changed, 49 insertions(+), 1 deletions(-)
>
> diff --git a/arch/ppc/include/asm/processor.h b/arch/ppc/include/asm/processor.h
> index 04cfb60..6b9b7dd 100644
> --- a/arch/ppc/include/asm/processor.h
> +++ b/arch/ppc/include/asm/processor.h
> @@ -966,6 +966,7 @@ struct cpu_type {
> struct cpu_type *identify_cpu(u32 ver);
>
> #if defined(CONFIG_MPC85xx)
> +#define LINUX_TLB1_MAX_ADDR ((void *)(64 << 20))
I had to drop this patch as it breaks the pcm030 compilation. I have no
idea what the correct value for LINUX_TLB1_MAX_ADDR on MPC5200 is. Can
you send an updated patch?
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 3/4] ppc: bootm: relocate fdt to valid boot memory
2013-09-05 12:21 ` Sascha Hauer
@ 2013-09-06 10:53 ` Renaud Barbier
2013-09-09 15:08 ` Sascha Hauer
0 siblings, 1 reply; 10+ messages in thread
From: Renaud Barbier @ 2013-09-06 10:53 UTC (permalink / raw)
To: barebox
For the MPC85xx family of SOCs Linux expects any boot firmware
information to be passed in the first 64MiB of memory. This adds support
to ensure that the device tree is relocated to a valid location if it is
outside that address range.
For the other SOC family currently present in the ppc architecture, the
default is not to relocate as at Linux startup the virtual address
equals the physical address.
Signed-off-by: Renaud Barbier <renaud.barbier@ge.com>
---
arch/ppc/include/asm/processor.h | 3 +++
arch/ppc/lib/ppclinux.c | 49 +++++++++++++++++++++++++++++++++++++++-
2 files changed, 51 insertions(+), 1 deletion(-)
diff --git a/arch/ppc/include/asm/processor.h b/arch/ppc/include/asm/processor.h
index 04cfb60..9145257 100644
--- a/arch/ppc/include/asm/processor.h
+++ b/arch/ppc/include/asm/processor.h
@@ -966,8 +966,11 @@ struct cpu_type {
struct cpu_type *identify_cpu(u32 ver);
#if defined(CONFIG_MPC85xx)
+#define LINUX_TLB1_MAX_ADDR ((void *)(64 << 20))
#define CPU_TYPE_ENTRY(n, v, nc) \
{ .name = #n, .soc_ver = SVR_##v, .num_cores = (nc), }
+#else
+#define LINUX_TLB1_MAX_ADDR ((void *)0xffffffff)
#endif
#ifndef CONFIG_MACH_SPECIFIC
extern int _machine;
diff --git a/arch/ppc/lib/ppclinux.c b/arch/ppc/lib/ppclinux.c
index ef69ead..7c30ac3 100644
--- a/arch/ppc/lib/ppclinux.c
+++ b/arch/ppc/lib/ppclinux.c
@@ -4,12 +4,45 @@
#include <command.h>
#include <image.h>
#include <init.h>
+#include <malloc.h>
#include <environment.h>
#include <asm/bitops.h>
+#include <asm/processor.h>
#include <boot.h>
#include <errno.h>
#include <fs.h>
+static int bootm_relocate_fdt(void *addr, struct image_data *data)
+{
+ if (addr < LINUX_TLB1_MAX_ADDR) {
+ /* The kernel is within the boot TLB mapping.
+ * Put the DTB above if there is no space
+ * below.
+ */
+ if (addr < (void *)data->oftree->totalsize) {
+ addr = (void *)PAGE_ALIGN((phys_addr_t)addr +
+ data->os->header.ih_size);
+ addr += data->oftree->totalsize;
+ if (addr < LINUX_TLB1_MAX_ADDR)
+ addr = LINUX_TLB1_MAX_ADDR;
+ }
+ }
+
+ if (addr > LINUX_TLB1_MAX_ADDR) {
+ pr_crit("Unable to relocate DTB to Linux TLB\n");
+ return 1;
+ }
+
+ addr = (void *)PAGE_ALIGN_DOWN((phys_addr_t)addr -
+ data->oftree->totalsize);
+ memcpy(addr, data->oftree, data->oftree->totalsize);
+ free(data->oftree);
+ data->oftree = addr;
+
+ pr_info("Relocating device tree to 0x%p\n", addr);
+ return 0;
+}
+
static int do_bootm_linux(struct image_data *data)
{
void (*kernel)(void *, void *, unsigned long,
@@ -24,6 +57,20 @@ static int do_bootm_linux(struct image_data *data)
return -EINVAL;
}
+ /* Relocate the device tree if outside the initial
+ * Linux mapped TLB.
+ */
+ if (IS_ENABLED(CONFIG_MPC85xx)) {
+ void *addr = data->oftree;
+
+ if ((addr + data->oftree->totalsize) > LINUX_TLB1_MAX_ADDR) {
+ addr = (void *)data->os_address;
+
+ if (bootm_relocate_fdt(addr, data))
+ goto error;
+ }
+ }
+
fdt_add_reserve_map(data->oftree);
kernel = (void *)(data->os_address + data->os_entry);
@@ -40,7 +87,7 @@ static int do_bootm_linux(struct image_data *data)
reset_cpu(0);
- /* not reached */
+error:
return -1;
}
--
1.8.3.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 3/4] ppc: bootm: relocate fdt to valid boot memory
2013-09-06 10:53 ` Renaud Barbier
@ 2013-09-09 15:08 ` Sascha Hauer
0 siblings, 0 replies; 10+ messages in thread
From: Sascha Hauer @ 2013-09-09 15:08 UTC (permalink / raw)
To: Renaud Barbier; +Cc: barebox
On Fri, Sep 06, 2013 at 11:53:12AM +0100, Renaud Barbier wrote:
> For the MPC85xx family of SOCs Linux expects any boot firmware
> information to be passed in the first 64MiB of memory. This adds support
> to ensure that the device tree is relocated to a valid location if it is
> outside that address range.
>
> For the other SOC family currently present in the ppc architecture, the
> default is not to relocate as at Linux startup the virtual address
> equals the physical address.
>
> Signed-off-by: Renaud Barbier <renaud.barbier@ge.com>
Applied, thanks
Sascha
> ---
> arch/ppc/include/asm/processor.h | 3 +++
> arch/ppc/lib/ppclinux.c | 49 +++++++++++++++++++++++++++++++++++++++-
> 2 files changed, 51 insertions(+), 1 deletion(-)
>
> diff --git a/arch/ppc/include/asm/processor.h b/arch/ppc/include/asm/processor.h
> index 04cfb60..9145257 100644
> --- a/arch/ppc/include/asm/processor.h
> +++ b/arch/ppc/include/asm/processor.h
> @@ -966,8 +966,11 @@ struct cpu_type {
> struct cpu_type *identify_cpu(u32 ver);
>
> #if defined(CONFIG_MPC85xx)
> +#define LINUX_TLB1_MAX_ADDR ((void *)(64 << 20))
> #define CPU_TYPE_ENTRY(n, v, nc) \
> { .name = #n, .soc_ver = SVR_##v, .num_cores = (nc), }
> +#else
> +#define LINUX_TLB1_MAX_ADDR ((void *)0xffffffff)
> #endif
> #ifndef CONFIG_MACH_SPECIFIC
> extern int _machine;
> diff --git a/arch/ppc/lib/ppclinux.c b/arch/ppc/lib/ppclinux.c
> index ef69ead..7c30ac3 100644
> --- a/arch/ppc/lib/ppclinux.c
> +++ b/arch/ppc/lib/ppclinux.c
> @@ -4,12 +4,45 @@
> #include <command.h>
> #include <image.h>
> #include <init.h>
> +#include <malloc.h>
> #include <environment.h>
> #include <asm/bitops.h>
> +#include <asm/processor.h>
> #include <boot.h>
> #include <errno.h>
> #include <fs.h>
>
> +static int bootm_relocate_fdt(void *addr, struct image_data *data)
> +{
> + if (addr < LINUX_TLB1_MAX_ADDR) {
> + /* The kernel is within the boot TLB mapping.
> + * Put the DTB above if there is no space
> + * below.
> + */
> + if (addr < (void *)data->oftree->totalsize) {
> + addr = (void *)PAGE_ALIGN((phys_addr_t)addr +
> + data->os->header.ih_size);
> + addr += data->oftree->totalsize;
> + if (addr < LINUX_TLB1_MAX_ADDR)
> + addr = LINUX_TLB1_MAX_ADDR;
> + }
> + }
> +
> + if (addr > LINUX_TLB1_MAX_ADDR) {
> + pr_crit("Unable to relocate DTB to Linux TLB\n");
> + return 1;
> + }
> +
> + addr = (void *)PAGE_ALIGN_DOWN((phys_addr_t)addr -
> + data->oftree->totalsize);
> + memcpy(addr, data->oftree, data->oftree->totalsize);
> + free(data->oftree);
> + data->oftree = addr;
> +
> + pr_info("Relocating device tree to 0x%p\n", addr);
> + return 0;
> +}
> +
> static int do_bootm_linux(struct image_data *data)
> {
> void (*kernel)(void *, void *, unsigned long,
> @@ -24,6 +57,20 @@ static int do_bootm_linux(struct image_data *data)
> return -EINVAL;
> }
>
> + /* Relocate the device tree if outside the initial
> + * Linux mapped TLB.
> + */
> + if (IS_ENABLED(CONFIG_MPC85xx)) {
> + void *addr = data->oftree;
> +
> + if ((addr + data->oftree->totalsize) > LINUX_TLB1_MAX_ADDR) {
> + addr = (void *)data->os_address;
> +
> + if (bootm_relocate_fdt(addr, data))
> + goto error;
> + }
> + }
> +
> fdt_add_reserve_map(data->oftree);
>
> kernel = (void *)(data->os_address + data->os_entry);
> @@ -40,7 +87,7 @@ static int do_bootm_linux(struct image_data *data)
>
> reset_cpu(0);
>
> - /* not reached */
> +error:
> return -1;
> }
>
> --
> 1.8.3.4
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 3/4] ppc: bootm: relocate fdt to valid boot memory
2013-08-30 13:34 [PATCH " Renaud Barbier
@ 2013-08-30 13:34 ` Renaud Barbier
0 siblings, 0 replies; 10+ messages in thread
From: Renaud Barbier @ 2013-08-30 13:34 UTC (permalink / raw)
To: barebox
For the MPC85xx family of SOCs Linux expects any boot firmware
information to be passed in the first 64MiB of memory. This adds support
to ensure that the device tree is relocated to a valid location if it is
outside that address range.
Signed-off-by: Renaud Barbier <renaud.barbier@ge.com>
---
arch/ppc/include/asm/processor.h | 1 +
arch/ppc/lib/ppclinux.c | 49 +++++++++++++++++++++++++++++++++++++-
2 files changed, 49 insertions(+), 1 deletions(-)
diff --git a/arch/ppc/include/asm/processor.h b/arch/ppc/include/asm/processor.h
index 04cfb60..6b9b7dd 100644
--- a/arch/ppc/include/asm/processor.h
+++ b/arch/ppc/include/asm/processor.h
@@ -966,6 +966,7 @@ struct cpu_type {
struct cpu_type *identify_cpu(u32 ver);
#if defined(CONFIG_MPC85xx)
+#define LINUX_TLB1_MAX_ADDR ((void *)(64 << 20))
#define CPU_TYPE_ENTRY(n, v, nc) \
{ .name = #n, .soc_ver = SVR_##v, .num_cores = (nc), }
#endif
diff --git a/arch/ppc/lib/ppclinux.c b/arch/ppc/lib/ppclinux.c
index ef69ead..e6cdcad 100644
--- a/arch/ppc/lib/ppclinux.c
+++ b/arch/ppc/lib/ppclinux.c
@@ -4,12 +4,45 @@
#include <command.h>
#include <image.h>
#include <init.h>
+#include <malloc.h>
#include <environment.h>
#include <asm/bitops.h>
+#include <asm/processor.h>
#include <boot.h>
#include <errno.h>
#include <fs.h>
+static int bootm_relocate_fdt(void *addr, struct image_data *data)
+{
+ if (addr < LINUX_TLB1_MAX_ADDR) {
+ /* The kernel is within the boot TLB mapping.
+ * Put the DTB above if there is no space
+ * below.
+ */
+ if (addr < (void *)data->oftree->totalsize) {
+ addr = (void *)PAGE_ALIGN((phys_addr_t)addr +
+ data->os->header.ih_size);
+ addr += data->oftree->totalsize;
+ if (addr < LINUX_TLB1_MAX_ADDR)
+ addr = LINUX_TLB1_MAX_ADDR;
+ }
+ }
+
+ if (addr > LINUX_TLB1_MAX_ADDR) {
+ pr_crit("Unable to relocate DTB to Linux TLB\n");
+ return 1;
+ }
+
+ addr = (void *)PAGE_ALIGN_DOWN((phys_addr_t)addr -
+ data->oftree->totalsize);
+ memcpy(addr, data->oftree, data->oftree->totalsize);
+ free(data->oftree);
+ data->oftree = addr;
+
+ pr_info("Relocating device tree to 0x%p\n", addr);
+ return 0;
+}
+
static int do_bootm_linux(struct image_data *data)
{
void (*kernel)(void *, void *, unsigned long,
@@ -24,6 +57,20 @@ static int do_bootm_linux(struct image_data *data)
return -EINVAL;
}
+ /* Relocate the device tree if outside the initial
+ * Linux mapped TLB.
+ */
+ if (IS_ENABLED(CONFIG_MPC85xx)) {
+ void *addr = data->oftree;
+
+ if ((addr + data->oftree->totalsize) > LINUX_TLB1_MAX_ADDR) {
+ addr = (void *)data->os_address;
+
+ if (bootm_relocate_fdt(addr, data))
+ goto error;
+ }
+ }
+
fdt_add_reserve_map(data->oftree);
kernel = (void *)(data->os_address + data->os_entry);
@@ -37,9 +84,9 @@ static int do_bootm_linux(struct image_data *data)
* r7: NULL
*/
kernel(data->oftree, kernel, 0, 0, 0);
-
reset_cpu(0);
+error:
/* not reached */
return -1;
}
--
1.7.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2013-09-09 15:09 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-03 14:54 [PATCH v2 0/4] Update P2020RDB board support to allow NFS booting Renaud Barbier
2013-09-03 14:54 ` [PATCH 1/4] of: base: import of_find_node_by_type Renaud Barbier
2013-09-03 14:54 ` [PATCH 2/4] ppc: add and update device tree fixup functions Renaud Barbier
2013-09-03 14:54 ` [PATCH 3/4] ppc: bootm: relocate fdt to valid boot memory Renaud Barbier
2013-09-05 12:21 ` Sascha Hauer
2013-09-06 10:53 ` Renaud Barbier
2013-09-09 15:08 ` Sascha Hauer
2013-09-03 14:54 ` [PATCH 4/4] ppc: P2020RDB configuration update Renaud Barbier
2013-09-04 6:46 ` [PATCH v2 0/4] Update P2020RDB board support to allow NFS booting Sascha Hauer
-- strict thread matches above, loose matches on Subject: below --
2013-08-30 13:34 [PATCH " Renaud Barbier
2013-08-30 13:34 ` [PATCH 3/4] ppc: bootm: relocate fdt to valid boot memory Renaud Barbier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox