projects
/
oweals
/
u-boot.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-socfpga
[oweals/u-boot.git]
/
drivers
/
mtd
/
spi
/
sf_dataflash.c
diff --git
a/drivers/mtd/spi/sf_dataflash.c
b/drivers/mtd/spi/sf_dataflash.c
index bcddfa07556bb9f1bd68b6606f29d20e22b84375..b6a2631747a9d89aea718b5f20eb2b62ec1e4e2c 100644
(file)
--- a/
drivers/mtd/spi/sf_dataflash.c
+++ b/
drivers/mtd/spi/sf_dataflash.c
@@
-1,10
+1,9
@@
+// SPDX-License-Identifier: GPL-2.0+
/*
* Atmel DataFlash probing
*
* Copyright (C) 2004-2009, 2015 Freescale Semiconductor, Inc.
* Haikun Wang (haikun.wang@freescale.com)
/*
* Atmel DataFlash probing
*
* Copyright (C) 2004-2009, 2015 Freescale Semiconductor, Inc.
* Haikun Wang (haikun.wang@freescale.com)
- *
- * SPDX-License-Identifier: GPL-2.0+
*/
#include <common.h>
*/
#include <common.h>
@@
-19,6
+18,7
@@
#include "sf_internal.h"
#include "sf_internal.h"
+#define CMD_READ_ID 0x9f
/* reads can bypass the buffers */
#define OP_READ_CONTINUOUS 0xE8
#define OP_READ_PAGE 0xD2
/* reads can bypass the buffers */
#define OP_READ_CONTINUOUS 0xE8
#define OP_READ_PAGE 0xD2
@@
-134,11
+134,17
@@
static int spi_dataflash_erase(struct udevice *dev, u32 offset, size_t len)
debug("%s: erase addr=0x%x len 0x%x\n", dev->name, offset, len);
div_u64_rem(len, spi_flash->page_size, &rem);
debug("%s: erase addr=0x%x len 0x%x\n", dev->name, offset, len);
div_u64_rem(len, spi_flash->page_size, &rem);
- if (rem)
+ if (rem) {
+ printf("%s: len(0x%x) isn't the multiple of page size(0x%x)\n",
+ dev->name, len, spi_flash->page_size);
return -EINVAL;
return -EINVAL;
+ }
div_u64_rem(offset, spi_flash->page_size, &rem);
div_u64_rem(offset, spi_flash->page_size, &rem);
- if (rem)
+ if (rem) {
+ printf("%s: offset(0x%x) isn't the multiple of page size(0x%x)\n",
+ dev->name, offset, spi_flash->page_size);
return -EINVAL;
return -EINVAL;
+ }
status = spi_claim_bus(spi);
if (status) {
status = spi_claim_bus(spi);
if (status) {
@@
-436,7
+442,7
@@
static int add_dataflash(struct udevice *dev, char *name, int nr_pages,
return 0;
}
return 0;
}
-struct flash_info {
+struct
data_
flash_info {
char *name;
/*
char *name;
/*
@@
-455,7
+461,7
@@
struct flash_info {
#define IS_POW2PS 0x0001 /* uses 2^N byte pages */
};
#define IS_POW2PS 0x0001 /* uses 2^N byte pages */
};
-static struct flash_info dataflash_data[] = {
+static struct
data_
flash_info dataflash_data[] = {
/*
* NOTE: chips with SUP_POW2PS (rev D and up) need two entries,
* one with IS_POW2PS and the other without. The entry with the
/*
* NOTE: chips with SUP_POW2PS (rev D and up) need two entries,
* one with IS_POW2PS and the other without. The entry with the
@@
-496,12
+502,12
@@
static struct flash_info dataflash_data[] = {
{ "at45db642d", 0x1f2800, 8192, 1024, 10, SUP_POW2PS | IS_POW2PS},
};
{ "at45db642d", 0x1f2800, 8192, 1024, 10, SUP_POW2PS | IS_POW2PS},
};
-static struct flash_info *jedec_probe(struct spi_slave *spi)
+static struct
data_
flash_info *jedec_probe(struct spi_slave *spi)
{
int tmp;
uint8_t id[5];
uint32_t jedec;
{
int tmp;
uint8_t id[5];
uint32_t jedec;
- struct
flash_info
*info;
+ struct
data_flash_info
*info;
int status;
/*
int status;
/*
@@
-578,7
+584,7
@@
static int spi_dataflash_probe(struct udevice *dev)
{
struct spi_slave *spi = dev_get_parent_priv(dev);
struct spi_flash *spi_flash;
{
struct spi_slave *spi = dev_get_parent_priv(dev);
struct spi_flash *spi_flash;
- struct flash_info *info;
+ struct
data_
flash_info *info;
int status;
spi_flash = dev_get_uclass_priv(dev);
int status;
spi_flash = dev_get_uclass_priv(dev);