]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - arch/arm/cpu/armv7/omap5/hwinit.c
ARM: DRA72: disable workaround for 801819
[karo-tx-uboot.git] / arch / arm / cpu / armv7 / omap5 / hwinit.c
index e192fea0ebccfd141bc37346f2f8e975003c74f4..22e0829a6a0c2482328f6136ec1e6cf2160586bc 100644 (file)
  *     Steve Sakoman   <steve@sakoman.com>
  *     Sricharan       <r.sricharan@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
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 #include <common.h>
 #include <asm/armv7.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/sys_proto.h>
-#include <asm/arch/clocks.h>
-#include <asm/sizes.h>
+#include <asm/arch/clock.h>
+#include <linux/sizes.h>
 #include <asm/utils.h>
 #include <asm/arch/gpio.h>
 #include <asm/emif.h>
@@ -43,17 +27,28 @@ DECLARE_GLOBAL_DATA_PTR;
 
 u32 *const omap_si_rev = (u32 *)OMAP_SRAM_SCRATCH_OMAP_REV;
 
-static struct gpio_bank gpio_bank_54xx[6] = {
+static struct gpio_bank gpio_bank_54xx[8] = {
        { (void *)OMAP54XX_GPIO1_BASE, METHOD_GPIO_24XX },
        { (void *)OMAP54XX_GPIO2_BASE, METHOD_GPIO_24XX },
        { (void *)OMAP54XX_GPIO3_BASE, METHOD_GPIO_24XX },
        { (void *)OMAP54XX_GPIO4_BASE, METHOD_GPIO_24XX },
        { (void *)OMAP54XX_GPIO5_BASE, METHOD_GPIO_24XX },
        { (void *)OMAP54XX_GPIO6_BASE, METHOD_GPIO_24XX },
+       { (void *)OMAP54XX_GPIO7_BASE, METHOD_GPIO_24XX },
+       { (void *)OMAP54XX_GPIO8_BASE, METHOD_GPIO_24XX },
 };
 
 const struct gpio_bank *const omap_gpio_bank = gpio_bank_54xx;
 
+void do_set_mux32(u32 base, struct pad_conf_entry const *array, int size)
+{
+       int i;
+       struct pad_conf_entry *pad = (struct pad_conf_entry *)array;
+
+       for (i = 0; i < size; i++, pad++)
+               writel(pad->val, base + pad->offset);
+}
+
 #ifdef CONFIG_SPL_BUILD
 /* LPDDR2 specific IO settings */
 static void io_settings_lpddr2(void)
@@ -89,27 +84,36 @@ static void io_settings_ddr3(void)
 
        writel(ioregs->ctrl_ddrio_0, (*ctrl)->control_ddrio_0);
        writel(ioregs->ctrl_ddrio_1, (*ctrl)->control_ddrio_1);
-       writel(ioregs->ctrl_ddrio_2, (*ctrl)->control_ddrio_2);
+
+       if (!is_dra7xx()) {
+               writel(ioregs->ctrl_ddrio_2, (*ctrl)->control_ddrio_2);
+               writel(ioregs->ctrl_lpddr2ch, (*ctrl)->control_lpddr2ch1_1);
+       }
 
        /* omap5432 does not use lpddr2 */
        writel(ioregs->ctrl_lpddr2ch, (*ctrl)->control_lpddr2ch1_0);
-       writel(ioregs->ctrl_lpddr2ch, (*ctrl)->control_lpddr2ch1_1);
 
        writel(ioregs->ctrl_emif_sdram_config_ext,
               (*ctrl)->control_emif1_sdram_config_ext);
-       writel(ioregs->ctrl_emif_sdram_config_ext,
-              (*ctrl)->control_emif2_sdram_config_ext);
+       if (!is_dra72x())
+               writel(ioregs->ctrl_emif_sdram_config_ext,
+                      (*ctrl)->control_emif2_sdram_config_ext);
 
-       /* Disable DLL select */
-       io_settings = (readl((*ctrl)->control_port_emif1_sdram_config)
+       if (is_omap54xx()) {
+               /* Disable DLL select */
+               io_settings = (readl((*ctrl)->control_port_emif1_sdram_config)
                                                        & 0xFFEFFFFF);
-       writel(io_settings,
-               (*ctrl)->control_port_emif1_sdram_config);
+               writel(io_settings,
+                       (*ctrl)->control_port_emif1_sdram_config);
 
-       io_settings = (readl((*ctrl)->control_port_emif2_sdram_config)
+               io_settings = (readl((*ctrl)->control_port_emif2_sdram_config)
                                                        & 0xFFEFFFFF);
-       writel(io_settings,
-               (*ctrl)->control_port_emif2_sdram_config);
+               writel(io_settings,
+                       (*ctrl)->control_port_emif2_sdram_config);
+       } else {
+               writel(ioregs->ctrl_ddr_ctrl_ext_0,
+                               (*ctrl)->control_ddr_control_ext_0);
+       }
 }
 
 /*
@@ -118,6 +122,7 @@ static void io_settings_ddr3(void)
 void do_io_settings(void)
 {
        u32 io_settings = 0, mask = 0;
+       struct emif_reg_struct *emif = (struct emif_reg_struct *)EMIF1_BASE;
 
        /* Impedance settings EMMC, C2C 1,2, hsi2 */
        mask = (ds_mask << 2) | (ds_mask << 8) |
@@ -173,16 +178,10 @@ void do_io_settings(void)
                       (sc_fast << 17) | (sc_fast << 14);
        writel(io_settings, (*ctrl)->control_smart3io_padconf_1);
 
-       if (emif_sdram_type() == EMIF_SDRAM_TYPE_LPDDR2)
+       if (emif_sdram_type(emif->emif_sdram_config) == EMIF_SDRAM_TYPE_LPDDR2)
                io_settings_lpddr2();
        else
                io_settings_ddr3();
-
-       /* Efuse settings */
-       writel(EFUSE_1, (*ctrl)->control_efuse_1);
-       writel(EFUSE_2, (*ctrl)->control_efuse_2);
-       writel(EFUSE_3, (*ctrl)->control_efuse_3);
-       writel(EFUSE_4, (*ctrl)->control_efuse_4);
 }
 
 static const struct srcomp_params srcomp_parameters[NUM_SYS_CLKS] = {
@@ -201,6 +200,9 @@ void srcomp_enable(void)
        u32 sysclk_ind  = get_sys_clk_index();
        u32 omap_rev    = omap_revision();
 
+       if (!is_omap54xx())
+               return;
+
        mul_factor = srcomp_parameters[sysclk_ind].multiply_factor;
        div_factor = srcomp_parameters[sysclk_ind].divide_factor;
 
@@ -303,13 +305,32 @@ void srcomp_enable(void)
 
 void config_data_eye_leveling_samples(u32 emif_base)
 {
+       const struct ctrl_ioregs *ioregs;
+
+       get_ioregs(&ioregs);
+
        /*EMIF_SDRAM_CONFIG_EXT-Read data eye leveling no of samples =4*/
        if (emif_base == EMIF1_BASE)
-               writel(SDRAM_CONFIG_EXT_RD_LVL_4_SAMPLES,
-                       (*ctrl)->control_emif1_sdram_config_ext);
+               writel(ioregs->ctrl_emif_sdram_config_ext_final,
+                      (*ctrl)->control_emif1_sdram_config_ext);
        else if (emif_base == EMIF2_BASE)
-               writel(SDRAM_CONFIG_EXT_RD_LVL_4_SAMPLES,
-                       (*ctrl)->control_emif2_sdram_config_ext);
+               writel(ioregs->ctrl_emif_sdram_config_ext_final,
+                      (*ctrl)->control_emif2_sdram_config_ext);
+}
+
+void init_cpu_configuration(void)
+{
+       u32 l2actlr;
+
+       asm volatile("mrc p15, 1, %0, c15, c0, 0" : "=r"(l2actlr));
+       /*
+        * L2ACTLR: Ensure to enable the following:
+        * 3: Disable clean/evict push to external
+        * 4: Disable WriteUnique and WriteLineUnique transactions from master
+        * 8: Disable DVM/CMO message broadcast
+        */
+       l2actlr |= 0x118;
+       omap_smc1(OMAP5_SERVICE_L2ACTLR_SET, l2actlr);
 }
 
 void init_omap_revision(void)
@@ -341,9 +362,16 @@ void init_omap_revision(void)
        case DRA752_CONTROL_ID_CODE_ES1_0:
                *omap_si_rev = DRA752_ES1_0;
                break;
+       case DRA752_CONTROL_ID_CODE_ES1_1:
+               *omap_si_rev = DRA752_ES1_1;
+               break;
+       case DRA722_CONTROL_ID_CODE_ES1_0:
+               *omap_si_rev = DRA722_ES1_0;
+               break;
        default:
                *omap_si_rev = OMAP5430_SILICON_ID_INVALID;
        }
+       init_cpu_configuration();
 }
 
 void reset_cpu(ulong ignored)
@@ -383,3 +411,27 @@ void setup_warmreset_time(void)
        rst_val |= rst_time;
        writel(rst_val, (*prcm)->prm_rsttime);
 }
+
+void v7_arch_cp15_set_l2aux_ctrl(u32 l2auxctrl, u32 cpu_midr,
+                                u32 cpu_rev_comb, u32 cpu_variant,
+                                u32 cpu_rev)
+{
+       omap_smc1(OMAP5_SERVICE_L2ACTLR_SET, l2auxctrl);
+}
+
+void v7_arch_cp15_set_acr(u32 acr, u32 cpu_midr, u32 cpu_rev_comb,
+                         u32 cpu_variant, u32 cpu_rev)
+{
+
+#ifdef CONFIG_ARM_ERRATA_801819
+       /*
+        * DRA72x processors are uniprocessors and DONOT have
+        * ACP (Accelerator Coherency Port) hooked to ACE (AXI Coherency
+        * Extensions) Hence the erratum workaround is not applicable for
+        * DRA72x processors.
+        */
+       if (is_dra72x())
+               acr &= ~((0x3 << 23) | (0x3 << 25));
+#endif
+       omap_smc1(OMAP5_SERVICE_ACR_SET, acr);
+}