sata: Move drivers into new drivers/ata directory
[oweals/u-boot.git] / arch / powerpc / cpu / mpc85xx / bsc9132_serdes.c
index 300a4dbcf659b08fab22833d1bab80a8bd1cc043..4b5cd9933211878db2e15cb7a4026f2532824e09 100644 (file)
@@ -2,10 +2,7 @@
  * Copyright 2013 Freescale Semiconductor, Inc.
  * Author: Prabhakar Kushwaha <prabhakar@freescale.com>
  *
- * 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.
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <config.h>
@@ -71,6 +68,9 @@ static u8 serdes1_cfg_tbl[][SRDS1_MAX_LANES] = {
 
 int is_serdes_configured(enum srds_prtcl prtcl)
 {
+       if (!(serdes1_prtcl_map & (1 << NONE)))
+               fsl_serdes_init();
+
        return (1 << prtcl) & serdes1_prtcl_map;
 }
 
@@ -82,6 +82,9 @@ void fsl_serdes_init(void)
                                MPC85xx_PORDEVSR_IO_SEL_SHIFT;
        int lane;
 
+       if (serdes1_prtcl_map & (1 << NONE))
+               return;
+
        debug("PORDEVSR[IO_SEL_SRDS] = %x\n", srds_cfg);
 
        if (srds_cfg >= ARRAY_SIZE(serdes1_cfg_tbl)) {
@@ -93,4 +96,7 @@ void fsl_serdes_init(void)
                enum srds_prtcl lane_prtcl = serdes1_cfg_tbl[srds_cfg][lane];
                serdes1_prtcl_map |= (1 << lane_prtcl);
        }
+
+       /* Set the first bit to indicate serdes has been initialized */
+       serdes1_prtcl_map |= (1 << NONE);
 }