summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2017-04-07 09:59:35 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2017-04-07 09:59:35 +0200
commit4cd023c77942f48efded3e9e47c2be823d5c8d82 (patch)
treeb6790388da4c11d50cc7b22ee915fc6133b051c0
parent011aec6558e93b01c64202929a6ae90a334a3742 (diff)
parente4f81050e098074792730b61563538d9e394e3d6 (diff)
downloadbarebox-4cd023c77942f48efded3e9e47c2be823d5c8d82.tar.gz
Merge branch 'for-next/misc'
-rw-r--r--arch/arm/Kconfig3
-rw-r--r--arch/arm/boards/mioa701/gpio0_poweroff.c3
-rw-r--r--arch/arm/mach-highbank/reset.c20
-rw-r--r--arch/arm/mach-pxa/pxa2xx.c15
-rw-r--r--arch/arm/mach-pxa/pxa3xx.c13
-rw-r--r--arch/mips/mach-xburst/Kconfig1
-rw-r--r--arch/mips/mach-xburst/reset-jz4750.c13
-rw-r--r--arch/sandbox/configs/sandbox_defconfig1
-rw-r--r--commands/Kconfig5
-rw-r--r--commands/digest.c14
-rw-r--r--commands/poweroff.c3
-rw-r--r--commands/usbgadget.c11
-rw-r--r--common/Makefile1
-rw-r--r--common/blspec.c24
-rw-r--r--common/boot.c36
-rw-r--r--common/bootchooser.c30
-rw-r--r--common/globalvar.c102
-rw-r--r--common/image-fit.c42
-rw-r--r--common/poweroff.c114
-rw-r--r--drivers/ata/disk_ata_drive.c3
-rw-r--r--drivers/ata/ide-sff.c54
-rw-r--r--drivers/clk/clk-fixed-factor.c2
-rw-r--r--drivers/clk/clk-fixed.c2
-rw-r--r--drivers/clocksource/mvebu.c2
-rw-r--r--drivers/net/phy/mdio-gpio.c2
-rw-r--r--drivers/usb/gadget/Kconfig11
-rw-r--r--drivers/usb/gadget/Makefile1
-rw-r--r--drivers/usb/gadget/autostart.c70
-rw-r--r--drivers/video/edid.c2
-rw-r--r--drivers/watchdog/Kconfig6
-rw-r--r--drivers/watchdog/Makefile1
-rw-r--r--drivers/watchdog/orion_wdt.c123
-rw-r--r--include/ata_drive.h3
-rw-r--r--include/boot.h2
-rw-r--r--include/bootchooser.h4
-rw-r--r--include/common.h3
-rw-r--r--include/globalvar.h12
-rw-r--r--include/linux/clk.h31
-rw-r--r--include/param.h1
-rw-r--r--include/poweroff.h21
-rwxr-xr-xscripts/tags.sh23
41 files changed, 632 insertions, 198 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 4f936af..2583e9d 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -93,7 +93,6 @@ config ARCH_EP93XX
config ARCH_HIGHBANK
bool "Calxeda Highbank"
select HAS_DEBUG_LL
- select HAS_POWEROFF
select ARCH_HAS_L2X0
select CPU_V7
select ARM_AMBA
@@ -117,7 +116,6 @@ config ARCH_MVEBU
select CLKDEV_LOOKUP
select GPIOLIB
select HAS_DEBUG_LL
- select HAVE_DEFAULT_ENVIRONMENT_NEW
select HAVE_MACH_ARM_HEAD
select HAVE_PBL_MULTI_IMAGES
select HW_HAS_PCI
@@ -154,7 +152,6 @@ config ARCH_OMAP
config ARCH_PXA
bool "Intel/Marvell PXA based"
select GENERIC_GPIO
- select HAS_POWEROFF
config ARCH_ROCKCHIP
bool "Rockchip RX3xxx"
diff --git a/arch/arm/boards/mioa701/gpio0_poweroff.c b/arch/arm/boards/mioa701/gpio0_poweroff.c
index 2054548..01a5d0c 100644
--- a/arch/arm/boards/mioa701/gpio0_poweroff.c
+++ b/arch/arm/boards/mioa701/gpio0_poweroff.c
@@ -19,6 +19,7 @@
#include <clock.h>
#include <common.h>
#include <init.h>
+#include <poweroff.h>
#include <gpio.h>
#include <poller.h>
@@ -45,7 +46,7 @@ static void try_poweroff(void)
gpio_set_value(GPIO115_LED_nKeyboard, 0);
mdelay(2000);
- poweroff();
+ poweroff_machine();
}
static void gpio0_poller_fn(struct poller_struct *poller)
diff --git a/arch/arm/mach-highbank/reset.c b/arch/arm/mach-highbank/reset.c
index 929ded5..b60f344 100644
--- a/arch/arm/mach-highbank/reset.c
+++ b/arch/arm/mach-highbank/reset.c
@@ -6,6 +6,7 @@
#include <common.h>
#include <io.h>
+#include <poweroff.h>
#include <restart.h>
#include <init.h>
@@ -20,15 +21,7 @@ static void __noreturn highbank_restart_soc(struct restart_handler *rst)
hang();
}
-static int restart_register_feature(void)
-{
- restart_handler_register_fn(highbank_restart_soc);
-
- return 0;
-}
-coredevice_initcall(restart_register_feature);
-
-void __noreturn poweroff()
+void __noreturn highbank_poweroff(struct poweroff_handler *handler)
{
shutdown_barebox();
@@ -37,3 +30,12 @@ void __noreturn poweroff()
while(1);
}
+
+static int highbank_init(void)
+{
+ restart_handler_register_fn(highbank_restart_soc);
+ poweroff_handler_register_fn(highbank_poweroff);
+
+ return 0;
+}
+coredevice_initcall(highbank_init);
diff --git a/arch/arm/mach-pxa/pxa2xx.c b/arch/arm/mach-pxa/pxa2xx.c
index b712b38..e28378e 100644
--- a/arch/arm/mach-pxa/pxa2xx.c
+++ b/arch/arm/mach-pxa/pxa2xx.c
@@ -14,6 +14,7 @@
#include <common.h>
#include <init.h>
+#include <poweroff.h>
#include <reset_source.h>
#include <mach/hardware.h>
#include <mach/pxa-regs.h>
@@ -46,9 +47,7 @@ void pxa_clear_reset_source(void)
RCSR = RCSR_GPR | RCSR_SMR | RCSR_WDR | RCSR_HWR;
}
-device_initcall(pxa_detect_reset_source);
-
-void __noreturn poweroff(void)
+static void __noreturn pxa2xx_poweroff(struct poweroff_handler *handler)
{
shutdown_barebox();
@@ -57,3 +56,13 @@ void __noreturn poweroff(void)
pxa_suspend(PWRMODE_DEEPSLEEP);
unreachable();
}
+
+static int pxa2xx_init(void)
+{
+ poweroff_handler_register_fn(pxa2xx_poweroff);
+
+ pxa_detect_reset_source();
+
+ return 0;
+}
+device_initcall(pxa2xx_init);
diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c
index 86ca63b..ccfd952 100644
--- a/arch/arm/mach-pxa/pxa3xx.c
+++ b/arch/arm/mach-pxa/pxa3xx.c
@@ -14,6 +14,7 @@
#include <common.h>
#include <init.h>
+#include <poweroff.h>
#include <reset_source.h>
#include <mach/hardware.h>
#include <mach/pxa-regs.h>
@@ -48,7 +49,7 @@ void pxa_clear_reset_source(void)
device_initcall(pxa_detect_reset_source);
-void __noreturn poweroff(void)
+static void __noreturn pxa3xx_poweroff(struct poweroff_handler *handler)
{
shutdown_barebox();
@@ -57,3 +58,13 @@ void __noreturn poweroff(void)
pxa3xx_suspend(PXA3xx_PM_S3D4C4);
unreachable();
}
+
+static int pxa3xx_init(void)
+{
+ poweroff_handler_register_fn(pxa3xx_poweroff);
+
+ pxa_detect_reset_source();
+
+ return 0;
+}
+device_initcall(pxa3xx_init);
diff --git a/arch/mips/mach-xburst/Kconfig b/arch/mips/mach-xburst/Kconfig
index fd106fe..ee79ff6 100644
--- a/arch/mips/mach-xburst/Kconfig
+++ b/arch/mips/mach-xburst/Kconfig
@@ -21,7 +21,6 @@ choice
config BOARD_RZX50
bool "Ritmix RZX-50"
- select HAS_POWEROFF
select CPU_JZ4755
config BOARD_CI20
diff --git a/arch/mips/mach-xburst/reset-jz4750.c b/arch/mips/mach-xburst/reset-jz4750.c
index 25830f1..1fdcc7b 100644
--- a/arch/mips/mach-xburst/reset-jz4750.c
+++ b/arch/mips/mach-xburst/reset-jz4750.c
@@ -22,6 +22,8 @@
#include <common.h>
#include <io.h>
+#include <init.h>
+#include <poweroff.h>
#include <mach/jz4750d_regs.h>
static void __noreturn jz4750d_halt(void)
@@ -37,7 +39,7 @@ static void __noreturn jz4750d_halt(void)
unreachable();
}
-void __noreturn poweroff()
+static void __noreturn jz4750_poweroff(struct poweroff_handler *handler)
{
u32 ctrl;
@@ -50,4 +52,11 @@ void __noreturn poweroff()
writel(RTC_HCR_PD, (u32 *)RTC_HCR);
jz4750d_halt();
}
-EXPORT_SYMBOL(poweroff);
+
+static int jz4750_init(void)
+{
+ poweroff_handler_register_fn(jz4750_poweroff);
+
+ return 0;
+}
+coredevice_initcall(jz4750_init);
diff --git a/arch/sandbox/configs/sandbox_defconfig b/arch/sandbox/configs/sandbox_defconfig
index c20dd15..dbaff12 100644
--- a/arch/sandbox/configs/sandbox_defconfig
+++ b/arch/sandbox/configs/sandbox_defconfig
@@ -79,6 +79,7 @@ CONFIG_FS_FAT_WRITE=y
CONFIG_FS_FAT_LFN=y
CONFIG_FS_BPKFS=y
CONFIG_FS_UIMAGEFS=y
+CONFIG_FS_SQUASHFS=y
CONFIG_BZLIB=y
CONFIG_LZ4_DECOMPRESS=y
CONFIG_XZ_DECOMPRESS=y
diff --git a/commands/Kconfig b/commands/Kconfig
index 35b7f43..43b8ded 100644
--- a/commands/Kconfig
+++ b/commands/Kconfig
@@ -6,10 +6,6 @@ config COMMAND_SUPPORT
depends on !SHELL_NONE
default y
-config HAS_POWEROFF
- bool
- default n
-
if COMMAND_SUPPORT
config COMPILE_HASH
@@ -1848,7 +1844,6 @@ config CMD_NAND_BITFLIP
config CMD_POWEROFF
tristate
- depends on HAS_POWEROFF
prompt "poweroff"
help
Turn the power off.
diff --git a/commands/digest.c b/commands/digest.c
index 02a9f6f..0edbbec 100644
--- a/commands/digest.c
+++ b/commands/digest.c
@@ -36,12 +36,16 @@ int __do_digest(struct digest *d, unsigned char *sig,
while (*argv) {
char *filename = "/dev/mem";
loff_t start = 0, size = ~0;
+ int show_area = 1;
/* arguments are either file, file+area or area */
if (parse_area_spec(*argv, &start, &size)) {
filename = *argv;
- if (argv[1] && !parse_area_spec(argv[1], &start, &size))
+ show_area = 0;
+ if (argv[1] && !parse_area_spec(argv[1], &start, &size)) {
argv++;
+ show_area = 1;
+ }
}
ret = digest_file_window(d, filename,
@@ -53,8 +57,12 @@ int __do_digest(struct digest *d, unsigned char *sig,
for (i = 0; i < digest_length(d); i++)
printf("%02x", hash[i]);
- printf(" %s\t0x%08llx ... 0x%08llx\n",
- filename, start, start + size);
+ printf(" %s", filename);
+ if (show_area)
+ printf("\t0x%08llx ... 0x%08llx",
+ start, start + size);
+
+ puts("\n");
}
}
diff --git a/commands/poweroff.c b/commands/poweroff.c
index e8c726a..bbafa13 100644
--- a/commands/poweroff.c
+++ b/commands/poweroff.c
@@ -19,10 +19,11 @@
#include <common.h>
#include <command.h>
+#include <poweroff.h>
static int cmd_poweroff(int argc, char *argv[])
{
- poweroff();
+ poweroff_machine();
/* Not reached */
return 1;
diff --git a/commands/usbgadget.c b/commands/usbgadget.c
index 314884a..02c2c96 100644
--- a/commands/usbgadget.c
+++ b/commands/usbgadget.c
@@ -20,6 +20,7 @@
*/
#include <common.h>
#include <command.h>
+#include <environment.h>
#include <errno.h>
#include <malloc.h>
#include <getopt.h>
@@ -32,11 +33,11 @@
static int do_usbgadget(int argc, char *argv[])
{
int opt, ret;
- int acm = 1, create_serial = 0;
- char *fastboot_opts = NULL, *dfu_opts = NULL;
+ int acm = 1, create_serial = 0, fastboot_set = 0;
+ const char *fastboot_opts = NULL, *dfu_opts = NULL;
struct f_multi_opts *opts;
- while ((opt = getopt(argc, argv, "asdA:D:")) > 0) {
+ while ((opt = getopt(argc, argv, "asdA::D:")) > 0) {
switch (opt) {
case 'a':
acm = 1;
@@ -51,6 +52,7 @@ static int do_usbgadget(int argc, char *argv[])
break;
case 'A':
fastboot_opts = optarg;
+ fastboot_set = 1;
break;
case 'd':
usb_multi_unregister();
@@ -60,6 +62,9 @@ static int do_usbgadget(int argc, char *argv[])
}
}
+ if (fastboot_set && !fastboot_opts)
+ fastboot_opts = getenv("global.usbgadget.fastboot_function");
+
if (!dfu_opts && !fastboot_opts && !create_serial)
return COMMAND_ERROR_USAGE;
diff --git a/common/Makefile b/common/Makefile
index 5f58c81..8cd0ab3 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -9,6 +9,7 @@ obj-pbl-y += memsize.o
obj-y += resource.o
obj-y += bootsource.o
obj-y += restart.o
+obj-y += poweroff.o
obj-$(CONFIG_AUTO_COMPLETE) += complete.o
obj-$(CONFIG_BANNER) += version.o
obj-$(CONFIG_BAREBOX_UPDATE) += bbu.o
diff --git a/common/blspec.c b/common/blspec.c
index ec63ddb..8132d14 100644
--- a/common/blspec.c
+++ b/common/blspec.c
@@ -732,3 +732,27 @@ int blspec_scan_devicename(struct bootentries *bootentries, const char *devname)
return blspec_scan_device(bootentries, dev);
}
+
+static int blspec_bootentry_provider(struct bootentries *bootentries,
+ const char *name)
+{
+ int ret, found = 0;
+
+ ret = blspec_scan_devicename(bootentries, name);
+ if (ret > 0)
+ found += ret;
+
+ if (*name == '/' || !strncmp(name, "nfs://", 6)) {
+ ret = blspec_scan_directory(bootentries, name);
+ if (ret > 0)
+ found += ret;
+ }
+
+ return found;
+}
+
+static int blspec_init(void)
+{
+ return bootentry_register_provider(blspec_bootentry_provider);
+}
+device_initcall(blspec_init); \ No newline at end of file
diff --git a/common/boot.c b/common/boot.c
index 4306319..cef3d5e 100644
--- a/common/boot.c
+++ b/common/boot.c
@@ -244,6 +244,25 @@ static int bootscript_scan_path(struct bootentries *bootentries, const char *pat
return ret;
}
+static LIST_HEAD(bootentry_providers);
+
+struct bootentry_provider {
+ int (*fn)(struct bootentries *bootentries, const char *name);
+ struct list_head list;
+};
+
+int bootentry_register_provider(int (*fn)(struct bootentries *bootentries, const char *name))
+{
+ struct bootentry_provider *p;
+
+ p = xzalloc(sizeof(*p));
+ p->fn = fn;
+
+ list_add_tail(&p->list, &bootentry_providers);
+
+ return 0;
+}
+
/*
* bootentry_create_from_name - create boot entries from a name
*
@@ -261,22 +280,11 @@ static int bootscript_scan_path(struct bootentries *bootentries, const char *pat
int bootentry_create_from_name(struct bootentries *bootentries,
const char *name)
{
+ struct bootentry_provider *p;
int found = 0, ret;
- if (IS_ENABLED(CONFIG_BLSPEC)) {
- ret = blspec_scan_devicename(bootentries, name);
- if (ret > 0)
- found += ret;
-
- if (*name == '/' || !strncmp(name, "nfs://", 6)) {
- ret = blspec_scan_directory(bootentries, name);
- if (ret > 0)
- found += ret;
- }
- }
-
- if (IS_ENABLED(CONFIG_BOOTCHOOSER) && !strcmp(name, "bootchooser")) {
- ret = bootchooser_create_bootentry(bootentries);
+ list_for_each_entry(p, &bootentry_providers, list) {
+ ret = p->fn(bootentries, name);
if (ret > 0)
found += ret;
}
diff --git a/common/bootchooser.c b/common/bootchooser.c
index 9c110f2..455f290 100644
--- a/common/bootchooser.c
+++ b/common/bootchooser.c
@@ -827,15 +827,10 @@ out:
return ret;
}
-static int bootchooser_boot(struct bootentry *entry, int verbose, int dryrun)
+int bootchooser_boot(struct bootchooser *bc)
{
- struct bootchooser *bc = container_of(entry, struct bootchooser,
- entry);
int ret, tryagain;
- bc->verbose = verbose;
- bc->dryrun = dryrun;
-
do {
ret = bootchooser_boot_one(bc, &tryagain);
@@ -846,6 +841,16 @@ static int bootchooser_boot(struct bootentry *entry, int verbose, int dryrun)
return ret;
}
+static int bootchooser_entry_boot(struct bootentry *entry, int verbose, int dryrun)
+{
+ struct bootchooser *bc = container_of(entry, struct bootchooser,
+ entry);
+ bc->verbose = verbose;
+ bc->dryrun = dryrun;
+
+ return bootchooser_boot(bc);
+}
+
static void bootchooser_release(struct bootentry *entry)
{
struct bootchooser *bc = container_of(entry, struct bootchooser,
@@ -863,14 +868,18 @@ static void bootchooser_release(struct bootentry *entry)
*
* Return: The number of entries added to the list
*/
-int bootchooser_create_bootentry(struct bootentries *entries)
+static int bootchooser_add_entry(struct bootentries *entries, const char *name)
{
- struct bootchooser *bc = bootchooser_get();
+ struct bootchooser *bc;
+
+ if (strcmp(name, "bootchooser"))
+ return 0;
+ bc = bootchooser_get();
if (IS_ERR(bc))
return PTR_ERR(bc);
- bc->entry.boot = bootchooser_boot;
+ bc->entry.boot = bootchooser_entry_boot;
bc->entry.release = bootchooser_release;
bc->entry.title = xstrdup("bootchooser");
bc->entry.description = xstrdup("bootchooser");
@@ -904,6 +913,9 @@ static int bootchooser_init(void)
reset_attempts_names, ARRAY_SIZE(reset_attempts_names));
globalvar_add_simple_bitmask("bootchooser.reset_priorities", &reset_priorities,
reset_priorities_names, ARRAY_SIZE(reset_priorities_names));
+
+ bootentry_register_provider(bootchooser_add_entry);
+
return 0;
}
device_initcall(bootchooser_init);
diff --git a/common/globalvar.c b/common/globalvar.c
index ab573cc..32ca6a2 100644
--- a/common/globalvar.c
+++ b/common/globalvar.c
@@ -29,22 +29,6 @@ void nv_var_set_clean(void)
nv_dirty = 0;
}
-int globalvar_add(const char *name,
- int (*set)(struct device_d *dev, struct param_d *p, const char *val),
- const char *(*get)(struct device_d *, struct param_d *p),
- unsigned long flags)
-{
- struct param_d *param;
-
- if (!strncmp(name, "global.", 7))
- name += 7;
-
- param = dev_add_param(&global_device, name, set, get, flags);
- if (IS_ERR(param))
- return PTR_ERR(param);
- return 0;
-}
-
void globalvar_remove(const char *name)
{
struct param_d *p, *tmp;
@@ -181,14 +165,18 @@ static int nvvar_device_dispatch(const char *name, struct device_d **dev,
static int nv_set(struct device_d *dev, struct param_d *p, const char *val)
{
+ struct param_d *g;
int ret;
if (!val)
val = "";
- ret = dev_set_param(&global_device, p->name, val);
- if (ret)
- return ret;
+ g = get_param_by_name(&global_device, p->name);
+ if (g) {
+ ret = dev_set_param(&global_device, p->name, val);
+ if (ret)
+ return ret;
+ }
free(p->value);
p->value = xstrdup(val);
@@ -215,7 +203,6 @@ static int nv_param_set(struct device_d *dev, struct param_d *p, const char *val
static int __nvvar_add(const char *name, const char *value)
{
struct param_d *p;
- int ret;
if (!IS_ENABLED(CONFIG_NVVAR))
return -ENOSYS;
@@ -228,11 +215,6 @@ static int __nvvar_add(const char *name, const char *value)
return PTR_ERR(p);
}
- /* Create corresponding globalvar if it doesn't exist yet */
- ret = globalvar_add_simple(name, value);
- if (ret && ret != -EEXIST)
- return ret;
-
if (value)
return nv_set(&nv_device, p, value);
@@ -327,7 +309,10 @@ static void device_param_print(struct device_d *dev)
if (IS_ENABLED(CONFIG_NVVAR) && dev != &nv_device)
nv = dev_get_param(&nv_device, param->name);
- printf("%s%s: %s\n", nv ? "* " : " ", param->name, p);
+ printf("%s%s: %s", nv ? "* " : " ", param->name, p);
+ if (param->info)
+ param->info(param);
+ printf("\n");
}
}
@@ -406,6 +391,15 @@ static int globalvar_simple_set(struct device_d *dev, struct param_d *p, const c
return dev_param_set_generic(dev, p, val);
}
+static void globalvar_nv_sync(const char *name)
+{
+ const char *val;
+
+ val = dev_get_param(&nv_device, name);
+ if (val)
+ dev_set_param(&global_device, name, val);
+}
+
/*
* globalvar_add_simple
*
@@ -416,51 +410,23 @@ int globalvar_add_simple(const char *name, const char *value)
struct param_d *param;
param = dev_add_param(&global_device, name, globalvar_simple_set, NULL,
- PARAM_GLOBALVAR_UNQUALIFIED);
+ 0);
if (IS_ERR(param)) {
if (PTR_ERR(param) != -EEXIST)
return PTR_ERR(param);
}
- if (!value)
- return 0;
-
- return dev_set_param(&global_device, name, value);
-}
-
-static int globalvar_remove_unqualified(const char *name)
-{
- struct param_d *p;
-
- p = get_param_by_name(&global_device, name);
- if (!p)
- return 0;
-
- if (!(p->flags & PARAM_GLOBALVAR_UNQUALIFIED))
- return -EEXIST;
+ if (value)
+ dev_set_param(&global_device, name, value);
- dev_remove_param(p);
+ globalvar_nv_sync(name);
return 0;
}
-static void globalvar_nv_sync(const char *name)
-{
- const char *val;
-
- val = dev_get_param(&nv_device, name);
- if (val)
- dev_set_param(&global_device, name, val);
-}
-
int globalvar_add_simple_string(const char *name, char **value)
{
struct param_d *p;
- int ret;
-
- ret = globalvar_remove_unqualified(name);
- if (ret)
- return ret;
p = dev_add_param_string(&global_device, name, NULL, NULL,
value, NULL);
@@ -477,11 +443,6 @@ int globalvar_add_simple_int(const char *name, int *value,
const char *format)
{
struct param_d *p;
- int ret;
-
- ret = globalvar_remove_unqualified(name);
- if (ret)
- return ret;
p = dev_add_param_int(&global_device, name, NULL, NULL,
value, format, NULL);
@@ -497,11 +458,6 @@ int globalvar_add_simple_int(const char *name, int *value,
int globalvar_add_simple_bool(const char *name, int *value)
{
struct param_d *p;
- int ret;
-
- ret = globalvar_remove_unqualified(name);
- if (ret)
- return ret;
p = dev_add_param_bool(&global_device, name, NULL, NULL,
value, NULL);
@@ -518,11 +474,6 @@ int globalvar_add_simple_enum(const char *name, int *value,
const char * const *names, int max)
{
struct param_d *p;
- int ret;
-
- ret = globalvar_remove_unqualified(name);
- if (ret)
- return ret;
p = dev_add_param_enum(&global_device, name, NULL, NULL,
value, names, max, NULL);
@@ -552,11 +503,6 @@ int globalvar_add_simple_bitmask(const char *name, unsigned long *value,
int globalvar_add_simple_ip(const char *name, IPaddr_t *ip)
{
struct param_d *p;
- int ret;
-
- ret = globalvar_remove_unqualified(name);
- if (ret)
- return ret;
p = dev_add_param_ip(&global_device, name, NULL, NULL,
ip, NULL);
diff --git a/common/image-fit.c b/common/image-fit.c
index 6a01c61..81433e6 100644
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -254,6 +254,8 @@ static int fit_verify_signature(struct device_node *sig_node, void *fit)
}
if (strcmp(algo_name, "sha1,rsa2048") == 0) {
algo = HASH_ALGO_SHA1;
+ } else if (strcmp(algo_name, "sha256,rsa2048") == 0) {
+ algo = HASH_ALGO_SHA256;
} else if (strcmp(algo_name, "sha256,rsa4096") == 0) {
algo = HASH_ALGO_SHA256;
} else {
@@ -489,6 +491,38 @@ static int fit_config_verify_signature(struct fit_handle *handle, struct device_
return ret;
}
+static int fit_find_compatible_unit(struct device_node *conf_node,
+ const char **unit)
+{
+ struct device_node *child = NULL;
+ struct device_node *barebox_root;
+ const char *machine;
+ int ret;
+
+ barebox_root = of_get_root_node();
+ if (!barebox_root)
+ goto default_unit;
+
+ ret = of_property_read_string(barebox_root, "compatible", &machine);
+ if (ret)
+ return -ENOENT;
+
+ for_each_child_of_node(conf_node, child) {
+ if (of_device_is_compatible(child, machine)) {
+ *unit = child->name;
+ pr_info("matching unit '%s' found\n", *unit);
+ return 0;
+ }
+ }
+
+default_unit:
+ pr_info("No match found. Trying default.\n");
+ if (of_property_read_string(conf_node, "default", unit) == 0)
+ return 0;
+
+ return -ENOENT;
+}
+
static int fit_open_configuration(struct fit_handle *handle, const char *name)
{
struct device_node *conf_node = NULL;
@@ -501,8 +535,12 @@ static int fit_open_configuration(struct fit_handle *handle, const char *name)
if (name) {
unit = name;
- } else if (of_property_read_string(conf_node, "default", &unit)) {
- unit = "conf@1";
+ } else {
+ ret = fit_find_compatible_unit(conf_node, &unit);
+ if (ret) {
+ pr_info("Couldn't get a valid configuration. Aborting.\n");
+ return ret;
+ }
}
conf_node = of_get_child_by_name(conf_node, unit);
diff --git a/common/poweroff.c b/common/poweroff.c
new file mode 100644
index 0000000..32a7828
--- /dev/null
+++ b/common/poweroff.c
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2015 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.
+ *
+ */
+#define pr_fmt(fmt) "poweroff: " fmt
+
+#include <common.h>
+#include <poweroff.h>
+#include <malloc.h>
+#include <of.h>
+
+static LIST_HEAD(poweroff_handler_list);
+
+/**
+ * poweroff_handler_register() - register a handler for poweroffing the system
+ * @rst: The handler struct
+ *
+ * This adds @rst to the list of registered poweroff handlers.
+ *
+ * return: 0 for success or negative error code
+ */
+int poweroff_handler_register(struct poweroff_handler *handler)
+{
+ if (!handler->name)
+ handler->name = POWEROFF_DEFAULT_NAME;
+ if (!handler->priority)
+ handler->priority = POWEROFF_DEFAULT_PRIORITY;
+
+ list_add_tail(&handler->list, &poweroff_handler_list);
+
+ pr_debug("registering poweroff handler \"%s\" with priority %d\n",
+ handler->name, handler->priority);
+
+ return 0;
+}
+
+/**
+ * poweroff_handler_register_fn() - register a handler function
+ * @poweroff_fn: The poweroff function
+ *
+ * convenience wrapper for poweroff_handler_register() to register a handler
+ * with given function and default values otherwise.
+ *
+ * return: 0 for success or negative error code
+ */
+int poweroff_handler_register_fn(void (*poweroff_fn)(struct poweroff_handler *))
+{
+ struct poweroff_handler *handler;
+ int ret;
+
+ handler = xzalloc(sizeof(*handler));
+
+ handler->poweroff = poweroff_fn;
+
+ ret = poweroff_handler_register(handler);
+
+ if (ret)
+ free(handler);
+
+ return ret;
+}
+
+/**
+ * poweroff_machine() - power off the machine
+ */
+void __noreturn poweroff_machine(void)
+{
+ struct poweroff_handler *handler = NULL, *tmp;
+ unsigned int priority = 0;
+
+ list_for_each_entry(tmp, &poweroff_handler_list, list) {
+ if (tmp->priority > priority) {
+ priority = tmp->priority;
+ handler = tmp;
+ }
+ }
+
+ if (handler) {
+ pr_debug("using poweroff handler %s\n", handler->name);
+ console_flush();
+ handler->poweroff(handler);
+ } else {
+ pr_err("No poweroff handler found!\n");
+ }
+
+ hang();
+}
+
+/**
+ * of_get_poweroff_priority() - get the desired poweroff priority from device tree
+ * @node: The device_node to read the property from
+ *
+ * return: The priority
+ */
+unsigned int of_get_poweroff_priority(struct device_node *node)
+{
+ unsigned int priority = POWEROFF_DEFAULT_PRIORITY;
+
+ of_property_read_u32(node, "poweroff-priority", &priority);
+
+ return priority;
+}
diff --git a/drivers/ata/disk_ata_drive.c b/drivers/ata/disk_ata_drive.c
index 1aa1bb1..5ebddbd 100644
--- a/drivers/ata/disk_ata_drive.c
+++ b/drivers/ata/disk_ata_drive.c
@@ -237,6 +237,9 @@ static int ata_port_init(struct ata_port *port)
#ifdef DEBUG
ata_dump_id(port->id);
#endif
+
+ port->lba48 = ata_id_has_lba48(port->id);
+
if (port->devname) {
port->blk.cdev.name = xstrdup(port->devname);
} else {
diff --git a/drivers/ata/ide-sff.c b/drivers/ata/ide-sff.c
index 6dc89d7..b7c8847 100644
--- a/drivers/ata/ide-sff.c
+++ b/drivers/ata/ide-sff.c
@@ -136,17 +136,33 @@ static int ata_wait_ready(struct ide_port *ide, unsigned timeout)
* @param io Register file
* @param drive 0 master drive, 1 slave drive
* @param num Sector number
- *
- * @todo LBA48 support
*/
-static int ata_set_lba_sector(struct ide_port *ide, unsigned drive, uint64_t num)
+static int ata_set_lba_sector(struct ata_port *port, unsigned drive,
+ uint64_t num)
{
- if (num > 0x0FFFFFFF || drive > 1)
+ struct ide_port *ide = to_ata_drive_access(port);
+
+ if (drive > 1)
return -EINVAL;
- ata_wr_byte(ide, 0xA0 | LBA_FLAG | drive << 4 | num >> 24,
- ide->io.device_addr);
- ata_wr_byte(ide, 0x00, ide->io.error_addr);
+ if (port->lba48) {
+ if (num > (1ULL << 48) - 1)
+ return -EINVAL;
+
+ ata_wr_byte(ide, LBA_FLAG | drive << 4, ide->io.device_addr);
+
+ ata_wr_byte(ide, 0x00, ide->io.nsect_addr);
+ ata_wr_byte(ide, num >> 24, ide->io.lbal_addr);
+ ata_wr_byte(ide, num >> 32, ide->io.lbam_addr);
+ ata_wr_byte(ide, num >> 40, ide->io.lbah_addr);
+ } else {
+ if (num > (1ULL << 28) - 1)
+ return -EINVAL;
+
+ ata_wr_byte(ide, 0xA0 | LBA_FLAG | drive << 4 | num >> 24,
+ ide->io.device_addr);
+ }
+
ata_wr_byte(ide, 0x01, ide->io.nsect_addr);
ata_wr_byte(ide, num, ide->io.lbal_addr); /* 0 ... 7 */
ata_wr_byte(ide, num >> 8, ide->io.lbam_addr); /* 8 ... 15 */
@@ -316,10 +332,18 @@ static int ide_read(struct ata_port *port, void *buffer, unsigned int block,
struct ide_port *ide = to_ata_drive_access(port);
while (num_blocks) {
- rc = ata_set_lba_sector(ide, DISK_MASTER, sector);
+ uint8_t cmd;
+
+ rc = ata_set_lba_sector(port, DISK_MASTER, sector);
if (rc != 0)
return rc;
- rc = ata_wr_cmd(ide, ATA_CMD_READ);
+
+ if (port->lba48)
+ cmd = ATA_CMD_PIO_READ_EXT;
+ else
+ cmd = ATA_CMD_READ;
+
+ rc = ata_wr_cmd(ide, cmd);
if (rc != 0)
return rc;
rc = ata_wait_ready(ide, MAX_TIMEOUT);
@@ -355,10 +379,18 @@ static int __maybe_unused ide_write(struct ata_port *port,
struct ide_port *ide = to_ata_drive_access(port);
while (num_blocks) {
- rc = ata_set_lba_sector(ide, DISK_MASTER, sector);
+ uint8_t cmd;
+
+ rc = ata_set_lba_sector(port, DISK_MASTER, sector);
if (rc != 0)
return rc;
- rc = ata_wr_cmd(ide, ATA_CMD_WRITE);
+
+ if (port->lba48)
+ cmd = ATA_CMD_PIO_WRITE_EXT;
+ else
+ cmd = ATA_CMD_WRITE;
+
+ rc = ata_wr_cmd(ide, cmd);
if (rc != 0)
return rc;
rc = ata_wait_ready(ide, MAX_TIMEOUT);
diff --git a/drivers/clk/clk-fixed-factor.c b/drivers/clk/clk-fixed-factor.c
index a3dbf33..0be4855 100644
--- a/drivers/clk/clk-fixed-factor.c
+++ b/drivers/clk/clk-fixed-factor.c
@@ -93,7 +93,6 @@ struct clk *clk_fixed_factor(const char *name,
return &f->clk;
}
-#if defined(CONFIG_COMMON_CLK_OF_PROVIDER)
/**
* of_fixed_factor_clk_setup() - Setup function for simple fixed factor clock
*/
@@ -127,4 +126,3 @@ static int of_fixed_factor_clk_setup(struct device_node *node)
}
CLK_OF_DECLARE(fixed_factor_clk, "fixed-factor-clock",
of_fixed_factor_clk_setup);
-#endif
diff --git a/drivers/clk/clk-fixed.c b/drivers/clk/clk-fixed.c
index f0f7fba..57bf36b 100644
--- a/drivers/clk/clk-fixed.c
+++ b/drivers/clk/clk-fixed.c
@@ -55,7 +55,6 @@ struct clk *clk_fixed(const char *name, int rate)
return &fix->clk;
}
-#if defined(CONFIG_COMMON_CLK_OF_PROVIDER)
/**
* of_fixed_clk_setup() - Setup function for simple fixed rate clock
*/
@@ -76,4 +75,3 @@ static int of_fixed_clk_setup(struct device_node *node)
return of_clk_add_provider(node, of_clk_src_simple_get, clk);
}
CLK_OF_DECLARE(fixed_clk, "fixed-clock", of_fixed_clk_setup);
-#endif
diff --git a/drivers/clocksource/mvebu.c b/drivers/clocksource/mvebu.c
index cf80571..59bbc4b 100644
--- a/drivers/clocksource/mvebu.c
+++ b/drivers/clocksource/mvebu.c
@@ -60,7 +60,7 @@ static int mvebu_timer_probe(struct device_d *dev)
struct clk *clk;
u32 rate, div, val;
- iores = dev_request_mem_resource(dev, 0);
+ iores = dev_get_resource(dev, IORESOURCE_MEM, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
timer_base = IOMEM(iores->start);
diff --git a/drivers/net/phy/mdio-gpio.c b/drivers/net/phy/mdio-gpio.c
index a839f2d..a846fb2 100644
--- a/drivers/net/phy/mdio-gpio.c
+++ b/drivers/net/phy/mdio-gpio.c
@@ -45,7 +45,7 @@ struct mdio_gpio_info {
int mdc_active_low, mdio_active_low, mdo_active_low;
};
-struct mdio_gpio_info *mdio_gpio_of_get_info(struct device_d *dev)
+static struct mdio_gpio_info *mdio_gpio_of_get_info(struct device_d *dev)
{
int ret;
enum of_gpio_flags flags;
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
index eb279ae..4292371 100644
--- a/drivers/usb/gadget/Kconfig
+++ b/drivers/usb/gadget/Kconfig
@@ -30,6 +30,17 @@ config USB_GADGET_DRIVER_PXA27X
default y
select USB_GADGET_DUALSPEED
+config USB_GADGET_AUTOSTART
+ bool
+ default y
+ select ENVIRONMENT_VARIABLES
+ select FILE_LIST
+ prompt "Automatically start usbgadget on boot"
+ help
+ Enabling this option allows to automatically start a fastboot
+ gadget during boot. This behaviour is controlled with the
+ global.usbgadget.fastboot_function variable.
+
comment "USB Gadget drivers"
config USB_GADGET_DFU
diff --git a/drivers/usb/gadget/Makefile b/drivers/usb/gadget/Makefile
index 9ef5945..e74cf02 100644
--- a/drivers/usb/gadget/Makefile
+++ b/drivers/usb/gadget/Makefile
@@ -1,5 +1,6 @@
obj-$(CONFIG_USB_GADGET) += composite.o config.o usbstring.o epautoconf.o udc-core.o functions.o config.o multi.o
+obj-$(CONFIG_USB_GADGET_AUTOSTART) += autostart.o
obj-$(CONFIG_USB_GADGET_SERIAL) += u_serial.o serial.o f_serial.o f_acm.o
obj-$(CONFIG_USB_GADGET_DFU) += dfu.o
obj-$(CONFIG_USB_GADGET_FASTBOOT) += f_fastboot.o
diff --git a/drivers/usb/gadget/autostart.c b/drivers/usb/gadget/autostart.c
new file mode 100644
index 0000000..4ad1dd6
--- /dev/null
+++ b/drivers/usb/gadget/autostart.c
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2017 Oleksij Rempel <o.rempel@pengutronix.de>, Pengutronix
+ *
+ * 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 <command.h>
+#include <errno.h>
+#include <environment.h>
+#include <malloc.h>
+#include <getopt.h>
+#include <fs.h>
+#include <xfuncs.h>
+#include <usb/usbserial.h>
+#include <usb/dfu.h>
+#include <usb/gadget-multi.h>
+#include <globalvar.h>
+#include <magicvar.h>
+
+static int autostart;
+static int acm;
+static char *fastboot_function;
+
+static int usbgadget_autostart(void)
+{
+ struct f_multi_opts opts = {};
+
+ if (!autostart)
+ return 0;
+
+ setenv("otg.mode", "peripheral");
+
+ if (fastboot_function)
+ opts.fastboot_opts.files = file_list_parse(fastboot_function);
+
+ opts.create_acm = acm;
+
+ return usb_multi_register(&opts);
+}
+postenvironment_initcall(usbgadget_autostart);
+
+static int usbgadget_globalvars_init(void)
+{
+
+ globalvar_add_simple_bool("usbgadget.autostart", &autostart);
+ globalvar_add_simple_bool("usbgadget.acm", &acm);
+ globalvar_add_simple_string("usbgadget.fastboot_function",
+ &fastboot_function);
+
+ return 0;
+}
+device_initcall(usbgadget_globalvars_init);
+
+BAREBOX_MAGICVAR_NAMED(global_usbgadget_autostart,
+ global.usbgadget.autostart,
+ "usbgadget: Automatically start usbgadget on boot");
+BAREBOX_MAGICVAR_NAMED(global_usbgadget_acm,
+ global.usbgadget.acm,
+ "usbgadget: Create CDC ACM function");
+BAREBOX_MAGICVAR_NAMED(global_usbgadget_fastboot_function,
+ global.usbgadget.fastboot_function,
+ "usbgadget: Create Android Fastboot function");
diff --git a/drivers/video/edid.c b/drivers/video/edid.c
index 2585264..bee4594 100644
--- a/drivers/video/edid.c
+++ b/drivers/video/edid.c
@@ -387,7 +387,7 @@ static void fb_timings_vfreq(struct __fb_timings *timings)
* REQUIRES:
* A valid info->monspecs, otherwise 'safe numbers' will be used.
*/
-int fb_get_mode(int flags, u32 val, struct fb_videomode *var)
+static int fb_get_mode(int flags, u32 val, struct fb_videomode *var)
{
struct __fb_timings *timings;
u32 interlace = 1, dscan = 1;
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index 63fb1a8..83b6528 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -46,4 +46,10 @@ config WATCHDOG_OMAP
help
Add support for watchdog on the TI OMAP SoC.
+config WATCHDOG_ORION
+ bool "Watchdog for Armada XP"
+ depends on ARCH_ARMADA_XP
+ help
+ Add support for watchdog on the Marvall Armada XP
+
endif
diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
index 5fca4c3..a3b2667 100644
--- a/drivers/watchdog/Makefile
+++ b/drivers/watchdog/Makefile
@@ -5,3 +5,4 @@ obj-$(CONFIG_WATCHDOG_MXS28) += im28wd.o
obj-$(CONFIG_WATCHDOG_DW) += dw_wdt.o
obj-$(CONFIG_WATCHDOG_JZ4740) += jz4740.o
obj-$(CONFIG_WATCHDOG_IMX_RESET_SOURCE) += imxwd.o
+obj-$(CONFIG_WATCHDOG_ORION) += orion_wdt.o
diff --git a/drivers/watchdog/orion_wdt.c b/drivers/watchdog/orion_wdt.c
new file mode 100644
index 0000000..2802033
--- /dev/null
+++ b/drivers/watchdog/orion_wdt.c
@@ -0,0 +1,123 @@
+/*
+ * Watchdog driver for Marvell Armada XP.
+ *
+ * Copyright (C) 2017 Pengutronix, Uwe Kleine-K├Ânig <kernel@pengutronix.de>
+ *
+ * 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 <errno.h>
+#include <init.h>
+#include <io.h>
+#include <malloc.h>
+#include <of.h>
+#include <watchdog.h>
+
+#define CLKRATE 25000000
+
+/* registers relative to timer_base (i.e. first reg property) */
+#define TIMER_CTRL 0x00
+#define TIMER_CTRL_WD_TIMER_25MHZ_EN BIT(10)
+#define TIMER_CTRL_WD_TIMER_EN BIT(8)
+
+#define TIMER_STATUS 0x04
+#define TIMER_STATUS_WD_EXPIRED BIT(31)
+
+#define TIMER_WD_TIMER 0x34
+
+/* registers relative to rstout_base (i.e. second reg property) */
+#define WD_RSTOUTn_MASK 0x00
+#define WD_RSTOUTn_MASK_GLOBAL_WD BIT(8)
+
+struct orion_wdt_ddata {
+ struct watchdog wd;
+ void __iomem *timer_base;
+ void __iomem *rstout_base;
+};
+
+static int armada_xp_set_timeout(struct watchdog *wd, unsigned timeout)
+{
+ struct orion_wdt_ddata *ddata =
+ container_of(wd, struct orion_wdt_ddata, wd);
+ u32 ctrl;
+
+ if (0xffffffff / CLKRATE < timeout)
+ return -EINVAL;
+
+ ctrl = readl(ddata->timer_base + TIMER_CTRL);
+
+ if (timeout == 0) {
+ /* disable timer */
+ ctrl &= ~TIMER_CTRL_WD_TIMER_EN;
+ writel(ctrl, ddata->timer_base + TIMER_CTRL);
+
+ return 0;
+ }
+
+ /* setup duration */
+ writel(CLKRATE * timeout, ddata->timer_base + TIMER_WD_TIMER);
+
+ /* clear expiration status */
+ writel(readl(ddata->timer_base + TIMER_STATUS) & ~TIMER_STATUS_WD_EXPIRED,
+ ddata->timer_base + TIMER_STATUS);
+
+ /* assert reset on expiration */
+ writel(WD_RSTOUTn_MASK_GLOBAL_WD, ddata->rstout_base + WD_RSTOUTn_MASK);
+
+ /* enable */
+ ctrl |= TIMER_CTRL_WD_TIMER_25MHZ_EN | TIMER_CTRL_WD_TIMER_EN;
+ writel(ctrl, ddata->timer_base + TIMER_CTRL);
+
+ return 0;
+}
+
+static int orion_wdt_probe(struct device_d *dev)
+{
+ struct orion_wdt_ddata* ddata;
+ struct resource *res_timer, *res_rstout;
+
+ ddata = xzalloc(sizeof(*ddata));
+
+ ddata->wd.set_timeout = armada_xp_set_timeout;
+ ddata->wd.name = "orion_wdt";
+ ddata->wd.dev = dev;
+
+ res_timer = dev_request_mem_resource(dev, 0);
+ if (IS_ERR(res_timer)) {
+ dev_err(dev, "could not get timer memory region\n");
+ return PTR_ERR(res_timer);
+ }
+ ddata->timer_base = IOMEM(res_timer->start);
+
+ res_rstout = dev_request_mem_resource(dev, 1);
+ if (IS_ERR(res_rstout)) {
+ dev_err(dev, "could not get rstout memory region\n");
+ release_region(res_timer);
+
+ return PTR_ERR(res_rstout);
+ }
+ ddata->rstout_base = IOMEM(res_rstout->start);
+
+ return watchdog_register(&ddata->wd);
+}
+
+static const struct of_device_id orion_wdt_of_match[] = {
+ {
+ .compatible = "marvell,armada-xp-wdt",
+ }, { /* sentinel */ }
+};
+
+static struct driver_d orion_wdt_driver = {
+ .probe = orion_wdt_probe,
+ .name = "orion_wdt",
+ .of_compatible = DRV_OF_COMPAT(orion_wdt_of_match),
+};
+device_platform_driver(orion_wdt_driver);
diff --git a/include/ata_drive.h b/include/ata_drive.h
index 44073cb..11685ee 100644
--- a/include/ata_drive.h
+++ b/include/ata_drive.h
@@ -37,8 +37,10 @@
#define ATA_CMD_ID_ATA 0xEC
#define ATA_CMD_READ 0x20
+#define ATA_CMD_PIO_READ_EXT 0x24
#define ATA_CMD_READ_EXT 0x25
#define ATA_CMD_WRITE 0x30
+#define ATA_CMD_PIO_WRITE_EXT 0x34
#define ATA_CMD_WRITE_EXT 0x35
/* drive's status flags */
@@ -140,6 +142,7 @@ struct ata_port {
void *drvdata;
struct block_device blk;
uint16_t *id;
+ int lba48;
int initialized;
int probe;
};
diff --git a/include/boot.h b/include/boot.h
index a855cbe..4f7612a 100644
--- a/include/boot.h
+++ b/include/boot.h
@@ -36,6 +36,8 @@ struct bootentry {
int bootentries_add_entry(struct bootentries *entries, struct bootentry *entry);
+int bootentry_register_provider(int (*fn)(struct bootentries *bootentries, const char *name));
+
#define bootentries_for_each_entry(bootentries, entry) \
list_for_each_entry(entry, &bootentries->entries, list)
diff --git a/include/bootchooser.h b/include/bootchooser.h
index c948247..7822c01 100644
--- a/include/bootchooser.h
+++ b/include/bootchooser.h
@@ -13,14 +13,14 @@ int bootchooser_put(struct bootchooser *bootchooser);
void bootchooser_info(struct bootchooser *bootchooser);
+int bootchooser_boot(struct bootchooser *bc);
+
struct bootchooser_target *bootchooser_get_last_chosen(struct bootchooser *bootchooser);
const char *bootchooser_target_name(struct bootchooser_target *target);
struct bootchooser_target *bootchooser_target_by_name(struct bootchooser *bootchooser,
const char *name);
void bootchooser_target_force_boot(struct bootchooser_target *target);
-int bootchooser_create_bootentry(struct bootentries *entries);
-
int bootchooser_target_set_attempts(struct bootchooser_target *target, int attempts);
int bootchooser_target_set_priority(struct bootchooser_target *target, int priority);
diff --git a/include/common.h b/include/common.h
index 680a0af..dd7445e 100644
--- a/include/common.h
+++ b/include/common.h
@@ -66,9 +66,6 @@ int readline (const char *prompt, char *buf, int len);
/* common/memsize.c */
long get_ram_size (volatile long *, long);
-/* $(CPU)/cpu.c */
-void __noreturn poweroff(void);
-
/* common/console.c */
int ctrlc (void);
diff --git a/include/globalvar.h b/include/globalvar.h
index 80bc53e..df43f1f 100644
--- a/include/globalvar.h
+++ b/include/globalvar.h
@@ -11,10 +11,6 @@ extern struct device_d global_device;
#ifdef CONFIG_GLOBALVAR
int globalvar_add_simple(const char *name, const char *value);
-int globalvar_add(const char *name,
- int (*set)(struct device_d *dev, struct param_d *p, const char *val),
- const char *(*get)(struct device_d *, struct param_d *p),
- unsigned long flags);
void globalvar_remove(const char *name);
char *globalvar_get_match(const char *match, const char *separator);
void globalvar_set_match(const char *match, const char *val);
@@ -80,14 +76,6 @@ static inline int globalvar_add_simple_ip(const char *name,
return 0;
}
-static inline int globalvar_add(const char *name,
- int (*set)(struct device_d *dev, struct param_d *p, const char *val),
- const char *(*get)(struct device_d *, struct param_d *p),
- unsigned long flags)
-{
- return 0;
-}
-
static inline void globalvar_remove(const char *name) {}
static inline void globalvar_print(void) {}
diff --git a/include/linux/clk.h b/include/linux/clk.h
index a061398..081a859 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -324,16 +324,13 @@ struct clk *clk_register_composite(const char *name,
struct device_node;
struct of_phandle_args;
+#if defined(CONFIG_COMMON_CLK_OF_PROVIDER)
+
#define CLK_OF_DECLARE(name, compat, fn) \
const struct of_device_id __clk_of_table_##name \
__attribute__ ((unused,section (".__clk_of_table"))) \
= { .compatible = compat, .data = fn }
-#if defined(CONFIG_COMMON_CLK_OF_PROVIDER)
-int of_clk_add_provider(struct device_node *np,
- struct clk *(*clk_src_get)(struct of_phandle_args *args,
- void *data),
- void *data);
void of_clk_del_provider(struct device_node *np);
typedef int (*of_clk_init_cb_t)(struct device_node *);
@@ -349,11 +346,27 @@ struct clk *of_clk_get(struct device_node *np, int index);
struct clk *of_clk_get_by_name(struct device_node *np, const char *name);
struct clk *of_clk_get_from_provider(struct of_phandle_args *clkspec);
unsigned int of_clk_get_parent_count(struct device_node *np);
-char *of_clk_get_parent_name(struct device_node *np, unsigned int index);
int of_clk_parent_fill(struct device_node *np, const char **parents,
unsigned int size);
int of_clk_init(struct device_node *root, const struct of_device_id *matches);
#else
+
+
+/*
+ * Create a dummy variable to avoid 'unused function'
+ * warnings. Compiler should be smart enough to throw it out.
+ */
+#define CLK_OF_DECLARE(name, compat, fn) \
+static const struct of_device_id __clk_of_table_##name \
+__attribute__ ((unused)) = { .data = fn }
+
+
+static inline struct clk *
+of_clk_src_simple_get(struct of_phandle_args *clkspec, void *data)
+{
+ return ERR_PTR(-ENOENT);
+}
+
static inline struct clk *of_clk_get(struct device_node *np, int index)
{
return ERR_PTR(-ENOENT);
@@ -374,4 +387,10 @@ struct string_list;
int clk_name_complete(struct string_list *sl, char *instr);
+int of_clk_add_provider(struct device_node *np,
+ struct clk *(*clk_src_get)(struct of_phandle_args *args,
+ void *data),
+ void *data);
+char *of_clk_get_parent_name(struct device_node *np, unsigned int index);
+
#endif
diff --git a/include/param.h b/include/param.h
index f5f82ee..f9f3398 100644
--- a/include/param.h
+++ b/include/param.h
@@ -6,7 +6,6 @@
#include <linux/list.h>
#define PARAM_FLAG_RO (1 << 0)
-#define PARAM_GLOBALVAR_UNQUALIFIED (1 << 1)
struct device_d;
typedef uint32_t IPaddr_t;
diff --git a/include/poweroff.h b/include/poweroff.h
new file mode 100644
index 0000000..ae9557d
--- /dev/null
+++ b/include/poweroff.h
@@ -0,0 +1,21 @@
+#ifndef __INCLUDE_POWEROFF_H
+#define __INCLUDE_POWEROFF_H
+
+void __noreturn poweroff_machine(void);
+
+struct poweroff_handler {
+ void (*poweroff)(struct poweroff_handler *);
+ int priority;
+ const char *name;
+ struct list_head list;
+};
+
+int poweroff_handler_register(struct poweroff_handler *);
+int poweroff_handler_register_fn(void (*poweroff_fn)(struct poweroff_handler *));
+
+#define POWEROFF_DEFAULT_PRIORITY 100
+#define POWEROFF_DEFAULT_NAME "default"
+
+unsigned int of_get_poweroff_priority(struct device_node *node);
+
+#endif /* __INCLUDE_POWEROFF_H */
diff --git a/scripts/tags.sh b/scripts/tags.sh
index 79fdafb..8ae4464 100755
--- a/scripts/tags.sh
+++ b/scripts/tags.sh
@@ -103,11 +103,6 @@ all_kconfigs()
find_other_sources 'Kconfig*'
}
-all_defconfigs()
-{
- find_sources $ALLSOURCE_ARCHS "defconfig"
-}
-
docscope()
{
(echo \-k; echo \-q; all_sources) > cscope.files
@@ -153,22 +148,14 @@ exuberant()
--regex-c++='/CLEARPAGEFLAG_NOOP\(([^,)]*).*/ClearPage\1/' \
--regex-c++='/__CLEARPAGEFLAG_NOOP\(([^,)]*).*/__ClearPage\1/' \
--regex-c++='/TESTCLEARFLAG_FALSE\(([^,)]*).*/TestClearPage\1/' \
- --regex-c++='/__TESTCLEARFLAG_FALSE\(([^,)]*).*/__TestClearPage\1/' \
--regex-c++='/_PE\(([^,)]*).*/PEVENT_ERRNO__\1/' \
--regex-c='/PCI_OP_READ\(([a-z]*[a-z]).*[1-4]\)/pci_bus_read_config_\1/' \
--regex-c='/PCI_OP_WRITE\(([a-z]*[a-z]).*[1-4]\)/pci_bus_write_config_\1/'
all_kconfigs | xargs $1 -a \
--langdef=kconfig --language-force=kconfig \
- --regex-kconfig='/^[[:blank:]]*(menu|)config[[:blank:]]+([[:alnum:]_]+)/\2/'
-
- all_kconfigs | xargs $1 -a \
- --langdef=kconfig --language-force=kconfig \
+ --regex-kconfig='/^[[:blank:]]*(menu|)config[[:blank:]]+([[:alnum:]_]+)/\2/' \
--regex-kconfig='/^[[:blank:]]*(menu|)config[[:blank:]]+([[:alnum:]_]+)/CONFIG_\2/'
-
- all_defconfigs | xargs -r $1 -a \
- --langdef=dotconfig --language-force=dotconfig \
- --regex-dotconfig='/^#?[[:blank:]]*(CONFIG_[[:alnum:]_]+)/\1/'
}
emacs()
@@ -198,19 +185,13 @@ emacs()
--regex='/CLEARPAGEFLAG_NOOP\(([^,)]*).*/ClearPage\1/' \
--regex='/__CLEARPAGEFLAG_NOOP\(([^,)]*).*/__ClearPage\1/' \
--regex='/TESTCLEARFLAG_FALSE\(([^,)]*).*/TestClearPage\1/' \
- --regex='/__TESTCLEARFLAG_FALSE\(([^,)]*).*/__TestClearPage\1/' \
--regex='/_PE\(([^,)]*).*/PEVENT_ERRNO__\1/' \
--regex='/PCI_OP_READ\(([a-z]*[a-z]).*[1-4]\)/pci_bus_read_config_\1/' \
--regex='/PCI_OP_WRITE\(([a-z]*[a-z]).*[1-4]\)/pci_bus_write_config_\1/'
all_kconfigs | xargs $1 -a \
- --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/\3/'
-
- all_kconfigs | xargs $1 -a \
+ --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/\3/' \
--regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/CONFIG_\3/'
-
- all_defconfigs | xargs -r $1 -a \
- --regex='/^#?[ \t]?\(CONFIG_[a-zA-Z0-9_]+\)/\1/'
}
xtags()