Merge branch 'for-next/tegra'
This commit is contained in:
commit
fa20ea45e0
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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/";
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
#include <arm/tegra20-colibri-512.dtsi>
|
||||
#include "tegra20.dtsi"
|
||||
|
|
|
@ -1 +1,8 @@
|
|||
#include <arm/tegra20.dtsi>
|
||||
/ {
|
||||
aliases {
|
||||
mmc0 = "/sdhci@c8000000/";
|
||||
mmc1 = "/sdhci@c8000200/";
|
||||
mmc2 = "/sdhci@c8000400/";
|
||||
mmc3 = "/sdhci@c8000600/";
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/dts-v1/;
|
||||
|
||||
#include <arm/tegra30.dtsi>
|
||||
#include "tegra30.dtsi"
|
||||
|
||||
/ {
|
||||
model = "NVIDIA Tegra30 Beaver evaluation board";
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
/ {
|
||||
aliases {
|
||||
mmc0 = "/sdhci@78000000/";
|
||||
mmc1 = "/sdhci@78000200/";
|
||||
mmc2 = "/sdhci@78000400/";
|
||||
mmc3 = "/sdhci@78000600/";
|
||||
};
|
||||
};
|
|
@ -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
|
||||
|
|
|
@ -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
|
|
@ -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;
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue