9
0
Fork 0

Merge branch 'for-next/misc'

This commit is contained in:
Sascha Hauer 2016-03-11 10:49:50 +01:00
commit 034d4ddcb6
21 changed files with 256 additions and 43 deletions

View File

@ -110,8 +110,10 @@ The Fastboot gadget supports the following commands:
- fastboot boot
- fastboot reboot
**NOTE** ``fastboot erase`` is not yet implemented. This means flashing MTD partitions
does not yet work.
``fastboot flash`` additionally supports image types UBI and Barebox. For UBI
Images and a MTD device as target, ubiformat is called. For a Barebox image
with an available barebox update handler for the fastboot exported device, the
barebox_update is called.
The barebox Fastboot gadget supports the following non standard extensions:
@ -126,6 +128,53 @@ The barebox Fastboot gadget supports the following non standard extensions:
command returns successfully when the barebox command was successful and it fails when
the barebox command fails.
**Example booting kernel/devicetree/initrd with fastboot**
In Barebox start the fastboot gadget:
.. code-block:: sh
usbgadget -A /kernel(kernel)c,/initrd(initrd)c,/devicetree(devicetree)c
On the host you can use this script to start a kernel with kernel, devicetree
and initrd:
.. code-block:: sh
#!/bin/bash
set -e
set -v
if [ "$#" -lt 3 ]
then
echo "USAGE: $0 <KERNEL> <DT> <INITRD> [<ARGS>]"
exit 0
fi
kernel=$1
dt=$2
initrd=$3
shift 3
fastboot -i 7531 flash kernel $kernel
fastboot -i 7531 flash devicetree $dt
fastboot -i 7531 flash initrd $initrd
fastboot -i 7531 oem exec 'global linux.bootargs.fa'$ct'=rdinit=/sbin/init'
if [ $# -gt 0 ]
then
ct=1
for i in $*
do
fastboot -i 7531 oem exec 'global linux.bootargs.fa'$ct'='"\"$i\""
ct=$(($ct + 1))
done
fi
timeout -k 5 3 fastboot -i 7531 oem exec -- bootm -o /devicetree -r /initrd /kernel
USB Composite Multifunction Gadget
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -27,10 +27,16 @@
#include <malloc.h>
#include <generated/mach-types.h>
#include <mach/ep93xx-regs.h>
#include <net/ep93xx_eth.h>
#include "edb93xx.h"
#define DEVCFG_U1EN (1 << 18)
static struct ep93xx_eth_platform_data ep93xx_eth_info = {
.xcv_type = PHY_INTERFACE_MODE_MII,
.phy_addr = 1,
};
static int ep93xx_mem_init(void)
{
arm_add_mem_device("ram0", CONFIG_EP93XX_SDRAM_BANK0_BASE,
@ -70,7 +76,7 @@ static int ep93xx_devices_init(void)
* CS line 6, data width is 16 bit
*/
add_generic_device("ep93xx_eth", DEVICE_ID_DYNAMIC, NULL, 0, 0, IORESOURCE_MEM,
NULL);
&ep93xx_eth_info);
armlinux_set_architecture(MACH_TYPE);

View File

@ -84,6 +84,7 @@ CONFIG_CMD_BAREBOX_UPDATE=y
CONFIG_CMD_OF_NODE=y
CONFIG_CMD_OF_PROPERTY=y
CONFIG_CMD_OF_DISPLAY_TIMINGS=y
CONFIG_CMD_OF_FIXUP_STATUS=y
CONFIG_CMD_OFTREE=y
CONFIG_CMD_TIME=y
CONFIG_NET=y

View File

@ -698,8 +698,8 @@ config IMX_OCOTP_WRITE
MAC to 12:34:56:78:9A:BC (2 words with address 0x22 (OCOTP_MAC0) and
address 0x23 (OCOTP_MAC1)). To calculate the file offset multiply
the value of the address by 4.
mw -l -d /dev/imx-ocotp 0x8C 0x00001234
mw -l -d /dev/imx-ocotp 0x88 0x56789ABC
mw -l -d /dev/imx-ocotp 0x8C 0x00001234
mw -l -d /dev/imx-ocotp 0x88 0x56789ABC
config HAB
bool

View File

@ -132,6 +132,9 @@ static int imx_bbu_check_prereq(struct bbu_data *data)
if (ret)
return ret;
if (!strncmp(data->devicefile, "/dev/", 5))
device_detect_by_name(data->devicefile + 5);
return 0;
}

View File

@ -2114,6 +2114,22 @@ config CMD_OF_DISPLAY_TIMINGS
-s path select display-timings and register oftree fixup
-f dtb work on dtb. Has no effect on -s option
config CMD_OF_FIXUP_STATUS
tristate
select OFTREE
prompt "of_fixup_status"
help
Register a fixup to enable or disable node
Usage: of_fixup_node [-d] path
Options:
-d disable node
path Node path or alias
Register a fixup to enable or disable a device tree node.
Nodes are enabled on default. Disabled with -d.
config CMD_OFTREE
tristate
select OFTREE

View File

@ -78,6 +78,7 @@ obj-$(CONFIG_CMD_OF_PROPERTY) += of_property.o
obj-$(CONFIG_CMD_OF_NODE) += of_node.o
obj-$(CONFIG_CMD_OF_DUMP) += of_dump.o
obj-$(CONFIG_CMD_OF_DISPLAY_TIMINGS) += of_display_timings.o
obj-$(CONFIG_CMD_OF_FIXUP_STATUS) += of_fixup_status.o
obj-$(CONFIG_CMD_MAGICVAR) += magicvar.o
obj-$(CONFIG_CMD_IOMEM) += iomemport.o
obj-$(CONFIG_CMD_LINUX_EXEC) += linux_exec.o

View File

@ -24,7 +24,7 @@ static void magicvar_print_one(struct magicvar_dyn *md, int verbose)
}
}
struct magicvar_dyn *magicvar_find(const char *name)
static struct magicvar_dyn *magicvar_find(const char *name)
{
struct magicvar_dyn *md;

View File

@ -0,0 +1,74 @@
/*
* of_fixup_status.c - Register a fixup to enable or disable nodes in the
* device tree
*
* Copyright (c) 2014-2016 PHYTEC Messtechnik GmbH
* Author:
* Teresa Remmet
* Wadim Egorov
*
* 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 version 2
* as published by the Free Software Foundation.
*
* 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.
*/
#include <common.h>
#include <of.h>
#include <command.h>
#include <malloc.h>
#include <complete.h>
#include <asm/byteorder.h>
#include <linux/err.h>
#include <getopt.h>
#include <string.h>
static int do_of_fixup_status(int argc, char *argv[])
{
int opt;
bool status = 1;
char *node = NULL;
while ((opt = getopt(argc, argv, "d")) > 0) {
switch (opt) {
case 'd':
status = 0;
break;
default:
return COMMAND_ERROR_USAGE;
}
}
if (optind == argc)
return COMMAND_ERROR_USAGE;
node = xstrdup(argv[optind]);
of_register_set_status_fixup(node, status);
return 0;
}
BAREBOX_CMD_HELP_START(of_fixup_status)
BAREBOX_CMD_HELP_TEXT("Options:")
BAREBOX_CMD_HELP_OPT("-d", "disable node")
BAREBOX_CMD_HELP_OPT("path", "Node path\n")
BAREBOX_CMD_HELP_TEXT("Register a fixup to enable or disable a device tree node.")
BAREBOX_CMD_HELP_TEXT("Nodes are enabled on default. Disabled with -d.")
BAREBOX_CMD_HELP_END
BAREBOX_CMD_START(of_fixup_status)
.cmd = do_of_fixup_status,
BAREBOX_CMD_DESC("register a fixup to enable or disable node")
BAREBOX_CMD_OPTS("[-d] path")
BAREBOX_CMD_GROUP(CMD_GRP_MISC)
BAREBOX_CMD_COMPLETE(devicetree_file_complete)
BAREBOX_CMD_HELP(cmd_of_fixup_status_help)
BAREBOX_CMD_END

View File

@ -139,6 +139,42 @@ static int of_register_bootargs_fixup(void)
}
late_initcall(of_register_bootargs_fixup);
struct of_fixup_status_data {
const char *path;
bool status;
};
static int of_fixup_status(struct device_node *root, void *context)
{
const struct of_fixup_status_data *data = context;
struct device_node *node;
node = of_find_node_by_path_or_alias(root, data->path);
if (!node)
return -ENODEV;
if (data->status)
return of_device_enable(node);
else
return of_device_disable(node);
}
/**
* of_register_set_status_fixup - register fix up to set status of nodes
* Register a fixup to enable or disable a node in the devicet tree by
* passing the path or alias.
*/
int of_register_set_status_fixup(const char *path, bool status)
{
struct of_fixup_status_data *data;
data = xzalloc(sizeof(*data));
data->path = path;
data->status = status;
return of_register_fixup(of_fixup_status, (void *)data);
}
struct of_fixup {
int (*fixup)(struct device_node *, void *);
void *context;

View File

@ -999,6 +999,7 @@ static int of_state_fixup(struct device_node *root, void *ctx)
return 0;
out:
dev_err(&state->dev, "error fixing up device tree with boot state\n");
of_delete_node(new_node);
return ret;
}

View File

@ -356,6 +356,7 @@ static int at25_probe(struct device_d *dev)
dev_dbg(dev, "%s probed\n", at25->cdev.name);
devfs_create(&at25->cdev);
of_parse_partitions(&at25->cdev, dev->device_node);
return 0;
fail:

View File

@ -87,17 +87,17 @@ config GPIO_PCA953X
SMBus I/O expanders, made mostly by NXP or TI. Compatible
models include:
4 bits: pca9536, pca9537
4 bits: pca9536, pca9537
8 bits: max7310, max7315, pca6107, pca9534, pca9538, pca9554,
pca9556, pca9557, pca9574, tca6408, xra1202
8 bits: max7310, max7315, pca6107, pca9534, pca9538, pca9554,
pca9556, pca9557, pca9574, tca6408, xra1202
16 bits: max7312, max7313, pca9535, pca9539, pca9555, pca9575,
tca6416
16 bits: max7312, max7313, pca9535, pca9539, pca9555, pca9575,
tca6416
24 bits: tca6424
24 bits: tca6424
40 bits: pca9505, pca9698
40 bits: pca9505, pca9698
config GPIO_PL061
bool "PrimeCell PL061 GPIO support"

View File

@ -38,6 +38,7 @@
#include <linux/types.h>
#include <mach/ep93xx-regs.h>
#include <linux/phy.h>
#include <net/ep93xx_eth.h>
#include "ep93xx.h"
#define EP93XX_MAX_PKT_SIZE 1536
@ -203,8 +204,8 @@ static int ep93xx_eth_open(struct eth_device *edev)
pr_debug("+ep93xx_eth_open\n");
ret = phy_device_connect(edev, &priv->miibus, 0, NULL,
0, PHY_INTERFACE_MODE_NA);
ret = phy_device_connect(edev, &priv->miibus, priv->phy_addr, NULL,
0, priv->interface);
if (ret)
return ret;
@ -482,6 +483,7 @@ static int ep93xx_eth_set_ethaddr(struct eth_device *edev,
static int ep93xx_eth_probe(struct device_d *dev)
{
struct ep93xx_eth_platform_data *pdata = (struct ep93xx_eth_platform_data *)dev->platform_data;
struct eth_device *edev;
struct ep93xx_eth_priv *priv;
int ret = -1;
@ -504,6 +506,14 @@ static int ep93xx_eth_probe(struct device_d *dev)
edev->set_ethaddr = ep93xx_eth_set_ethaddr;
edev->parent = dev;
if (pdata) {
priv->interface = pdata->xcv_type;
priv->phy_addr = pdata->phy_addr;
} else {
priv->interface = PHY_INTERFACE_MODE_NA;
priv->phy_addr = 0;
}
priv->miibus.read = ep93xx_phy_read;
priv->miibus.write = ep93xx_phy_write;
priv->miibus.parent = dev;
@ -589,14 +599,12 @@ static int ep93xx_phy_read(struct mii_bus *bus, int phy_addr, int phy_reg)
pr_debug("+ep93xx_phy_read\n");
/*
* Save the current SelfCTL register value. Set MAC to suppress
* Save the current SelfCTL register value. Set MAC to send
* preamble bits. Wait for any previous MII command to complete
* before issuing the new command.
*/
self_ctl = readl(&regs->selfctl);
#if defined(CONFIG_MII_SUPPRESS_PREAMBLE) /* TODO */
writel(self_ctl & ~(1 << 8), &regs->selfctl);
#endif /* defined(CONFIG_MII_SUPPRESS_PREAMBLE) */
while (readl(&regs->miists) & MIISTS_BUSY)
; /* noop */
@ -632,14 +640,12 @@ static int ep93xx_phy_write(struct mii_bus *bus, int phy_addr,
pr_debug("+ep93xx_phy_write\n");
/*
* Save the current SelfCTL register value. Set MAC to suppress
* Save the current SelfCTL register value. Set MAC to send
* preamble bits. Wait for any previous MII command to complete
* before issuing the new command.
*/
self_ctl = readl(&regs->selfctl);
#if defined(CONFIG_MII_SUPPRESS_PREAMBLE) /* TODO */
writel(self_ctl & ~(1 << 8), &regs->selfctl);
#endif /* defined(CONFIG_MII_SUPPRESS_PREAMBLE) */
while (readl(&regs->miists) & MIISTS_BUSY)
; /* noop */

View File

@ -137,6 +137,8 @@ struct ep93xx_eth_priv {
struct tx_descriptor_queue tx_dq;
struct tx_status_queue tx_sq;
int phy_addr;
phy_interface_t interface;
struct mii_bus miibus;
};

View File

@ -1005,7 +1005,7 @@ static struct int_queue *ehci_create_int_queue(struct usb_device *dev,
struct usb_host *host = dev->host;
struct ehci_priv *ehci = to_ehci(host);
struct int_queue *result = NULL;
uint32_t i, toggle;
uint32_t i;
struct QH *list = ehci->periodic_queue;
/*
@ -1057,8 +1057,6 @@ static struct int_queue *ehci_create_int_queue(struct usb_device *dev,
memset(result->first, 0, sizeof(struct QH) * queuesize);
memset(result->tds, 0, sizeof(struct qTD) * queuesize);
toggle = usb_gettoggle(dev, usb_pipeendpoint(pipe), usb_pipeout(pipe));
for (i = 0; i < queuesize; i++) {
struct QH *qh = result->first + i;
struct qTD *td = result->tds + i;
@ -1073,7 +1071,6 @@ static struct int_queue *ehci_create_int_queue(struct usb_device *dev,
qh->qh_endpt1 =
cpu_to_hc32((0 << 28) | /* No NAK reload (ehci 4.9) */
(usb_maxpacket(dev, pipe) << 16) | /* MPS */
(1 << 14) |
QH_ENDPT1_EPS(ehci_encode_speed(dev->speed)) |
(usb_pipeendpoint(pipe) << 8) | /* Endpoint Number */
(usb_pipedevice(pipe) << 0));
@ -1092,7 +1089,6 @@ static struct int_queue *ehci_create_int_queue(struct usb_device *dev,
"communication direction is '%s'\n",
usb_pipein(pipe) ? "in" : "out");
td->qt_token = cpu_to_hc32(
QT_TOKEN_DT(toggle) |
(elementsize << 16) |
((usb_pipein(pipe) ? 1 : 0) << 8) | /* IN/OUT token */
0x80); /* active */
@ -1108,7 +1104,6 @@ static struct int_queue *ehci_create_int_queue(struct usb_device *dev,
cpu_to_hc32((td->qt_buffer[0] + 0x4000) & ~0xfff);
*buf = buffer + i * elementsize;
toggle ^= 1;
}
if (ehci->periodic_schedules > 0) {
@ -1144,8 +1139,7 @@ static void *ehci_poll_int_queue(struct usb_device *dev,
{
struct QH *cur = queue->current;
struct qTD *cur_td;
uint32_t token, toggle;
unsigned long pipe = queue->pipe;
uint32_t token;
/* depleted queue */
if (cur == NULL) {
@ -1162,9 +1156,6 @@ static void *ehci_poll_int_queue(struct usb_device *dev,
return NULL;
}
toggle = QT_TOKEN_GET_DT(token);
usb_settoggle(dev, usb_pipeendpoint(pipe), usb_pipeout(pipe), toggle);
if (!(cur->qh_link & QH_LINK_TERMINATE))
queue->current++;
else
@ -1183,7 +1174,6 @@ static int ehci_destroy_int_queue(struct usb_device *dev,
struct usb_host *host = dev->host;
struct ehci_priv *ehci = to_ehci(host);
struct QH *cur = ehci->periodic_queue;
uint64_t start;
if (disable_periodic(ehci) < 0) {
dev_err(&dev->dev,
@ -1192,7 +1182,6 @@ static int ehci_destroy_int_queue(struct usb_device *dev,
}
ehci->periodic_schedules--;
start = get_time_ns();
while (!(cur->qh_link & cpu_to_hc32(QH_LINK_TERMINATE))) {
dev_dbg(&dev->dev,
"considering %p, with qh_link %x\n",
@ -1205,12 +1194,6 @@ static int ehci_destroy_int_queue(struct usb_device *dev,
break;
}
cur = NEXT_QH(cur);
if (is_timeout_non_interruptible(start, 500 * MSECOND)) {
dev_err(&dev->dev,
"Timeout destroying interrupt endpoint queue\n");
result = -ETIMEDOUT;
goto out;
}
}
if (ehci->periodic_schedules > 0) {

View File

@ -127,7 +127,8 @@ int ext4fs_read_inode(struct ext2_data *data, int ino, struct ext2_inode *inode)
return 0;
}
int ext4fs_get_indir_block(struct ext2fs_node *node, struct ext4fs_indir_block *indir, int blkno)
static int ext4fs_get_indir_block(struct ext2fs_node *node,
struct ext4fs_indir_block *indir, int blkno)
{
struct ext_filesystem *fs = node->data->fs;
int blksz;

View File

@ -1,7 +1,7 @@
/*
* ramfs.c - a malloc based filesystem
* fat.c - FAT filesystem barebox driver
*
* Copyright (c) 2007 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
* Copyright (c) 2011 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
*
* See file CREDITS for list of people who contributed to this
* project.

26
include/net/ep93xx_eth.h Normal file
View File

@ -0,0 +1,26 @@
/*
* (C) Copyright 2016 Alexander Kurz <akurz@blala.de>
*
* 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.
*
*/
#ifndef __NET_EP93XX_ETH_H
#define __NET_EP93XX_ETH_H
#include <linux/phy.h>
struct ep93xx_eth_platform_data {
phy_interface_t xcv_type;
int phy_addr;
};
#endif /* __NET_EP93XX_ETH_H */

View File

@ -249,6 +249,7 @@ int of_find_path(struct device_node *node, const char *propname, char **outpath,
int of_find_path_by_node(struct device_node *node, char **outpath, unsigned flags);
int of_register_fixup(int (*fixup)(struct device_node *, void *), void *context);
int of_unregister_fixup(int (*fixup)(struct device_node *, void *), void *context);
int of_register_set_status_fixup(const char *node, bool status);
struct device_node *of_find_node_by_alias(struct device_node *root,
const char *alias);
struct device_node *of_find_node_by_path_or_alias(struct device_node *root,

View File

@ -18,6 +18,7 @@
*/
#include <common.h>
#include <fs.h>
#include <globalvar.h>
#include <libbb.h>
#include <shell.h>
@ -57,6 +58,11 @@ int process_escape_sequence(const char *source, char *dest, int destlen)
case 'h':
i += snprintf(dest + i, destlen - i, "%s", barebox_get_model());
break;
case 'u':
if (IS_ENABLED(CONFIG_GLOBALVAR))
i += snprintf(dest + i, destlen - i, "%s",
dev_get_param(&global_device, "user"));
break;
case 'w':
i += snprintf(dest + i, destlen - i, "%s", getcwd());
break;