sata: Move drivers into new drivers/ata directory
[oweals/u-boot.git] / arch / powerpc / cpu / mpc85xx / c29x_serdes.c
index 4b3214dd5ef2b10b0a78849fb75d2846f7fc9f2d..74d27b9a63ffeb75a0404595f4057dedd033c951 100644 (file)
@@ -1,10 +1,7 @@
 /*
  * Copyright 2013 Freescale Semiconductor, Inc.
  *
- * 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>
@@ -35,6 +32,9 @@ static const struct serdes_config serdes1_cfg_tbl[] = {
 
 int is_serdes_configured(enum srds_prtcl device)
 {
+       if (!(serdes1_prtcl_map & (1 << NONE)))
+               fsl_serdes_init();
+
        return (1 << device) & serdes1_prtcl_map;
 }
 
@@ -47,6 +47,9 @@ void fsl_serdes_init(void)
        const struct serdes_config *ptr;
        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)) {
@@ -62,4 +65,7 @@ void fsl_serdes_init(void)
                enum srds_prtcl lane_prtcl = ptr->lanes[lane];
                serdes1_prtcl_map |= (1 << lane_prtcl);
        }
+
+       /* Set the first bit to indicate serdes has been initialized */
+       serdes1_prtcl_map |= (1 << NONE);
 }