summaryrefslogtreecommitdiff
path: root/drivers/mtd/spi/macronix.c
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2011-06-28 07:38:10 +0000
committerWolfgang Denk <wd@denx.de>2011-07-26 16:29:59 +0200
commitb06afa75faeea2498447c56df1abaa23dbedb689 (patch)
tree4bc3eb8909e65e73cbaf5429866907225c5019ee /drivers/mtd/spi/macronix.c
parentd4aa500913adf074ad85b1b74bf79e9abb104a70 (diff)
downloadu-boot-imx-b06afa75faeea2498447c56df1abaa23dbedb689.zip
u-boot-imx-b06afa75faeea2498447c56df1abaa23dbedb689.tar.gz
u-boot-imx-b06afa75faeea2498447c56df1abaa23dbedb689.tar.bz2
sf: kill off now-unused local state
Now that the common spi_flash structure tracks all the info that these drivers need, kill off their local state indirection and use just what the common code provides. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'drivers/mtd/spi/macronix.c')
-rw-r--r--drivers/mtd/spi/macronix.c36
1 files changed, 12 insertions, 24 deletions
diff --git a/drivers/mtd/spi/macronix.c b/drivers/mtd/spi/macronix.c
index 0a56420..e689562 100644
--- a/drivers/mtd/spi/macronix.c
+++ b/drivers/mtd/spi/macronix.c
@@ -58,17 +58,6 @@ struct macronix_spi_flash_params {
const char *name;
};
-struct macronix_spi_flash {
- struct spi_flash flash;
- const struct macronix_spi_flash_params *params;
-};
-
-static inline struct macronix_spi_flash *to_macronix_spi_flash(struct spi_flash
- *flash)
-{
- return container_of(flash, struct macronix_spi_flash, flash);
-}
-
static const struct macronix_spi_flash_params macronix_spi_flash_table[] = {
{
.idcode = 0x2015,
@@ -120,7 +109,7 @@ static int macronix_erase(struct spi_flash *flash, u32 offset, size_t len)
struct spi_flash *spi_flash_probe_macronix(struct spi_slave *spi, u8 *idcode)
{
const struct macronix_spi_flash_params *params;
- struct macronix_spi_flash *mcx;
+ struct spi_flash *flash;
unsigned int i;
u16 id = idcode[2] | idcode[1] << 8;
@@ -135,23 +124,22 @@ struct spi_flash *spi_flash_probe_macronix(struct spi_slave *spi, u8 *idcode)
return NULL;
}
- mcx = malloc(sizeof(*mcx));
- if (!mcx) {
+ flash = malloc(sizeof(*flash));
+ if (!flash) {
debug("SF: Failed to allocate memory\n");
return NULL;
}
- mcx->params = params;
- mcx->flash.spi = spi;
- mcx->flash.name = params->name;
+ flash->spi = spi;
+ flash->name = params->name;
- mcx->flash.write = spi_flash_cmd_write_multi;
- mcx->flash.erase = macronix_erase;
- mcx->flash.read = spi_flash_cmd_read_fast;
- mcx->flash.page_size = params->page_size;
- mcx->flash.sector_size = params->page_size * params->pages_per_sector
+ flash->write = spi_flash_cmd_write_multi;
+ flash->erase = macronix_erase;
+ flash->read = spi_flash_cmd_read_fast;
+ flash->page_size = params->page_size;
+ flash->sector_size = params->page_size * params->pages_per_sector
* params->sectors_per_block;
- mcx->flash.size = mcx->flash.sector_size * params->nr_blocks;
+ flash->size = flash->sector_size * params->nr_blocks;
- return &mcx->flash;
+ return flash;
}