From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 05/12] cfi_flash: Do not typedef struct flash_info
Date: Mon, 5 Jul 2010 15:16:28 +0200 [thread overview]
Message-ID: <1278335795-16289-6-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1278335795-16289-1-git-send-email-s.hauer@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/nor/cfi_flash.c | 46 +++++++++++++++++++-------------------
drivers/nor/cfi_flash.h | 48 ++++++++++++++++++++--------------------
drivers/nor/cfi_flash_amd.c | 14 ++++++------
drivers/nor/cfi_flash_intel.c | 12 +++++-----
4 files changed, 60 insertions(+), 60 deletions(-)
diff --git a/drivers/nor/cfi_flash.c b/drivers/nor/cfi_flash.c
index b21739b..bf582ab 100644
--- a/drivers/nor/cfi_flash.c
+++ b/drivers/nor/cfi_flash.c
@@ -77,7 +77,7 @@ static uint flash_offset_cfi[2]={FLASH_OFFSET_CFI,FLASH_OFFSET_CFI_ALT};
* Functions
*/
-static void flash_add_byte (flash_info_t * info, cfiword_t * cword, uchar c)
+static void flash_add_byte (struct flash_info *info, cfiword_t * cword, uchar c)
{
#if defined(__LITTLE_ENDIAN)
unsigned short w;
@@ -114,7 +114,7 @@ static void flash_add_byte (flash_info_t * info, cfiword_t * cword, uchar c)
}
}
-static int flash_write_cfiword (flash_info_t * info, ulong dest,
+static int flash_write_cfiword (struct flash_info *info, ulong dest,
cfiword_t cword)
{
cfiptr_t cptr;
@@ -159,7 +159,7 @@ void print_longlong (char *str, unsigned long long data)
sprintf (&str[i * 2], "%2.2x", *cp++);
}
-static void flash_printqry (flash_info_t * info, flash_sect_t sect)
+static void flash_printqry (struct flash_info *info, flash_sect_t sect)
{
cfiptr_t cptr;
int x, y;
@@ -188,7 +188,7 @@ static void flash_printqry (flash_info_t * info, flash_sect_t sect)
/*
* read a short word by swapping for ppc format.
*/
-static ushort flash_read_ushort (flash_info_t * info, flash_sect_t sect, uint offset)
+static ushort flash_read_ushort (struct flash_info *info, flash_sect_t sect, uint offset)
{
uchar *addr;
ushort retval;
@@ -220,7 +220,7 @@ static ushort flash_read_ushort (flash_info_t * info, flash_sect_t sect, uint of
* read a long word by picking the least significant byte of each maximum
* port size word. Swap for ppc format.
*/
-static ulong flash_read_long (flash_info_t * info, flash_sect_t sect, uint offset)
+static ulong flash_read_long (struct flash_info *info, flash_sect_t sect, uint offset)
{
uchar *addr;
ulong retval;
@@ -254,7 +254,7 @@ static ulong flash_read_long (flash_info_t * info, flash_sect_t sect, uint offse
* http://www.jedec.org/download/search/jesd68.pdf
*
*/
-static int flash_detect_cfi (flash_info_t * info)
+static int flash_detect_cfi (struct flash_info *info)
{
int cfi_offset;
debug ("flash detect cfi\n");
@@ -291,7 +291,7 @@ static int flash_detect_cfi (flash_info_t * info)
/*
* The following code cannot be run from FLASH!
*/
-static ulong flash_get_size (flash_info_t *info, ulong base)
+static ulong flash_get_size (struct flash_info *info, ulong base)
{
int i, j;
flash_sect_t sect_cnt;
@@ -478,7 +478,7 @@ static ulong flash_get_size (flash_info_t *info, ulong base)
* when the passed address is greater or equal to the sector address
* we have a match
*/
-flash_sect_t find_sector (flash_info_t * info, ulong addr)
+flash_sect_t find_sector (struct flash_info *info, ulong addr)
{
flash_sect_t sector;
@@ -491,7 +491,7 @@ flash_sect_t find_sector (flash_info_t * info, ulong addr)
static int cfi_erase(struct cdev *cdev, size_t count, unsigned long offset)
{
- flash_info_t *finfo = (flash_info_t *)cdev->priv;
+ struct flash_info *finfo = (struct flash_info *)cdev->priv;
unsigned long start, end;
int i, ret = 0;
@@ -519,7 +519,7 @@ out:
* 1 - write timeout
* 2 - Flash not erased
*/
-static int write_buff (flash_info_t * info, const uchar * src, ulong addr, ulong cnt)
+static int write_buff (struct flash_info *info, const uchar * src, ulong addr, ulong cnt)
{
ulong wp;
ulong cp;
@@ -614,7 +614,7 @@ static int write_buff (flash_info_t * info, const uchar * src, ulong addr, ulong
return flash_write_cfiword (info, wp, cword);
}
-static int flash_real_protect (flash_info_t * info, long sector, int prot)
+static int flash_real_protect (struct flash_info *info, long sector, int prot)
{
int retcode = 0;
@@ -649,7 +649,7 @@ static int flash_real_protect (flash_info_t * info, long sector, int prot)
static int cfi_protect(struct cdev *cdev, size_t count, unsigned long offset, int prot)
{
- flash_info_t *finfo = (flash_info_t *)cdev->priv;
+ struct flash_info *finfo = (struct flash_info *)cdev->priv;
unsigned long start, end;
int i, ret = 0;
const char *action = (prot? "protect" : "unprotect");
@@ -672,7 +672,7 @@ out:
static ssize_t cfi_write(struct cdev *cdev, const void *buf, size_t count, unsigned long offset, ulong flags)
{
- flash_info_t *finfo = (flash_info_t *)cdev->priv;
+ struct flash_info *finfo = (struct flash_info *)cdev->priv;
int ret;
debug("cfi_write: buf=0x%08x addr=0x%08x count=0x%08x\n",buf, cdev->dev->map_base + offset, count);
@@ -683,7 +683,7 @@ static ssize_t cfi_write(struct cdev *cdev, const void *buf, size_t count, unsig
static void cfi_info (struct device_d* dev)
{
- flash_info_t *info = (flash_info_t *)dev->priv;
+ struct flash_info *info = (struct flash_info *)dev->priv;
int i;
if (info->flash_id != FLASH_MAN_CFI) {
@@ -775,7 +775,7 @@ static void cfi_info (struct device_d* dev)
/*
* flash_read_user_serial - read the OneTimeProgramming cells
*/
-static void flash_read_user_serial (flash_info_t * info, void *buffer, int offset,
+static void flash_read_user_serial (struct flash_info *info, void *buffer, int offset,
int len)
{
uchar *src;
@@ -791,7 +791,7 @@ static void flash_read_user_serial (flash_info_t * info, void *buffer, int offse
/*
* flash_read_factory_serial - read the device Id from the protection area
*/
-static void flash_read_factory_serial (flash_info_t * info, void *buffer, int offset,
+static void flash_read_factory_serial (struct flash_info *info, void *buffer, int offset,
int len)
{
uchar *src;
@@ -804,7 +804,7 @@ static void flash_read_factory_serial (flash_info_t * info, void *buffer, int of
#endif
-int flash_status_check (flash_info_t * info, flash_sect_t sector,
+int flash_status_check (struct flash_info *info, flash_sect_t sector,
uint64_t tout, char *prompt)
{
return info->cfi_cmd_set->flash_status_check(info, sector, tout, prompt);
@@ -814,7 +814,7 @@ int flash_status_check (flash_info_t * info, flash_sect_t sector,
* wait for XSR.7 to be set. Time out with an error if it does not.
* This routine does not set the flash to read-array mode.
*/
-int flash_generic_status_check (flash_info_t * info, flash_sect_t sector,
+int flash_generic_status_check (struct flash_info *info, flash_sect_t sector,
uint64_t tout, char *prompt)
{
uint64_t start;
@@ -839,7 +839,7 @@ int flash_generic_status_check (flash_info_t * info, flash_sect_t sector,
/*
* make a proper sized command based on the port and chip widths
*/
-void flash_make_cmd (flash_info_t * info, uchar cmd, void *cmdbuf)
+void flash_make_cmd (struct flash_info *info, uchar cmd, void *cmdbuf)
{
int i;
uchar *cp = (uchar *) cmdbuf;
@@ -855,7 +855,7 @@ void flash_make_cmd (flash_info_t * info, uchar cmd, void *cmdbuf)
/*
* Write a proper sized command to the correct address
*/
-void flash_write_cmd (flash_info_t * info, flash_sect_t sect, uint offset, uchar cmd)
+void flash_write_cmd (struct flash_info *info, flash_sect_t sect, uint offset, uchar cmd)
{
uchar *addr;
@@ -866,7 +866,7 @@ void flash_write_cmd (flash_info_t * info, flash_sect_t sect, uint offset, uchar
flash_write_word(info, cword, addr);
}
-int flash_isequal (flash_info_t * info, flash_sect_t sect, uint offset, uchar cmd)
+int flash_isequal (struct flash_info *info, flash_sect_t sect, uint offset, uchar cmd)
{
cfiptr_t cptr;
cfiword_t cword;
@@ -903,7 +903,7 @@ int flash_isequal (flash_info_t * info, flash_sect_t sect, uint offset, uchar cm
return retval;
}
-int flash_isset (flash_info_t * info, flash_sect_t sect, uint offset, uchar cmd)
+int flash_isset (struct flash_info *info, flash_sect_t sect, uint offset, uchar cmd)
{
cfiptr_t cptr;
cfiword_t cword;
@@ -937,7 +937,7 @@ struct file_operations cfi_ops = {
static int cfi_probe (struct device_d *dev)
{
unsigned long size = 0;
- flash_info_t *info = xzalloc(sizeof(flash_info_t));
+ struct flash_info *info = xzalloc(sizeof(*info));
dev->priv = (void *)info;
diff --git a/drivers/nor/cfi_flash.h b/drivers/nor/cfi_flash.h
index a8fa879..8e76c3e 100644
--- a/drivers/nor/cfi_flash.h
+++ b/drivers/nor/cfi_flash.h
@@ -34,7 +34,7 @@ struct cfi_cmd_set;
* FLASH Info: contains chip specific data, per FLASH bank
*/
-typedef struct {
+struct flash_info {
struct driver_d driver;
ulong size; /* total bank size in bytes */
ushort sector_count; /* number of erase units */
@@ -60,15 +60,15 @@ typedef struct {
ushort cfi_offset; /* offset for cfi query */
struct cfi_cmd_set *cfi_cmd_set;
struct cdev cdev;
-} flash_info_t;
+};
struct cfi_cmd_set {
- int (*flash_write_cfibuffer) (flash_info_t * info, ulong dest, const uchar * cp, int len);
- int (*flash_erase_one) (flash_info_t * info, long sect);
- int (*flash_is_busy) (flash_info_t * info, flash_sect_t sect);
- void (*flash_read_jedec_ids) (flash_info_t * info);
- void (*flash_prepare_write) (flash_info_t * info);
- int (*flash_status_check) (flash_info_t * info, flash_sect_t sector, uint64_t tout, char *prompt);
+ int (*flash_write_cfibuffer) (struct flash_info *info, ulong dest, const uchar * cp, int len);
+ int (*flash_erase_one) (struct flash_info *info, long sect);
+ int (*flash_is_busy) (struct flash_info *info, flash_sect_t sect);
+ void (*flash_read_jedec_ids) (struct flash_info *info);
+ void (*flash_prepare_write) (struct flash_info *info);
+ int (*flash_status_check) (struct flash_info *info, flash_sect_t sector, uint64_t tout, char *prompt);
};
extern struct cfi_cmd_set cfi_cmd_set_intel;
@@ -180,21 +180,21 @@ extern struct cfi_cmd_set cfi_cmd_set_amd;
#define CFI_FLASH_SHIFT_WIDTH 3
/* Prototypes */
-int flash_isset (flash_info_t * info, flash_sect_t sect, uint offset, uchar cmd);
-void flash_write_cmd (flash_info_t * info, flash_sect_t sect, uint offset, uchar cmd);
-flash_sect_t find_sector (flash_info_t * info, ulong addr);
-int flash_status_check (flash_info_t * info, flash_sect_t sector,
+int flash_isset (struct flash_info *info, flash_sect_t sect, uint offset, uchar cmd);
+void flash_write_cmd (struct flash_info *info, flash_sect_t sect, uint offset, uchar cmd);
+flash_sect_t find_sector (struct flash_info *info, ulong addr);
+int flash_status_check (struct flash_info *info, flash_sect_t sector,
uint64_t tout, char *prompt);
-int flash_generic_status_check (flash_info_t * info, flash_sect_t sector,
+int flash_generic_status_check (struct flash_info *info, flash_sect_t sector,
uint64_t tout, char *prompt);
-int flash_isequal (flash_info_t * info, flash_sect_t sect, uint offset, uchar cmd);
-void flash_make_cmd (flash_info_t * info, uchar cmd, void *cmdbuf);
+int flash_isequal (struct flash_info *info, flash_sect_t sect, uint offset, uchar cmd);
+void flash_make_cmd (struct flash_info *info, uchar cmd, void *cmdbuf);
/*
* create an address based on the offset and the port width
*/
-static inline uchar *flash_make_addr (flash_info_t * info, flash_sect_t sect, uint offset)
+static inline uchar *flash_make_addr (struct flash_info *info, flash_sect_t sect, uint offset)
{
return ((uchar *) (info->start[sect] + (offset * info->portwidth)));
}
@@ -202,7 +202,7 @@ static inline uchar *flash_make_addr (flash_info_t * info, flash_sect_t sect, ui
/*
* read a character at a port width address
*/
-static inline uchar flash_read_uchar (flash_info_t * info, uint offset)
+static inline uchar flash_read_uchar (struct flash_info *info, uint offset)
{
uchar *cp;
@@ -252,7 +252,7 @@ typedef union {
volatile unsigned long long *llp;
} cfiptr_t;
-static inline void flash_write_word(flash_info_t *info, cfiword_t datum, void *addr)
+static inline void flash_write_word(struct flash_info *info, cfiword_t datum, void *addr)
{
if (bankwidth_is_1(info)) {
debug("fw addr %p val %02x\n", addr, datum.c);
@@ -268,21 +268,21 @@ static inline void flash_write_word(flash_info_t *info, cfiword_t datum, void *a
}
}
-extern void flash_print_info (flash_info_t *);
+extern void flash_print_info (struct flash_info *);
extern int flash_sect_erase (ulong addr_first, ulong addr_last);
extern int flash_sect_protect (int flag, ulong addr_first, ulong addr_last);
/* common/flash.c */
-extern void flash_protect (int flag, ulong from, ulong to, flash_info_t *info);
+extern void flash_protect (int flag, ulong from, ulong to, struct flash_info *info);
extern int flash_write (char *, ulong, ulong);
-extern flash_info_t *addr2info (ulong);
+extern struct flash_info *addr2info (ulong);
//extern int write_buff (flash_info_t *info, const uchar *src, ulong addr, ulong cnt);
/* board/?/flash.c */
#if defined(CFG_FLASH_PROTECTION)
-extern int flash_real_protect(flash_info_t *info, long sector, int prot);
-extern void flash_read_user_serial(flash_info_t * info, void * buffer, int offset, int len);
-extern void flash_read_factory_serial(flash_info_t * info, void * buffer, int offset, int len);
+extern int flash_real_protect(struct flash_info *info, long sector, int prot);
+extern void flash_read_user_serial(struct flash_info *info, void * buffer, int offset, int len);
+extern void flash_read_factory_serial(struct flash_info *info, void * buffer, int offset, int len);
#endif /* CFG_FLASH_PROTECTION */
/*-----------------------------------------------------------------------
diff --git a/drivers/nor/cfi_flash_amd.c b/drivers/nor/cfi_flash_amd.c
index ea4c2c9..45b7e5c 100644
--- a/drivers/nor/cfi_flash_amd.c
+++ b/drivers/nor/cfi_flash_amd.c
@@ -2,7 +2,7 @@
#include <stdio.h>
#include "cfi_flash.h"
-static void flash_unlock_seq (flash_info_t * info)
+static void flash_unlock_seq (struct flash_info *info)
{
flash_write_cmd (info, 0, AMD_ADDR_START, AMD_CMD_UNLOCK_START);
flash_write_cmd (info, 0, AMD_ADDR_ACK, AMD_CMD_UNLOCK_ACK);
@@ -14,7 +14,7 @@ static void flash_unlock_seq (flash_info_t * info)
* Note: assume cfi->vendor, cfi->portwidth and cfi->chipwidth are correct
*
*/
-static void amd_read_jedec_ids (flash_info_t * info)
+static void amd_read_jedec_ids (struct flash_info *info)
{
info->manufacturer_id = 0;
info->device_id = 0;
@@ -39,7 +39,7 @@ static void amd_read_jedec_ids (flash_info_t * info)
flash_write_cmd(info, 0, 0, AMD_CMD_RESET);
}
-static int flash_toggle (flash_info_t * info, flash_sect_t sect, uint offset, uchar cmd)
+static int flash_toggle (struct flash_info *info, flash_sect_t sect, uint offset, uchar cmd)
{
cfiptr_t cptr;
cfiword_t cword;
@@ -66,12 +66,12 @@ static int flash_toggle (flash_info_t * info, flash_sect_t sect, uint offset, uc
* flash_is_busy - check to see if the flash is busy
* This routine checks the status of the chip and returns true if the chip is busy
*/
-static int amd_flash_is_busy (flash_info_t * info, flash_sect_t sect)
+static int amd_flash_is_busy (struct flash_info *info, flash_sect_t sect)
{
return flash_toggle (info, sect, 0, AMD_STATUS_TOGGLE);
}
-static int amd_flash_erase_one (flash_info_t * info, long sect)
+static int amd_flash_erase_one (struct flash_info *info, long sect)
{
flash_unlock_seq(info);
flash_write_cmd (info, 0, AMD_ADDR_ERASE_START, AMD_CMD_ERASE_START);
@@ -81,14 +81,14 @@ static int amd_flash_erase_one (flash_info_t * info, long sect)
return flash_status_check(info, sect, info->erase_blk_tout, "erase");
}
-static void amd_flash_prepare_write(flash_info_t * info)
+static void amd_flash_prepare_write(struct flash_info *info)
{
flash_unlock_seq(info);
flash_write_cmd (info, 0, AMD_ADDR_START, AMD_CMD_WRITE);
}
#ifdef CONFIG_CFI_BUFFER_WRITE
-static int amd_flash_write_cfibuffer (flash_info_t * info, ulong dest, const uchar * cp,
+static int amd_flash_write_cfibuffer (struct flash_info *info, ulong dest, const uchar * cp,
int len)
{
flash_sect_t sector;
diff --git a/drivers/nor/cfi_flash_intel.c b/drivers/nor/cfi_flash_intel.c
index e4dfdfa..4344760 100644
--- a/drivers/nor/cfi_flash_intel.c
+++ b/drivers/nor/cfi_flash_intel.c
@@ -7,7 +7,7 @@
* Note: assume cfi->vendor, cfi->portwidth and cfi->chipwidth are correct
*
*/
-static void intel_read_jedec_ids (flash_info_t * info)
+static void intel_read_jedec_ids (struct flash_info *info)
{
info->manufacturer_id = 0;
info->device_id = 0;
@@ -27,12 +27,12 @@ static void intel_read_jedec_ids (flash_info_t * info)
* flash_is_busy - check to see if the flash is busy
* This routine checks the status of the chip and returns true if the chip is busy
*/
-static int intel_flash_is_busy (flash_info_t * info, flash_sect_t sect)
+static int intel_flash_is_busy (struct flash_info *info, flash_sect_t sect)
{
return !flash_isset (info, sect, 0, FLASH_STATUS_DONE);
}
-static int intel_flash_erase_one (flash_info_t * info, long sect)
+static int intel_flash_erase_one (struct flash_info *info, long sect)
{
flash_write_cmd (info, sect, 0, FLASH_CMD_CLEAR_STATUS);
flash_write_cmd (info, sect, 0, FLASH_CMD_BLOCK_ERASE);
@@ -41,14 +41,14 @@ static int intel_flash_erase_one (flash_info_t * info, long sect)
return flash_status_check(info, sect, info->erase_blk_tout, "erase");
}
-static void intel_flash_prepare_write(flash_info_t * info)
+static void intel_flash_prepare_write(struct flash_info *info)
{
flash_write_cmd (info, 0, 0, FLASH_CMD_CLEAR_STATUS);
flash_write_cmd (info, 0, 0, FLASH_CMD_WRITE);
}
#ifdef CONFIG_CFI_BUFFER_WRITE
-static int intel_flash_write_cfibuffer (flash_info_t * info, ulong dest, const uchar * cp,
+static int intel_flash_write_cfibuffer (struct flash_info *info, ulong dest, const uchar * cp,
int len)
{
flash_sect_t sector;
@@ -94,7 +94,7 @@ static int intel_flash_write_cfibuffer (flash_info_t * info, ulong dest, const u
#define intel_flash_write_cfibuffer NULL
#endif /* CONFIG_CFI_BUFFER_WRITE */
-static int intel_flash_status_check (flash_info_t * info, flash_sect_t sector,
+static int intel_flash_status_check (struct flash_info *info, flash_sect_t sector,
uint64_t tout, char *prompt)
{
int retcode;
--
1.7.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2010-07-05 13:16 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-05 13:16 UBI support Sascha Hauer
2010-07-05 13:16 ` [PATCH 01/12] crc32: activate crc32_no_comp (needed for jffs2 and UBI) Sascha Hauer
2010-07-05 13:16 ` [PATCH 02/12] move drivers/nand to drivers/mtd/nand Sascha Hauer
2010-07-05 13:16 ` [PATCH 03/12] add rbtree support (needed for ubi) Sascha Hauer
2010-07-05 13:16 ` [PATCH 04/12] add partition mtd support Sascha Hauer
2010-07-05 13:16 ` Sascha Hauer [this message]
2010-07-05 13:16 ` [PATCH 06/12] cfi_flash: Do not print debug info while erasing Sascha Hauer
2010-07-05 13:16 ` [PATCH 07/12] cfi_flash: Add mtd partition support for UBI Sascha Hauer
2010-07-05 13:16 ` [PATCH 08/12] devfs: only check for ioctl function when needed Sascha Hauer
2010-07-05 13:16 ` [PATCH 09/12] include stuff missing for ubi Sascha Hauer
2010-07-05 13:16 ` [PATCH 10/12] add ubi support from u-boot. Just enough to compile and scan Sascha Hauer
2010-07-05 13:16 ` [PATCH 11/12] barebox ubi changes Sascha Hauer
2010-07-05 13:16 ` [PATCH 12/12] Add UBI commands: ubiattach, ubidetach, ubimkvol, ubirmvol Sascha Hauer
2010-07-05 15:22 ` [PATCH 02/12] move drivers/nand to drivers/mtd/nand Alessandro Rubini
2010-07-06 6:31 ` Sascha Hauer
2010-07-08 9:19 ` UBI support Baruch Siach
2010-07-16 7:27 ` Sascha Hauer
2010-07-16 8:57 ` Eric Bénard
2010-07-16 12:13 ` Esben Haabendal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1278335795-16289-6-git-send-email-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox