]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - board/genesi/mx51_efikamx/efikamx.c
Merge branch 'master' of git://git.denx.de/u-boot-imx
[karo-tx-uboot.git] / board / genesi / mx51_efikamx / efikamx.c
index cfd2e938b94c46e841e3ce4413f6c2e8ff16575f..6ba55cd08a82f62a5cd420b024ff68cdb0cc171a 100644 (file)
@@ -3,23 +3,7 @@
  * Copyright (C) 2010 Marek Vasut <marek.vasut@gmail.com>
  * Copyright (C) 2009-2012 Genesi USA, Inc.
  *
- * 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>
 #include <asm/errno.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/arch/crm_regs.h>
+#include <asm/arch/clock.h>
+#include <asm/imx-common/spi.h>
 #include <i2c.h>
 #include <mmc.h>
 #include <fsl_esdhc.h>
-#include <pmic.h>
+#include <power/pmic.h>
 #include <fsl_pmic.h>
 #include <mc13892.h>
 
@@ -93,7 +79,7 @@ static u32 get_mx_rev(void)
        return (~rev & 0x7) + 1;
 }
 
-static iomux_v3_cfg_t efikasb_revision_pads[] = {
+static iomux_v3_cfg_t const efikasb_revision_pads[] = {
        MX51_PAD_EIM_CS3__GPIO2_28,
        MX51_PAD_EIM_CS4__GPIO2_29,
 };
@@ -140,7 +126,7 @@ int dram_init(void)
 /*
  * UART configuration
  */
-static iomux_v3_cfg_t efikamx_uart_pads[] = {
+static iomux_v3_cfg_t const efikamx_uart_pads[] = {
        MX51_PAD_UART1_RXD__UART1_RXD,
        MX51_PAD_UART1_TXD__UART1_TXD,
        MX51_PAD_UART1_RTS__UART1_RTS,
@@ -150,7 +136,7 @@ static iomux_v3_cfg_t efikamx_uart_pads[] = {
 /*
  * SPI configuration
  */
-static iomux_v3_cfg_t efikamx_spi_pads[] = {
+static iomux_v3_cfg_t const efikamx_spi_pads[] = {
        MX51_PAD_CSPI1_MOSI__ECSPI1_MOSI,
        MX51_PAD_CSPI1_MISO__ECSPI1_MISO,
        MX51_PAD_CSPI1_SCLK__ECSPI1_SCLK,
@@ -167,14 +153,25 @@ static iomux_v3_cfg_t efikamx_spi_pads[] = {
  * PMIC configuration
  */
 #ifdef CONFIG_MXC_SPI
+int board_spi_cs_gpio(unsigned bus, unsigned cs)
+{
+       return (bus == 0 && cs == 1) ? 121 : -1;
+}
+
 static void power_init(void)
 {
        unsigned int val;
        struct mxc_ccm_reg *mxc_ccm = (struct mxc_ccm_reg *)MXC_CCM_BASE;
        struct pmic *p;
+       int ret;
 
-       pmic_init();
-       p = get_pmic();
+       ret = pmic_init(CONFIG_FSL_PMIC_BUS);
+       if (ret)
+               return;
+
+       p = pmic_get("FSL_PMIC");
+       if (!p)
+               return;
 
        /* Write needed to Power Gate 2 register */
        pmic_reg_read(p, REG_POWER_MISC, &val);
@@ -272,7 +269,7 @@ struct fsl_esdhc_cfg esdhc_cfg[2] = {
        {MMC_SDHC2_BASE_ADDR},
 };
 
-static iomux_v3_cfg_t efikamx_sdhc1_pads[] = {
+static iomux_v3_cfg_t const efikamx_sdhc1_pads[] = {
        MX51_PAD_SD1_CMD__SD1_CMD,
        MX51_PAD_SD1_CLK__SD1_CLK,
        MX51_PAD_SD1_DATA0__SD1_DATA0,
@@ -284,15 +281,15 @@ static iomux_v3_cfg_t efikamx_sdhc1_pads[] = {
 
 #define EFIKAMX_SDHC1_WP       IMX_GPIO_NR(1, 1)
 
-static iomux_v3_cfg_t efikamx_sdhc1_cd_pads[] = {
+static iomux_v3_cfg_t const efikamx_sdhc1_cd_pads[] = {
        MX51_PAD_GPIO1_0__SD1_CD,
-       MX51_PAD_EIM_CS2__SD1_CD,
+       NEW_PAD_CTRL(MX51_PAD_EIM_CS2__GPIO2_27, MX51_ESDHC_PAD_CTRL),
 };
 
 #define EFIKAMX_SDHC1_CD       IMX_GPIO_NR(1, 0)
 #define EFIKASB_SDHC1_CD       IMX_GPIO_NR(2, 27)
 
-static iomux_v3_cfg_t efikasb_sdhc2_pads[] = {
+static iomux_v3_cfg_t const efikasb_sdhc2_pads[] = {
        MX51_PAD_SD2_CMD__SD2_CMD,
        MX51_PAD_SD2_CLK__SD2_CLK,
        MX51_PAD_SD2_DATA0__SD2_DATA0,
@@ -349,6 +346,9 @@ int board_mmc_init(bd_t *bis)
                gpio_direction_input(EFIKASB_SDHC1_CD);
        }
 
+       esdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC_CLK);
+       esdhc_cfg[1].sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK);
+
        ret = fsl_esdhc_initialize(bis, &esdhc_cfg[0]);
 
        if (machine_is_efikasb()) {
@@ -368,7 +368,7 @@ int board_mmc_init(bd_t *bis)
 /*
  * PATA
  */
-static iomux_v3_cfg_t efikamx_pata_pads[] = {
+static iomux_v3_cfg_t const efikamx_pata_pads[] = {
        MX51_PAD_NANDF_WE_B__PATA_DIOW,
        MX51_PAD_NANDF_RE_B__PATA_DIOR,
        MX51_PAD_NANDF_ALE__PATA_BUFFER_EN,
@@ -419,7 +419,7 @@ static inline void setup_iomux_usb(void) { }
 #define EFIKAMX_LED_GREEN      IMX_GPIO_NR(3, 14)
 #define EFIKAMX_LED_RED                IMX_GPIO_NR(3, 15)
 
-static iomux_v3_cfg_t efikasb_led_pads[] = {
+static iomux_v3_cfg_t const efikasb_led_pads[] = {
        MX51_PAD_GPIO1_3__GPIO1_3,
        MX51_PAD_EIM_CS0__GPIO2_25,
 };