Skip to content

Commit

Permalink
Merge tag 'imx-soc-4.6' of git://git.kernel.org/pub/scm/linux/kernel/…
Browse files Browse the repository at this point in the history
…git/shawnguo/linux into next/soc

Merge "i.MX SoC update for 4.6" from Shawn Guo:

- Enable big endian mode support for i.MX platform
- Add support for i.MX6QP SoC which is the latest i.MX6 family addition
- Add basic suspend/resume support for i.MX25
- A couple of i.MX7D support updates
- A few random code cleanups

* tag 'imx-soc-4.6' of git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux:
  ARM: imx: Make reset_control_ops const
  ARM: imx: Do L2 errata only if the L2 cache isn't enabled
  ARM: imx: select ARM_CPU_SUSPEND only for imx6
  ARM: mx25: Add basic suspend/resume support
  ARM: imx: Add msl code support for imx6qp
  ARM: imx: enable big endian mode
  ARM: imx: use endian-safe readl/readw/writel/writew
  ARM: imx7d: correct chip version information
  ARM: imx: select HAVE_ARM_ARCH_TIMER if selected i.MX7D
  ARM: imx6: fix cleanup path in imx6q_suspend_init()
  • Loading branch information
Arnd Bergmann committed Mar 2, 2016
2 parents e91fb3b + d2443b2 commit f3a186f
Show file tree
Hide file tree
Showing 33 changed files with 203 additions and 132 deletions.
3 changes: 3 additions & 0 deletions arch/arm/include/debug/imx.S
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
*
*/

#include <asm/assembler.h>
#include "imx-uart.h"

/*
Expand All @@ -34,6 +35,7 @@
.endm

.macro senduart,rd,rx
ARM_BE8(rev \rd, \rd)
str \rd, [\rx, #0x40] @ TXDATA
.endm

Expand All @@ -42,6 +44,7 @@

.macro busyuart,rd,rx
1002: ldr \rd, [\rx, #0x98] @ SR2
ARM_BE8(rev \rd, \rd)
tst \rd, #1 << 3 @ TXDC
beq 1002b @ wait until transmit done
.endm
30 changes: 15 additions & 15 deletions arch/arm/mach-imx/3ds_debugboard.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ static void mxc_expio_irq_handler(struct irq_desc *desc)
/* irq = gpio irq number */
desc->irq_data.chip->irq_mask(&desc->irq_data);

imr_val = __raw_readw(brd_io + INTR_MASK_REG);
int_valid = __raw_readw(brd_io + INTR_STATUS_REG) & ~imr_val;
imr_val = imx_readw(brd_io + INTR_MASK_REG);
int_valid = imx_readw(brd_io + INTR_STATUS_REG) & ~imr_val;

expio_irq = 0;
for (; int_valid != 0; int_valid >>= 1, expio_irq++) {
Expand All @@ -117,17 +117,17 @@ static void expio_mask_irq(struct irq_data *d)
u16 reg;
u32 expio = d->hwirq;

reg = __raw_readw(brd_io + INTR_MASK_REG);
reg = imx_readw(brd_io + INTR_MASK_REG);
reg |= (1 << expio);
__raw_writew(reg, brd_io + INTR_MASK_REG);
imx_writew(reg, brd_io + INTR_MASK_REG);
}

static void expio_ack_irq(struct irq_data *d)
{
u32 expio = d->hwirq;

__raw_writew(1 << expio, brd_io + INTR_RESET_REG);
__raw_writew(0, brd_io + INTR_RESET_REG);
imx_writew(1 << expio, brd_io + INTR_RESET_REG);
imx_writew(0, brd_io + INTR_RESET_REG);
expio_mask_irq(d);
}

Expand All @@ -136,9 +136,9 @@ static void expio_unmask_irq(struct irq_data *d)
u16 reg;
u32 expio = d->hwirq;

reg = __raw_readw(brd_io + INTR_MASK_REG);
reg = imx_readw(brd_io + INTR_MASK_REG);
reg &= ~(1 << expio);
__raw_writew(reg, brd_io + INTR_MASK_REG);
imx_writew(reg, brd_io + INTR_MASK_REG);
}

static struct irq_chip expio_irq_chip = {
Expand All @@ -162,9 +162,9 @@ int __init mxc_expio_init(u32 base, u32 intr_gpio)
if (brd_io == NULL)
return -ENOMEM;

if ((__raw_readw(brd_io + MAGIC_NUMBER1_REG) != 0xAAAA) ||
(__raw_readw(brd_io + MAGIC_NUMBER2_REG) != 0x5555) ||
(__raw_readw(brd_io + MAGIC_NUMBER3_REG) != 0xCAFE)) {
if ((imx_readw(brd_io + MAGIC_NUMBER1_REG) != 0xAAAA) ||
(imx_readw(brd_io + MAGIC_NUMBER2_REG) != 0x5555) ||
(imx_readw(brd_io + MAGIC_NUMBER3_REG) != 0xCAFE)) {
pr_info("3-Stack Debug board not detected\n");
iounmap(brd_io);
brd_io = NULL;
Expand All @@ -181,10 +181,10 @@ int __init mxc_expio_init(u32 base, u32 intr_gpio)
gpio_direction_input(intr_gpio);

/* disable the interrupt and clear the status */
__raw_writew(0, brd_io + INTR_MASK_REG);
__raw_writew(0xFFFF, brd_io + INTR_RESET_REG);
__raw_writew(0, brd_io + INTR_RESET_REG);
__raw_writew(0x1F, brd_io + INTR_MASK_REG);
imx_writew(0, brd_io + INTR_MASK_REG);
imx_writew(0xFFFF, brd_io + INTR_RESET_REG);
imx_writew(0, brd_io + INTR_RESET_REG);
imx_writew(0x1F, brd_io + INTR_MASK_REG);

irq_base = irq_alloc_descs(-1, 0, MXC_MAX_EXP_IO_LINES, numa_node_id());
WARN_ON(irq_base < 0);
Expand Down
4 changes: 3 additions & 1 deletion arch/arm/mach-imx/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ menuconfig ARCH_MXC
bool "Freescale i.MX family"
depends on ARCH_MULTI_V4_V5 || ARCH_MULTI_V6_V7 || ARM_SINGLE_ARMV7M
select ARCH_REQUIRE_GPIOLIB
select ARM_CPU_SUSPEND if PM
select ARCH_SUPPORTS_BIG_ENDIAN
select CLKSRC_IMX_GPT
select GENERIC_IRQ_CHIP
select PINCTRL
Expand Down Expand Up @@ -511,6 +511,7 @@ config SOC_IMX53

config SOC_IMX6
bool
select ARM_CPU_SUSPEND if PM
select ARM_ERRATA_754322
select ARM_ERRATA_775420
select ARM_GIC
Expand Down Expand Up @@ -561,6 +562,7 @@ config SOC_IMX7D
bool "i.MX7 Dual support"
select PINCTRL_IMX7D
select ARM_GIC
select HAVE_ARM_ARCH_TIMER
select HAVE_IMX_ANATOP
select HAVE_IMX_MMDC
select HAVE_IMX_SRC
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-imx/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ obj-y := cpu.o system.o irq-common.o
obj-$(CONFIG_SOC_IMX1) += mm-imx1.o
obj-$(CONFIG_SOC_IMX21) += mm-imx21.o

obj-$(CONFIG_SOC_IMX25) += cpu-imx25.o mach-imx25.o
obj-$(CONFIG_SOC_IMX25) += cpu-imx25.o mach-imx25.o pm-imx25.o

obj-$(CONFIG_SOC_IMX27) += cpu-imx27.o pm-imx27.o
obj-$(CONFIG_SOC_IMX27) += mm-imx27.o ehci-imx27.o
Expand Down
18 changes: 16 additions & 2 deletions arch/arm/mach-imx/anatop.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,14 @@ void __init imx_init_revision_from_anatop(void)

switch (digprog & 0xff) {
case 0:
revision = IMX_CHIP_REVISION_1_0;
/*
* For i.MX6QP, most of the code for i.MX6Q can be resued,
* so internally, we identify it as i.MX6Q Rev 2.0
*/
if (digprog >> 8 & 0x01)
revision = IMX_CHIP_REVISION_2_0;
else
revision = IMX_CHIP_REVISION_1_0;
break;
case 1:
revision = IMX_CHIP_REVISION_1_1;
Expand All @@ -151,7 +158,14 @@ void __init imx_init_revision_from_anatop(void)
revision = IMX_CHIP_REVISION_1_5;
break;
default:
revision = IMX_CHIP_REVISION_UNKNOWN;
/*
* Fail back to return raw register value instead of 0xff.
* It will be easy to know version information in SOC if it
* can't be recognized by known version. And some chip's (i.MX7D)
* digprog value match linux version format, so it needn't map
* again and we can use register value directly.
*/
revision = digprog & 0xff;
}

mxc_set_cpu_type(digprog >> 16 & 0xff);
Expand Down
30 changes: 15 additions & 15 deletions arch/arm/mach-imx/avic.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ static int avic_set_irq_fiq(unsigned int irq, unsigned int type)
return -EINVAL;

if (irq < AVIC_NUM_IRQS / 2) {
irqt = __raw_readl(avic_base + AVIC_INTTYPEL) & ~(1 << irq);
__raw_writel(irqt | (!!type << irq), avic_base + AVIC_INTTYPEL);
irqt = imx_readl(avic_base + AVIC_INTTYPEL) & ~(1 << irq);
imx_writel(irqt | (!!type << irq), avic_base + AVIC_INTTYPEL);
} else {
irq -= AVIC_NUM_IRQS / 2;
irqt = __raw_readl(avic_base + AVIC_INTTYPEH) & ~(1 << irq);
__raw_writel(irqt | (!!type << irq), avic_base + AVIC_INTTYPEH);
irqt = imx_readl(avic_base + AVIC_INTTYPEH) & ~(1 << irq);
imx_writel(irqt | (!!type << irq), avic_base + AVIC_INTTYPEH);
}

return 0;
Expand All @@ -94,8 +94,8 @@ static void avic_irq_suspend(struct irq_data *d)
struct irq_chip_type *ct = gc->chip_types;
int idx = d->hwirq >> 5;

avic_saved_mask_reg[idx] = __raw_readl(avic_base + ct->regs.mask);
__raw_writel(gc->wake_active, avic_base + ct->regs.mask);
avic_saved_mask_reg[idx] = imx_readl(avic_base + ct->regs.mask);
imx_writel(gc->wake_active, avic_base + ct->regs.mask);
}

static void avic_irq_resume(struct irq_data *d)
Expand All @@ -104,7 +104,7 @@ static void avic_irq_resume(struct irq_data *d)
struct irq_chip_type *ct = gc->chip_types;
int idx = d->hwirq >> 5;

__raw_writel(avic_saved_mask_reg[idx], avic_base + ct->regs.mask);
imx_writel(avic_saved_mask_reg[idx], avic_base + ct->regs.mask);
}

#else
Expand Down Expand Up @@ -140,7 +140,7 @@ static void __exception_irq_entry avic_handle_irq(struct pt_regs *regs)
u32 nivector;

do {
nivector = __raw_readl(avic_base + AVIC_NIVECSR) >> 16;
nivector = imx_readl(avic_base + AVIC_NIVECSR) >> 16;
if (nivector == 0xffff)
break;

Expand All @@ -164,16 +164,16 @@ void __init mxc_init_irq(void __iomem *irqbase)
/* put the AVIC into the reset value with
* all interrupts disabled
*/
__raw_writel(0, avic_base + AVIC_INTCNTL);
__raw_writel(0x1f, avic_base + AVIC_NIMASK);
imx_writel(0, avic_base + AVIC_INTCNTL);
imx_writel(0x1f, avic_base + AVIC_NIMASK);

/* disable all interrupts */
__raw_writel(0, avic_base + AVIC_INTENABLEH);
__raw_writel(0, avic_base + AVIC_INTENABLEL);
imx_writel(0, avic_base + AVIC_INTENABLEH);
imx_writel(0, avic_base + AVIC_INTENABLEL);

/* all IRQ no FIQ */
__raw_writel(0, avic_base + AVIC_INTTYPEH);
__raw_writel(0, avic_base + AVIC_INTTYPEL);
imx_writel(0, avic_base + AVIC_INTTYPEH);
imx_writel(0, avic_base + AVIC_INTTYPEL);

irq_base = irq_alloc_descs(-1, 0, AVIC_NUM_IRQS, numa_node_id());
WARN_ON(irq_base < 0);
Expand All @@ -188,7 +188,7 @@ void __init mxc_init_irq(void __iomem *irqbase)

/* Set default priority value (0) for all IRQ's */
for (i = 0; i < 8; i++)
__raw_writel(0, avic_base + AVIC_NIPRIORITY(i));
imx_writel(0, avic_base + AVIC_NIPRIORITY(i));

set_handle_irq(avic_handle_irq);

Expand Down
1 change: 1 addition & 0 deletions arch/arm/mach-imx/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ void imx_gpc_check_dt(void);
void imx_gpc_set_arm_power_in_lpm(bool power_off);
void imx_gpc_set_arm_power_up_timing(u32 sw2iso, u32 sw);
void imx_gpc_set_arm_power_down_timing(u32 sw2iso, u32 sw);
void imx25_pm_init(void);

enum mxc_cpu_pwr_mode {
WAIT_CLOCKED, /* wfi only */
Expand Down
3 changes: 1 addition & 2 deletions arch/arm/mach-imx/cpu-imx27.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ static int mx27_read_cpu_rev(void)
* the silicon revision very early we read it here to
* avoid any further hooks
*/
val = __raw_readl(MX27_IO_ADDRESS(MX27_SYSCTRL_BASE_ADDR
+ SYS_CHIP_ID));
val = imx_readl(MX27_IO_ADDRESS(MX27_SYSCTRL_BASE_ADDR + SYS_CHIP_ID));

mx27_cpu_partnumber = (int)((val >> 12) & 0xFFFF);

Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-imx/cpu-imx31.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ static int mx31_read_cpu_rev(void)
u32 i, srev;

/* read SREV register from IIM module */
srev = __raw_readl(MX31_IO_ADDRESS(MX31_IIM_BASE_ADDR + MXC_IIMSREV));
srev = imx_readl(MX31_IO_ADDRESS(MX31_IIM_BASE_ADDR + MXC_IIMSREV));
srev &= 0xff;

for (i = 0; i < ARRAY_SIZE(mx31_cpu_type); i++)
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-imx/cpu-imx35.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ static int mx35_read_cpu_rev(void)
{
u32 rev;

rev = __raw_readl(MX35_IO_ADDRESS(MX35_IIM_BASE_ADDR + MXC_IIMSREV));
rev = imx_readl(MX35_IO_ADDRESS(MX35_IIM_BASE_ADDR + MXC_IIMSREV));
switch (rev) {
case 0x00:
return IMX_CHIP_REVISION_1_0;
Expand Down
16 changes: 8 additions & 8 deletions arch/arm/mach-imx/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,20 @@ void __init imx_set_aips(void __iomem *base)
* Set all MPROTx to be non-bufferable, trusted for R/W,
* not forced to user-mode.
*/
__raw_writel(0x77777777, base + 0x0);
__raw_writel(0x77777777, base + 0x4);
imx_writel(0x77777777, base + 0x0);
imx_writel(0x77777777, base + 0x4);

/*
* Set all OPACRx to be non-bufferable, to not require
* supervisor privilege level for access, allow for
* write access and untrusted master access.
*/
__raw_writel(0x0, base + 0x40);
__raw_writel(0x0, base + 0x44);
__raw_writel(0x0, base + 0x48);
__raw_writel(0x0, base + 0x4C);
reg = __raw_readl(base + 0x50) & 0x00FFFFFF;
__raw_writel(reg, base + 0x50);
imx_writel(0x0, base + 0x40);
imx_writel(0x0, base + 0x44);
imx_writel(0x0, base + 0x48);
imx_writel(0x0, base + 0x4C);
reg = imx_readl(base + 0x50) & 0x00FFFFFF;
imx_writel(reg, base + 0x50);
}

void __init imx_aips_allow_unprivileged_access(
Expand Down
22 changes: 11 additions & 11 deletions arch/arm/mach-imx/epit.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,23 +64,23 @@ static inline void epit_irq_disable(void)
{
u32 val;

val = __raw_readl(timer_base + EPITCR);
val = imx_readl(timer_base + EPITCR);
val &= ~EPITCR_OCIEN;
__raw_writel(val, timer_base + EPITCR);
imx_writel(val, timer_base + EPITCR);
}

static inline void epit_irq_enable(void)
{
u32 val;

val = __raw_readl(timer_base + EPITCR);
val = imx_readl(timer_base + EPITCR);
val |= EPITCR_OCIEN;
__raw_writel(val, timer_base + EPITCR);
imx_writel(val, timer_base + EPITCR);
}

static void epit_irq_acknowledge(void)
{
__raw_writel(EPITSR_OCIF, timer_base + EPITSR);
imx_writel(EPITSR_OCIF, timer_base + EPITSR);
}

static int __init epit_clocksource_init(struct clk *timer_clk)
Expand All @@ -98,9 +98,9 @@ static int epit_set_next_event(unsigned long evt,
{
unsigned long tcmp;

tcmp = __raw_readl(timer_base + EPITCNR);
tcmp = imx_readl(timer_base + EPITCNR);

__raw_writel(tcmp - evt, timer_base + EPITCMPR);
imx_writel(tcmp - evt, timer_base + EPITCMPR);

return 0;
}
Expand Down Expand Up @@ -213,11 +213,11 @@ void __init epit_timer_init(void __iomem *base, int irq)
/*
* Initialise to a known state (all timers off, and timing reset)
*/
__raw_writel(0x0, timer_base + EPITCR);
imx_writel(0x0, timer_base + EPITCR);

__raw_writel(0xffffffff, timer_base + EPITLR);
__raw_writel(EPITCR_EN | EPITCR_CLKSRC_REF_HIGH | EPITCR_WAITEN,
timer_base + EPITCR);
imx_writel(0xffffffff, timer_base + EPITLR);
imx_writel(EPITCR_EN | EPITCR_CLKSRC_REF_HIGH | EPITCR_WAITEN,
timer_base + EPITCR);

/* init and register the timer to the framework */
epit_clocksource_init(timer_clk);
Expand Down
2 changes: 2 additions & 0 deletions arch/arm/mach-imx/headsmp.S
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

#include <linux/linkage.h>
#include <linux/init.h>
#include <asm/assembler.h>

diag_reg_offset:
.word g_diag_reg - .
Expand All @@ -25,6 +26,7 @@ diag_reg_offset:
.endm

ENTRY(v7_secondary_startup)
ARM_BE8(setend be) @ go BE8 if entered LE
set_diag_reg
b secondary_startup
ENDPROC(v7_secondary_startup)
Loading

0 comments on commit f3a186f

Please sign in to comment.