From 1088743f7901d02e8af9c6d615976322e7b04a32 Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Fri, 8 Jun 2018 10:42:44 +0200 Subject: mvebu: create bbu handler for kwb images and use it on cubox MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Uwe Kleine-König Signed-off-by: Sascha Hauer --- arch/arm/boards/solidrun-cubox/board.c | 15 +++++++++- arch/arm/mach-mvebu/Makefile | 1 + arch/arm/mach-mvebu/include/mach/bbu.h | 12 ++++++++ arch/arm/mach-mvebu/kwb_bbu.c | 54 ++++++++++++++++++++++++++++++++++ 4 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 arch/arm/mach-mvebu/include/mach/bbu.h create mode 100644 arch/arm/mach-mvebu/kwb_bbu.c 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 +#include +#include + +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 +#include +#include + +#include + +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; +} -- cgit v1.2.3 From b3baf2d861490184f058ed5966a36bf5679ef181 Mon Sep 17 00:00:00 2001 From: Roland Hieber Date: Wed, 13 Jun 2018 11:55:02 +0200 Subject: TODO: remove unused file This file was last touched in 2014-12, 2010-07 and 2009-12 and has at most historical value. Most of the open tasks are done, if not, they are probably out of date anyway. Signed-off-by: Roland Hieber Signed-off-by: Sascha Hauer --- TODO | 110 ------------------------------------------------------------------- 1 file changed, 110 deletions(-) delete mode 100644 TODO 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 -- cgit v1.2.3 From 053c9f33b1253981b5e7d076628e5ac1841a9e1d Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Wed, 13 Jun 2018 17:26:44 +0200 Subject: scripts: gitignore += omap3-usb-loader MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Uwe Kleine-König Signed-off-by: Sascha Hauer --- scripts/.gitignore | 1 + 1 file changed, 1 insertion(+) 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 -- cgit v1.2.3 From e10efc50805672b426f9cdcf4e72a1ba1bd89a8b Mon Sep 17 00:00:00 2001 From: Peter Mamonov Date: Wed, 13 Jun 2018 19:17:55 +0300 Subject: fs: fix memory access via /dev/mem for MIPS64 lseek checks for non-negative in-memory offsets (addresses), failing otherwise. However negative address 0xffffffffXXXXXXXX is a valid MIPS64 virtual address. Signed-off-by: Peter Mamonov Signed-off-by: Sascha Hauer --- fs/fs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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; } -- cgit v1.2.3 From 51c0c6454944d53b63de7b1f42484ed5dc64d703 Mon Sep 17 00:00:00 2001 From: Heinrich Toews Date: Mon, 18 Jun 2018 10:48:18 +0000 Subject: nand-bb: mtd_del_bb: fix missing pointer reset If an attached bb device was removed before the actual mtd device the code would try due to a missing pointer reset to access the no more present bb device handle which leads to a page fault. This bug was made visible by commit "7649473 mtd: nand: remove automatically created bb devices" which relys on a correct mtd->cdev_bb handling. Signed-off-by: Heinrich Toews Signed-off-by: Sascha Hauer --- drivers/mtd/nand/nand-bb.c | 2 ++ 1 file changed, 2 insertions(+) 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; } /** -- cgit v1.2.3 From be940f1a513b5167963174eca1d9509aaddda2fe Mon Sep 17 00:00:00 2001 From: Christoph Fritz Date: Mon, 18 Jun 2018 12:03:58 +0200 Subject: mmc_extcsd command: Add cmd option to set bkops-enable This patch is for convenience to set bkops-enable (EXT_CSD_BKOPS_EN[163]) on devices which have it not yet activated. Signed-off-by: Christoph Fritz Signed-off-by: Sascha Hauer --- commands/mmc_extcsd.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/commands/mmc_extcsd.c b/commands/mmc_extcsd.c index 82e0600eaf..3a418ea5e9 100644 --- a/commands/mmc_extcsd.c +++ b/commands/mmc_extcsd.c @@ -1482,7 +1482,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 +2371,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,6 +2391,13 @@ 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) @@ -2421,6 +2429,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 +2484,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 -- cgit v1.2.3 From 898ec202d06ccf89506b9f64bea438a1974b4687 Mon Sep 17 00:00:00 2001 From: Lucas Stach Date: Wed, 20 Jun 2018 11:47:49 +0200 Subject: video: backlight: add slew time parameter Currently the backlight implementation stretches a brightness change over a period of 100ms. While this is a fine default for PWM backlights, a user might wish to change this slew time to meet other constraints or even completely disable it for some backlight devices. Add a parameter and provide the default value from the backlight device. Signed-off-by: Lucas Stach Signed-off-by: Sascha Hauer --- drivers/video/backlight-pwm.c | 1 + drivers/video/backlight.c | 14 ++++++++++++-- include/video/backlight.h | 1 + 3 files changed, 14 insertions(+), 2 deletions(-) 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/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; -- cgit v1.2.3 From 578db478b16f4f2ccb6ee17ccac17353d5f5d04c Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Sun, 24 Jun 2018 14:29:56 -0700 Subject: fs: devfs-core: Make use of devpath_to_name() Signed-off-by: Andrey Smirnov Signed-off-by: Sascha Hauer --- fs/devfs-core.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) 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 #include #include +#include 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; -- cgit v1.2.3 From 8ca7053b3ffd12af20c2eff49082b6483b81d431 Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Sun, 24 Jun 2018 14:29:57 -0700 Subject: commands: mount: Make use of devpath_to_name() Signed-off-by: Andrey Smirnov Signed-off-by: Sascha Hauer --- commands/mount.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) 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) -- cgit v1.2.3 From f20f5ec7444bec35961938ea5b7cc249a058665d Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Sun, 24 Jun 2018 14:29:58 -0700 Subject: commands: mmc_extcsd: Make use of devpath_to_name() Signed-off-by: Andrey Smirnov Signed-off-by: Sascha Hauer --- commands/mmc_extcsd.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/commands/mmc_extcsd.c b/commands/mmc_extcsd.c index 3a418ea5e9..889a6c614a 100644 --- a/commands/mmc_extcsd.c +++ b/commands/mmc_extcsd.c @@ -22,6 +22,7 @@ #include #include #include +#include #define EXT_CSD_BLOCKSIZE 512 @@ -2404,10 +2405,8 @@ static int do_mmc_extcsd(int argc, char *argv[]) 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; -- cgit v1.2.3 From 0257de4753356c5e9a3a645f025f215e3037372f Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Sun, 24 Jun 2018 14:29:59 -0700 Subject: drivers: of: Make use of devpath_to_name() Signed-off-by: Andrey Smirnov Signed-off-by: Sascha Hauer --- drivers/of/of_path.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) 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 #include #include +#include #include @@ -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; -- cgit v1.2.3 From 36260f162defe41fe144d69756990519c4188c83 Mon Sep 17 00:00:00 2001 From: Oleksij Rempel Date: Fri, 29 Jun 2018 13:55:02 +0200 Subject: net: designware: make sure DMA is disabled on kernel start. Halt is not automatically executed if we start the kernel. So, we may have potentially memory corruptions. Signed-off-by: Oleksij Rempel Signed-off-by: Sascha Hauer --- drivers/net/designware.c | 8 ++++++++ drivers/net/designware.h | 1 + drivers/net/designware_generic.c | 1 + drivers/net/designware_socfpga.c | 1 + 4 files changed, 11 insertions(+) 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); -- cgit v1.2.3