2017-04-11 |
param: make parameter functions more consistent
...
This patch creates a consitent set of device parameter functions.
With this we have: dev_add_param_<type><access>
"type" is one of: int32, uint32, int64, uint64, string, mac, ipv4, enum, bitmask
The improvement here is that we now can exactly specify the width of the
int type parameters and also correctly distinguish between signed and
unsigned variables which means that a variable no longer ends up with
INT_MAX when it's assigned -1.
"access" can be empty for regular read/write parameter, "_ro" for readonly
parameters which get their value from a variable pointer in the
background or "_fixed" for parameters which are set to a fixed value
(without a pointer in the background).
Some more exotic types are not (yet) implemented, like
dev_add_param_ip_ro.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 11 Apr 2017
|
mtd: use dev_add_param_string
...
dev_add_param_string allows to pass a priv * so that the device_d *
argument is not needed and can be removed later.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 11 Apr 2017
|
2017-03-30 |
of: partition: Move of_mtd_fixup to drivers/of/
...
Move the fixup code where the parser code is already.
Since the code will not only be used for mtd in the future
drivers/of/ is a better place than drivers/mtd/.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 30 Mar 2017
|
2017-03-23 |
mtd: fix reading data from page that needs cleanup
...
mtd_read´() returns -EUCLEAN to indicate that a page needs cleanup.
This value shouldn't be returned from the mtd read file operation
since this should return the number of bytes read.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 23 Mar 2017
|
2016-11-11 |
mtd: Make UBI detection more robust
...
When we want to detect if a mtd device contains an UBI image then
testing the first block is not enough since it can always happen that
UBI has just erased the block before the power failed during last boot.
Since UBI only ever erases one block at a time and directly writes the
ec header to it afterwards, it shouldn't be necessary to scan the whole
device for UBI data. Scan the first 64 blocks. The first non-empty block
then must contain UBI data, if instead we find foreign data we assume
that no UBI is on that mtd device.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 11 Nov 2016
|
2016-04-15 |
string: Fix (v)asprintf prototypes
...
Our asprintf and vasprintf have different prototypes than the glibc
functions. This causes trouble when we want to share barebox code
with userspace code. Change the prototypes for (v)asprintf to match
the glibc prototypes. Since the current (v)asprintf are convenient
to use change the existing functions to b(v)asprintf.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 15 Apr 2016
|
2016-03-15 |
mtd: Introduce mtd_check_pattern
...
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 15 Mar 2016
|
mtd: rename mtd_all_ff -> mtd_buf_all_ff
...
To make clear this function checks a given buffer and not data on a mtd
device.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 15 Mar 2016
|
mtd: Introduce function to get mtd type string
...
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 15 Mar 2016
|
mtd: Add support for marking blocks as good
...
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 15 Mar 2016
|
2016-03-04 |
mtd: mtd_[read|write|erase]: check for valid input data
...
mtd_[read|write|erase] are input functions to the mtd subsystem, so
check for valid input data here rather than relying on the drivers doing
this. The checks are copied from the Kernel as of 4.5-rc5
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 4 Mar 2016
|
2016-02-23 |
mtd: core: check offset in mtd_block_markbad
...
Check if the given offset is valid for the mtd device. Print an error
message if not to inform the user in the command 'nand'.
Signed-off-by: Stefan Christ <s.christ@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Stefan Christ
authored
on 15 Feb 2016
Sascha Hauer
committed
on 23 Feb 2016
|
2016-02-09 |
mtd: Fix erasing of devices >4GiB
...
When a device >4GiB is erased, not only the offset can be bigger
than 4GiB, but also the size. This happens with the simplest command
to erase a device: erase /dev/nand0. Make the size argument a 64bit
type to make this work.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 9 Feb 2016
|
mtd: Fix mtd_op_erase for devices >4GiB
...
The mtd erase file operation has a unnecessary conversion to unsigned
long in the offset. Remove it to make it work with chips >4GiB.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 9 Feb 2016
|
mtd: Fix mtd_op_read for devices >4GiB
...
The mtd read file operation has a unnecessary conversion to unsigned
long in the read offset. Remove it to make it work with chips >4GiB
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 9 Feb 2016
|
mtd: Make erase_info structs 64bit where necessary
...
Make the userspace structs 64bit where necessary. Since we do not have
separated kernel/userspace in barebox we can just modifiy the original
structs instead of adding separate 64bit structs.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 9 Feb 2016
|
2015-11-23 |
mtd: core: initialize *retlen in mtd_write()
...
Some mtd drivers like the spi-nor driver do not assign a value
to the retlen pointer but instead only add the bytes written
to *retlen. Users of mtd_write expect the variable to be initialized
by the mtd core though, so we have to do it in mtd_write(). The
same is done in mtd_read already.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 23 Nov 2015
|
2015-07-23 |
mtd: of: put master offset into partition name
...
Partition names should be partition@<offset> with <offset> being the
offset in the master mtd, and not a counting number.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 23 Jul 2015
|
2015-07-20 |
mtd: core: Check partitions for empty string
...
Make setting partitions a litte bit more robust.
Signed-off-by: Teresa Remmet <t.remmet@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Teresa Remmet
authored
on 17 Jul 2015
Sascha Hauer
committed
on 20 Jul 2015
|
2015-07-03 |
Merge branch 'for-next/mtd'
...
Conflicts:
drivers/mtd/core.c
Sascha Hauer
committed
on 3 Jul 2015
|
2015-06-29 |
mtd: Make devname argument to add_mtd_device const
...
add_mtd_device duplicates the string where necessary, so make it
const.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 29 Jun 2015
|
2015-06-26 |
mtd: detect ubi devices automatically
...
Hook UBI attachment into the mtd class devices detect function. This
makes it possible to attach ubi devices with 'detect nand0.root'.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 26 Jun 2015
|
2015-05-15 |
mtd: Fix function prototype
...
mtd_op_protect must return int instead of size_t.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 15 May 2015
|
2015-05-06 |
Merge branch 'for-next/misc'
Sascha Hauer
committed
on 6 May 2015
|
2015-05-01 |
mtd: of_mtd_fixup(): fix given DT not the default one
...
We have to start searching for the mtd node starting in the given root node not
the defaukt (= barebox internal) one. This means the internal DT is always
fixed up. This leads to booting not fixed up DT when using external DTs.
This patch fixes the problem.
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Marc Kleine-Budde
authored
on 30 Apr 2015
Sascha Hauer
committed
on 1 May 2015
|
2015-04-28 |
mtd: partition: Fix OF partition fixup
...
To get the number of address cells and size cells we have to use
the newly created partition node, not the parent device node. The
parent device node returns the address/size cells of the controller
node, not the partition node.
On an am335x machine this fixes the device tree passed to Linux.
The situation there is:
...
gpmc@50000000 {
...
#address-cells = <0x2>;
#size-cells = <0x1>;
ranges = <0x0 0x0 0x8000000 0x10000000>;
...
nand@0,0 {
reg = <0x0 0x0 0x0>;
#address-cells = <0x1>;
#size-cells = <0x1>;
...
partition@7 {
label = "system";
reg = <0x220000 0x7de0000>;
};
};
};
and without this patch barebox passes three bytes for
partition@7's reg property instead of only two which naturally
confuses Linux and yields to the system partition to start at 0
with a size of 0x220000.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Reported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Tested-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Sascha Hauer
committed
on 28 Apr 2015
|
2015-02-12 |
mtd: fixup device tree partitions
...
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 12 Feb 2015
|
mtd: Add a partitions parameter to mtd devices
...
The partitions parameter allows to partition a mtd device
using a standard cmdline partition description string. This
way the partitions of a mtd device can be changed at once.
The output of the string can be used to be passed to the kernel
as cmdline partition string. The partitions can also still be
changed with addpart/delpart, the partitions parameter will
be updated accordingly.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 12 Feb 2015
|
mtd: forbid conflicting mtd partitions
...
mtd partitions should not conflict with each other, so forbid this.
Also add the partitions to the partitions list sorted, so that they
can be easier translated into a cmdline partition string.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 12 Feb 2015
|
mtd: nand: remove automatically created bb devices
...
the bb devices which are created in add_mtd_device() must be removed
in del_mtd_device(). Also remove deletion of the bb devices in the
mtdparts-add environment file.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 12 Feb 2015
|