summaryrefslogtreecommitdiff
path: root/arch/arm/mach-uniphier
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-uniphier')
-rw-r--r--arch/arm/mach-uniphier/board_init.c58
-rw-r--r--arch/arm/mach-uniphier/clk/Makefile1
-rw-r--r--arch/arm/mach-uniphier/clk/pll-base-ld20.c15
-rw-r--r--arch/arm/mach-uniphier/sbc/sbc-ld11.c2
-rw-r--r--arch/arm/mach-uniphier/sbc/sbc-pxs2.c2
5 files changed, 15 insertions, 63 deletions
diff --git a/arch/arm/mach-uniphier/board_init.c b/arch/arm/mach-uniphier/board_init.c
index a6ee22e339..8418902a5a 100644
--- a/arch/arm/mach-uniphier/board_init.c
+++ b/arch/arm/mach-uniphier/board_init.c
@@ -6,66 +6,17 @@
* SPDX-License-Identifier: GPL-2.0+
*/
-#include <common.h>
-#include <libfdt.h>
+#include <linux/errno.h>
#include <linux/io.h>
+#include <linux/printk.h>
#include "init.h"
#include "micro-support-card.h"
-#include "sg-regs.h"
#include "soc-info.h"
-DECLARE_GLOBAL_DATA_PTR;
-
-static void uniphier_setup_xirq(void)
-{
- const void *fdt = gd->fdt_blob;
- int soc_node, aidet_node;
- const fdt32_t *val;
- unsigned long aidet_base;
- u32 tmp;
-
- soc_node = fdt_path_offset(fdt, "/soc");
- if (soc_node < 0)
- return;
-
- aidet_node = fdt_subnode_offset_namelen(fdt, soc_node, "aidet", 5);
- if (aidet_node < 0)
- return;
-
- val = fdt_getprop(fdt, aidet_node, "reg", NULL);
- if (!val)
- return;
-
- aidet_base = fdt32_to_cpu(*val);
-
- tmp = readl(aidet_base + 8); /* AIDET DETCONFR2 */
- tmp |= 0x00ff0000; /* Set XIRQ0-7 low active */
- writel(tmp, aidet_base + 8);
-
- tmp = readl(0x55000090); /* IRQCTL */
- tmp |= 0x000000ff;
- writel(tmp, 0x55000090);
-}
-
-#ifdef CONFIG_ARCH_UNIPHIER_LD11
-static void uniphier_ld11_misc_init(void)
-{
- sg_set_pinsel(149, 14, 8, 4); /* XIRQ0 -> XIRQ0 */
- sg_set_iectrl(149);
- sg_set_pinsel(153, 14, 8, 4); /* XIRQ4 -> XIRQ4 */
- sg_set_iectrl(153);
-}
-#endif
-
#ifdef CONFIG_ARCH_UNIPHIER_LD20
static void uniphier_ld20_misc_init(void)
{
- sg_set_pinsel(149, 14, 8, 4); /* XIRQ0 -> XIRQ0 */
- sg_set_iectrl(149);
- sg_set_pinsel(153, 14, 8, 4); /* XIRQ4 -> XIRQ4 */
- sg_set_iectrl(153);
-
/* ES1 errata: increase VDD09 supply to suppress VBO noise */
if (uniphier_get_soc_revision() == 1) {
writel(0x00000003, 0x6184e004);
@@ -136,7 +87,6 @@ static const struct uniphier_initdata uniphier_initdata[] = {
.sbc_init = uniphier_ld11_sbc_init,
.pll_init = uniphier_ld11_pll_init,
.clk_init = uniphier_ld11_clk_init,
- .misc_init = uniphier_ld11_misc_init,
},
#endif
#if defined(CONFIG_ARCH_UNIPHIER_LD20)
@@ -192,10 +142,6 @@ int board_init(void)
led_puts("U3");
- uniphier_setup_xirq();
-
- led_puts("U4");
-
support_card_late_init();
led_puts("Uboo");
diff --git a/arch/arm/mach-uniphier/clk/Makefile b/arch/arm/mach-uniphier/clk/Makefile
index 76633bcd49..5cd0897dff 100644
--- a/arch/arm/mach-uniphier/clk/Makefile
+++ b/arch/arm/mach-uniphier/clk/Makefile
@@ -27,3 +27,4 @@ endif
obj-$(CONFIG_ARCH_UNIPHIER_LD11) += pll-base-ld20.o
obj-$(CONFIG_ARCH_UNIPHIER_LD20) += pll-base-ld20.o
+obj-$(CONFIG_ARCH_UNIPHIER_PXS3) += pll-base-ld20.o
diff --git a/arch/arm/mach-uniphier/clk/pll-base-ld20.c b/arch/arm/mach-uniphier/clk/pll-base-ld20.c
index 3aa42f8bfd..385f54dfc3 100644
--- a/arch/arm/mach-uniphier/clk/pll-base-ld20.c
+++ b/arch/arm/mach-uniphier/clk/pll-base-ld20.c
@@ -5,8 +5,10 @@
* SPDX-License-Identifier: GPL-2.0+
*/
+#include <linux/bitfield.h>
#include <linux/bitops.h>
#include <linux/delay.h>
+#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/io.h>
#include <linux/sizes.h>
@@ -18,7 +20,6 @@
#define SC_PLLCTRL_SSC_EN BIT(31)
#define SC_PLLCTRL2_NRSTDS BIT(28)
#define SC_PLLCTRL2_SSC_JK_MASK GENMASK(26, 0)
-#define SC_PLLCTRL3_REGI_SHIFT 16
#define SC_PLLCTRL3_REGI_MASK GENMASK(19, 16)
/* PLL type: VPLL27 */
@@ -41,13 +42,17 @@ int uniphier_ld20_sscpll_init(unsigned long reg_base, unsigned int freq,
if (freq != UNIPHIER_PLL_FREQ_DEFAULT) {
tmp = readl(base); /* SSCPLLCTRL */
tmp &= ~SC_PLLCTRL_SSC_DK_MASK;
- tmp |= (487 * freq * ssc_rate / divn / 512) &
- SC_PLLCTRL_SSC_DK_MASK;
+ tmp |= FIELD_PREP(SC_PLLCTRL_SSC_DK_MASK,
+ DIV_ROUND_CLOSEST(487UL * freq * ssc_rate,
+ divn * 512));
writel(tmp, base);
tmp = readl(base + 4);
tmp &= ~SC_PLLCTRL2_SSC_JK_MASK;
- tmp |= (41859 * freq / divn) & SC_PLLCTRL2_SSC_JK_MASK;
+ tmp |= FIELD_PREP(SC_PLLCTRL2_SSC_JK_MASK,
+ DIV_ROUND_CLOSEST(21431887UL * freq,
+ divn * 512));
+ writel(tmp, base + 4);
udelay(50);
}
@@ -90,7 +95,7 @@ int uniphier_ld20_sscpll_set_regi(unsigned long reg_base, unsigned regi)
tmp = readl(base + 8); /* SSCPLLCTRL3 */
tmp &= ~SC_PLLCTRL3_REGI_MASK;
- tmp |= regi << SC_PLLCTRL3_REGI_SHIFT;
+ tmp |= FIELD_PREP(SC_PLLCTRL3_REGI_MASK, regi);
writel(tmp, base + 8);
iounmap(base);
diff --git a/arch/arm/mach-uniphier/sbc/sbc-ld11.c b/arch/arm/mach-uniphier/sbc/sbc-ld11.c
index e6b83ff75b..d075c47d61 100644
--- a/arch/arm/mach-uniphier/sbc/sbc-ld11.c
+++ b/arch/arm/mach-uniphier/sbc/sbc-ld11.c
@@ -21,5 +21,5 @@ void uniphier_ld11_sbc_init(void)
/* pins for NAND and System Bus are multiplexed */
if (spl_boot_device() != BOOT_DEVICE_NAND)
- uniphier_pin_init("system_bus_grp");
+ uniphier_pin_init("system-bus");
}
diff --git a/arch/arm/mach-uniphier/sbc/sbc-pxs2.c b/arch/arm/mach-uniphier/sbc/sbc-pxs2.c
index 0e0ba27bd9..9ee264628b 100644
--- a/arch/arm/mach-uniphier/sbc/sbc-pxs2.c
+++ b/arch/arm/mach-uniphier/sbc/sbc-pxs2.c
@@ -17,5 +17,5 @@ void uniphier_pxs2_sbc_init(void)
/* system bus output enable */
writel(0x17, PC0CTRL);
- uniphier_pin_init("system_bus_grp"); /* PXs3 */
+ uniphier_pin_init("system-bus"); /* PXs3 */
}