9
0
Fork 0
Commit Graph

46 Commits

Author SHA1 Message Date
Alexander Shiyan 6a256321b8 Use new device_platform_driver() macro for drivers
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-02-13 09:23:28 +01:00
Sascha Hauer a01e54d201 treewide: fix format specifiers
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-27 14:24:10 +01:00
Jean-Christophe PLAGNIOL-VILLARD 3c5327e660 switch all platform_bus device/driver registering to platform_driver/device_register
now register_driver and register_device are for bus only usage.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-10-04 15:19:12 +02:00
Sascha Hauer d1e65d2a7b Merge branch 'for-next/remove-fsf-address'
Conflicts:
	drivers/net/miidev.c
	include/miidev.h
2012-10-03 21:12:48 +02:00
Sascha Hauer a3cd9a7ebe Merge branch 'for-next/mtd' 2012-10-03 21:11:06 +02:00
Sascha Hauer 2790d29b58 cfi-flash: Add devicetree probe support
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-09-23 21:15:12 +02:00
Sascha Hauer 77322aa896 Treewide: remove address of the Free Software Foundation
The FSF address has changed in the past. Instead of updating it
each time the address changes, just drop it completely treewide.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-09-17 10:57:41 +02:00
Jan Luebbe aa577bfc6d drivers/nor/cfi_flash: use IS_ENABLED instead of an ifdef
Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-09-16 09:55:18 +02:00
Sascha Hauer 3e503822c7 use loff_t for file offsets
This is a first step for 64bit file support: Make the file sizes/offsets
64bit.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-06-30 16:53:24 +02:00
Sascha Hauer 51885a7d73 Change byte order detection mechanism to kernel style
The Linux Kernel defines only one of __LITTLE_ENDIAN and
__BIG_ENDIAN. Endianess can then be tested with #ifdef __xx_ENDIAN. Userspace
always defined both __LITTLE_ENDIAN and __BIG_ENDIAN and byteorder can then
be tested with #if __BYTE_ORDER == __xx_ENDIAN.

As we tend to use a lot of Kernel code in barebox we switch to use the kernel
way of determing the byte order.

As this always causes a lot of confusion add a check to include/common.h to
make sure only one of __LITTLE_ENDIAN and __BIG_ENDIAN is defined.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-06-28 13:49:16 +02:00
Sascha Hauer 2024fa56ff cfi flash: fix flash_make_cmd for big endian access
This is broken on big endian systems since:

943b271 cfi_flash: support of u32 cmd

I looked over it and I *think* that the function was correct
for both big and little endian systems before this patch.
To support u32 cmd we only have to change the data type of
the command from u8 to u32.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Teresa Gámez <t.gamez@phytec.de>
2011-09-23 16:32:48 +02:00
Sascha Hauer 3ee7877a48 introduce io.h
To allow for some generic io accessors introduce io.h and use
this instead of asm/io.h throughout the tree.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-09-22 19:03:05 +02:00
Teresa Gámez 943b27107c cfi_flash: support of u32 cmd
Some NOR flash chips have commands with length greater than the maximum
value size of uchar.

Based on an U-Boot Patch by Vasiliy Leoenenko <vasiliy.leonenko@mail.ru>

Only tested with little endian on an intel cfi_flash.

Signed-off-by: Teresa Gámez <t.gamez@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-08-26 09:33:37 +02:00
Jean-Christophe PLAGNIOL-VILLARD 13da42d6d7 cfi_flash: convert missing map_base
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2011-07-30 02:05:26 +08:00
Sascha Hauer 8262d20dae cfi: convert to struct resource
This is the non invasive approach. All this type casting
shows this driver should be really cleaned up (or retired)

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-07-19 00:12:53 +08:00
Sascha Hauer 2f0109b1bb Merge branch 'master' into next 2011-01-17 09:43:40 +01:00
Krzysztof Halasa 04e89d094a CFI NOR flash: fix write timeout units.
Write timeouts are expressed in microseconds. Milliseconds are 1000 times
longer than microseconds, not 1000 times shorter.

Before (Intel 28F128J3D75):

CFI conformant FLASH (16 x 16)  Size: 16 MB in 128 Sectors
  Intel Extended command set, Manufacturer ID: 0x89, Device ID: 0x18
  Erase timeout: 4096 ms, write timeout: 256000 ms
  Buffer write timeout: 1024000 ms, buffer size: 32 bytes

After:
  ...
  Erase timeout: 4096 ms, write timeout: 256 us
  Buffer write timeout: 1024 us, buffer size: 32 bytes

Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-01-17 08:26:06 +01:00
Krzysztof Halasa c5baa0edc4 Fix error handling with malloc, memalign etc. Introduce xmemalign().
The idea is to panic() when there is no memory available for normal
operation. Exception: code which can consume arbitrary amount of RAM
(example: files allocated in ramfs) must report error instead of panic().

This patch also fixes code which didn't check for NULL from malloc() etc.

Usage: malloc(), memalign() return NULL when out of RAM.
xmalloc(), xmemalign() always return non-NULL or panic().

Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-01-07 10:21:22 +01:00
Krzysztof Halasa 72e94e7373 Fix NOR CFI flash driver to work on big endian systems.
Fix NOR CFI flash driver to work on big endian systems.
Basically this transforms the u8/u16/u32/u64 union into
a single u64 value.

Not tested on LE platform. Apply with caution.

Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-12-21 09:02:40 +01:00
Krzysztof Halasa d66ae58cd8 Cosmetic fixes, including format attributes for printf() and friends.
Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-12-21 09:02:40 +01:00
Krzysztof Halasa e2bf1aec90 Flash CFI: removed unused 'size' variable.
Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-12-21 09:02:40 +01:00
Sascha Hauer f4b1ebd2fd cfi flash driver: check for ctrl-c during erase
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-12-20 09:28:21 +01:00
Jean-Christophe PLAGNIOL-VILLARD 9985498695 cfi_flash: introduce flash cmdset fixup
Move fixing up like geometry reversal into separate functions.
The geometry reversal fixup is now performed
by altering the qry structure directly, which makes the sector init
code slightly cleaner.

based on U-Boot

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2010-12-03 01:53:14 +08:00
Jean-Christophe PLAGNIOL-VILLARD 0df2a8d263 cfi_flash: move reset command assigment to specific chipset init function
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2010-12-03 01:53:14 +08:00
Jean-Christophe PLAGNIOL-VILLARD 04191aa0fc cfi_flash: do not reset flash when probe fails
The CFI flash driver starts at flash_init() which calls down into
flash_get_size().  This starts by calling flash_detect_cfi().  If said
function fails, flash_get_size() finishes by attempting to reset the
flash.  Unfortunately, it does this with an info->portwidth set to 0x10
which filters down into flash_make_cmd() and that happily smashes the
stack by sticking info->portwidth bytes into a cfiword_t variable that
lives on the stack.  On a 64bit system you probably won't notice, but
killing the last 8 bytes on a 32bit system usually leads to a corrupt
return address.  Which is what happens on a Blackfin system.

based on U-Boot

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2010-12-03 01:53:13 +08:00
Jean-Christophe PLAGNIOL-VILLARD fec9928dc7 cfi_flash: Read whole QRY structure in one go
Read out the whole CFI Standard Query structure after successful cfi
identification. This allows subsequent code to access this information
directly without having to go through flash_read_uchar() and friends.

based on U-Boot

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2010-12-03 01:53:13 +08:00
Jean-Christophe PLAGNIOL-VILLARD 6bc05afea5 cfi_flash: Introduce read and write accessors
Introduce flash_read{8,16,32,64) and flash_write{8,16,32,64} and use
them to access the flash memory. This makes it clearer when the flash
is actually being accessed; merely dereferencing a volatile pointer
looks just like any other kind of access.

based on U-Boot

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2010-12-03 01:53:13 +08:00
Jean-Christophe PLAGNIOL-VILLARD 8b41ca208e cfi_flash: update manufacturer id flash support
several first banks can contain 0x7f instead of actual ID

support as done in linux

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2010-12-03 01:53:12 +08:00
Jean-Christophe PLAGNIOL-VILLARD 64e70cd050 cfi_flash: use amd and standard reset flash command at probing
as we do not known which flash we have yet

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2010-12-03 01:53:12 +08:00
Jean-Christophe PLAGNIOL-VILLARD ae416f6270 cfi_flash: move flash_read_uchar from inline to noinline
it will reduce the binary size of 28 bytes
and fix some issue observerd during the porting of the at91rm9200ek
when reading the device_id and manufacturor_id

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2010-12-03 01:53:12 +08:00
Jean-Christophe PLAGNIOL-VILLARD 322b9af875 cfi_flash: move intel real protect flash support to cfi_flash_intel.c
let an empty function for amd as we will add later atmel real protect flash

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2010-12-03 01:53:12 +08:00
Sascha Hauer 8196b9e2cc cfi_flash: Add mtd partition support for UBI
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-07-05 15:07:09 +02:00
Sascha Hauer b6b76c4ee2 cfi_flash: Do not print debug info while erasing
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-07-05 13:00:02 +02:00
Sascha Hauer 497445d51e cfi_flash: Do not typedef struct flash_info
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-07-05 13:00:02 +02:00
Sascha Hauer b99e2c4ac6 cfi flash driver: Use generic progression bar function
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-06-28 10:43:55 +02:00
Uwe Kleine-König 7a0a29ca36 cfi_flash: use flash_write_word instead of reimplementing it again
While at it remove some unused code and an unbalanced
enable_interrupts().

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-05-03 15:01:28 +02:00
Sascha Hauer e6b8bdc0c5 cfi_flash: move include/cfi_flash.c next to driver
This file has no useful things for others than the driver,
so move it next to the driver and remove the corresponding
include from other files.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-02-08 14:37:50 +01:00
Sascha Hauer 582da05383 cfi_flash: remove old driver and switch to new one
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-02-08 14:37:49 +01:00
Marc Kleine-Budde 1e658639f1 cfi_flash: fix alignment problem
This patch fixes a alignment problem which may show during this
scenario:
- 32 or 64 attached NOR flash
- flashing an image directly from network to the nor flash

The involved network driver is "smc9111.c".

The data that comes from the network stack and should be written into
the flash isn't 32 bit alligned (at least with this network driver).
This is probably due to the 48 bit wide ethernet addresses.

However the "cfi_flash.c" driver doesn't handle this situation, and
accesses the not-alligned address with a 32 bit pointer.

This patch fixes the problem by reducing the access width if an
alligment problem between source and destination is found.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-02-01 16:27:35 +01:00
Matthias Kaehlcke cd1e08850f CFI flash driver: Fix misleading trace when unprotecting a sector
When (un)protecting a flash sector with the CFI flash driver a trace
"protect 0x..." is generated, independently of the type of operation. This is
misleading in case of an unprotect. Tell the truth when unprotecting a sector.

Signed-off-by: Matthias Kaehlcke <matthias@kaehlcke.net>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-01-05 13:14:37 +01:00
Sascha Hauer a3ffa97f40 rename U-Boot-v2 project to barebox
This has been done with the following script:

find -path ./.git -prune -o -type f -print0 | xargs -0 -r sed -i \
	-e 's/u2boot/barebox/g' \
	-e 's/U2Boot/barebox/g' \
	-e 's/U-boot V2/barebox/g' \
	-e 's/u-boot v2/barebox/g' \
	-e 's/U-Boot V2/barebox/g' \
	-e 's/U-Boot-v2/barebox/g' \
	-e 's/U_BOOT/BAREBOX/g' \
	-e 's/UBOOT/BAREBOX/g' \
	-e 's/uboot/barebox/g' \
	-e 's/u-boot/barebox/g' \
	-e 's/u_boot/barebox/g' \
	-e 's/U-Boot/barebox/g' \
	-e 's/U-boot/barebox/g' \
	-e 's/U-BOOT/barebox/g'

find -path ./.git -prune -o \( -name "*u-boot*" -o -name "*uboot*" -o -name "*u_boot*" \) -print0 | \
	xargs -0 -r rename 's/u[-_]?boot/barebox/'

It needs some manual fixup following in the next patch

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-12-15 10:18:30 +01:00
Sascha Hauer 02ba8a0542 get rid of device ids
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-07-21 16:41:47 +02:00
Sascha Hauer a2b7cd183b introduce cdev
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-07-21 16:41:44 +02:00
Sascha Hauer 42c9801f66 cfi driver: change function order to a more common one
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-05-25 16:52:24 +02:00
Sascha Hauer db572dce5f cfi driver: Limit device size to actual size
When probing CFI, limit the device size to the actual probed size of
the flash

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2008-12-17 18:18:44 +01:00
Sascha Hauer 313a618ce0 Move cfi flash drivers to drivers/nor as suggested by Nishanth Menon
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2008-08-25 09:31:04 +02:00