|
| 1 | +/* |
| 2 | + * Copyright (C) 2024 Technische Universität Hamburg |
| 3 | + * |
| 4 | + * This file is subject to the terms and conditions of the GNU Lesser |
| 5 | + * General Public License v2.1. See the file LICENSE in the top level |
| 6 | + * directory for more details. |
| 7 | + */ |
| 8 | +/** |
| 9 | + * @{ |
| 10 | + * |
| 11 | + * @file |
| 12 | + * @brief Definitions for different Flash chips that can be tested |
| 13 | + * |
| 14 | + * @author Christopher Büchse <christopher.buechse@tuhh.de> |
| 15 | + */ |
| 16 | + |
| 17 | +#include "timex.h" |
| 18 | +#include "mtd_spi_nor.h" |
| 19 | + |
| 20 | +/* The default CS pin and SPI device is for the built-in flash of the nRF52840DK */ |
| 21 | +#ifndef FLASH_SPI_CS |
| 22 | +#define FLASH_SPI_CS GPIO_PIN(0, 17) |
| 23 | +#endif |
| 24 | + |
| 25 | +#ifndef FLASH_SPI_DEV |
| 26 | +#define FLASH_SPI_DEV 0 |
| 27 | +#endif |
| 28 | + |
| 29 | +#ifdef TEST_IS25LP128 |
| 30 | + |
| 31 | +#define IS25LP128_PAGE_SIZE (256) |
| 32 | +#define IS25LP128_PAGES_PER_SECTOR (16) |
| 33 | +#define IS25LP128_SECTOR_COUNT (4096) |
| 34 | +#define IS25LP128_FLAGS (SPI_NOR_F_SECT_4K | SPI_NOR_F_SECT_32K | \ |
| 35 | + SPI_NOR_F_SECT_64K) |
| 36 | +#define IS25LP128_SPI_CLK SPI_CLK_100KHZ |
| 37 | +#define IS25LP128_SPI_MODE SPI_MODE_0 |
| 38 | + |
| 39 | +static const mtd_spi_nor_params_t _is25lp128_flash_nor_params = { |
| 40 | + .opcode = &mtd_spi_nor_opcode_default, |
| 41 | + .wait_chip_erase = 30LU * US_PER_SEC, |
| 42 | + .wait_32k_erase = 100LU *US_PER_MS, |
| 43 | + .wait_sector_erase = 70LU * US_PER_MS, |
| 44 | + .wait_chip_wake_up = 100LU * US_PER_MS, |
| 45 | + .clk = IS25LP128_SPI_CLK, |
| 46 | + .flag = IS25LP128_FLAGS, |
| 47 | + .spi = SPI_DEV(FLASH_SPI_DEV), |
| 48 | + .mode = IS25LP128_SPI_MODE, |
| 49 | + .cs = FLASH_SPI_CS, |
| 50 | + .wp = GPIO_UNDEF, |
| 51 | + .hold = GPIO_UNDEF, |
| 52 | +}; |
| 53 | + |
| 54 | +static mtd_spi_nor_t _is25lp128_nor_dev = { |
| 55 | + .base = { |
| 56 | + .driver = &mtd_spi_nor_driver, |
| 57 | + .page_size = IS25LP128_PAGE_SIZE, |
| 58 | + .pages_per_sector = IS25LP128_PAGES_PER_SECTOR, |
| 59 | + .sector_count = IS25LP128_SECTOR_COUNT, |
| 60 | + }, |
| 61 | + .params = &_is25lp128_flash_nor_params, |
| 62 | +}; |
| 63 | + |
| 64 | +MTD_XFA_ADD(_is25lp128_nor_dev, 10); |
| 65 | + |
| 66 | +#elif defined TEST_IS25LE01G |
| 67 | + |
| 68 | +#define IS25LE01G_PAGE_SIZE (256) |
| 69 | +#define IS25LE01G_PAGES_PER_SECTOR (16) |
| 70 | +#define IS25LE01G_SECTOR_COUNT (32768) |
| 71 | +#define IS25LE01G_FLAGS (SPI_NOR_F_SECT_4K | SPI_NOR_F_SECT_32K | \ |
| 72 | + SPI_NOR_F_SECT_64K) |
| 73 | +#define IS25LE01G_SPI_CLK SPI_CLK_10MHZ |
| 74 | +#define IS25LE01G_SPI_MODE SPI_MODE_0 |
| 75 | + |
| 76 | +static const mtd_spi_nor_params_t _is25le01g_flash_nor_params = { |
| 77 | + .opcode = &mtd_spi_nor_opcode_default, |
| 78 | + .wait_chip_erase = 90LU * US_PER_SEC, |
| 79 | + .wait_32k_erase = 140LU * US_PER_MS, |
| 80 | + .wait_sector_erase = 100LU * US_PER_MS, |
| 81 | + .wait_chip_wake_up = 35LU * US_PER_MS, |
| 82 | + .clk = IS25LE01G_SPI_CLK, |
| 83 | + .flag = IS25LE01G_FLAGS, |
| 84 | + .spi = SPI_DEV(FLASH_SPI_DEV), |
| 85 | + .mode = IS25LE01G_SPI_MODE, |
| 86 | + .cs = FLASH_SPI_CS, |
| 87 | + .wp = GPIO_UNDEF, |
| 88 | + .hold = GPIO_UNDEF, |
| 89 | +}; |
| 90 | + |
| 91 | +static mtd_spi_nor_t _is25le01g_nor_dev = { |
| 92 | + .base = { |
| 93 | + .driver = &mtd_spi_nor_driver, |
| 94 | + .page_size = IS25LE01G_PAGE_SIZE, |
| 95 | + .pages_per_sector = IS25LE01G_PAGES_PER_SECTOR, |
| 96 | + .sector_count = IS25LE01G_SECTOR_COUNT, |
| 97 | + }, |
| 98 | + .params = &_is25le01g_flash_nor_params, |
| 99 | +}; |
| 100 | + |
| 101 | +MTD_XFA_ADD(_is25le01g_nor_dev, 10); |
| 102 | + |
| 103 | +#elif defined TEST_MX25L12873F |
| 104 | + |
| 105 | +#define MX25L12873F_PAGE_SIZE (256) |
| 106 | +#define MX25L12873F_PAGES_PER_SECTOR (16) |
| 107 | +#define MX25L12873F_SECTOR_COUNT (4096) |
| 108 | +#define MX25L12873F_FLAGS (SPI_NOR_F_SECT_4K | SPI_NOR_F_SECT_32K | \ |
| 109 | + SPI_NOR_F_SECT_64K) |
| 110 | +#define MX25L12873F_SPI_CLK SPI_CLK_10MHZ |
| 111 | +#define MX25L12873F_SPI_MODE SPI_MODE_0 |
| 112 | + |
| 113 | +static const mtd_spi_nor_params_t _mx25l12873f_flash_nor_params = { |
| 114 | + .opcode = &mtd_spi_nor_opcode_default, |
| 115 | + .wait_chip_erase = 50LU * US_PER_SEC, |
| 116 | + .wait_32k_erase = 150LU *US_PER_MS, |
| 117 | + .wait_sector_erase = 40LU * US_PER_MS, |
| 118 | + .wait_chip_wake_up = 35LU * US_PER_MS, |
| 119 | + .clk = MX25L12873F_SPI_CLK, |
| 120 | + .flag = MX25L12873F_FLAGS, |
| 121 | + .spi = SPI_DEV(FLASH_SPI_DEV), |
| 122 | + .mode = MX25L12873F_SPI_MODE, |
| 123 | + .cs = FLASH_SPI_CS, |
| 124 | + .wp = GPIO_UNDEF, |
| 125 | + .hold = GPIO_UNDEF, |
| 126 | +}; |
| 127 | + |
| 128 | +static mtd_spi_nor_t _mx25l12873f_nor_dev = { |
| 129 | + .base = { |
| 130 | + .driver = &mtd_spi_nor_driver, |
| 131 | + .page_size = MX25L12873F_PAGE_SIZE, |
| 132 | + .pages_per_sector = MX25L12873F_PAGES_PER_SECTOR, |
| 133 | + .sector_count = MX25L12873F_SECTOR_COUNT, |
| 134 | + }, |
| 135 | + .params = &_mx25l12873f_flash_nor_params, |
| 136 | +}; |
| 137 | + |
| 138 | +MTD_XFA_ADD(_mx25l12873f_nor_dev, 10); |
| 139 | + |
| 140 | +#endif /* TEST_MX25L12873F */ |
| 141 | +/** @} */ |
0 commit comments