|
| 1 | +/* |
| 2 | + * This file is part of the MicroPython project, http://micropython.org/ |
| 3 | + * |
| 4 | + * The MIT License (MIT) |
| 5 | + * |
| 6 | + * Copyright (c) 2018 Scott Shawcroft for Adafruit Industries LLC |
| 7 | + * |
| 8 | + * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 9 | + * of this software and associated documentation files (the "Software"), to deal |
| 10 | + * in the Software without restriction, including without limitation the rights |
| 11 | + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 12 | + * copies of the Software, and to permit persons to whom the Software is |
| 13 | + * furnished to do so, subject to the following conditions: |
| 14 | + * |
| 15 | + * The above copyright notice and this permission notice shall be included in |
| 16 | + * all copies or substantial portions of the Software. |
| 17 | + * |
| 18 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 19 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 20 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 21 | + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 22 | + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 23 | + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 24 | + * THE SOFTWARE. |
| 25 | + */ |
| 26 | +#ifndef MICROPY_INCLUDED_ATMEL_SAMD_EXTERNAL_FLASH_DEVICES_H |
| 27 | +#define MICROPY_INCLUDED_ATMEL_SAMD_EXTERNAL_FLASH_DEVICES_H |
| 28 | + |
| 29 | +#include <stdbool.h> |
| 30 | +#include <stdint.h> |
| 31 | + |
| 32 | +typedef struct { |
| 33 | + uint32_t total_size; |
| 34 | + uint16_t start_up_time_us; |
| 35 | + |
| 36 | + // Three response bytes to 0x9f JEDEC ID command. |
| 37 | + uint8_t manufacturer_id; |
| 38 | + uint8_t memory_type; |
| 39 | + uint8_t capacity; |
| 40 | + |
| 41 | + // Max clock speed for all operations and the fastest read mode. |
| 42 | + uint8_t max_clock_speed_mhz; |
| 43 | + bool has_sector_protection : 1; |
| 44 | + |
| 45 | + // Supports the 0x0b fast read command with 8 dummy cycles. |
| 46 | + bool supports_fast_read : 1; |
| 47 | + |
| 48 | + // Supports the fast read, quad output command 0x6b with 8 dummy cycles. |
| 49 | + bool supports_qspi : 1; |
| 50 | + |
| 51 | + // Requires quad enable set in status bit 9. |
| 52 | + bool has_quad_enable : 1; |
| 53 | + |
| 54 | + // Supports the quad input page program command 0x32. This is known as 1-1-4 because it only |
| 55 | + // uses all four lines for data. |
| 56 | + bool supports_qspi_writes: 1; |
| 57 | +} external_flash_device; |
| 58 | + |
| 59 | +// Settings for the Adesto Tech AT25DF081A 1MiB SPI flash. Its on the SAMD21 |
| 60 | +// Xplained board. |
| 61 | +// Datasheet: https://www.adestotech.com/wp-content/uploads/doc8715.pdf |
| 62 | +#define AT25DF081A {\ |
| 63 | + .total_size = (1 << 20), /* 1 MiB */ \ |
| 64 | + .start_up_time_us = 10000, \ |
| 65 | + .manufacturer_id = 0x1f, \ |
| 66 | + .memory_type = 0x45, \ |
| 67 | + .capacity = 0x01, \ |
| 68 | + .max_clock_speed_mhz = 85, \ |
| 69 | + .has_sector_protection = true, \ |
| 70 | + .supports_fast_read = true, \ |
| 71 | + .supports_qspi = false, \ |
| 72 | + .has_quad_enable = false, \ |
| 73 | + .supports_qspi_writes = false, \ |
| 74 | +} |
| 75 | + |
| 76 | +// Settings for the Gigadevice GD25Q16C 2MiB SPI flash. |
| 77 | +// Datasheet: http://www.gigadevice.com/wp-content/uploads/2017/12/DS-00086-GD25Q16C-Rev2.6.pdf |
| 78 | +#define GD25Q16C {\ |
| 79 | + .total_size = (1 << 21), /* 2 MiB */ \ |
| 80 | + .start_up_time_us = 5000, \ |
| 81 | + .manufacturer_id = 0xc8, \ |
| 82 | + .memory_type = 0x40, \ |
| 83 | + .capacity = 0x15, \ |
| 84 | + .max_clock_speed_mhz = 104, /* if we need 120 then we can turn on high performance mode */ \ |
| 85 | + .has_sector_protection = false, \ |
| 86 | + .supports_fast_read = true, \ |
| 87 | + .supports_qspi = true, \ |
| 88 | + .has_quad_enable = true, \ |
| 89 | + .supports_qspi_writes = true, \ |
| 90 | +} |
| 91 | + |
| 92 | +// Settings for the Cypress (was Spansion) S25FL064L 8MiB SPI flash. |
| 93 | +// Datasheet: http://www.cypress.com/file/316661/download |
| 94 | +#define S25FL064L {\ |
| 95 | + .total_size = (1 << 23), /* 8 MiB */ \ |
| 96 | + .start_up_time_us = 300, \ |
| 97 | + .manufacturer_id = 0x01, \ |
| 98 | + .memory_type = 0x60, \ |
| 99 | + .capacity = 0x17, \ |
| 100 | + .max_clock_speed_mhz = 108, \ |
| 101 | + .has_sector_protection = false, \ |
| 102 | + .supports_fast_read = true, \ |
| 103 | + .supports_qspi = true, \ |
| 104 | + .has_quad_enable = true, \ |
| 105 | + .supports_qspi_writes = true, \ |
| 106 | +} |
| 107 | + |
| 108 | +// Settings for the Cypress (was Spansion) S25FL116K 2MiB SPI flash. |
| 109 | +// Datasheet: http://www.cypress.com/file/196886/download |
| 110 | +#define S25FL116K {\ |
| 111 | + .total_size = (1 << 21), /* 2 MiB */ \ |
| 112 | + .start_up_time_us = 10000, \ |
| 113 | + .manufacturer_id = 0x01, \ |
| 114 | + .memory_type = 0x40, \ |
| 115 | + .capacity = 0x15, \ |
| 116 | + .max_clock_speed_mhz = 108, \ |
| 117 | + .has_sector_protection = false, \ |
| 118 | + .supports_fast_read = true, \ |
| 119 | + .supports_qspi = true, \ |
| 120 | + .has_quad_enable = true, \ |
| 121 | + .supports_qspi_writes = false, \ |
| 122 | +} |
| 123 | + |
| 124 | +// Settings for the Cypress (was Spansion) S25FL216K 2MiB SPI flash. |
| 125 | +// Datasheet: http://www.cypress.com/file/197346/download |
| 126 | +#define S25FL216K {\ |
| 127 | + .total_size = (1 << 21), /* 2 MiB */ \ |
| 128 | + .start_up_time_us = 10000, \ |
| 129 | + .manufacturer_id = 0x01, \ |
| 130 | + .memory_type = 0x40, \ |
| 131 | + .capacity = 0x15, \ |
| 132 | + .max_clock_speed_mhz = 65, \ |
| 133 | + .has_sector_protection = false, \ |
| 134 | + .supports_fast_read = true, \ |
| 135 | + .supports_qspi = false, \ |
| 136 | + .has_quad_enable = false, \ |
| 137 | + .supports_qspi_writes = false, \ |
| 138 | +} |
| 139 | + |
| 140 | +// Settings for the Winbond W25Q16FW 2MiB SPI flash. |
| 141 | +// Datasheet: https://www.winbond.com/resource-files/w25q16fw%20revj%2005182017%20sfdp.pdf |
| 142 | +#define W25Q16FW {\ |
| 143 | + .total_size = (1 << 21), /* 2 MiB */ \ |
| 144 | + .start_up_time_us = 5000, \ |
| 145 | + .manufacturer_id = 0xef, \ |
| 146 | + .memory_type = 0x60, \ |
| 147 | + .capacity = 0x15, \ |
| 148 | + .max_clock_speed_mhz = 133, \ |
| 149 | + .has_sector_protection = false, \ |
| 150 | + .supports_fast_read = true, \ |
| 151 | + .supports_qspi = true, \ |
| 152 | + .has_quad_enable = true, \ |
| 153 | + .supports_qspi_writes = true, \ |
| 154 | +} |
| 155 | + |
| 156 | +// Settings for the Winbond W25Q16JV 2MiB SPI flash. |
| 157 | +// Datasheet: https://www.winbond.com/resource-files/w25q16jv%20spi%20revf%2005092017.pdf |
| 158 | +#define W25Q16JV {\ |
| 159 | + .total_size = (1 << 21), /* 2 MiB */ \ |
| 160 | + .start_up_time_us = 5000, \ |
| 161 | + .manufacturer_id = 0xef, \ |
| 162 | + .memory_type = 0x40, \ |
| 163 | + .capacity = 0x15, \ |
| 164 | + .max_clock_speed_mhz = 133, \ |
| 165 | + .has_sector_protection = false, \ |
| 166 | + .supports_fast_read = true, \ |
| 167 | + .supports_qspi = true, \ |
| 168 | + .has_quad_enable = true, \ |
| 169 | + .supports_qspi_writes = true, \ |
| 170 | +} |
| 171 | + |
| 172 | +// Settings for the Winbond W25Q32BV 2MiB SPI flash. |
| 173 | +// Datasheet: https://www.winbond.com/resource-files/w25q32bv_revi_100413_wo_automotive.pdf |
| 174 | +#define W25Q32BV {\ |
| 175 | + .total_size = (1 << 22), /* 4 MiB */ \ |
| 176 | + .start_up_time_us = 10000, \ |
| 177 | + .manufacturer_id = 0xef, \ |
| 178 | + .memory_type = 0x60, \ |
| 179 | + .capacity = 0x16, \ |
| 180 | + .max_clock_speed_mhz = 104, \ |
| 181 | + .has_sector_protection = false, \ |
| 182 | + .supports_fast_read = true, \ |
| 183 | + .supports_qspi = true, \ |
| 184 | + .has_quad_enable = true, \ |
| 185 | + .supports_qspi_writes = false, \ |
| 186 | +} |
| 187 | + |
| 188 | +// Settings for the Winbond W25Q80DL 1MiB SPI flash. |
| 189 | +// Datasheet: https://www.winbond.com/resource-files/w25q80dv%20dl_revh_10022015.pdf |
| 190 | +#define W25Q80DL {\ |
| 191 | + .total_size = (1 << 20), /* 1 MiB */ \ |
| 192 | + .start_up_time_us = 5000, \ |
| 193 | + .manufacturer_id = 0xef, \ |
| 194 | + .memory_type = 0x60, \ |
| 195 | + .capacity = 0x14, \ |
| 196 | + .max_clock_speed_mhz = 104, \ |
| 197 | + .has_sector_protection = false, \ |
| 198 | + .supports_fast_read = true, \ |
| 199 | + .supports_qspi = true, \ |
| 200 | + .has_quad_enable = true, \ |
| 201 | + .supports_qspi_writes = false, \ |
| 202 | +} |
| 203 | + |
| 204 | +#endif // MICROPY_INCLUDED_ATMEL_SAMD_EXTERNAL_FLASH_DEVICES_H |
0 commit comments