]> git.sur5r.net Git - u-boot/blobdiff - board/nokia/rx51/rx51.c
SPDX: Convert all of our single license tags to Linux Kernel style
[u-boot] / board / nokia / rx51 / rx51.c
index 42bf8b669d74c24563706598476701cde39fe5bf..76f6ede38c62d8b9811c717b59762b5d584fb49c 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * (C) Copyright 2012
  * Ивайло Димитров <freemangordon@abv.bg>
  *
  *     Richard Woodruff <r-woodruff2@ti.com>
  *     Syed Mohammed Khasim <khasim@ti.com>
- *
- * 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
  */
 
 #include <common.h>
@@ -250,18 +233,18 @@ void setup_board_tags(struct tag **in_params)
        params->u.core.rootdev = 0x0;
 
        /* append omap atag only if env setup_omap_atag is set to 1 */
-       str = getenv("setup_omap_atag");
+       str = env_get("setup_omap_atag");
        if (!str || str[0] != '1')
                return;
 
-       str = getenv("setup_console_atag");
+       str = env_get("setup_console_atag");
        if (str && str[0] == '1')
                setup_console_atag = 1;
        else
                setup_console_atag = 0;
 
-       setup_boot_reason_atag = getenv("setup_boot_reason_atag");
-       setup_boot_mode_atag = getenv("setup_boot_mode_atag");
+       setup_boot_reason_atag = env_get("setup_boot_reason_atag");
+       setup_boot_mode_atag = env_get("setup_boot_mode_atag");
 
        params = *in_params;
        t = (struct tag_omap *)&params->u;
@@ -357,6 +340,17 @@ static void omap3_emu_romcode_call(u32 service_id, u32 *parameters)
        do_omap3_emu_romcode_call(service_id, OMAP3_PUBLIC_SRAM_SCRATCH_AREA);
 }
 
+void omap3_set_aux_cr_secure(u32 acr)
+{
+       struct emu_hal_params_rx51 emu_romcode_params = { 0, };
+
+       emu_romcode_params.num_params = 2;
+       emu_romcode_params.param1 = acr;
+
+       omap3_emu_romcode_call(OMAP3_EMU_HAL_API_WRITE_ACR,
+                              (u32 *)&emu_romcode_params);
+}
+
 /*
  * Routine: omap3_update_aux_cr_secure_rx51
  * Description: Modify the contents Auxiliary Control Register.
@@ -366,19 +360,13 @@ static void omap3_emu_romcode_call(u32 service_id, u32 *parameters)
  */
 static void omap3_update_aux_cr_secure_rx51(u32 set_bits, u32 clear_bits)
 {
-       struct emu_hal_params_rx51 emu_romcode_params = { 0, };
        u32 acr;
 
        /* Read ACR */
        asm volatile ("mrc p15, 0, %0, c1, c0, 1" : "=r" (acr));
        acr &= ~clear_bits;
        acr |= set_bits;
-
-       emu_romcode_params.num_params = 2;
-       emu_romcode_params.param1 = acr;
-
-       omap3_emu_romcode_call(OMAP3_EMU_HAL_API_WRITE_ACR,
-                               (u32 *)&emu_romcode_params);
+       omap3_set_aux_cr_secure(acr);
 }
 
 /*
@@ -424,7 +412,7 @@ int misc_init_r(void)
 
        /* set env variable attkernaddr for relocated kernel */
        sprintf(buf, "%#x", KERNEL_ADDRESS);
-       setenv("attkernaddr", buf);
+       env_set("attkernaddr", buf);
 
        /* initialize omap tags */
        init_omap_tags();
@@ -432,14 +420,18 @@ int misc_init_r(void)
        /* reuse atags from previous bootloader */
        reuse_atags();
 
-       dieid_num_r();
+       omap_die_id_display();
        print_cpuinfo();
 
        /*
         * Cortex-A8(r1p0..r1p2) errata 430973 workaround
         * Set IBE bit in Auxiliary Control Register
+        *
+        * Call this routine only on real secure device
+        * Qemu does not implement secure PPA and crash
         */
-       omap3_update_aux_cr_secure_rx51(1 << 6, 0);
+       if (get_device_type() == HS_DEVICE)
+               omap3_update_aux_cr_secure_rx51(1 << 6, 0);
 
        return 0;
 }
@@ -601,7 +593,7 @@ static void rx51_kp_fill(u8 k, u8 mods)
  * Routine: rx51_kp_tstc
  * Description: Test if key was pressed (from buffer).
  */
-int rx51_kp_tstc(void)
+int rx51_kp_tstc(struct stdio_dev *sdev)
 {
        u8 c, r, dk, i;
        u8 intr;
@@ -657,10 +649,10 @@ int rx51_kp_tstc(void)
  * Routine: rx51_kp_getc
  * Description: Get last pressed key (from buffer).
  */
-int rx51_kp_getc(void)
+int rx51_kp_getc(struct stdio_dev *sdev)
 {
        keybuf_head %= KEYBUF_SIZE;
-       while (!rx51_kp_tstc())
+       while (!rx51_kp_tstc(sdev))
                WATCHDOG_RESET();
        return keybuf[keybuf_head++];
 }
@@ -675,3 +667,9 @@ int board_mmc_init(bd_t *bis)
        omap_mmc_init(1, 0, 0, -1, -1);
        return 0;
 }
+
+void board_mmc_power_init(void)
+{
+       twl4030_power_mmc_init(0);
+       twl4030_power_mmc_init(1);
+}