flash/nor: Add PSoC 5LP flash driver
[fw/openocd] / src / flash / nor / stellaris.c
index 27b66325a363d48be00310d428cf6189b94adade..79aaf3ba2c6a4ed355a4ac997763efd45a51688d 100644 (file)
@@ -16,9 +16,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 <http://www.gnu.org/licenses/>. *
  ***************************************************************************/
 
 /***************************************************************************
@@ -507,12 +505,12 @@ static int get_stellaris_info(struct flash_bank *bank, char *buf, int buf_size)
        printed = snprintf(buf,
                           buf_size,
                           "did1: 0x%8.8" PRIx32 ", arch: 0x%4.4" PRIx32
-                          ", eproc: %s, ramsize: %ik, flashsize: %ik\n",
+                          ", eproc: %s, ramsize: %" PRIu32 "k, flashsize: %" PRIu32 "k\n",
                           stellaris_info->did1,
                           stellaris_info->did1,
                           "ARMv7M",
                           stellaris_info->sramsiz,
-                          stellaris_info->num_pages * stellaris_info->pagesize / 1024);
+                          (uint32_t)(stellaris_info->num_pages * stellaris_info->pagesize / 1024));
        buf += printed;
        buf_size -= printed;
 
@@ -602,7 +600,7 @@ static void stellaris_read_clock_info(struct flash_bank *bank)
        LOG_DEBUG("Stellaris PLLCFG %" PRIx32 "", pllcfg);
 
        stellaris_info->rcc = rcc;
-       stellaris_info->rcc = rcc2;
+       stellaris_info->rcc2 = rcc2;
 
        sysdiv = (rcc >> 23) & 0xF;
        usesysdiv = (rcc >> 22) & 0x1;
@@ -1065,7 +1063,7 @@ static int stellaris_write_block(struct flash_bank *bank,
                        &write_algorithm) != ERROR_OK) {
                LOG_DEBUG("no working area for block memory writes");
                return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
-       };
+       }
 
        /* plus a buffer big enough for this data */
        if (wcount * 4 < buffer_size)
@@ -1080,7 +1078,7 @@ static int stellaris_write_block(struct flash_bank *bank,
                }
                LOG_DEBUG("retry target_alloc_working_area(%s, size=%u)",
                                target_name(target), (unsigned) buffer_size);
-       };
+       }
 
        target_write_buffer(target, write_algorithm->address,
                        sizeof(stellaris_write_code),
@@ -1454,4 +1452,5 @@ struct flash_driver stellaris_flash = {
        .erase_check = default_flash_blank_check,
        .protect_check = stellaris_protect_check,
        .info = get_stellaris_info,
+       .free_driver_priv = default_flash_free_driver_priv,
 };