openocd: fix SPDX tag format for files .c
[fw/openocd] / src / flash / nand / ecc_kw.c
index 55273c58f7622e7e0ca2341a9f1de6a2b4a8a968..cea1a5a0ab98aaff60c74e279ab4a505e8b09667 100644 (file)
@@ -1,26 +1,18 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+
 /*
  * Reed-Solomon ECC handling for the Marvell Kirkwood SOC
  * Copyright (C) 2009 Marvell Semiconductor, Inc.
  *
  * Authors: Lennert Buytenhek <buytenh@wantstofly.org>
  *          Nicolas Pitre <nico@fluxnic.net>
- *
- * This file is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 or (at your option) any
- * later version.
- *
- * This file is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * for more details.
  */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
-#include <flash/nand.h>
+#include "core.h"
 
 /*****************************************************************************
  * Arithmetic in GF(2^10) ("F") modulo x^10 + x^3 + 1.
@@ -28,7 +20,7 @@
  * For multiplication, a discrete log/exponent table is used, with
  * primitive element x (F is a primitive field, so x is primitive).
  */
-#define MODPOLY                0x409           /* x^10 + x^3 + 1 in binary */
+#define MODPOLY 0x409          /* x^10 + x^3 + 1 in binary */
 
 /*
  * Maps an integer a [0..1022] to a polynomial b = gf_exp[a] in
@@ -102,7 +94,7 @@ int nand_calculate_ecc_kw(struct nand_device *nand, const uint8_t *data, uint8_t
 {
        unsigned int r7, r6, r5, r4, r3, r2, r1, r0;
        int i;
-       static int tables_initialized = 0;
+       static int tables_initialized;
 
        if (!tables_initialized) {
                gf_build_log_exp_table();
@@ -121,7 +113,6 @@ int nand_calculate_ecc_kw(struct nand_device *nand, const uint8_t *data, uint8_t
        r6 = data[510];
        r7 = data[511];
 
-
        /*
         * Shift bytes 503..0 (in that order) into r0, followed
         * by eight zero bytes, while reducing the polynomial by the