Adriana Kobylak | 57ba998 | 2017-08-15 20:08:42 -0500 | [diff] [blame^] | 1 | From e0943f339fcb502444135f880a3e630b8e42b004 Mon Sep 17 00:00:00 2001 |
| 2 | From: Adriana Kobylak <anoo@linux.vnet.ibm.com> |
| 3 | Date: Mon, 7 Aug 2017 12:17:27 -0500 |
| 4 | Subject: [PATCH u-boot v2016.07-aspeed-openbmc] Add MTD support to Aspeed Flash driver |
| 5 | |
| 6 | Add support to the aspeed flash driver to enable the common mtd layer |
| 7 | through CONFIG_FLASH_CFI_MTD. |
| 8 | |
| 9 | This enables the flash to be used by u-boot mtd drivers including |
| 10 | the mtdparts and ubi commands. |
| 11 | |
| 12 | Signed-off-by: Adriana Kobylak <anoo@linux.vnet.ibm.com> |
| 13 | Acked-by: Milton Miller <miltonm@us.ibm.com> |
| 14 | --- |
| 15 | arch/arm/mach-aspeed/flash.c | 20 ++++++++++++++++++++ |
| 16 | 1 file changed, 20 insertions(+) |
| 17 | |
| 18 | diff --git a/arch/arm/mach-aspeed/flash.c b/arch/arm/mach-aspeed/flash.c |
| 19 | index 9c5ead6..e1e3cf8 100644 |
| 20 | --- a/arch/arm/mach-aspeed/flash.c |
| 21 | +++ b/arch/arm/mach-aspeed/flash.c |
| 22 | @@ -124,6 +124,22 @@ flash_info_t flash_info[CONFIG_SYS_MAX_FLASH_BANKS]; /* FLASH chips info */ |
| 23 | /* specificspi */ |
| 24 | #define SpecificSPI_N25Q512 0x00000001 |
| 25 | |
| 26 | +#ifdef CONFIG_FLASH_CFI_MTD |
| 27 | +static uint flash_verbose=1; |
| 28 | +void flash_set_verbose(uint v) |
| 29 | +{ |
| 30 | + flash_verbose = v; |
| 31 | +} |
| 32 | + |
| 33 | +unsigned long flash_sector_size(flash_info_t *info, flash_sect_t sect) |
| 34 | +{ |
| 35 | + if (sect != (info->sector_count - 1)) |
| 36 | + return info->start[sect + 1] - info->start[sect]; |
| 37 | + else |
| 38 | + return info->start[0] + info->size - info->start[sect]; |
| 39 | +} |
| 40 | +#endif |
| 41 | + |
| 42 | /*-----------------------------------------------------------------------*/ |
| 43 | static u32 ast_spi_calculate_divisor(u32 max_speed_hz) |
| 44 | { |
| 45 | @@ -1372,6 +1388,10 @@ unsigned long flash_init (void) |
| 46 | flash_get_info(CONFIG_ENV_ADDR_REDUND)); |
| 47 | #endif |
| 48 | |
| 49 | +#ifdef CONFIG_FLASH_CFI_MTD |
| 50 | + cfi_mtd_init(); |
| 51 | +#endif |
| 52 | + |
| 53 | return (size); |
| 54 | } |
| 55 | |
| 56 | -- |
| 57 | 1.8.2.2 |
| 58 | |