Merge branch 'for-next/misc'
This commit is contained in:
commit
3975737a7d
|
@ -62,16 +62,18 @@ static int do_state(int argc, char *argv[])
|
|||
return ret;
|
||||
}
|
||||
|
||||
static const __maybe_unused char cmd_state_help[] =
|
||||
"Usage: state [OPTIONS] [STATENAME]\n"
|
||||
"\n"
|
||||
"options:\n"
|
||||
"-s save state\n"
|
||||
"-l load state\n";
|
||||
BAREBOX_CMD_HELP_START(state)
|
||||
BAREBOX_CMD_HELP_TEXT("Usage: state [OPTIONS] [STATENAME]")
|
||||
BAREBOX_CMD_HELP_TEXT("")
|
||||
BAREBOX_CMD_HELP_TEXT("options:")
|
||||
BAREBOX_CMD_HELP_OPT ("-s", "save state")
|
||||
BAREBOX_CMD_HELP_OPT ("-l", "load state")
|
||||
BAREBOX_CMD_HELP_END
|
||||
|
||||
BAREBOX_CMD_START(state)
|
||||
.cmd = do_state,
|
||||
BAREBOX_CMD_DESC("handle state information")
|
||||
BAREBOX_CMD_DESC("load and save state information")
|
||||
BAREBOX_CMD_OPTS("[-sl] [STATENAME]")
|
||||
BAREBOX_CMD_GROUP(CMD_GRP_MISC)
|
||||
BAREBOX_CMD_HELP(cmd_state_help)
|
||||
BAREBOX_CMD_END
|
||||
|
|
|
@ -16,40 +16,35 @@
|
|||
* GNU General Public License for more details.
|
||||
*
|
||||
*/
|
||||
#include <common.h>
|
||||
|
||||
#include <command.h>
|
||||
#include <linux/stat.h>
|
||||
#include <errno.h>
|
||||
#include <getopt.h>
|
||||
#include <clock.h>
|
||||
#include <environment.h>
|
||||
#include <console_countdown.h>
|
||||
|
||||
#define TIMEOUT_RETURN (1 << 0)
|
||||
#define TIMEOUT_CTRLC (1 << 1)
|
||||
#define TIMEOUT_ANYKEY (1 << 2)
|
||||
#define TIMEOUT_SILENT (1 << 3)
|
||||
#include <linux/kernel.h>
|
||||
|
||||
static int do_timeout(int argc, char *argv[])
|
||||
{
|
||||
int timeout = 3, ret = 1;
|
||||
int flags = 0, opt, countdown;
|
||||
int key = 0;
|
||||
uint64_t start, second;
|
||||
int timeout, ret, opt;
|
||||
unsigned flags = 0;
|
||||
char str[2] = { };
|
||||
const char *varname = NULL;
|
||||
|
||||
while((opt = getopt(argc, argv, "t:crsav:")) > 0) {
|
||||
while((opt = getopt(argc, argv, "crsav:")) > 0) {
|
||||
switch(opt) {
|
||||
case 'r':
|
||||
flags |= TIMEOUT_RETURN;
|
||||
flags |= CONSOLE_COUNTDOWN_RETURN;
|
||||
break;
|
||||
case 'c':
|
||||
flags |= TIMEOUT_CTRLC;
|
||||
flags |= CONSOLE_COUNTDOWN_CTRLC;
|
||||
break;
|
||||
case 'a':
|
||||
flags |= TIMEOUT_ANYKEY;
|
||||
flags |= CONSOLE_COUNTDOWN_ANYKEY;
|
||||
break;
|
||||
case 's':
|
||||
flags |= TIMEOUT_SILENT;
|
||||
flags |= CONSOLE_COUNTDOWN_SILENT;
|
||||
break;
|
||||
case 'v':
|
||||
varname = optarg;
|
||||
|
@ -63,43 +58,12 @@ static int do_timeout(int argc, char *argv[])
|
|||
return COMMAND_ERROR_USAGE;
|
||||
|
||||
timeout = simple_strtoul(argv[optind], NULL, 0);
|
||||
ret = console_countdown(timeout, flags, str);
|
||||
|
||||
start = get_time_ns();
|
||||
second = start;
|
||||
|
||||
countdown = timeout;
|
||||
|
||||
if (!(flags & TIMEOUT_SILENT))
|
||||
printf("%2d", countdown--);
|
||||
|
||||
do {
|
||||
if (tstc()) {
|
||||
key = getc();
|
||||
if (flags & TIMEOUT_CTRLC && key == 3)
|
||||
goto out;
|
||||
if (flags & TIMEOUT_ANYKEY)
|
||||
goto out;
|
||||
if (flags & TIMEOUT_RETURN && key == '\n')
|
||||
goto out;
|
||||
key = 0;
|
||||
}
|
||||
if (!(flags & TIMEOUT_SILENT) && is_timeout(second, SECOND)) {
|
||||
printf("\b\b%2d", countdown--);
|
||||
second += SECOND;
|
||||
}
|
||||
} while (!is_timeout(start, timeout * SECOND));
|
||||
|
||||
ret = 0;
|
||||
out:
|
||||
if (varname && key) {
|
||||
char str[2] = { };
|
||||
str[0] = key;
|
||||
if (varname && str[0])
|
||||
setenv(varname, str);
|
||||
}
|
||||
if (!(flags & TIMEOUT_SILENT))
|
||||
printf("\n");
|
||||
|
||||
return ret;
|
||||
return ret ? 1 : 0;
|
||||
}
|
||||
|
||||
BAREBOX_CMD_HELP_START(timeout)
|
||||
|
@ -110,12 +74,13 @@ BAREBOX_CMD_HELP_OPT("-a", "interrupt on any key")
|
|||
BAREBOX_CMD_HELP_OPT("-c", "interrupt on Ctrl-C")
|
||||
BAREBOX_CMD_HELP_OPT("-r", "interrupt on RETURN")
|
||||
BAREBOX_CMD_HELP_OPT("-s", "silent mode")
|
||||
BAREBOX_CMD_HELP_OPT("-v <VARIABLE>", "export pressed key to environment")
|
||||
BAREBOX_CMD_HELP_END
|
||||
|
||||
BAREBOX_CMD_START(timeout)
|
||||
.cmd = do_timeout,
|
||||
BAREBOX_CMD_DESC("wait for a specified timeout")
|
||||
BAREBOX_CMD_OPTS("[-acrs] SECONDS")
|
||||
BAREBOX_CMD_OPTS("[-acrsv] SECONDS")
|
||||
BAREBOX_CMD_GROUP(CMD_GRP_CONSOLE)
|
||||
BAREBOX_CMD_HELP(cmd_timeout_help)
|
||||
BAREBOX_CMD_END
|
||||
|
|
|
@ -20,6 +20,7 @@ obj-$(CONFIG_CMD_MEMTEST) += memtest.o
|
|||
obj-$(CONFIG_COMMAND_SUPPORT) += command.o
|
||||
obj-$(CONFIG_CONSOLE_FULL) += console.o
|
||||
obj-$(CONFIG_CONSOLE_SIMPLE) += console_simple.o
|
||||
obj-y += console_countdown.o
|
||||
obj-$(CONFIG_DDR_SPD) += ddr_spd.o
|
||||
obj-$(CONFIG_ENV_HANDLING) += environment.o
|
||||
obj-$(CONFIG_ENVIRONMENT_VARIABLES) += env.o
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
* console_countdown - contdown on the console - interruptible by a keypress
|
||||
*
|
||||
* Copyright (c) 2007 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
|
||||
*
|
||||
* 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 <clock.h>
|
||||
#include <command.h>
|
||||
#include <errno.h>
|
||||
#include <console_countdown.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int console_countdown(int timeout_s, unsigned flags, char *out_key)
|
||||
{
|
||||
uint64_t start, second;
|
||||
int countdown, ret = -EINTR;
|
||||
int key = 0;
|
||||
|
||||
start = get_time_ns();
|
||||
second = start;
|
||||
|
||||
countdown = timeout_s;
|
||||
|
||||
if (!(flags & CONSOLE_COUNTDOWN_SILENT))
|
||||
printf("%2d", countdown--);
|
||||
|
||||
do {
|
||||
if (tstc()) {
|
||||
key = getc();
|
||||
if (flags & CONSOLE_COUNTDOWN_ANYKEY)
|
||||
goto out;
|
||||
if (flags & CONSOLE_COUNTDOWN_RETURN && key == '\n')
|
||||
goto out;
|
||||
if (flags & CONSOLE_COUNTDOWN_CTRLC && key == 3)
|
||||
goto out;
|
||||
key = 0;
|
||||
}
|
||||
if (!(flags & CONSOLE_COUNTDOWN_SILENT) &&
|
||||
is_timeout(second, SECOND)) {
|
||||
printf("\b\b%2d", countdown--);
|
||||
second += SECOND;
|
||||
}
|
||||
} while (!is_timeout(start, timeout_s * SECOND));
|
||||
|
||||
ret = 0;
|
||||
|
||||
out:
|
||||
if (!(flags & CONSOLE_COUNTDOWN_SILENT))
|
||||
printf("\n");
|
||||
if (key && out_key)
|
||||
*out_key = key;
|
||||
|
||||
return ret;
|
||||
}
|
12
common/env.c
12
common/env.c
|
@ -218,16 +218,18 @@ int setenv(const char *_name, const char *value)
|
|||
|
||||
*par++ = 0;
|
||||
dev = get_device_by_name(name);
|
||||
if (dev)
|
||||
if (dev) {
|
||||
ret = dev_set_param(dev, par, value);
|
||||
else
|
||||
if (ret)
|
||||
eprintf("%s: set parameter %s: %s\n",
|
||||
dev_name(dev), par, strerror(-ret));
|
||||
} else {
|
||||
ret = -ENODEV;
|
||||
eprintf("set parameter: no such device %s\n", name);
|
||||
}
|
||||
|
||||
errno = -ret;
|
||||
|
||||
if (ret < 0)
|
||||
perror("set parameter");
|
||||
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ int device_match(struct device_d *dev, struct driver_d *drv)
|
|||
return 0;
|
||||
|
||||
if (drv->id_table) {
|
||||
struct platform_device_id *id = drv->id_table;
|
||||
const struct platform_device_id *id = drv->id_table;
|
||||
|
||||
while (id->name) {
|
||||
if (!strcmp(id->name, dev->name)) {
|
||||
|
@ -74,7 +74,7 @@ int device_match(struct device_d *dev, struct driver_d *drv)
|
|||
|
||||
int device_match_of_modalias(struct device_d *dev, struct driver_d *drv)
|
||||
{
|
||||
struct platform_device_id *id = drv->id_table;
|
||||
const struct platform_device_id *id = drv->id_table;
|
||||
const char *of_modalias = NULL, *p;
|
||||
int cplen;
|
||||
const char *compat;
|
||||
|
|
|
@ -13,5 +13,5 @@ config FIRMWARE_ALTERA_SERIAL
|
|||
config FIRMWARE_ALTERA_SOCFPGA
|
||||
bool "Altera SoCFPGA fpga loader"
|
||||
depends on ARCH_SOCFPGA
|
||||
|
||||
select FIRMWARE
|
||||
endmenu
|
||||
|
|
|
@ -324,13 +324,27 @@ static int fpgamgr_program_write_buf(struct firmware_handler *fh, const void *bu
|
|||
const uint32_t *buf32 = buf;
|
||||
|
||||
/* write to FPGA Manager AXI data */
|
||||
while (size) {
|
||||
while (size >= sizeof(uint32_t)) {
|
||||
writel(*buf32, mgr->regs_data);
|
||||
readl(mgr->regs + FPGAMGRREGS_MON_GPIO_EXT_PORTA_ADDRESS);
|
||||
buf32++;
|
||||
size -= sizeof(uint32_t);
|
||||
}
|
||||
|
||||
if (size) {
|
||||
const uint8_t *buf8 = (const uint8_t *)buf32;
|
||||
uint32_t word = 0;
|
||||
|
||||
while (size--) {
|
||||
word |= *buf8;
|
||||
word <<= 8;
|
||||
buf8++;
|
||||
}
|
||||
|
||||
writel(word, mgr->regs_data);
|
||||
readl(mgr->regs + FPGAMGRREGS_MON_GPIO_EXT_PORTA_ADDRESS);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -540,8 +540,7 @@ mv64xxx_of_config(struct mv64xxx_i2c_data *drv_data,
|
|||
}
|
||||
tclk = clk_get_rate(drv_data->clk);
|
||||
|
||||
rc = of_property_read_u32(np, "clock-frequency", &bus_freq);
|
||||
if (rc)
|
||||
if (of_property_read_u32(np, "clock-frequency", &bus_freq))
|
||||
bus_freq = 100000; /* 100kHz by default */
|
||||
|
||||
if (!mv64xxx_find_baud_factors(bus_freq, tclk,
|
||||
|
|
|
@ -41,7 +41,7 @@ static int state_probe(struct device_d *dev)
|
|||
if (IS_ERR(state))
|
||||
return PTR_ERR(state);
|
||||
|
||||
ret = of_find_path(np, "backend", &path);
|
||||
ret = of_find_path(np, "backend", &path, 0);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
|
|
@ -488,7 +488,7 @@ static int of_mtd_fixup(struct device_node *root, void *ctx)
|
|||
struct device_node *np, *part, *tmp;
|
||||
int ret, i = 0;
|
||||
|
||||
np = of_find_node_by_path(mtd->of_path);
|
||||
np = of_find_node_by_path_from(root, mtd->of_path);
|
||||
if (!np) {
|
||||
dev_err(&mtd->class_dev, "Cannot find nodepath %s, cannot fixup\n",
|
||||
mtd->of_path);
|
||||
|
|
|
@ -743,6 +743,7 @@ static const struct platform_device_id m25p_ids[] = {
|
|||
{ "w25q64", INFO(0xef4017, 0, 64 * 1024, 128, SECT_4K) },
|
||||
{ "w25q80", INFO(0xef5014, 0, 64 * 1024, 16, SECT_4K) },
|
||||
{ "w25q80bl", INFO(0xef4014, 0, 64 * 1024, 16, SECT_4K) },
|
||||
{ "w25q128", INFO(0xef4018, 0, 64 * 1024, 256, SECT_4K) },
|
||||
|
||||
/* Catalyst / On Semiconductor -- non-JEDEC */
|
||||
{ "cat25c11", CAT25_INFO( 16, 8, 16, 1) },
|
||||
|
|
|
@ -25,7 +25,7 @@ static ssize_t ubi_volume_cdev_read(struct cdev *cdev, void *buf, size_t size,
|
|||
loff_t offp = offset;
|
||||
int usable_leb_size = vol->usable_leb_size;
|
||||
|
||||
ubi_debug("%s: %zd @ 0x%08llx\n", __func__, size, offset);
|
||||
ubi_debug("%s: %zd @ 0x%08llx", __func__, size, offset);
|
||||
|
||||
len = size > usable_leb_size ? usable_leb_size : size;
|
||||
|
||||
|
@ -38,7 +38,7 @@ static ssize_t ubi_volume_cdev_read(struct cdev *cdev, void *buf, size_t size,
|
|||
|
||||
err = ubi_eba_read_leb(ubi, vol, lnum, buf, off, len, 0);
|
||||
if (err) {
|
||||
ubi_err("read error: %s\n", strerror(-err));
|
||||
ubi_err("read error: %s", strerror(-err));
|
||||
break;
|
||||
}
|
||||
off += len;
|
||||
|
@ -68,14 +68,14 @@ static ssize_t ubi_volume_cdev_write(struct cdev* cdev, const void *buf,
|
|||
if (!priv->written) {
|
||||
err = ubi_start_update(ubi, vol, vol->used_bytes);
|
||||
if (err < 0) {
|
||||
ubi_err("Cannot start volume update\n");
|
||||
ubi_err("Cannot start volume update");
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
err = ubi_more_update_data(ubi, vol, buf, size);
|
||||
if (err < 0) {
|
||||
ubi_err("Couldnt or partially wrote data \n");
|
||||
ubi_err("Couldnt or partially wrote data");
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -117,7 +117,7 @@ static int ubi_volume_cdev_close(struct cdev *cdev)
|
|||
kfree(buf);
|
||||
|
||||
if (err < 0) {
|
||||
ubi_err("Couldnt or partially wrote data \n");
|
||||
ubi_err("Couldnt or partially wrote data");
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ static int ubi_volume_cdev_close(struct cdev *cdev)
|
|||
|
||||
err = ubi_check_volume(ubi, vol->vol_id);
|
||||
if (err < 0) {
|
||||
ubi_err("ubi volume check failed: %s\n", strerror(err));
|
||||
ubi_err("ubi volume check failed: %s", strerror(err));
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -180,7 +180,7 @@ int ubi_volume_cdev_add(struct ubi_device *ubi, struct ubi_volume *vol)
|
|||
cdev->priv = priv;
|
||||
cdev->size = vol->used_bytes;
|
||||
cdev->dev = &vol->dev;
|
||||
ubi_msg("registering %s as /dev/%s\n", vol->name, cdev->name);
|
||||
ubi_msg("registering %s as /dev/%s", vol->name, cdev->name);
|
||||
ret = devfs_create(cdev);
|
||||
if (ret) {
|
||||
kfree(priv);
|
||||
|
|
|
@ -308,7 +308,10 @@ static int fec_init(struct eth_device *dev)
|
|||
}
|
||||
}
|
||||
|
||||
if (fec->interface == PHY_INTERFACE_MODE_RGMII)
|
||||
if (fec->interface == PHY_INTERFACE_MODE_RGMII ||
|
||||
fec->interface == PHY_INTERFACE_MODE_RGMII_ID ||
|
||||
fec->interface == PHY_INTERFACE_MODE_RGMII_TXID ||
|
||||
fec->interface == PHY_INTERFACE_MODE_RGMII_RXID)
|
||||
rcntl |= 1 << 6;
|
||||
|
||||
writel(rcntl, fec->regs + FEC_R_CNTRL);
|
||||
|
|
|
@ -846,6 +846,10 @@ static const struct usb_device_id products [] = {
|
|||
// LevelOne USB Fast Ethernet Adapter
|
||||
USB_DEVICE(0x0b95, 0x772b),
|
||||
.driver_info = &ax88772b_info,
|
||||
}, {
|
||||
// DLink DUB-E100 H/W Ver C1
|
||||
USB_DEVICE(0x2001, 0x1a02),
|
||||
.driver_info = &ax88772_info,
|
||||
},
|
||||
{ }, // END
|
||||
};
|
||||
|
|
|
@ -26,42 +26,15 @@
|
|||
#include <envfs.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
|
||||
struct of_partition {
|
||||
struct list_head list;
|
||||
char *nodepath;
|
||||
struct device_d *dev;
|
||||
struct device_node *of_partitions;
|
||||
};
|
||||
|
||||
static LIST_HEAD(of_partition_list);
|
||||
|
||||
static int environment_probe(struct device_d *dev)
|
||||
{
|
||||
char *path;
|
||||
int ret;
|
||||
|
||||
ret = of_find_path(dev->device_node, "device-path", &path);
|
||||
ret = of_find_path(dev->device_node, "device-path", &path, OF_FIND_PATH_FLAGS_BB);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
/*
|
||||
* The environment support is not bad block aware, hence we
|
||||
* have to use the .bb device. Test if we have a nand device
|
||||
* and if yes, append .bb to the filename.
|
||||
*/
|
||||
if (!strncmp(path, "/dev/", 5)) {
|
||||
struct cdev *cdev;
|
||||
char *cdevname;
|
||||
|
||||
cdevname = path + 5;
|
||||
cdev = cdev_by_name(cdevname);
|
||||
if (cdev && cdev->mtd && mtd_can_have_bb(cdev->mtd)) {
|
||||
char *bbpath = asprintf("%s.bb", path);
|
||||
free(path);
|
||||
path = bbpath;
|
||||
}
|
||||
}
|
||||
|
||||
dev_info(dev, "setting default environment path to %s\n", path);
|
||||
|
||||
default_environment_path_set(path);
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
#include <malloc.h>
|
||||
#include <of.h>
|
||||
|
||||
#include <linux/mtd/mtd.h>
|
||||
|
||||
struct of_path {
|
||||
struct cdev *cdev;
|
||||
struct device_d *dev;
|
||||
|
@ -112,6 +114,7 @@ out:
|
|||
* @propname: the property name of the path description
|
||||
* @outpath: if this function returns 0 outpath will contain the path belonging
|
||||
* to the input path description. Must be freed with free().
|
||||
* @flags: use OF_FIND_PATH_FLAGS_BB to return the .bb device if available
|
||||
*
|
||||
* paths in the devicetree have the form of a multistring property. The first
|
||||
* string contains the full path to the physical device containing the path.
|
||||
|
@ -127,11 +130,12 @@ out:
|
|||
* device-path = &mmc0, "partname:0";
|
||||
* device-path = &norflash, "partname:barebox-environment";
|
||||
*/
|
||||
int of_find_path(struct device_node *node, const char *propname, char **outpath)
|
||||
int of_find_path(struct device_node *node, const char *propname, char **outpath, unsigned flags)
|
||||
{
|
||||
struct of_path op = {};
|
||||
struct device_node *rnode;
|
||||
const char *path, *str;
|
||||
bool add_bb = false;
|
||||
int i, ret;
|
||||
|
||||
path = of_get_property(node, propname, NULL);
|
||||
|
@ -166,7 +170,11 @@ int of_find_path(struct device_node *node, const char *propname, char **outpath)
|
|||
if (!op.cdev)
|
||||
return -ENOENT;
|
||||
|
||||
*outpath = asprintf("/dev/%s", op.cdev->name);
|
||||
if ((flags & OF_FIND_PATH_FLAGS_BB) && op.cdev->mtd &&
|
||||
mtd_can_have_bb(op.cdev->mtd))
|
||||
add_bb = true;
|
||||
|
||||
*outpath = asprintf("/dev/%s%s", op.cdev->name, add_bb ? ".bb" : "");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -27,11 +27,11 @@ static int pci_match(struct device_d *dev, struct driver_d *drv)
|
|||
{
|
||||
struct pci_dev *pdev = to_pci_dev(dev);
|
||||
struct pci_driver *pdrv = to_pci_driver(drv);
|
||||
struct pci_device_id *id;
|
||||
const struct pci_device_id *id;
|
||||
|
||||
for (id = (struct pci_device_id *)pdrv->id_table; id->vendor; id++)
|
||||
for (id = pdrv->id_table; id->vendor; id++)
|
||||
if (pci_match_one_device(id, pdev)) {
|
||||
dev->priv = id;
|
||||
pdev->id = id;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ static int pci_probe(struct device_d *dev)
|
|||
struct pci_dev *pdev = to_pci_dev(dev);
|
||||
struct pci_driver *pdrv = to_pci_driver(dev->driver);
|
||||
|
||||
return pdrv->probe(pdev, dev->priv);
|
||||
return pdrv->probe(pdev, pdev->id);
|
||||
}
|
||||
|
||||
static void pci_remove(struct device_d *dev)
|
||||
|
|
|
@ -350,13 +350,6 @@ static void dw_pcie_prog_viewport_io_outbound(struct pcie_port *pp)
|
|||
dw_pcie_writel_rc(pp, PCIE_ATU_ENABLE, PCIE_ATU_CR2);
|
||||
}
|
||||
|
||||
struct pci_bus *get_parent_bus(struct pci_bus *bus)
|
||||
{
|
||||
struct pci_dev *bridge = container_of(bus->parent, struct pci_dev, dev);
|
||||
|
||||
return bridge->bus;
|
||||
}
|
||||
|
||||
static int dw_pcie_rd_other_conf(struct pcie_port *pp, struct pci_bus *bus,
|
||||
u32 devfn, int where, int size, u32 *val)
|
||||
{
|
||||
|
@ -367,7 +360,7 @@ static int dw_pcie_rd_other_conf(struct pcie_port *pp, struct pci_bus *bus,
|
|||
PCIE_ATU_FUNC(PCI_FUNC(devfn));
|
||||
address = where & ~0x3;
|
||||
|
||||
if (get_parent_bus(bus)->number == pp->root_bus_nr) {
|
||||
if (bus->primary == pp->root_bus_nr) {
|
||||
dw_pcie_prog_viewport_cfg0(pp, busdev);
|
||||
ret = dw_pcie_cfg_read(pp->va_cfg0_base + address, where, size,
|
||||
val);
|
||||
|
@ -392,7 +385,7 @@ static int dw_pcie_wr_other_conf(struct pcie_port *pp, struct pci_bus *bus,
|
|||
PCIE_ATU_FUNC(PCI_FUNC(devfn));
|
||||
address = where & ~0x3;
|
||||
|
||||
if (get_parent_bus(bus)->number == pp->root_bus_nr) {
|
||||
if (bus->primary == pp->root_bus_nr) {
|
||||
dw_pcie_prog_viewport_cfg0(pp, busdev);
|
||||
ret = dw_pcie_cfg_write(pp->va_cfg0_base + address, where, size,
|
||||
val);
|
||||
|
|
|
@ -663,7 +663,7 @@ int usb_clear_halt(struct usb_device *dev, int pipe)
|
|||
|
||||
result = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
|
||||
USB_REQ_CLEAR_FEATURE, USB_RECIP_ENDPOINT, 0,
|
||||
endp, NULL, 0, USB_CNTL_TIMEOUT * 3);
|
||||
endp, NULL, 0, USB_CNTL_TIMEOUT);
|
||||
|
||||
/* don't clear if failed */
|
||||
if (result < 0)
|
||||
|
@ -748,7 +748,7 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate)
|
|||
ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
|
||||
USB_REQ_SET_INTERFACE, USB_RECIP_INTERFACE,
|
||||
alternate, interface, NULL, 0,
|
||||
USB_CNTL_TIMEOUT * 5);
|
||||
USB_CNTL_TIMEOUT);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
#ifndef __CONSOLE_COUNTDOWN_H
|
||||
#define __CONSOLE_COUNTDOWN_H
|
||||
|
||||
#define CONSOLE_COUNTDOWN_SILENT (1 << 0)
|
||||
#define CONSOLE_COUNTDOWN_ANYKEY (1 << 1)
|
||||
#define CONSOLE_COUNTDOWN_RETURN (1 << 3)
|
||||
#define CONSOLE_COUNTDOWN_CTRLC (1 << 4)
|
||||
|
||||
int console_countdown(int timeout_s, unsigned flags, char *out_key);
|
||||
|
||||
#endif /* __CONSOLE_COUNTDOWN_H */
|
|
@ -77,7 +77,7 @@ struct device_d {
|
|||
|
||||
struct list_head cdevs;
|
||||
|
||||
struct platform_device_id *id_entry;
|
||||
const struct platform_device_id *id_entry;
|
||||
struct device_node *device_node;
|
||||
|
||||
const struct of_device_id *of_id_entry;
|
||||
|
@ -107,8 +107,8 @@ struct driver_d {
|
|||
|
||||
struct bus_type *bus;
|
||||
|
||||
struct platform_device_id *id_table;
|
||||
struct of_device_id *of_compatible;
|
||||
const struct platform_device_id *id_table;
|
||||
const struct of_device_id *of_compatible;
|
||||
};
|
||||
|
||||
/*@}*/ /* do not delete, doxygen relevant */
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#ifndef _FDT_H
|
||||
#define _FDT_H
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#define _B(n) ((unsigned long long)((uint8_t *)&x)[n])
|
||||
|
|
|
@ -60,9 +60,6 @@ extern struct bus_type amba_bustype;
|
|||
|
||||
#define to_amba_device(d) container_of(d, struct amba_device, dev)
|
||||
|
||||
#define amba_get_drvdata(d) dev_get_drvdata(&d->dev)
|
||||
#define amba_set_drvdata(d,p) dev_set_drvdata(&d->dev, p)
|
||||
|
||||
int amba_driver_register(struct amba_driver *);
|
||||
void amba_driver_unregister(struct amba_driver *);
|
||||
struct amba_device *amba_device_alloc(const char *, int id, resource_size_t, size_t);
|
||||
|
|
|
@ -92,6 +92,7 @@ struct pci_dev {
|
|||
struct pci_bus *bus; /* bus this device is on */
|
||||
struct pci_bus *subordinate; /* bus this device bridges to */
|
||||
struct pci_slot *slot; /* Physical slot this device is in */
|
||||
const struct pci_device_id *id; /* the id this device matches */
|
||||
|
||||
struct device_d dev;
|
||||
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
|
||||
#include <fdt.h>
|
||||
#include <errno.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/list.h>
|
||||
#include <asm/byteorder.h>
|
||||
|
||||
/* Default string compare functions */
|
||||
|
@ -238,7 +240,8 @@ int of_add_memory(struct device_node *node, bool dump);
|
|||
void of_add_memory_bank(struct device_node *node, bool dump, int r,
|
||||
u64 base, u64 size);
|
||||
struct device_d *of_find_device_by_node_path(const char *path);
|
||||
int of_find_path(struct device_node *node, const char *propname, char **outpath);
|
||||
#define OF_FIND_PATH_FLAGS_BB 1 /* return .bb device if available */
|
||||
int of_find_path(struct device_node *node, const char *propname, char **outpath, unsigned flags);
|
||||
int of_register_fixup(int (*fixup)(struct device_node *, void *), void *context);
|
||||
struct device_node *of_find_node_by_alias(struct device_node *root,
|
||||
const char *alias);
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#ifndef __STATE_H
|
||||
#define __STATE_H
|
||||
|
||||
#include <of.h>
|
||||
|
||||
struct state;
|
||||
|
||||
int state_backend_dtb_file(struct state *state, const char *path);
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
#define USB_MAXCHILDREN 8 /* This is arbitrary */
|
||||
#define USB_MAX_HUB 16
|
||||
|
||||
#define USB_CNTL_TIMEOUT 100 /* 100ms timeout */
|
||||
#define USB_CNTL_TIMEOUT 5000 /* 5000ms timeout */
|
||||
|
||||
/* device request (setup) */
|
||||
struct devrequest {
|
||||
|
|
|
@ -1466,6 +1466,41 @@ sub process {
|
|||
#print "is_end<$is_end> length<$length>\n";
|
||||
}
|
||||
|
||||
# check for DT compatible documentation
|
||||
if (defined $root &&
|
||||
(($realfile =~ /\.dtsi?$/ && $line =~ /^\+\s*compatible\s*=\s*\"/) ||
|
||||
($realfile =~ /\.[ch]$/ && $line =~ /^\+.*\.compatible\s*=\s*\"/))) {
|
||||
|
||||
my @compats = $rawline =~ /\"([a-zA-Z0-9\-\,\.\+_]+)\"/g;
|
||||
|
||||
# linux device tree files
|
||||
my $dt_path = $root . "/dts/Bindings/";
|
||||
my $vp_file = $dt_path . "vendor-prefixes.txt";
|
||||
|
||||
# barebox-specific bindings
|
||||
$dt_path = $dt_path . " " . $root . "/Documentation/devicetree/bindings/";
|
||||
|
||||
foreach my $compat (@compats) {
|
||||
my $compat2 = $compat;
|
||||
$compat2 =~ s/\,[a-zA-Z0-9]*\-/\,<\.\*>\-/;
|
||||
my $compat3 = $compat;
|
||||
$compat3 =~ s/\,([a-z]*)[0-9]*\-/\,$1<\.\*>\-/;
|
||||
`grep -Erq "$compat|$compat2|$compat3" $dt_path`;
|
||||
if ( $? >> 8 ) {
|
||||
WARN(
|
||||
"DT compatible string \"$compat\" appears un-documented -- check $dt_path\n" . $herecurr);
|
||||
}
|
||||
|
||||
next if $compat !~ /^([a-zA-Z0-9\-]+)\,/;
|
||||
my $vendor = $1;
|
||||
`grep -Eq "^$vendor\\b" $vp_file`;
|
||||
if ( $? >> 8 ) {
|
||||
WARN(
|
||||
"DT compatible string vendor \"$vendor\" appears un-documented -- check $vp_file\n" . $herecurr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# check we are in a valid source file if not then ignore this hunk
|
||||
next if ($realfile !~ /\.(h|c|s|S|pl|sh)$/);
|
||||
|
||||
|
|
Loading…
Reference in New Issue