]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - post/cpu/mpc8xx/uart.c
Merge branch 'u-boot/master'
[karo-tx-uboot.git] / post / cpu / mpc8xx / uart.c
index fd97e3899e9e1187aaff700cec7c97d06c89d4ee..5214c71b085cd394cc975bda57e39f03ac06524a 100644 (file)
@@ -2,23 +2,7 @@
  * (C) Copyright 2002
  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program 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 of
- * the License, or (at your option) any later version.
- *
- * This program 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.
- *
- * 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., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
  *   TEST_NUM - number of tests
  */
 
-#ifdef CONFIG_POST
-
 #include <post.h>
-#if CONFIG_POST & CFG_POST_UART
+#if CONFIG_POST & CONFIG_SYS_POST_UART
 #if defined(CONFIG_8xx)
 #include <commproc.h>
 #elif defined(CONFIG_MPC8260)
@@ -63,8 +45,6 @@ static int ctlr_list[][2] =
 static int ctlr_list[][2] = { };
 #endif
 
-#define CTRL_LIST_SIZE (sizeof(ctlr_list) / sizeof(ctlr_list[0]))
-
 static struct {
        void (*init) (int index);
        void (*halt) (int index);
@@ -86,7 +66,7 @@ static void smc_init (int smc_index)
 {
        static int cpm_cr_ch[] = { CPM_CR_CH_SMC1, CPM_CR_CH_SMC2 };
 
-       volatile immap_t *im = (immap_t *) CFG_IMMR;
+       volatile immap_t *im = (immap_t *) CONFIG_SYS_IMMR;
        volatile smc_t *sp;
        volatile smc_uart_t *up;
        volatile cbd_t *tbdf, *rbdf;
@@ -107,15 +87,15 @@ static void smc_init (int smc_index)
        im->im_siu_conf.sc_sdcr = 1;
 
        /* clear error conditions */
-#ifdef CFG_SDSR
-       im->im_sdma.sdma_sdsr = CFG_SDSR;
+#ifdef CONFIG_SYS_SDSR
+       im->im_sdma.sdma_sdsr = CONFIG_SYS_SDSR;
 #else
        im->im_sdma.sdma_sdsr = 0x83;
 #endif
 
        /* clear SDMA interrupt mask */
-#ifdef CFG_SDMR
-       im->im_sdma.sdma_sdmr = CFG_SDMR;
+#ifdef CONFIG_SYS_SDMR
+       im->im_sdma.sdma_sdmr = CONFIG_SYS_SDMR;
 #else
        im->im_sdma.sdma_sdmr = 0x00;
 #endif
@@ -126,7 +106,7 @@ static void smc_init (int smc_index)
                        ~(smc_index == 1 ? BCSR1_RS232EN_1 : BCSR1_RS232EN_2);
 #endif
 
-#if defined(CONFIG_RPXLITE) || defined(CONFIG_RPXCLASSIC)
+#if defined(CONFIG_RPXLITE)
        /* Enable Monitor Port Transceiver */
        *((uchar *) BCSR0) |= BCSR0_ENMONXCVR;
 #endif
@@ -135,7 +115,7 @@ static void smc_init (int smc_index)
         * the buffer descriptors.
         */
 
-#ifdef CFG_ALLOC_DPRAM
+#ifdef CONFIG_SYS_ALLOC_DPRAM
        dpaddr = dpram_alloc_align (sizeof (cbd_t) * 2 + 2, 8);
 #else
        dpaddr = CPM_POST_BASE;
@@ -161,10 +141,6 @@ static void smc_init (int smc_index)
        up->smc_rfcr = SMC_EB;
        up->smc_tfcr = SMC_EB;
 
-#if defined(CONFIG_MBX)
-       board_serial_init ();
-#endif
-
        /* Set UART mode, 8 bit, no parity, one stop.
         * Enable receive and transmit.
         * Set local loopback mode.
@@ -220,7 +196,7 @@ static void smc_putc (int smc_index, const char c)
        volatile cbd_t *tbdf;
        volatile char *buf;
        volatile smc_uart_t *up;
-       volatile immap_t *im = (immap_t *) CFG_IMMR;
+       volatile immap_t *im = (immap_t *) CONFIG_SYS_IMMR;
        volatile cpm8xx_t *cpmp = &(im->im_cpm);
 
        up = (smc_uart_t *) & cpmp->cp_dparam[proff_smc[smc_index]];
@@ -252,7 +228,7 @@ static int smc_getc (int smc_index)
        volatile cbd_t *rbdf;
        volatile unsigned char *buf;
        volatile smc_uart_t *up;
-       volatile immap_t *im = (immap_t *) CFG_IMMR;
+       volatile immap_t *im = (immap_t *) CONFIG_SYS_IMMR;
        volatile cpm8xx_t *cpmp = &(im->im_cpm);
        unsigned char c;
        int i;
@@ -295,7 +271,7 @@ static void scc_init (int scc_index)
                CPM_CR_CH_SCC4,
        };
 
-       volatile immap_t *im = (immap_t *) CFG_IMMR;
+       volatile immap_t *im = (immap_t *) CONFIG_SYS_IMMR;
        volatile scc_t *sp;
        volatile scc_uart_t *up;
        volatile cbd_t *tbdf, *rbdf;
@@ -315,7 +291,7 @@ static void scc_init (int scc_index)
        /* Allocate space for two buffer descriptors in the DP ram.
         */
 
-#ifdef CFG_ALLOC_DPRAM
+#ifdef CONFIG_SYS_ALLOC_DPRAM
        dpaddr = dpram_alloc_align (sizeof (cbd_t) * 2 + 2, 8);
 #else
        dpaddr = CPM_POST_BASE;
@@ -422,7 +398,7 @@ static void scc_init (int scc_index)
 
 static void scc_halt(int scc_index)
 {
-       volatile immap_t *im = (immap_t *) CFG_IMMR;
+       volatile immap_t *im = (immap_t *) CONFIG_SYS_IMMR;
        volatile cpm8xx_t *cp = &(im->im_cpm);
        volatile scc_t *sp = (scc_t *) & (cp->cp_scc[scc_index]);
 
@@ -434,7 +410,7 @@ static void scc_putc (int scc_index, const char c)
        volatile cbd_t *tbdf;
        volatile char *buf;
        volatile scc_uart_t *up;
-       volatile immap_t *im = (immap_t *) CFG_IMMR;
+       volatile immap_t *im = (immap_t *) CONFIG_SYS_IMMR;
        volatile cpm8xx_t *cpmp = &(im->im_cpm);
 
        up = (scc_uart_t *) & cpmp->cp_dparam[proff_scc[scc_index]];
@@ -466,7 +442,7 @@ static int scc_getc (int scc_index)
        volatile cbd_t *rbdf;
        volatile unsigned char *buf;
        volatile scc_uart_t *up;
-       volatile immap_t *im = (immap_t *) CFG_IMMR;
+       volatile immap_t *im = (immap_t *) CONFIG_SYS_IMMR;
        volatile cpm8xx_t *cpmp = &(im->im_cpm);
        unsigned char c;
        int i;
@@ -542,7 +518,7 @@ int uart_post_test (int flags)
        ctlr_proc[CTLR_SCC].putc = scc_putc;
        ctlr_proc[CTLR_SCC].getc = scc_getc;
 
-       for (i = 0; i < CTRL_LIST_SIZE; i++) {
+       for (i = 0; i < ARRAY_SIZE(ctlr_list); i++) {
                if (test_ctlr (ctlr_list[i][0], ctlr_list[i][1]) != 0) {
                        res = -1;
                }
@@ -555,6 +531,4 @@ int uart_post_test (int flags)
        return res;
 }
 
-#endif /* CONFIG_POST & CFG_POST_UART */
-
-#endif /* CONFIG_POST */
+#endif /* CONFIG_POST & CONFIG_SYS_POST_UART */