Patchwork [U-Boot,2/3] nand: Add common functions to nand.h

login
register
mail settings
Submitter Simon Schwarz
Date Sept. 29, 2011, 7:44 a.m.
Message ID <1317282243-14848-3-git-send-email-simonschwarzcor@gmail.com>
Download mbox | patch
Permalink /patch/116913/
State Superseded
Headers show

Comments

Simon Schwarz - Sept. 29, 2011, 7:44 a.m.
Functions often used in SPL are now part of nand.h.

Signed-off-by: Simon Schwarz <simonschwarzcor@gmail.com>
---
 include/nand.h |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
Scott Wood - Oct. 3, 2011, 11:54 p.m.
On 09/29/2011 02:44 AM, Simon Schwarz wrote:
> Functions often used in SPL are now part of nand.h.
> 
> Signed-off-by: Simon Schwarz <simonschwarzcor@gmail.com>
> ---
>  include/nand.h |   10 +++++++---
>  1 files changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/include/nand.h b/include/nand.h
> index b4140794..980408a 100644
> --- a/include/nand.h
> +++ b/include/nand.h
> @@ -135,9 +135,6 @@ int nand_get_lock_status(nand_info_t *meminfo, loff_t offset);
>  int nand_spl_load_image(uint32_t offs, unsigned int size, void *dst);
>  void nand_deselect(void);
>  
> -void nand_read_buf16(struct mtd_info *mtd, uint8_t *buf, int len);
> -void nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len);
> -
>  #ifdef CONFIG_SYS_NAND_SELECT_DEVICE
>  void board_nand_select_device(struct nand_chip *nand, int chip);
>  #endif
> @@ -154,3 +151,10 @@ __attribute__((noreturn)) void nand_boot(void);
>  #define ENV_OFFSET_SIZE 8
>  int get_nand_env_oob(nand_info_t *nand, unsigned long *result);
>  #endif
> +
> +/* Standard NAND functions from nand_base.c */
> +void nand_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len);
> +void nand_write_buf16(struct mtd_info *mtd, const uint8_t *buf, int len);
> +void nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len);
> +void nand_read_buf16(struct mtd_info *mtd, uint8_t *buf, int len);
> +uint8_t nand_read_byte(struct mtd_info *mtd);

Sorry for not noticing this before, but these should go in
include/linux/mtd/nand.h since that corresponds to
drivers/mtd/nand/nand_base.c.  include/nand.h is for U-Boot-specific things.

As it stands now, drivers/mtd/nand/nand_base.c does not include
include/nand.h, so we won't get warned if the function signatures diverge.

-Scott
Simon Schwarz - Oct. 14, 2011, 6:09 p.m.
Hi Scott,

ok. Will have a look - hopefully this weekend.

Regards
Simon

2011/10/14 Simon Schwarz <simonschwarzcor@googlemail.com>:
> Hi Scott,
>
> ok. Will have a look - hopefully this weekend.
>
> Regards
> Simon
>
> 2011/10/4 Scott Wood <scottwood@freescale.com>:
>> On 09/29/2011 02:44 AM, Simon Schwarz wrote:
>>> Functions often used in SPL are now part of nand.h.
>>>
>>> Signed-off-by: Simon Schwarz <simonschwarzcor@gmail.com>
>>> ---
>>>  include/nand.h |   10 +++++++---
>>>  1 files changed, 7 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/include/nand.h b/include/nand.h
>>> index b4140794..980408a 100644
>>> --- a/include/nand.h
>>> +++ b/include/nand.h
>>> @@ -135,9 +135,6 @@ int nand_get_lock_status(nand_info_t *meminfo, loff_t offset);
>>>  int nand_spl_load_image(uint32_t offs, unsigned int size, void *dst);
>>>  void nand_deselect(void);
>>>
>>> -void nand_read_buf16(struct mtd_info *mtd, uint8_t *buf, int len);
>>> -void nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len);
>>> -
>>>  #ifdef CONFIG_SYS_NAND_SELECT_DEVICE
>>>  void board_nand_select_device(struct nand_chip *nand, int chip);
>>>  #endif
>>> @@ -154,3 +151,10 @@ __attribute__((noreturn)) void nand_boot(void);
>>>  #define ENV_OFFSET_SIZE 8
>>>  int get_nand_env_oob(nand_info_t *nand, unsigned long *result);
>>>  #endif
>>> +
>>> +/* Standard NAND functions from nand_base.c */
>>> +void nand_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len);
>>> +void nand_write_buf16(struct mtd_info *mtd, const uint8_t *buf, int len);
>>> +void nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len);
>>> +void nand_read_buf16(struct mtd_info *mtd, uint8_t *buf, int len);
>>> +uint8_t nand_read_byte(struct mtd_info *mtd);
>>
>> Sorry for not noticing this before, but these should go in
>> include/linux/mtd/nand.h since that corresponds to
>> drivers/mtd/nand/nand_base.c.  include/nand.h is for U-Boot-specific things.
>>
>> As it stands now, drivers/mtd/nand/nand_base.c does not include
>> include/nand.h, so we won't get warned if the function signatures diverge.
>>
>> -Scott
>>
>>
>

Patch

diff --git a/include/nand.h b/include/nand.h
index b4140794..980408a 100644
--- a/include/nand.h
+++ b/include/nand.h
@@ -135,9 +135,6 @@  int nand_get_lock_status(nand_info_t *meminfo, loff_t offset);
 int nand_spl_load_image(uint32_t offs, unsigned int size, void *dst);
 void nand_deselect(void);
 
-void nand_read_buf16(struct mtd_info *mtd, uint8_t *buf, int len);
-void nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len);
-
 #ifdef CONFIG_SYS_NAND_SELECT_DEVICE
 void board_nand_select_device(struct nand_chip *nand, int chip);
 #endif
@@ -154,3 +151,10 @@  __attribute__((noreturn)) void nand_boot(void);
 #define ENV_OFFSET_SIZE 8
 int get_nand_env_oob(nand_info_t *nand, unsigned long *result);
 #endif
+
+/* Standard NAND functions from nand_base.c */
+void nand_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len);
+void nand_write_buf16(struct mtd_info *mtd, const uint8_t *buf, int len);
+void nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len);
+void nand_read_buf16(struct mtd_info *mtd, uint8_t *buf, int len);
+uint8_t nand_read_byte(struct mtd_info *mtd);