]> git.karo-electronics.de Git - karo-tx-uboot.git/blobdiff - board/denx/m28evk/m28evk.c
mxs_gpio: correctly use the GPIO API
[karo-tx-uboot.git] / board / denx / m28evk / m28evk.c
index aff7c1fe5e6554b886e5ce09a31f3dc7da709ba0..b0bb934a38fd918ebd5d73a4ef2563cbf0172cad 100644 (file)
@@ -4,23 +4,7 @@
  * Copyright (C) 2011 Marek Vasut <marek.vasut@gmail.com>
  * on behalf of DENX Software Engineering GmbH
  *
- * 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>
@@ -56,11 +40,11 @@ int board_early_init_f(void)
        mxs_iomux_setup_pad(MX28_PAD_SSP2_SS1__USB1_OVERCURRENT);
        mxs_iomux_setup_pad(MX28_PAD_AUART3_TX__GPIO_3_13 |
                        MXS_PAD_12MA | MXS_PAD_3V3 | MXS_PAD_PULLUP);
-       gpio_direction_output(MX28_PAD_AUART3_TX__GPIO_3_13, 0);
+       gpio_direction_output(MXS_PAD_TO_GPIO(MX28_PAD_AUART3_TX__GPIO_3_13), 0);
 
        mxs_iomux_setup_pad(MX28_PAD_AUART3_RX__GPIO_3_12 |
                        MXS_PAD_12MA | MXS_PAD_3V3 | MXS_PAD_PULLUP);
-       gpio_direction_output(MX28_PAD_AUART3_RX__GPIO_3_12, 0);
+       gpio_direction_output(MXS_PAD_TO_GPIO(MX28_PAD_AUART3_RX__GPIO_3_12), 0);
 #endif
 
        return 0;
@@ -87,15 +71,15 @@ static int m28_mmc_wp(int id)
                return 1;
        }
 
-       return gpio_get_value(MX28_PAD_AUART2_CTS__GPIO_3_10);
+       return gpio_get_value(MXS_PAD_TO_GPIO(MX28_PAD_AUART2_CTS__GPIO_3_10));
 }
 
 int board_mmc_init(bd_t *bis)
 {
        /* Configure WP as input. */
-       gpio_direction_input(MX28_PAD_AUART2_CTS__GPIO_3_10);
+       gpio_direction_input(MXS_PAD_TO_GPIO(MX28_PAD_AUART2_CTS__GPIO_3_10));
        /* Turn on the power to the card. */
-       gpio_direction_output(MX28_PAD_PWM3__GPIO_3_28, 0);
+       gpio_direction_output(MXS_PAD_TO_GPIO(MX28_PAD_PWM3__GPIO_3_28), 0);
 
        return mxsmmc_initialize(bis, 0, m28_mmc_wp, NULL);
 }
@@ -132,6 +116,8 @@ int board_eth_init(bd_t *bis)
        int ret;
 
        ret = cpu_eth_init(bis);
+       if (ret)
+               return ret;
 
        clrsetbits_le32(&clkctrl_regs->hw_clkctrl_enet,
                CLKCTRL_ENET_TIME_SEL_MASK | CLKCTRL_ENET_CLK_OUT_EN,
@@ -139,9 +125,9 @@ int board_eth_init(bd_t *bis)
 
 #if !defined(CONFIG_DENX_M28_V11) && !defined(CONFIG_DENX_M28_V10)
        /* Reset the new PHY */
-       gpio_direction_output(MX28_PAD_AUART2_RTS__GPIO_3_11, 0);
+       gpio_direction_output(MXS_PAD_TO_GPIO(MX28_PAD_AUART2_RTS__GPIO_3_11), 0);
        udelay(10000);
-       gpio_set_value(MX28_PAD_AUART2_RTS__GPIO_3_11, 1);
+       gpio_set_value(MXS_PAD_TO_GPIO(MX28_PAD_AUART2_RTS__GPIO_3_11), 1);
        udelay(10000);
 #endif