diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2015-03-09 08:32:26 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2015-03-09 08:32:26 +0100 |
commit | fa20ea45e0955f07229f0fbf646ac5e5e04f5a33 (patch) | |
tree | 4736a5bd899599e02a08c02a5cdc8e77218b1012 | |
parent | 4680b375b9dd32e6558ae2ee8a15b27819c70e73 (diff) | |
parent | f5eaa68abf2af676bd34257af436ecba85bbf78a (diff) | |
download | barebox-fa20ea45e0955f07229f0fbf646ac5e5e04f5a33.tar.gz barebox-fa20ea45e0955f07229f0fbf646ac5e5e04f5a33.tar.xz |
Merge branch 'for-next/tegra'
-rw-r--r-- | arch/arm/boards/nvidia-beaver/board.c | 4 | ||||
-rw-r--r-- | arch/arm/boards/nvidia-jetson-tk1/board.c | 4 | ||||
-rw-r--r-- | arch/arm/configs/tegra_v7_defconfig | 1 | ||||
-rw-r--r-- | arch/arm/dts/tegra124.dtsi | 4 | ||||
-rw-r--r-- | arch/arm/dts/tegra20-colibri.dtsi | 1 | ||||
-rw-r--r-- | arch/arm/dts/tegra20.dtsi | 9 | ||||
-rw-r--r-- | arch/arm/dts/tegra30-beaver.dts | 1 | ||||
-rw-r--r-- | arch/arm/dts/tegra30.dtsi | 8 | ||||
-rw-r--r-- | arch/arm/mach-tegra/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/mach-tegra/include/mach/tegra-bbu.h | 28 | ||||
-rw-r--r-- | arch/arm/mach-tegra/tegra-bbu.c | 74 | ||||
-rw-r--r-- | common/bbu.c | 4 | ||||
-rw-r--r-- | drivers/mci/tegra-sdmmc.c | 3 | ||||
-rw-r--r-- | drivers/of/base.c | 8 | ||||
-rw-r--r-- | include/bbu.h | 2 |
15 files changed, 146 insertions, 6 deletions
diff --git a/arch/arm/boards/nvidia-beaver/board.c b/arch/arm/boards/nvidia-beaver/board.c index d270301ab3..bab0238779 100644 --- a/arch/arm/boards/nvidia-beaver/board.c +++ b/arch/arm/boards/nvidia-beaver/board.c @@ -19,6 +19,7 @@ #include <gpio.h> #include <i2c/i2c.h> #include <init.h> +#include <mach/tegra-bbu.h> static int nvidia_beaver_fs_init(void) { @@ -53,6 +54,9 @@ static int nvidia_beaver_device_init(void) barebox_set_hostname("beaver"); + tegra_bbu_register_emmc_handler("eMMC", "/dev/mmc3.boot0", + BBU_HANDLER_FLAG_DEFAULT); + return 0; } device_initcall(nvidia_beaver_device_init); diff --git a/arch/arm/boards/nvidia-jetson-tk1/board.c b/arch/arm/boards/nvidia-jetson-tk1/board.c index 564e6a0aa1..939d18419a 100644 --- a/arch/arm/boards/nvidia-jetson-tk1/board.c +++ b/arch/arm/boards/nvidia-jetson-tk1/board.c @@ -19,6 +19,7 @@ #include <gpio.h> #include <i2c/i2c.h> #include <init.h> +#include <mach/tegra-bbu.h> #define AS3722_SD_VOLTAGE(n) (0x00 + (n)) #define AS3722_GPIO_CONTROL(n) (0x08 + (n)) @@ -56,6 +57,9 @@ static int nvidia_jetson_tk1_device_init(void) barebox_set_hostname("jetson-tk1"); + tegra_bbu_register_emmc_handler("eMMC", "/dev/mmc3.boot0", + BBU_HANDLER_FLAG_DEFAULT); + return 0; } device_initcall(nvidia_jetson_tk1_device_init); diff --git a/arch/arm/configs/tegra_v7_defconfig b/arch/arm/configs/tegra_v7_defconfig index 47e594ba68..c7b59ac1d0 100644 --- a/arch/arm/configs/tegra_v7_defconfig +++ b/arch/arm/configs/tegra_v7_defconfig @@ -36,6 +36,7 @@ CONFIG_CMD_TIMEOUT=y CONFIG_CMD_CLK=y CONFIG_CMD_DETECT=y CONFIG_CMD_GPIO=y +CONFIG_CMD_BAREBOX_UPDATE=y CONFIG_CMD_OFTREE=y CONFIG_NET=y CONFIG_OF_BAREBOX_DRIVERS=y diff --git a/arch/arm/dts/tegra124.dtsi b/arch/arm/dts/tegra124.dtsi index c795811c57..cd515a2e2a 100644 --- a/arch/arm/dts/tegra124.dtsi +++ b/arch/arm/dts/tegra124.dtsi @@ -4,5 +4,9 @@ serial1 = "/serial@0,70006040/"; serial2 = "/serial@0,70006200/"; serial3 = "/serial@0,70006300/"; + mmc0 = "/sdhci@0,700b0000/"; + mmc1 = "/sdhci@0,700b0200/"; + mmc2 = "/sdhci@0,700b0400/"; + mmc3 = "/sdhci@0,700b0600/"; }; }; diff --git a/arch/arm/dts/tegra20-colibri.dtsi b/arch/arm/dts/tegra20-colibri.dtsi index 96da8a43f7..e931c07406 100644 --- a/arch/arm/dts/tegra20-colibri.dtsi +++ b/arch/arm/dts/tegra20-colibri.dtsi @@ -1 +1,2 @@ #include <arm/tegra20-colibri-512.dtsi> +#include "tegra20.dtsi" diff --git a/arch/arm/dts/tegra20.dtsi b/arch/arm/dts/tegra20.dtsi index ce7d32266b..995eee4a6e 100644 --- a/arch/arm/dts/tegra20.dtsi +++ b/arch/arm/dts/tegra20.dtsi @@ -1 +1,8 @@ -#include <arm/tegra20.dtsi> +/ { + aliases { + mmc0 = "/sdhci@c8000000/"; + mmc1 = "/sdhci@c8000200/"; + mmc2 = "/sdhci@c8000400/"; + mmc3 = "/sdhci@c8000600/"; + }; +}; diff --git a/arch/arm/dts/tegra30-beaver.dts b/arch/arm/dts/tegra30-beaver.dts index 5879353fc6..91e1354448 100644 --- a/arch/arm/dts/tegra30-beaver.dts +++ b/arch/arm/dts/tegra30-beaver.dts @@ -1,6 +1,7 @@ /dts-v1/; #include <arm/tegra30.dtsi> +#include "tegra30.dtsi" / { model = "NVIDIA Tegra30 Beaver evaluation board"; diff --git a/arch/arm/dts/tegra30.dtsi b/arch/arm/dts/tegra30.dtsi new file mode 100644 index 0000000000..90bd08ba63 --- /dev/null +++ b/arch/arm/dts/tegra30.dtsi @@ -0,0 +1,8 @@ +/ { + aliases { + mmc0 = "/sdhci@78000000/"; + mmc1 = "/sdhci@78000200/"; + mmc2 = "/sdhci@78000400/"; + mmc3 = "/sdhci@78000600/"; + }; +}; diff --git a/arch/arm/mach-tegra/Makefile b/arch/arm/mach-tegra/Makefile index e68156a772..7c4c1fd137 100644 --- a/arch/arm/mach-tegra/Makefile +++ b/arch/arm/mach-tegra/Makefile @@ -13,3 +13,4 @@ lwl-y += tegra_maincomplex_init.o obj-y += tegra20.o obj-y += tegra20-pmc.o obj-y += tegra20-timer.o +obj-$(CONFIG_BAREBOX_UPDATE) += tegra-bbu.o diff --git a/arch/arm/mach-tegra/include/mach/tegra-bbu.h b/arch/arm/mach-tegra/include/mach/tegra-bbu.h new file mode 100644 index 0000000000..32e2861ac6 --- /dev/null +++ b/arch/arm/mach-tegra/include/mach/tegra-bbu.h @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2015 Lucas Stach <l.stach@pengutronix.de> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include <bbu.h> + +#ifdef CONFIG_BAREBOX_UPDATE +int tegra_bbu_register_emmc_handler(const char *name, char *devicefile, + unsigned long flags); +#else +static int tegra_bbu_register_emmc_handler(const char *name, char *devicefile, + unsigned long flags) +{ + return 0; +}; +#endif diff --git a/arch/arm/mach-tegra/tegra-bbu.c b/arch/arm/mach-tegra/tegra-bbu.c new file mode 100644 index 0000000000..089e6c736a --- /dev/null +++ b/arch/arm/mach-tegra/tegra-bbu.c @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2015 Lucas Stach <l.stach@pengutronix.de> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include <common.h> +#include <fcntl.h> +#include <fs.h> +#include <mach/tegra-bbu.h> +#include <malloc.h> + +static int tegra_bbu_emmc_handler(struct bbu_handler *handler, + struct bbu_data *data) +{ + + int fd, ret; + + if (file_detect_type(data->image + 0x4000, data->len) != + filetype_arm_barebox && + !bbu_force(data, "Not an ARM barebox image")) + return -EINVAL; + + ret = bbu_confirm(data); + if (ret) + return ret; + + fd = open(data->devicefile, O_WRONLY); + if (fd < 0) + return fd; + + ret = write(fd, data->image, data->len); + if (ret < 0) { + pr_err("writing update to %s failed with %s\n", + data->devicefile, strerror(-ret)); + goto err_close; + } + + ret = 0; + +err_close: + close(fd); + + return ret; +} + +int tegra_bbu_register_emmc_handler(const char *name, char *devicefile, + unsigned long flags) +{ + struct bbu_handler *handler; + int ret = 0; + + handler = xzalloc(sizeof(*handler)); + handler->name = name; + handler->devicefile = devicefile; + handler->flags = flags; + handler->handler = tegra_bbu_emmc_handler; + + ret = bbu_register_handler(handler); + if (ret) + free(handler); + + return ret; +} diff --git a/common/bbu.c b/common/bbu.c index e31f645d9c..7fb154a230 100644 --- a/common/bbu.c +++ b/common/bbu.c @@ -65,8 +65,10 @@ int bbu_confirm(struct bbu_data *data) key = read_key(); - if (key == 'y') + if (key == 'y') { + printf("updating barebox...\n"); return 0; + } return -EINTR; } diff --git a/drivers/mci/tegra-sdmmc.c b/drivers/mci/tegra-sdmmc.c index 670c280cb8..14c230483f 100644 --- a/drivers/mci/tegra-sdmmc.c +++ b/drivers/mci/tegra-sdmmc.c @@ -411,7 +411,10 @@ static int tegra_sdmmc_detect(struct device_d *dev) static void tegra_sdmmc_parse_dt(struct tegra_sdmmc_host *host) { struct device_node *np = host->mci.hw_dev->device_node; + const char *alias = of_alias_get(np); + if (alias) + host->mci.devname = xstrdup(alias); host->gpio_cd = of_get_named_gpio(np, "cd-gpios", 0); host->gpio_pwr = of_get_named_gpio(np, "power-gpios", 0); mci_of_parse(&host->mci); diff --git a/drivers/of/base.c b/drivers/of/base.c index d45d3941b8..3e40a48ecf 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -227,11 +227,11 @@ EXPORT_SYMBOL_GPL(of_alias_get_id); const char *of_alias_get(struct device_node *np) { - struct property *pp; + struct alias_prop *app; - list_for_each_entry(pp, &of_aliases->properties, list) { - if (!of_node_cmp(np->full_name, pp->value)) - return pp->name; + list_for_each_entry(app, &aliases_lookup, link) { + if (np == app->np) + return app->alias; } return NULL; diff --git a/include/bbu.h b/include/bbu.h index adb52b0dec..4a3d35e7ce 100644 --- a/include/bbu.h +++ b/include/bbu.h @@ -2,6 +2,8 @@ #define __INCLUDE_BBU_H #include <asm-generic/errno.h> +#include <linux/list.h> +#include <linux/types.h> struct bbu_data { #define BBU_FLAG_FORCE (1 << 0) |