2020-05-05 |
mtd: mtdraw: Fix cdev size calculation for large NANDs
...
Raw size for large NAND devices (> 4 GB) can exceed 32 bits, so we need
64 bit types as factors. Both factors are of 32 bit types, as such is
the return value. At least one factor needs to be 64 bit type when
calculating the size.
Signed-off-by: Stefan Riedmueller <s.riedmueller@phytec.de>
Signed-off-by: Christian Hemp <c.hemp@phytec.de>
Signed-off-by: Yunus Bas <y.bas@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Stefan Riedmueller
authored
on 4 May 2020
Sascha Hauer
committed
on 5 May 2020
|
2019-01-29 |
devfs: Drop dev_lseek_default()
...
Only the following cdevs do not declare an .lseek() operation:
- Console devices in common/console.c
- Firmware framework in common/firmware.c
- JTAG driver in drivers/misc/jtag.c
- UBI in drivers/mtd/ubi/barebox.c
Of those four, first two are marked DEVFS_IS_CHARACTER_DEV and
implement only .write() operation and the last two don't implement
anything but .ioctl(). While there's probably no meaningful way to use
lseek() against any of those devices, there doesn't seem to be any
harm in allowing it either.
Change devfs_lseek() to ignore absense of .lseek() callback and drop
dev_lseek_default() and all references to it in the codebase.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Andrey Smirnov
authored
on 29 Jan 2019
Sascha Hauer
committed
on 29 Jan 2019
|
2018-09-25 |
mtd: mtdraw: fix wrong alignment check
...
The write offset must be raw page size aligned on entry, not page size
aligned.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 25 Sep 2018
|
mtd: mtdraw: replace "block" with "page"
...
When the code says "block" it actually means "page" as this is what
the code handles. Rename the functions and variable names accordingly.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 25 Sep 2018
|
2018-09-24 |
mtd: mtdraw: fail when writing fails
...
When writing a block fails then fail the whole write process. There's
no point in returning the written bytes so far as this would only
indicate the caller to write the remaining bytes again which would
then fail.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 24 Sep 2018
|
mtd: mtdraw: add raw page size to private data
...
The raw page size is used many times in the driver, so add a variable
to the private data instead of calculating it each time again.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 24 Sep 2018
|
2018-09-21 |
mtd: mtdraw: pass mtdraw around
...
Pass mtdraw around internally instead of mtd. mtd can be accessed
easily from mtdraw, so we can also drop to_mtd().
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 21 Sep 2018
|
mtd: mtdraw: do not write empty buffers
...
When a page is completely 0xff then do not write it since users
expect pages to be writable when they are empty.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 21 Sep 2018
|
mtd: mtdraw: use dev_* for printing
...
We have a struct device_d *, so use dev_* for printing instead of
printf.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 21 Sep 2018
|
mtd: mtdraw: Simplify error path
...
We do not need a printf when writing fails, it's the callers job
to report this. Remove printf and simplify the error path a bit.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 21 Sep 2018
|
2018-04-06 |
rename file_operations -> cdev_operations
...
Linux also has struct file_operations which are something different.
Rename our file_operations to cdev_operations which better matches
what we have.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 6 Apr 2018
|
2017-05-17 |
mtd: only build mtdraw_raw_to_mtd_offset when write support is enabled
...
mtdraw_raw_to_mtd_offset() is only used from mtdraw_erase(), so will
only be referenced when MTD write support is enabled. This fixes a
harmless warning.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Lucas Stach
authored
on 11 May 2017
Sascha Hauer
committed
on 17 May 2017
|
2016-06-24 |
mtd: fix mtdraw_erase stub signature
...
Commit 81737c1d436a (mtd: Fix erasing of devices >4GiB) changed the
prototype of the erase function, but fogot to fix up the stub function
used when no MTD write support is built in.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Lucas Stach
authored
on 23 Jun 2016
Sascha Hauer
committed
on 24 Jun 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-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 mtdraw for Nand > 4GiB
...
The mtdraw code has some casts to avoid 64bit divisions. For Chips
>4GiB using 64bit types become necessary, so use them and to the
necessary 64bit math.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 9 Feb 2016
|
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
|
2014-03-12 |
mtd: Update internal API to support 64-bit device size
...
MTD internal API presently uses 32-bit values to represent device
size. This patch updates them to 64-bits but leaves the external API
unchanged.
In general, changing from 32-bit to 64-bit values cause little
or no changes to the majority of the code with the following
exceptions:
- printk message formats;
- division and modulus of 64-bit values (mtd_div_by_wb,
mtd_div_by_eb may be used in some of such cases).
Was tested on phyFLEX i.MX6.
Signed-off-by: Dmitry Lavnikevich <d.lavnikevich@sam-solutions.com>
Signed-off-by: Grigory Milev <g.milev@sam-solutions.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Dmitry Lavnikevich
authored
on 10 Mar 2014
Sascha Hauer
committed
on 12 Mar 2014
|
2014-02-26 |
mtd: mtdraw: Do not create for partitions and devices without oob
...
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 26 Feb 2014
|
2013-12-02 |
mtd: mtdraw: drop ioctl callback for mtdraw device
...
Do not call mtd_ioctl for mtdraw devices. mtd_ioctl will derefence
the priv pointer to a struct mtd_info whereas with mtdraw devices it will be
a struct mtdraw pointer. We do not need ioctls for mtdraw devices, so drop
it instead of fixing it.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 2 Dec 2013
|
2013-10-29 |
mtd: raw: rename raw device
...
The name of the raw device is mtdraw<num> which is inconsistent to other
mtd devices which are named mtd<num>.<partname>. Rename it to mtd<num>.raw.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 29 Oct 2013
|
2013-07-22 |
mtd: introduce mtd_read_oob and mtd_write_oob
...
Directly copied from the Kernel as of 3.11-rc1
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 22 Jul 2013
|
mtd: rename MTD_OOB_* to MTD_OPS_*
...
To sync with the Linux kernel.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 22 Jul 2013
|
2013-04-12 |
mtdraw: fix oob read and write
...
actually ops.ooboffs is not defaulted so when its value gets
added to chip->oob_poi in nand_fill_oob or nand_transfer_oob
the respective memcpy is using a wrong address.
With this patch, both md -s /dev/nandraw0 and cp xyz /dev/nandraw0.sb
are working fine on an i.MX28 target (instead of crashing the board).
Signed-off-by: Eric Bénard <eric@eukrea.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Eric Bénard
authored
on 11 Apr 2013
Sascha Hauer
committed
on 12 Apr 2013
|
2013-03-04 |
mtd: Add parameter to allow erasing bad blocks
...
While erasing bad blocks is a potentially dangerous operation
it is sometimes needed during development or when some foreign
code has touched the flash.
This patch adds a device parameter 'erasebad' to allow erasing
bad blocks. Since this is not wanted during production this is
behind a Kconfig option.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 4 Mar 2013
|
2013-02-14 |
mtd: Use mtd_* functions where appropriate
...
Instead of dereferencing struct mtd_info members directly use
the wrapper functions which have an additional check if the
callback exists if it is optional, like mark_bad or is_bad.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 14 Feb 2013
|
2012-11-16 |
Merge branch 'for-next/mtd'
...
Conflicts:
arch/arm/configs/at91sam9x5ek_defconfig
Sascha Hauer
committed
on 16 Nov 2012
|
2012-11-03 |
mtd: introduce mtd_block_isbad
...
this allow to do not provide block_isbad at mtd driver level
as example spi flash
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Jean-Christophe PLAGNIOL-VILLARD
authored
on 1 Nov 2012
Sascha Hauer
committed
on 3 Nov 2012
|
2012-10-26 |
mtd: fix mtdraw_write/mtdraw_erase arguments
...
For the !CONFIG_MTD_WRITE case they still have ulong as offset
argument.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 26 Oct 2012
|
2012-09-20 |
mtd mtdraw: fix fixing partial page read
...
toread is unitialized. We have to use count instead.
| commit 992c291
| Author: Sascha Hauer <s.hauer@pengutronix.de>
| Date: Sat Sep 15 16:54:47 2012 +0200
|
| mtd mtdraw: Fix partial page read
|
| When reading parts of a page we have to limit the maximum bytes copied
| to the remaining bytes of a page.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Sascha Hauer
committed
on 20 Sep 2012
|