9
0
Fork 0
Commit Graph

31 Commits

Author SHA1 Message Date
Sascha Hauer db48d9d190 mtd: cfi-flash: Fix info
Since

636d384 mtd: cfi-flash: Add mtd concat support

The devinfo output is broken. dev->priv no longer contains a
struct flash_info * but instead a struct cfi_priv *.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-08-05 14:47:36 +02:00
Sascha Hauer 636d384ed4 mtd: cfi-flash: Add mtd concat support
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-23 16:59:54 +02:00
Sascha Hauer 713285ca19 mtd: cfi-flash: remove dead code
CFG_FLASH_PROTECTION is never defined, remove the code. Also
remove code inside #if 0.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-22 10:38:31 +02:00
Sascha Hauer 9746f02cae mtd: cfi-flash: Coding style cleanup
- use consistent variable types (drop uchar, ushort and friends)
- remove whitespace between functions and opening brace
- Add some blank lines to rectify code
- drop 'rc' and 'retcode' and use 'ret' consistently
- Do not put variable assignment into if()
- drop unncessary braces

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-22 10:38:31 +02:00
Sascha Hauer 6be93f2fce mtd: cfi-flash: use unaligned accessor functions
Some members in struct cfi_qry are unaligned. Use get_unaligned_*
to access them. Fixes unaligned aborts on busses which don't support
unaligned accesses.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-22 09:27:59 +02:00
Sascha Hauer 9c48ac000b mtd: cfi-flash: turn some messages into vdbg
Some messages produce a lot of log spam. Turn them into
dev_vdbg to make some more important messages more visible.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-22 09:27:59 +02:00
Sascha Hauer 81d8fa83b4 mtd: cfi-flash: return 0 for success
Use zero as success return code and negative standard error codes
consistently in the driver.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-22 09:26:52 +02:00
Sascha Hauer 0203b33d14 mtd: cfi-flash: make flash_detect_width more readable
Use variables instead of long defines to get the loops into a single
line. Also use goto to move the deeply indented code more to the left.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-22 09:17:16 +02:00
Sascha Hauer 20a096120a mtd: cfi-flash: remove unnecessary ifdefs
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-22 09:17:16 +02:00
Sascha Hauer 25b42d1fe7 mtd: cfi-flash: replace ifdef with IS_ENABLED
TO get rid of some ifdefs. While at it add the vendor code of
the unsupported vendor to the error message.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-22 09:16:40 +02:00
Sascha Hauer 2ec3921248 mtd: cfi-flash: statically initialize instead of memset
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-22 08:59:59 +02:00
Sascha Hauer bbc89b5754 mtd: cfi-flash: save indention level
Bail out early in flash_get_size() and save an indention level.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-22 08:58:56 +02:00
Sascha Hauer 1099bd178e mtd: cfi-flash: We can print longlongs
printf supports printing longlongs, so drop print_longlong.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-22 08:58:15 +02:00
Masahiro Yamada 5731d3ebcc Abolish cpu_read* and cpu_write* accessors
Commit 2e6a88f210 (add cpu native ordered io accessors) introduced
these macros and then commit be57f20cdd (Fix big endian MMIO
primitives) figured out they are equivalent to __raw_{read,write}*.

They turned out unnecessary after all.  Anyway, most source files
use __raw_read* and __raw_write*.

Let's replace a few remaining references and abolish them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-20 08:05:44 +02:00
Sascha Hauer fa93e4fb60 Merge branch 'for-next/resource-err-ptr' 2014-10-02 08:54:42 +02:00
Franck Jullien 9f0133d489 Subject: [PATCH] cfi: print size in human readable format
The CFI size is now printed in a human readable format.
It also adds "0x" prefix to the printed address.

Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-09-24 06:44:26 +02:00
Sascha Hauer ed6e965824 resource: Let dev_request_mem_region return an error pointer
For all users fix or add the error check.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-09-16 08:32:10 +02:00
Herve Codina d2d058365c mtd: fix mtd erasesize
Set mtd erasize using max erasesize from erase regions

Signed-off-by: Herve Codina <Herve.CODINA@celad.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-06-10 08:38:39 +02:00
Philippe Rétornaz fb7836ebf6 cfi_flash: fix NULL pointer dereference
We need to setup the info->dev pointer before flash_get_size() since it
might use it for dev_dbg().
This fix a crash on boot when debug output is enabled.

Signed-off-by: Philippe Rétornaz <philippe.retornaz@epfl.ch>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-28 09:03:04 +01:00
Cristiano De Alti 4f2f9150b7 cfi_flash.c: correct calculation of region erasesize and offset for multiple (size_ratio > 1) chips in parallel
Signed-off-by: Cristiano De Alti <cristiano_dealti@hotmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-04 08:21:51 +01:00
Sascha Hauer d317b1bf85 mtd: Pass device_id to add_mtd_device
Right now we do not support persistent names for mtd devices. The
base name can be passed to add_mtd_device, but this is always appended
with a dynamic number. With this patch add_mtd_device takes a device_id
argument which can be used to create a mtd device with an exact name.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-10-29 09:10:21 +01:00
Sascha Hauer 8f9044927d Merge branch 'for-next/mci'
Conflicts:
	include/driver.h
2013-06-02 16:28:21 +02:00
Sascha Hauer 73b0d228e5 driver: Attach info callback to device, not to driver
Since the info is device specific and not driver specific, attach
the callback to the device. This makes it possible to have a info
callback for a device which does not have a driver attached.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-30 12:18:27 +02:00
Sascha Hauer ecceaac8e7 cfi: make hardware device parent of mtd device
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-27 18:25:03 +02:00
Sascha Hauer 736f711917 cfi: Add dev * to flash_info and switch to dev_*
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-27 18:24:59 +02:00
Sascha Hauer 6d7cd20442 cfi: remove unused field from struct flash_info
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-27 18:24:53 +02:00
Oleksij Rempel 24b9ea6e75 cfi_flash: size_ratio should not be 0
We will get size = 0 if size_ratio = 0

Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-27 18:24:05 +02:00
Oleksij Rempel fbf9d87633 cfi_flash: add shift option for some cfi memory chips
Many cfi chips support 16 and 8 bit modes. Most important
difference is use of so called "Q15/A-1" pin. In 16bit mode this
pin is used for data IO. In 8bit mode, it is an address input
which add one more least significant bit (LSB). In this case
we should shift all adresses by one:
For example 0xaa << 1 = 0x154

Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-27 18:23:55 +02:00
Sascha Hauer 62ee96bd3b Merge branch 'for-next/mtd'
Conflicts:
	arch/arm/configs/eukrea_cpuimx27_defconfig
	drivers/mtd/core.c
2013-03-04 09:21:49 +01:00
Sascha Hauer ef06284cd9 mtd nor: remove unnecessary 'depend' in Kconfig
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-02-18 11:21:47 +01:00
Sascha Hauer 2749fbac48 nor flash: integrate into mtd
CFI Flash is currently handled outside the mtd layer which makes it
a special case. Integrate it into mtd so that we get rid of this
special status.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-02-14 23:37:53 +01:00