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 /arch | |
parent | 4680b375b9dd32e6558ae2ee8a15b27819c70e73 (diff) | |
parent | f5eaa68abf2af676bd34257af436ecba85bbf78a (diff) | |
download | barebox-fa20ea45e0955f07229f0fbf646ac5e5e04f5a33.tar.gz barebox-fa20ea45e0955f07229f0fbf646ac5e5e04f5a33.tar.xz |
Merge branch 'for-next/tegra'
Diffstat (limited to 'arch')
-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 |
11 files changed, 134 insertions, 1 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; +} |