]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
mxc nand: cosmectic: Light cleanup
authorBenoît Thébaudeau <benoit.thebaudeau@advansee.com>
Mon, 13 Aug 2012 20:48:26 +0000 (22:48 +0200)
committerScott Wood <scottwood@freescale.com>
Tue, 18 Sep 2012 00:42:46 +0000 (19:42 -0500)
Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Cc: Scott Wood <scottwood@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Signed-off-by: Scott Wood <scottwood@freescale.com>
drivers/mtd/nand/mxc_nand.c
include/fsl_nfc.h
nand_spl/nand_boot_fsl_nfc.c

index 9a9260caf4794dda9dd737224414bf80813549c7..62d8c6b38cfb1b041609c7d1bd88ab9900adabda 100644 (file)
@@ -123,8 +123,7 @@ static int is_16bit_nand(void)
 #elif defined(CONFIG_MX25) || defined(CONFIG_MX35)
 static int is_16bit_nand(void)
 {
-       struct ccm_regs *ccm =
-               (struct ccm_regs *)IMX_CCM_BASE;
+       struct ccm_regs *ccm = (struct ccm_regs *)IMX_CCM_BASE;
 
        if (readl(&ccm->rcsr) & CCM_RCSR_NF_16BIT_SEL)
                return 1;
@@ -238,7 +237,7 @@ static void send_prog_page(struct mxc_nand_host *host, uint8_t buf_id,
                if (spare_only)
                        config1 |= NFC_SP_EN;
                else
-                       config1 &= ~(NFC_SP_EN);
+                       config1 &= ~NFC_SP_EN;
                writew(config1, &host->regs->config1);
        }
 
@@ -687,7 +686,6 @@ static int mxc_nand_correct_data(struct mtd_info *mtd, u_char *dat,
 #define mxc_nand_write_page_syndrome NULL
 #define mxc_nand_write_page_raw_syndrome NULL
 #define mxc_nand_write_oob_syndrome NULL
-#define mxc_nfc_11_nand_correct_data NULL
 
 static int mxc_nand_correct_data(struct mtd_info *mtd, u_char *dat,
                                 u_char *read_ecc, u_char *calc_ecc)
@@ -1188,7 +1186,6 @@ int board_nand_init(struct nand_chip *this)
 {
        struct mtd_info *mtd;
        uint16_t tmp;
-       int err = 0;
 
 #ifdef CONFIG_SYS_NAND_USE_FLASH_BBT
        this->options |= NAND_USE_FLASH_BBT;
@@ -1287,5 +1284,5 @@ int board_nand_init(struct nand_chip *this)
        this->ecc.layout = &nand_hw_eccoob;
 #endif
        mxc_setup_config1();
-       return err;
+       return 0;
 }
index 6691e410b65683639b163bd27d8d114e427c5a9e..1c16c71d45c14f99f733f64003d20522263fbe2c 100644 (file)
@@ -166,5 +166,6 @@ struct fsl_nfc_regs {
 #define NFC_RST                (1 << 6)
 #define NFC_CE         (1 << 7)
 #define NFC_ONE_CYCLE  (1 << 8)
+#define NFC_FP_INT     (1 << 11)
 
 #endif /* __FSL_NFC_H */
index f437debdc1539eedc339d4127cef93de84ff632a..b90f93e3b85916d18a2b2839ec62365246034a4f 100644 (file)
@@ -45,10 +45,10 @@ static void nfc_wait_ready(void)
        writew(tmp, &nfc->config2);
 }
 
-void nfc_nand_init(void)
+static void nfc_nand_init(void)
 {
 #if defined(MXC_NFC_V1_1)
-       int ecc_per_page  = CONFIG_SYS_NAND_PAGE_SIZE / 512;
+       int ecc_per_page = CONFIG_SYS_NAND_PAGE_SIZE / 512;
        int config1;
 
        writew(CONFIG_SYS_NAND_SPARE_SIZE / 2, &nfc->spare_area_size);
@@ -57,12 +57,12 @@ void nfc_nand_init(void)
        writew(0x2, &nfc->config);
 
        /* hardware ECC checking and correct */
-       config1 = readw(&nfc->config1) | NFC_ECC_EN | 0x800;
+       config1 = readw(&nfc->config1) | NFC_ECC_EN | NFC_FP_INT;
        /*
         * if spare size is larger that 16 bytes per 512 byte hunk
         * then use 8 symbol correction instead of 4
         */
-       if ((CONFIG_SYS_NAND_SPARE_SIZE / ecc_per_page) > 16)
+       if (CONFIG_SYS_NAND_SPARE_SIZE / ecc_per_page > 16)
                config1 &= ~NFC_4_8N_ECC;
        else
                config1 |= NFC_4_8N_ECC;
@@ -133,7 +133,7 @@ static void nfc_nand_data_output(void)
         * This NAND controller requires multiple input commands
         * for pages larger than 512 bytes.
         */
-       for (i = 1; i < (CONFIG_SYS_NAND_PAGE_SIZE / 512); i++) {
+       for (i = 1; i < CONFIG_SYS_NAND_PAGE_SIZE / 512; i++) {
                config1 = readw(&nfc->config1);
                config1 |= NFC_ECC_EN | NFC_INT_MSK;
                writew(config1, &nfc->config1);
@@ -171,7 +171,7 @@ static int nfc_read_page(unsigned int page_address, unsigned char *buf)
        dst = (u32 *)buf;
 
        /* main copy loop from NAND-buffer to SDRAM memory */
-       for (i = 0; i < (CONFIG_SYS_NAND_PAGE_SIZE / 4); i++) {
+       for (i = 0; i < CONFIG_SYS_NAND_PAGE_SIZE / 4; i++) {
                writel(readl(src), dst);
                src++;
                dst++;
@@ -230,7 +230,7 @@ static int nand_load(unsigned int from, unsigned int size, unsigned char *buf)
        page = from / CONFIG_SYS_NAND_PAGE_SIZE;
        i = 0;
 
-       while (i < (size / CONFIG_SYS_NAND_PAGE_SIZE)) {
+       while (i < size / CONFIG_SYS_NAND_PAGE_SIZE) {
                if (nfc_read_page(page, buf) < 0)
                        return -1;