X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=blobdiff_plain;f=src%2Fflash%2Fnor%2Fstmsmi.c;h=c839bf74cb2ef625b28123e9bde58d78caff51be;hp=9a715ef947d3ee85876afe5da532f621f4492b36;hb=7690a74b094347ec393c280414a182b7361d7b17;hpb=f132fcf636361009b4125827351ef01556d49b31 diff --git a/src/flash/nor/stmsmi.c b/src/flash/nor/stmsmi.c index 9a715ef947..c839bf74cb 100644 --- a/src/flash/nor/stmsmi.c +++ b/src/flash/nor/stmsmi.c @@ -12,9 +12,7 @@ * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * + * along with this program. If not, see . * ***************************************************************************/ /* STM Serial Memory Interface (SMI) controller is a SPI bus controller @@ -120,7 +118,7 @@ struct stmsmi_flash_bank { int probed; uint32_t io_base; uint32_t bank_num; - struct flash_device *dev; + const struct flash_device *dev; }; struct stmsmi_target { @@ -130,7 +128,7 @@ struct stmsmi_target { uint32_t io_base; }; -static struct stmsmi_target target_devices[] = { +static const struct stmsmi_target target_devices[] = { /* name, tap_idcode, smi_base, io_base */ { "SPEAr3xx/6xx", 0x07926041, 0xf8000000, 0xfc000000 }, { "STR75x", 0x4f1f0041, 0x80000000, 0x90000000 }, @@ -162,7 +160,7 @@ FLASH_BANK_COMMAND_HANDLER(stmsmi_flash_bank_command) /* timeout in ms */ static int poll_tff(struct target *target, uint32_t io_base, int timeout) { - long long endtime; + int64_t endtime; if (SMI_READ_REG(SMI_SR) & SMI_TFF) return ERROR_OK; @@ -213,7 +211,7 @@ static int wait_till_ready(struct flash_bank *bank, int timeout) { uint32_t status; int retval; - long long endtime; + int64_t endtime; endtime = timeval_ms() + timeout; do { @@ -372,7 +370,7 @@ static int stmsmi_protect(struct flash_bank *bank, int set, return ERROR_OK; } -static int smi_write_buffer(struct flash_bank *bank, uint8_t *buffer, +static int smi_write_buffer(struct flash_bank *bank, const uint8_t *buffer, uint32_t address, uint32_t len) { struct target *target = bank->target; @@ -397,7 +395,7 @@ static int smi_write_buffer(struct flash_bank *bank, uint8_t *buffer, return ERROR_OK; } -static int stmsmi_write(struct flash_bank *bank, uint8_t *buffer, +static int stmsmi_write(struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count) { struct target *target = bank->target; @@ -529,7 +527,7 @@ static int stmsmi_probe(struct flash_bank *bank) uint32_t io_base; struct flash_sector *sectors; uint32_t id = 0; /* silence uninitialized warning */ - struct stmsmi_target *target_device; + const struct stmsmi_target *target_device; int retval; if (stmsmi_info->probed) @@ -575,7 +573,7 @@ static int stmsmi_probe(struct flash_bank *bank) return retval; stmsmi_info->dev = NULL; - for (struct flash_device *p = flash_devices; p->name ; p++) + for (const struct flash_device *p = flash_devices; p->name ; p++) if (p->device_id == id) { stmsmi_info->dev = p; break; @@ -656,4 +654,5 @@ struct flash_driver stmsmi_flash = { .erase_check = default_flash_blank_check, .protect_check = stmsmi_protect_check, .info = get_stmsmi_info, + .free_driver_priv = default_flash_free_driver_priv, };