* [PATCH] drivers/nor: allow overriding of AMD_ADDR_* in board-configs
@ 2010-06-17 3:22 Wolfram Sang
2010-06-17 8:54 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Wolfram Sang @ 2010-06-17 3:22 UTC (permalink / raw)
To: barebox
Because there are a number of flash-makers who did it wrong.
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
---
drivers/nor/cfi_flash.h | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/drivers/nor/cfi_flash.h b/drivers/nor/cfi_flash.h
index a8fa879..a278772 100644
--- a/drivers/nor/cfi_flash.h
+++ b/drivers/nor/cfi_flash.h
@@ -109,9 +109,16 @@ extern struct cfi_cmd_set cfi_cmd_set_amd;
#define AMD_STATUS_TOGGLE 0x40
#define AMD_STATUS_ERROR 0x20
-#define AMD_ADDR_ERASE_START ((info->portwidth == FLASH_CFI_8BIT) ? 0xAAA : 0x555)
-#define AMD_ADDR_START ((info->portwidth == FLASH_CFI_8BIT) ? 0xAAA : 0x555)
-#define AMD_ADDR_ACK ((info->portwidth == FLASH_CFI_8BIT) ? 0x555 : 0x2AA)
+/* AMD_ADDR_* can be overridden in board-specific config.h files */
+#ifndef AMD_ADDR_ERASE_START
+# define AMD_ADDR_ERASE_START ((info->portwidth == FLASH_CFI_8BIT) ? 0xAAA : 0x555)
+#endif
+#ifndef AMD_ADDR_START
+# define AMD_ADDR_START ((info->portwidth == FLASH_CFI_8BIT) ? 0xAAA : 0x555)
+#endif
+#ifndef AMD_ADDR_ACK
+# define AMD_ADDR_ACK ((info->portwidth == FLASH_CFI_8BIT) ? 0x555 : 0x2AA)
+#endif
#define FLASH_OFFSET_MANUFACTURER_ID 0x00
#define FLASH_OFFSET_DEVICE_ID 0x01
--
1.7.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] drivers/nor: allow overriding of AMD_ADDR_* in board-configs
2010-06-17 3:22 [PATCH] drivers/nor: allow overriding of AMD_ADDR_* in board-configs Wolfram Sang
@ 2010-06-17 8:54 ` Sascha Hauer
0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2010-06-17 8:54 UTC (permalink / raw)
To: Wolfram Sang; +Cc: barebox
On Thu, Jun 17, 2010 at 05:22:45AM +0200, Wolfram Sang wrote:
> Because there are a number of flash-makers who did it wrong.
>
> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
> ---
> drivers/nor/cfi_flash.h | 13 ++++++++++---
> 1 files changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/nor/cfi_flash.h b/drivers/nor/cfi_flash.h
> index a8fa879..a278772 100644
> --- a/drivers/nor/cfi_flash.h
> +++ b/drivers/nor/cfi_flash.h
> @@ -109,9 +109,16 @@ extern struct cfi_cmd_set cfi_cmd_set_amd;
> #define AMD_STATUS_TOGGLE 0x40
> #define AMD_STATUS_ERROR 0x20
>
> -#define AMD_ADDR_ERASE_START ((info->portwidth == FLASH_CFI_8BIT) ? 0xAAA : 0x555)
> -#define AMD_ADDR_START ((info->portwidth == FLASH_CFI_8BIT) ? 0xAAA : 0x555)
> -#define AMD_ADDR_ACK ((info->portwidth == FLASH_CFI_8BIT) ? 0x555 : 0x2AA)
> +/* AMD_ADDR_* can be overridden in board-specific config.h files */
> +#ifndef AMD_ADDR_ERASE_START
> +# define AMD_ADDR_ERASE_START ((info->portwidth == FLASH_CFI_8BIT) ? 0xAAA : 0x555)
> +#endif
> +#ifndef AMD_ADDR_START
> +# define AMD_ADDR_START ((info->portwidth == FLASH_CFI_8BIT) ? 0xAAA : 0x555)
> +#endif
> +#ifndef AMD_ADDR_ACK
> +# define AMD_ADDR_ACK ((info->portwidth == FLASH_CFI_8BIT) ? 0x555 : 0x2AA)
> +#endif
Uh, Having arbitrary board specific defines is exactly what I wanted to
get rid of while rewriting U-Boot. Sorry, this is not acceptable.
There are some ways to do this: You could add a runtime detection if
possible, maybe combined with a kconfig option if it influences image
size too badly. Or you could add the information to platform_data.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-06-17 8:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-17 3:22 [PATCH] drivers/nor: allow overriding of AMD_ADDR_* in board-configs Wolfram Sang
2010-06-17 8:54 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox