summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--TODO110
-rw-r--r--arch/arm/boards/solidrun-cubox/board.c15
-rw-r--r--arch/arm/mach-mvebu/Makefile1
-rw-r--r--arch/arm/mach-mvebu/include/mach/bbu.h12
-rw-r--r--arch/arm/mach-mvebu/kwb_bbu.c54
-rw-r--r--commands/mmc_extcsd.c31
-rw-r--r--commands/mount.c5
-rw-r--r--drivers/mtd/nand/nand-bb.c2
-rw-r--r--drivers/net/designware.c8
-rw-r--r--drivers/net/designware.h1
-rw-r--r--drivers/net/designware_generic.c1
-rw-r--r--drivers/net/designware_socfpga.c1
-rw-r--r--drivers/of/of_path.c6
-rw-r--r--drivers/video/backlight-pwm.c1
-rw-r--r--drivers/video/backlight.c14
-rw-r--r--fs/devfs-core.c6
-rw-r--r--fs/fs.c4
-rw-r--r--include/video/backlight.h1
-rw-r--r--scripts/.gitignore1
19 files changed, 141 insertions, 133 deletions
diff --git a/TODO b/TODO
deleted file mode 100644
index 8527e577e0..0000000000
--- a/TODO
+++ /dev/null
@@ -1,110 +0,0 @@
-TODO
-----
-
-[ ] ask jbe about:
- ./commands/Makefile:40:obj-$(CONFIG_SIMPLE_PARSER) += setenv.o
-[ ] bark on partition not ending on flash sector boundaries
-[ ] Every driver should have a remove function.
- (It must have. Currently there is no provision to given to remove my
- interrupt handlers and to reset all hardware in use, before the target
- OS is called. csc 21.03.2008 19:50:34)
-[ ] Global shutdown_drivers() function is needed to carefully clean up all
- interrupt handlers and reset hardware to initial post reset or otherwise
- save state.
- (Ideally the hardware is set back to post-reset state after this call.
- Run-up and run-down should be reentrant, so if bootm is failing the system
- can re-initialize devices. csc 21.03.2008 19:48:49)
-[ ] Clean up make system. Currently I think there are many things from the
- Linux make system which are not needed for barebox.
- (Please retain definitions and related for module loading and relocation, so
- that special barebox modules containing an ELF object can be linked to the
- running barebox. csc 21.03.2008 19:52:49)
-[ ] get/set for nonextisting parameters crashes
-[ ] There is a xmalloc function which panics when out of memory. Use this
- function where we don't want to check for oom. Same applies to
- strdup/xstrdup.
-[ ] cleanup common.h. There are far too many things in it where we better have
- a seperate header file.
- (Use doxygen to track header file hierarchy)
-[ ] Rewrite network stack. The one-loop-for-all-protocols stack is just too
- ugly and big and uses thousands of global variables. Identify common
- functions and make a loop per network protocol
-[-] Cleanup cpu/*. Many functions there are not cpu specific. For example the
- cache functions for arm are common for most arm processors. (done for ARM)
- (I will check this for m68k arch - csc 21.03.2008 19:56:24)
-[ ] Move SoC specific header files from include/ to include/asm/arch/
-[ ] Several .c/.h files do not have GNU/copyright headers.
-[ ] The cramfs driver currently uses direct memory accesses instead of read().
- This disqualifies it for real block devices.
-[ ] Add documentation for:
- [ ] driver model
- [ ] device parameter
- [ ] big picture
-[ ] Add example driver and filesystem for reference purposes. Or denote a driver
- and a filesystem to be the reference.
-[ ] realloc seems to crash without further notice when out of memory.
-[ ] implement a mmap() function. Of course we cannot really mmap without mmu,
- but for memory mapped devices like nor flash we could provide a pointer to
- it. With this we would not have to copy uimages to memory.
-[ ] command line editing is somewhat broken
-[ ] how to select a ethernet channel for tftp when more than one interface
- of this type exists in the system?
-[ ] Cleanup headers. I propose to rearrange the files in a way to reflect the
- organisation of the source tree. This requires changing the include paths
- in nearly all files, therefore a merge window for this change must be
- opened and merge in of all other topic branches must happen before.
- Week 23 or 42 issue? csc, 21.03.2008 19:36:06
-[ ] Merge similiar information into a single common and a single arch dependant
- file. E.g. all those general typedefs should be located in include types.h
- and arch/asm/types.h. csc 21.03.2008 19:38:57
-[ ] Get rid of the current linux include dir. It should only contain information
- required to boot linux. csc 21.03.2008 19:39:02
-[ ] Unify source headers to show up the GPL lic stuff followed by a doxygen file
- description.
-[ ] Enhance and complete doxygen comments.
-[ ] Eliminate all #ifdef CONFIG_??? in C code. Disabled APIs should be defined
- as empty macros, so that code is removed by the compiler, not the
- preprocessor.
- The #ifdefs should be located in their related header files only.
-[ ] Create an example board, which implements all functions stubs required
- to compile a full barebox build. Functions are just stubs containing a
- panic() call - Real code must be filled in accordingly.
- Can be copied as starting point for a new target board.
-[ ] Add generic PCI bios code and a PCI bus driver model. The driver should
- be configured by an appropriate platformconfig. Detected PCI buses and
- devices should be represented as a hierarchical tree in /dev
-[ ] Work out, how to mount driver on PCI devices. The mechanism should be
- transparent to the driver code.
-
-DONE
-----
-
-[x] Rename vmlinux -> barebox
-[x] Implement current work directory
-[x] ARCH=linux should catch ctrl-c
-[x] Implement 'rm'
-[x] the mount command currently does not accept a full path (i.e. /dev/nor0) but
- only a device id string (nor0). This sucks.
-[x] FS support is not optional eventhough the Kconfig system claims it.
-[x] barebox used to have support for different consoles. The old code was huge and
- ineffective, so I removed it. Reimplement it using the driver model.
-[x] Mount without options should show mounted filesystems
-[x] Add/fix help texts for commands
-[x] mw is broken. Add common option parsing for mm/md
-[x] Implement a info command for malloced space. Use it to find memory holes.
-[x] patch hush.c so that you can get/set device parameters with dev.param= and remove
- get/set applets
-[x] rsc: switching on CONFIG_AUTO_COMPLETE fails, because env_complete()
- isn't there
-[x] The header files in include/asm-linux/ are i386 specific. Make it work on
- your i-Book (bigendian...)
-[x] Globbing support? Might be too expensive, but on the other hand, if you
- have the space, why not?
-[x] Implement protect/unprotect support for cfi devices.
-[x] Implement a command 'countdown' or similar. It should delay the boot
- process and interrupt it if a certain string is received. The string could
- be any key, ctrl-c or a certain string. Maybe like this:
- countdown -m msg -t timeout -x [ctrl-c|anykey|string]
- If done, remove the corresponding stuff from common/main.c
-[X] Board support should go to arch/*/boards/*
-[X] distclean doesn't work without a config
diff --git a/arch/arm/boards/solidrun-cubox/board.c b/arch/arm/boards/solidrun-cubox/board.c
index a28f4197df..aac93afb0c 100644
--- a/arch/arm/boards/solidrun-cubox/board.c
+++ b/arch/arm/boards/solidrun-cubox/board.c
@@ -14,4 +14,17 @@
*
*/
-/* empty */
+#include <common.h>
+#include <init.h>
+#include <mach/bbu.h>
+
+static int cubox_devices_init(void)
+{
+ if (!of_machine_is_compatible("solidrun,cubox"))
+ return 0;
+
+ mvebu_bbu_flash_register_handler("flash", "/dev/m25p0", 0, true);
+
+ return 0;
+}
+device_initcall(cubox_devices_init);
diff --git a/arch/arm/mach-mvebu/Makefile b/arch/arm/mach-mvebu/Makefile
index 87a8511919..6079403b83 100644
--- a/arch/arm/mach-mvebu/Makefile
+++ b/arch/arm/mach-mvebu/Makefile
@@ -4,4 +4,5 @@ obj-$(CONFIG_ARCH_ARMADA_XP) += armada-370-xp.o
obj-$(CONFIG_ARCH_ARMADA_38X) += armada-370-xp.o
obj-$(CONFIG_ARCH_DOVE) += dove.o
obj-$(CONFIG_ARCH_KIRKWOOD) += kirkwood.o
+obj-$(CONFIG_BAREBOX_UPDATE) += kwb_bbu.o
obj-$(CONFIG_BOOTM) += kwbootimage.o
diff --git a/arch/arm/mach-mvebu/include/mach/bbu.h b/arch/arm/mach-mvebu/include/mach/bbu.h
new file mode 100644
index 0000000000..a06db2b144
--- /dev/null
+++ b/arch/arm/mach-mvebu/include/mach/bbu.h
@@ -0,0 +1,12 @@
+#ifdef CONFIG_BAREBOX_UPDATE
+int mvebu_bbu_flash_register_handler(const char *name,
+ char *devicefile, int version,
+ bool isdefault);
+#else
+int mvebu_bbu_flash_register_handler(const char *name,
+ char *devicefile, int version,
+ bool isdefault)
+{
+ return -ENOSYS;
+}
+#endif
diff --git a/arch/arm/mach-mvebu/kwb_bbu.c b/arch/arm/mach-mvebu/kwb_bbu.c
new file mode 100644
index 0000000000..f79464fe53
--- /dev/null
+++ b/arch/arm/mach-mvebu/kwb_bbu.c
@@ -0,0 +1,54 @@
+#include <bbu.h>
+#include <libfile.h>
+#include <printk.h>
+
+#include <mach/bbu.h>
+
+struct mvebu_bbu_handler {
+ struct bbu_handler bbuh;
+ int version;
+};
+
+static int mvebu_bbu_flash_update_handler(struct bbu_handler *bbuh,
+ struct bbu_data *data)
+{
+ struct mvebu_bbu_handler *mbbuh =
+ container_of(bbuh, struct mvebu_bbu_handler, bbuh);
+ const void *image = data->image;
+ size_t size = data->len;
+ enum filetype ft = file_detect_type(image, size);
+
+ if ((mbbuh->version == 0 && ft == filetype_kwbimage_v0) ||
+ (mbbuh->version == 1 && ft == filetype_kwbimage_v1) ||
+ data->flags & BBU_FLAG_FORCE) {
+ int ret = bbu_confirm(data);
+ if (ret)
+ return ret;
+
+ return write_file_flash(bbuh->devicefile, image, size);
+ } else {
+ pr_err("%s is not a valid kwbimage\n", data->imagefile);
+ return -EINVAL;
+ }
+}
+
+int mvebu_bbu_flash_register_handler(const char *name,
+ char *devicefile, int version,
+ bool isdefault)
+{
+ struct mvebu_bbu_handler *mbbuh;
+ int ret;
+
+ mbbuh = xzalloc(sizeof(*mbbuh));
+ mbbuh->bbuh.devicefile = devicefile;
+ mbbuh->bbuh.handler = mvebu_bbu_flash_update_handler;
+ mbbuh->bbuh.flags = isdefault ? BBU_HANDLER_FLAG_DEFAULT : 0;
+ mbbuh->bbuh.name = name;
+ mbbuh->version = version;
+
+ ret = bbu_register_handler(&mbbuh->bbuh);
+ if (ret)
+ free(mbbuh);
+
+ return ret;
+}
diff --git a/commands/mmc_extcsd.c b/commands/mmc_extcsd.c
index 82e0600eaf..889a6c614a 100644
--- a/commands/mmc_extcsd.c
+++ b/commands/mmc_extcsd.c
@@ -22,6 +22,7 @@
#include <stdio.h>
#include <mci.h>
#include <getopt.h>
+#include <fs.h>
#define EXT_CSD_BLOCKSIZE 512
@@ -1482,7 +1483,7 @@ static int print_field(u8 *reg, int index)
str = "may";
else
str = "shall not";
- printf("\t[1] AUTO_EN: Device %s perform background ops while"
+ printf("\t[1] AUTO_EN: Device %s perform background ops while\n"
"\t not servicing the host\n", str);
return 1;
@@ -2371,11 +2372,12 @@ static int do_mmc_extcsd(int argc, char *argv[])
int write_operation = 0;
int always_write = 0;
int print_as_raw = 0;
+ int set_bkops_en = 0;
if (argc < 2)
return COMMAND_ERROR_USAGE;
- while ((opt = getopt(argc, argv, "i:v:yr")) > 0)
+ while ((opt = getopt(argc, argv, "i:v:yrb")) > 0)
switch (opt) {
case 'i':
index = simple_strtoul(optarg, NULL, 0);
@@ -2390,16 +2392,21 @@ static int do_mmc_extcsd(int argc, char *argv[])
case 'r':
print_as_raw = 1;
break;
+ case 'b':
+ set_bkops_en = 1;
+ index = EXT_CSD_BKOPS_EN;
+ value = BIT(0);
+ write_operation = 1;
+ always_write = 1;
+ break;
}
if (optind == argc)
return COMMAND_ERROR_USAGE;
devname = argv[optind];
- if (!strncmp(devname, "/dev/", 5))
- devname += 5;
- mci = mci_get_device_by_name(devname);
+ mci = mci_get_device_by_name(devpath_to_name(devname));
if (mci == NULL) {
retval = -ENOENT;
goto error;
@@ -2421,6 +2428,16 @@ static int do_mmc_extcsd(int argc, char *argv[])
goto error_with_mem;
}
+ if (set_bkops_en) {
+ if (dst[index]) {
+ printf("Abort: EXT_CSD [%u] already set to %#02x!\n",
+ index, dst[index]);
+ goto error_with_mem;
+ }
+ if (dst[EXT_CSD_REV] >= 7)
+ value |= BIT(1); /* set AUTO_EN bit too */
+ }
+
if (write_operation)
if (!print_field(dst, index)) {
printf("No field with this index found. Abort write operation!\n");
@@ -2466,12 +2483,14 @@ BAREBOX_CMD_HELP_OPT("-r", "print the register as raw data")
BAREBOX_CMD_HELP_OPT("-v", "value which will be written")
BAREBOX_CMD_HELP_OPT("-y", "don't request when writing to one time programmable fields")
BAREBOX_CMD_HELP_OPT("", "__CAUTION__: this could damage the device!")
+BAREBOX_CMD_HELP_OPT("-b", "set bkops-enable (EXT_CSD_BKOPS_EN[163])")
+BAREBOX_CMD_HELP_OPT("", "__WARNING__: this is a write-once setting!")
BAREBOX_CMD_HELP_END
BAREBOX_CMD_START(mmc_extcsd)
.cmd = do_mmc_extcsd,
BAREBOX_CMD_DESC("Read/write the extended CSD register.")
- BAREBOX_CMD_OPTS("dev [-r | -i index [-r | -v value [-y]]]")
+ BAREBOX_CMD_OPTS("dev [-r | -b | -i index [-r | -v value [-y]]]")
BAREBOX_CMD_GROUP(CMD_GRP_CONSOLE)
BAREBOX_CMD_HELP(cmd_mmc_extcsd_help)
BAREBOX_CMD_END
diff --git a/commands/mount.c b/commands/mount.c
index 4cf1179b7b..834b06386b 100644
--- a/commands/mount.c
+++ b/commands/mount.c
@@ -76,10 +76,7 @@ static int do_mount(int argc, char *argv[])
struct cdev *cdev;
const char *path;
- if (!strncmp(devstr, "/dev/", 5))
- devstr += 5;
-
- device_detect_by_name(devstr);
+ device_detect_by_name(devpath_to_name(devstr));
cdev = cdev_by_name(devstr);
if (!cdev)
diff --git a/drivers/mtd/nand/nand-bb.c b/drivers/mtd/nand/nand-bb.c
index c1977381d4..012163ebb2 100644
--- a/drivers/mtd/nand/nand-bb.c
+++ b/drivers/mtd/nand/nand-bb.c
@@ -316,6 +316,8 @@ void mtd_del_bb(struct mtd_info *mtd)
list_del_init(&bb->list);
free(bb->name);
free(bb);
+
+ mtd->cdev_bb = NULL;
}
/**
diff --git a/drivers/net/designware.c b/drivers/net/designware.c
index 862ee2f046..49ddaa20d8 100644
--- a/drivers/net/designware.c
+++ b/drivers/net/designware.c
@@ -471,6 +471,7 @@ struct dw_eth_dev *dwc_drv_probe(struct device_d *dev)
miibus = &priv->miibus;
edev->priv = priv;
+ dev->priv = edev;
edev->parent = dev;
edev->open = dwc_ether_open;
edev->send = dwc_ether_send;
@@ -489,3 +490,10 @@ struct dw_eth_dev *dwc_drv_probe(struct device_d *dev)
return priv;
}
+
+void dwc_drv_remove(struct device_d *dev)
+{
+ struct eth_device *edev = dev->priv;
+
+ dwc_ether_halt(edev);
+}
diff --git a/drivers/net/designware.h b/drivers/net/designware.h
index 4a99fa2aa6..6236d6c2e5 100644
--- a/drivers/net/designware.h
+++ b/drivers/net/designware.h
@@ -51,6 +51,7 @@ struct dw_eth_drvdata {
};
struct dw_eth_dev *dwc_drv_probe(struct device_d *dev);
+void dwc_drv_remove(struct device_d *dev);
#define CONFIG_TX_DESCR_NUM 16
#define CONFIG_RX_DESCR_NUM 16
diff --git a/drivers/net/designware_generic.c b/drivers/net/designware_generic.c
index 29269deac9..9d125b47a6 100644
--- a/drivers/net/designware_generic.c
+++ b/drivers/net/designware_generic.c
@@ -55,6 +55,7 @@ static __maybe_unused struct of_device_id dwc_ether_compatible[] = {
static struct driver_d dwc_ether_driver = {
.name = "designware_eth",
.probe = dwc_ether_probe,
+ .remove = dwc_drv_remove,
.of_compatible = DRV_OF_COMPAT(dwc_ether_compatible),
};
device_platform_driver(dwc_ether_driver);
diff --git a/drivers/net/designware_socfpga.c b/drivers/net/designware_socfpga.c
index 154c38f9a1..cb88882d66 100644
--- a/drivers/net/designware_socfpga.c
+++ b/drivers/net/designware_socfpga.c
@@ -179,6 +179,7 @@ static __maybe_unused struct of_device_id socfpga_dwc_ether_compatible[] = {
static struct driver_d socfpga_dwc_ether_driver = {
.name = "socfpga_designware_eth",
.probe = socfpga_dwc_ether_probe,
+ .remove = dwc_drv_remove,
.of_compatible = DRV_OF_COMPAT(socfpga_dwc_ether_compatible),
};
device_platform_driver(socfpga_dwc_ether_driver);
diff --git a/drivers/of/of_path.c b/drivers/of/of_path.c
index e53041b0a1..f8bbf2cba1 100644
--- a/drivers/of/of_path.c
+++ b/drivers/of/of_path.c
@@ -20,6 +20,7 @@
#include <common.h>
#include <malloc.h>
#include <of.h>
+#include <fs.h>
#include <linux/mtd/mtd.h>
@@ -142,10 +143,7 @@ struct device_node *of_find_node_by_devpath(struct device_node *root, const char
pr_debug("%s: looking for path %s\n", __func__, path);
- if (!strncmp(path, "/dev/", 5))
- path += 5;
-
- cdev = cdev_by_name(path);
+ cdev = cdev_by_name(devpath_to_name(path));
if (!cdev) {
pr_debug("%s: cdev %s not found\n", __func__, path);
return NULL;
diff --git a/drivers/video/backlight-pwm.c b/drivers/video/backlight-pwm.c
index ec35bd1bc0..997235a74a 100644
--- a/drivers/video/backlight-pwm.c
+++ b/drivers/video/backlight-pwm.c
@@ -206,6 +206,7 @@ static int backlight_pwm_of_probe(struct device_d *dev)
pwm_backlight->period = pwm_get_period(pwm_backlight->pwm);
+ pwm_backlight->backlight.slew_time_ms = 100;
pwm_backlight->backlight.brightness_set = backlight_pwm_set;
pwm_backlight->backlight.node = dev->device_node;
diff --git a/drivers/video/backlight.c b/drivers/video/backlight.c
index 09c0e47af6..30d52fcb68 100644
--- a/drivers/video/backlight.c
+++ b/drivers/video/backlight.c
@@ -15,6 +15,15 @@ int backlight_set_brightness(struct backlight_device *bl, int brightness)
if (brightness == bl->brightness_cur)
return 0;
+ if (!bl->slew_time_ms) {
+ ret = bl->brightness_set(bl, brightness);
+ if (ret)
+ return ret;
+
+ bl->brightness_cur = bl->brightness = brightness;
+ return 0;
+ }
+
if (brightness > bl->brightness_cur)
step = 1;
else
@@ -34,10 +43,9 @@ int backlight_set_brightness(struct backlight_device *bl, int brightness)
if (i == brightness)
break;
- udelay(100000 / num_steps);
+ udelay(bl->slew_time_ms * 1000 / num_steps);
}
-
bl->brightness_cur = bl->brightness = brightness;
return ret;
@@ -72,6 +80,8 @@ int backlight_register(struct backlight_device *bl)
dev_add_param_uint32(&bl->dev, "brightness", backlight_brightness_set,
NULL, &bl->brightness, "%d", bl);
+ dev_add_param_uint32(&bl->dev, "slew_time_ms", NULL, NULL,
+ &bl->slew_time_ms, "%d", NULL);
list_add_tail(&bl->list, &backlights);
diff --git a/fs/devfs-core.c b/fs/devfs-core.c
index 6b5e6da6a8..f017e1c55d 100644
--- a/fs/devfs-core.c
+++ b/fs/devfs-core.c
@@ -28,6 +28,7 @@
#include <linux/fs.h>
#include <linux/mtd/mtd.h>
#include <unistd.h>
+#include <fs.h>
LIST_HEAD(cdev_list);
@@ -155,10 +156,7 @@ struct cdev *cdev_open(const char *name, unsigned long flags)
struct cdev *cdev;
int ret;
- if (!strncmp(name, "/dev/", 5))
- name += 5;
-
- cdev = cdev_by_name(name);
+ cdev = cdev_by_name(devpath_to_name(name));
if (!cdev)
return NULL;
diff --git a/fs/fs.c b/fs/fs.c
index b66cc9b178..8a49e32b5c 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -962,7 +962,7 @@ loff_t lseek(int fildes, loff_t offset, int whence)
case SEEK_SET:
if (f->size != FILE_SIZE_STREAM && offset > f->size)
goto out;
- if (offset < 0)
+ if (IS_ERR_VALUE(offset))
goto out;
pos = offset;
break;
@@ -981,7 +981,7 @@ loff_t lseek(int fildes, loff_t offset, int whence)
}
pos = fsdrv->lseek(&f->fsdev->dev, f, pos);
- if (pos < 0) {
+ if (IS_ERR_VALUE(pos)) {
errno = -pos;
return -1;
}
diff --git a/include/video/backlight.h b/include/video/backlight.h
index 8dc49dc113..afa384cc9a 100644
--- a/include/video/backlight.h
+++ b/include/video/backlight.h
@@ -7,6 +7,7 @@ struct backlight_device {
int brightness_cur;
int brightness_max;
int brightness_default;
+ int slew_time_ms; /* time to stretch brightness changes */
int (*brightness_set)(struct backlight_device *, int brightness);
struct list_head list;
struct device_d dev;
diff --git a/scripts/.gitignore b/scripts/.gitignore
index 5aa2943a71..11ac77eb37 100644
--- a/scripts/.gitignore
+++ b/scripts/.gitignore
@@ -25,5 +25,6 @@ mk-am35xx-spi-image
mxsimage
mxsboot
mxs-usb-loader
+/omap3-usb-loader
omap4_usbboot
omap3-usb-loader