Commit 6017efc4 authored by Olof Johansson's avatar Olof Johansson

Merge tag 'samsung-soc-4.20' of...

Merge tag 'samsung-soc-4.20' of https://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux into next/dt

Samsung mach/soc changes for v4.20

1. Fix imprecise abort during Odroid XU3-family suspend to RAM (but it
   is not end of work needed for suspend).
2. Cleanup and fix of SD card write protect on MINI2440.

* tag 'samsung-soc-4.20' of https://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux:
  ARM: s3c24xx: Restore proper usage of pr_info/pr_cont
  ARM: s3c24xx: Correct SD card write protect detection on Mini2440
  ARM: s3c24xx: Consistently use tab for indenting member assignments
  ARM: s3c24xx: formatting cleanup in mach-mini2440.c
  ARM: s3c24xx: Remove empty gta02_pmu children probe
  ARM: exynos: Fix imprecise abort during Exynos5422 suspend to RAM
  ARM: exynos: Store Exynos5420 register state in one variable
Signed-off-by: default avatarOlof Johansson <olof@lixom.net>
parents 3e18d3ca f3085843
...@@ -26,6 +26,7 @@ Offset Value Purpose ...@@ -26,6 +26,7 @@ Offset Value Purpose
0x20 0xfcba0d10 (Magic cookie) AFTR 0x20 0xfcba0d10 (Magic cookie) AFTR
0x24 exynos_cpu_resume_ns AFTR 0x24 exynos_cpu_resume_ns AFTR
0x28 + 4*cpu 0x8 (Magic cookie, Exynos3250) AFTR 0x28 + 4*cpu 0x8 (Magic cookie, Exynos3250) AFTR
0x28 0x0 or last value during resume (Exynos542x) System suspend
2. Secure mode 2. Secure mode
......
...@@ -110,6 +110,7 @@ void exynos_firmware_init(void); ...@@ -110,6 +110,7 @@ void exynos_firmware_init(void);
#define EXYNOS_SLEEP_MAGIC 0x00000bad #define EXYNOS_SLEEP_MAGIC 0x00000bad
#define EXYNOS_AFTR_MAGIC 0xfcba0d10 #define EXYNOS_AFTR_MAGIC 0xfcba0d10
bool __init exynos_secure_firmware_available(void);
void exynos_set_boot_flag(unsigned int cpu, unsigned int mode); void exynos_set_boot_flag(unsigned int cpu, unsigned int mode);
void exynos_clear_boot_flag(unsigned int cpu, unsigned int mode); void exynos_clear_boot_flag(unsigned int cpu, unsigned int mode);
......
...@@ -185,7 +185,7 @@ static void exynos_l2_configure(const struct l2x0_regs *regs) ...@@ -185,7 +185,7 @@ static void exynos_l2_configure(const struct l2x0_regs *regs)
exynos_smc(SMC_CMD_L2X0SETUP2, regs->pwr_ctrl, regs->aux_ctrl, 0); exynos_smc(SMC_CMD_L2X0SETUP2, regs->pwr_ctrl, regs->aux_ctrl, 0);
} }
void __init exynos_firmware_init(void) bool __init exynos_secure_firmware_available(void)
{ {
struct device_node *nd; struct device_node *nd;
const __be32 *addr; const __be32 *addr;
...@@ -193,14 +193,22 @@ void __init exynos_firmware_init(void) ...@@ -193,14 +193,22 @@ void __init exynos_firmware_init(void)
nd = of_find_compatible_node(NULL, NULL, nd = of_find_compatible_node(NULL, NULL,
"samsung,secure-firmware"); "samsung,secure-firmware");
if (!nd) if (!nd)
return; return false;
addr = of_get_address(nd, 0, NULL, NULL); addr = of_get_address(nd, 0, NULL, NULL);
if (!addr) { if (!addr) {
pr_err("%s: No address specified.\n", __func__); pr_err("%s: No address specified.\n", __func__);
return; return false;
} }
return true;
}
void __init exynos_firmware_init(void)
{
if (!exynos_secure_firmware_available())
return;
pr_info("Running under secure firmware.\n"); pr_info("Running under secure firmware.\n");
register_firmware_ops(&exynos_firmware_ops); register_firmware_ops(&exynos_firmware_ops);
......
...@@ -59,10 +59,15 @@ struct exynos_pm_data { ...@@ -59,10 +59,15 @@ struct exynos_pm_data {
int (*cpu_suspend)(unsigned long); int (*cpu_suspend)(unsigned long);
}; };
static const struct exynos_pm_data *pm_data __ro_after_init; /* Used only on Exynos542x/5800 */
struct exynos_pm_state {
int cpu_state;
unsigned int pmu_spare3;
void __iomem *sysram_base;
};
static int exynos5420_cpu_state; static const struct exynos_pm_data *pm_data __ro_after_init;
static unsigned int exynos_pmu_spare3; static struct exynos_pm_state pm_state;
/* /*
* GIC wake-up support * GIC wake-up support
...@@ -257,7 +262,7 @@ static int exynos5420_cpu_suspend(unsigned long arg) ...@@ -257,7 +262,7 @@ static int exynos5420_cpu_suspend(unsigned long arg)
unsigned int cluster = MPIDR_AFFINITY_LEVEL(mpidr, 1); unsigned int cluster = MPIDR_AFFINITY_LEVEL(mpidr, 1);
unsigned int cpu = MPIDR_AFFINITY_LEVEL(mpidr, 0); unsigned int cpu = MPIDR_AFFINITY_LEVEL(mpidr, 0);
writel_relaxed(0x0, sysram_base_addr + EXYNOS5420_CPU_STATE); writel_relaxed(0x0, pm_state.sysram_base + EXYNOS5420_CPU_STATE);
if (IS_ENABLED(CONFIG_EXYNOS5420_MCPM)) { if (IS_ENABLED(CONFIG_EXYNOS5420_MCPM)) {
mcpm_set_entry_vector(cpu, cluster, exynos_cpu_resume); mcpm_set_entry_vector(cpu, cluster, exynos_cpu_resume);
...@@ -321,7 +326,7 @@ static void exynos5420_pm_prepare(void) ...@@ -321,7 +326,7 @@ static void exynos5420_pm_prepare(void)
/* Set wake-up mask registers */ /* Set wake-up mask registers */
exynos_pm_set_wakeup_mask(); exynos_pm_set_wakeup_mask();
exynos_pmu_spare3 = pmu_raw_readl(S5P_PMU_SPARE3); pm_state.pmu_spare3 = pmu_raw_readl(S5P_PMU_SPARE3);
/* /*
* The cpu state needs to be saved and restored so that the * The cpu state needs to be saved and restored so that the
* secondary CPUs will enter low power start. Though the U-Boot * secondary CPUs will enter low power start. Though the U-Boot
...@@ -329,7 +334,7 @@ static void exynos5420_pm_prepare(void) ...@@ -329,7 +334,7 @@ static void exynos5420_pm_prepare(void)
* needs to restore it back in case, the primary cpu fails to * needs to restore it back in case, the primary cpu fails to
* suspend for any reason. * suspend for any reason.
*/ */
exynos5420_cpu_state = readl_relaxed(sysram_base_addr + pm_state.cpu_state = readl_relaxed(pm_state.sysram_base +
EXYNOS5420_CPU_STATE); EXYNOS5420_CPU_STATE);
exynos_pm_enter_sleep_mode(); exynos_pm_enter_sleep_mode();
...@@ -448,8 +453,8 @@ static void exynos5420_pm_resume(void) ...@@ -448,8 +453,8 @@ static void exynos5420_pm_resume(void)
EXYNOS5_ARM_CORE0_SYS_PWR_REG); EXYNOS5_ARM_CORE0_SYS_PWR_REG);
/* Restore the sysram cpu state register */ /* Restore the sysram cpu state register */
writel_relaxed(exynos5420_cpu_state, writel_relaxed(pm_state.cpu_state,
sysram_base_addr + EXYNOS5420_CPU_STATE); pm_state.sysram_base + EXYNOS5420_CPU_STATE);
pmu_raw_writel(EXYNOS5420_USE_STANDBY_WFI_ALL, pmu_raw_writel(EXYNOS5420_USE_STANDBY_WFI_ALL,
S5P_CENTRAL_SEQ_OPTION); S5P_CENTRAL_SEQ_OPTION);
...@@ -457,7 +462,7 @@ static void exynos5420_pm_resume(void) ...@@ -457,7 +462,7 @@ static void exynos5420_pm_resume(void)
if (exynos_pm_central_resume()) if (exynos_pm_central_resume())
goto early_wakeup; goto early_wakeup;
pmu_raw_writel(exynos_pmu_spare3, S5P_PMU_SPARE3); pmu_raw_writel(pm_state.pmu_spare3, S5P_PMU_SPARE3);
early_wakeup: early_wakeup:
...@@ -654,4 +659,13 @@ void __init exynos_pm_init(void) ...@@ -654,4 +659,13 @@ void __init exynos_pm_init(void)
register_syscore_ops(&exynos_pm_syscore_ops); register_syscore_ops(&exynos_pm_syscore_ops);
suspend_set_ops(&exynos_suspend_ops); suspend_set_ops(&exynos_suspend_ops);
/*
* Applicable as of now only to Exynos542x. If booted under secure
* firmware, the non-secure region of sysram should be used.
*/
if (exynos_secure_firmware_available())
pm_state.sysram_base = sysram_ns_base_addr;
else
pm_state.sysram_base = sysram_base_addr;
} }
...@@ -219,17 +219,6 @@ static void gta02_udc_vbus_draw(unsigned int ma) ...@@ -219,17 +219,6 @@ static void gta02_udc_vbus_draw(unsigned int ma)
#define gta02_udc_vbus_draw NULL #define gta02_udc_vbus_draw NULL
#endif #endif
/*
* This is called when pc50633 is probed, unfortunately quite late in the
* day since it is an I2C bus device. Here we can belatedly define some
* platform devices with the advantage that we can mark the pcf50633 as the
* parent. This makes them get suspended and resumed with their parent
* the pcf50633 still around.
*/
static void gta02_pmu_attach_child_devices(struct pcf50633 *pcf);
static char *gta02_batteries[] = { static char *gta02_batteries[] = {
"battery", "battery",
}; };
...@@ -355,7 +344,6 @@ static struct pcf50633_platform_data gta02_pcf_pdata = { ...@@ -355,7 +344,6 @@ static struct pcf50633_platform_data gta02_pcf_pdata = {
}, },
}, },
.probe_done = gta02_pmu_attach_child_devices,
.mbc_event_callback = gta02_pmu_event_callback, .mbc_event_callback = gta02_pmu_event_callback,
}; };
...@@ -512,36 +500,6 @@ static struct platform_device *gta02_devices[] __initdata = { ...@@ -512,36 +500,6 @@ static struct platform_device *gta02_devices[] __initdata = {
&s3c_device_ts, &s3c_device_ts,
}; };
/* These guys DO need to be children of PMU. */
static struct platform_device *gta02_devices_pmu_children[] = {
};
/*
* This is called when pc50633 is probed, quite late in the day since it is an
* I2C bus device. Here we can define platform devices with the advantage that
* we can mark the pcf50633 as the parent. This makes them get suspended and
* resumed with their parent the pcf50633 still around. All devices whose
* operation depends on something from pcf50633 must have this relationship
* made explicit like this, or suspend and resume will become an unreliable
* hellworld.
*/
static void gta02_pmu_attach_child_devices(struct pcf50633 *pcf)
{
int n;
/* Grab a copy of the now probed PMU pointer. */
gta02_pcf = pcf;
for (n = 0; n < ARRAY_SIZE(gta02_devices_pmu_children); n++)
gta02_devices_pmu_children[n]->dev.parent = pcf->dev;
platform_add_devices(gta02_devices_pmu_children,
ARRAY_SIZE(gta02_devices_pmu_children));
}
static void gta02_poweroff(void) static void gta02_poweroff(void)
{ {
pcf50633_reg_set_bit_mask(gta02_pcf, PCF50633_REG_OOCSHDWN, 1, 1); pcf50633_reg_set_bit_mask(gta02_pcf, PCF50633_REG_OOCSHDWN, 1, 1);
......
...@@ -64,8 +64,8 @@ static struct map_desc mini2440_iodesc[] __initdata = { ...@@ -64,8 +64,8 @@ static struct map_desc mini2440_iodesc[] __initdata = {
}; };
#define UCON S3C2410_UCON_DEFAULT #define UCON S3C2410_UCON_DEFAULT
#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB #define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB)
#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE #define UFCON (S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE)
static struct s3c2410_uartcfg mini2440_uartcfgs[] __initdata = { static struct s3c2410_uartcfg mini2440_uartcfgs[] __initdata = {
...@@ -104,8 +104,8 @@ static struct s3c2410_udc_mach_info mini2440_udc_cfg __initdata = { ...@@ -104,8 +104,8 @@ static struct s3c2410_udc_mach_info mini2440_udc_cfg __initdata = {
/* /*
* This macro simplifies the table bellow * This macro simplifies the table bellow
*/ */
#define _LCD_DECLARE(_clock,_xres,margin_left,margin_right,hsync, \ #define _LCD_DECLARE(_clock, _xres, margin_left, margin_right, hsync, \
_yres,margin_top,margin_bottom,vsync, refresh) \ _yres, margin_top, margin_bottom, vsync, refresh) \
.width = _xres, \ .width = _xres, \
.xres = _xres, \ .xres = _xres, \
.height = _yres, \ .height = _yres, \
...@@ -160,7 +160,8 @@ static struct s3c2410fb_display mini2440_lcd_cfg[] __initdata = { ...@@ -160,7 +160,8 @@ static struct s3c2410fb_display mini2440_lcd_cfg[] __initdata = {
1024, 1, 2, 2, /* y timing */ 1024, 1, 2, 2, /* y timing */
768, 200, 16, 16, /* x timing */ 768, 200, 16, 16, /* x timing */
24), /* refresh rate, maximum stable, 24), /* refresh rate, maximum stable,
tested with the FPGA shield */ * tested with the FPGA shield
*/
.lcdcon5 = (S3C2410_LCDCON5_FRM565 | .lcdcon5 = (S3C2410_LCDCON5_FRM565 |
S3C2410_LCDCON5_HWSWP), S3C2410_LCDCON5_HWSWP),
}, },
...@@ -196,7 +197,8 @@ static struct s3c2410fb_mach_info mini2440_fb_info __initdata = { ...@@ -196,7 +197,8 @@ static struct s3c2410fb_mach_info mini2440_fb_info __initdata = {
/* Enable VD[2..7], VD[10..15], VD[18..23] and VCLK, syncs, VDEN /* Enable VD[2..7], VD[10..15], VD[18..23] and VCLK, syncs, VDEN
* and disable the pull down resistors on pins we are using for LCD * and disable the pull down resistors on pins we are using for LCD
* data. */ * data.
*/
.gpcup = (0xf << 1) | (0x3f << 10), .gpcup = (0xf << 1) | (0x3f << 10),
...@@ -234,6 +236,7 @@ static struct s3c2410fb_mach_info mini2440_fb_info __initdata = { ...@@ -234,6 +236,7 @@ static struct s3c2410fb_mach_info mini2440_fb_info __initdata = {
static struct s3c24xx_mci_pdata mini2440_mmc_cfg __initdata = { static struct s3c24xx_mci_pdata mini2440_mmc_cfg __initdata = {
.gpio_detect = S3C2410_GPG(8), .gpio_detect = S3C2410_GPG(8),
.gpio_wprotect = S3C2410_GPH(8), .gpio_wprotect = S3C2410_GPH(8),
.wprotect_invert = 1,
.set_power = NULL, .set_power = NULL,
.ocr_avail = MMC_VDD_32_33|MMC_VDD_33_34, .ocr_avail = MMC_VDD_32_33|MMC_VDD_33_34,
}; };
...@@ -254,7 +257,8 @@ static struct mtd_partition mini2440_default_nand_part[] __initdata = { ...@@ -254,7 +257,8 @@ static struct mtd_partition mini2440_default_nand_part[] __initdata = {
[2] = { [2] = {
.name = "kernel", .name = "kernel",
/* 5 megabytes, for a kernel with no modules /* 5 megabytes, for a kernel with no modules
* or a uImage with a ramdisk attached */ * or a uImage with a ramdisk attached
*/
.size = 0x00500000, .size = 0x00500000,
.offset = SZ_256K + SZ_128K, .offset = SZ_256K + SZ_128K,
}, },
...@@ -290,7 +294,7 @@ static struct s3c2410_platform_nand mini2440_nand_info __initdata = { ...@@ -290,7 +294,7 @@ static struct s3c2410_platform_nand mini2440_nand_info __initdata = {
static struct resource mini2440_dm9k_resource[] = { static struct resource mini2440_dm9k_resource[] = {
[0] = DEFINE_RES_MEM(MACH_MINI2440_DM9K_BASE, 4), [0] = DEFINE_RES_MEM(MACH_MINI2440_DM9K_BASE, 4),
[1] = DEFINE_RES_MEM(MACH_MINI2440_DM9K_BASE + 4, 4), [1] = DEFINE_RES_MEM(MACH_MINI2440_DM9K_BASE + 4, 4),
[2] = DEFINE_RES_NAMED(IRQ_EINT7, 1, NULL, IORESOURCE_IRQ \ [2] = DEFINE_RES_NAMED(IRQ_EINT7, 1, NULL, IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHEDGE), | IORESOURCE_IRQ_HIGHEDGE),
}; };
...@@ -362,7 +366,8 @@ static struct gpio_keys_button mini2440_buttons[] = { ...@@ -362,7 +366,8 @@ static struct gpio_keys_button mini2440_buttons[] = {
}, },
#if 0 #if 0
/* this pin is also known as TCLK1 and seems to already /* this pin is also known as TCLK1 and seems to already
* marked as "in use" somehow in the kernel -- possibly wrongly */ * marked as "in use" somehow in the kernel -- possibly wrongly
*/
{ {
.gpio = S3C2410_GPG(11), /* K6 */ .gpio = S3C2410_GPG(11), /* K6 */
.code = KEY_F6, .code = KEY_F6,
...@@ -564,7 +569,8 @@ static char mini2440_features_str[12] __initdata = "0tb"; ...@@ -564,7 +569,8 @@ static char mini2440_features_str[12] __initdata = "0tb";
static int __init mini2440_features_setup(char *str) static int __init mini2440_features_setup(char *str)
{ {
if (str) if (str)
strlcpy(mini2440_features_str, str, sizeof(mini2440_features_str)); strlcpy(mini2440_features_str, str,
sizeof(mini2440_features_str));
return 1; return 1;
} }
...@@ -583,10 +589,10 @@ struct mini2440_features_t { ...@@ -583,10 +589,10 @@ struct mini2440_features_t {
}; };
static void __init mini2440_parse_features( static void __init mini2440_parse_features(
struct mini2440_features_t * features, struct mini2440_features_t *features,
const char * features_str ) const char *features_str)
{ {
const char * fp = features_str; const char *fp = features_str;
features->count = 0; features->count = 0;
features->done = 0; features->done = 0;
...@@ -598,13 +604,14 @@ static void __init mini2440_parse_features( ...@@ -598,13 +604,14 @@ static void __init mini2440_parse_features(
switch (f) { switch (f) {
case '0'...'9': /* tft screen */ case '0'...'9': /* tft screen */
if (features->done & FEATURE_SCREEN) { if (features->done & FEATURE_SCREEN) {
printk(KERN_INFO "MINI2440: '%c' ignored, " pr_info("MINI2440: '%c' ignored, screen type already set\n",
"screen type already set\n", f); f);
} else { } else {
int li = f - '0'; int li = f - '0';
if (li >= ARRAY_SIZE(mini2440_lcd_cfg)) if (li >= ARRAY_SIZE(mini2440_lcd_cfg))
printk(KERN_INFO "MINI2440: " pr_info("MINI2440: '%c' out of range LCD mode\n",
"'%c' out of range LCD mode\n", f); f);
else { else {
features->optional[features->count++] = features->optional[features->count++] =
&s3c_device_lcd; &s3c_device_lcd;
...@@ -615,8 +622,8 @@ static void __init mini2440_parse_features( ...@@ -615,8 +622,8 @@ static void __init mini2440_parse_features(
break; break;
case 'b': case 'b':
if (features->done & FEATURE_BACKLIGHT) if (features->done & FEATURE_BACKLIGHT)
printk(KERN_INFO "MINI2440: '%c' ignored, " pr_info("MINI2440: '%c' ignored, backlight already set\n",
"backlight already set\n", f); f);
else { else {
features->optional[features->count++] = features->optional[features->count++] =
&mini2440_led_backlight; &mini2440_led_backlight;
...@@ -624,13 +631,13 @@ static void __init mini2440_parse_features( ...@@ -624,13 +631,13 @@ static void __init mini2440_parse_features(
features->done |= FEATURE_BACKLIGHT; features->done |= FEATURE_BACKLIGHT;
break; break;
case 't': case 't':
printk(KERN_INFO "MINI2440: '%c' ignored, " pr_info("MINI2440: '%c' ignored, touchscreen not compiled in\n",
"touchscreen not compiled in\n", f); f);
break; break;
case 'c': case 'c':
if (features->done & FEATURE_CAMERA) if (features->done & FEATURE_CAMERA)
printk(KERN_INFO "MINI2440: '%c' ignored, " pr_info("MINI2440: '%c' ignored, camera already registered\n",
"camera already registered\n", f); f);
else else
features->optional[features->count++] = features->optional[features->count++] =
&s3c_device_camif; &s3c_device_camif;
...@@ -645,7 +652,7 @@ static void __init mini2440_init(void) ...@@ -645,7 +652,7 @@ static void __init mini2440_init(void)
struct mini2440_features_t features = { 0 }; struct mini2440_features_t features = { 0 };
int i; int i;
printk(KERN_INFO "MINI2440: Option string mini2440=%s\n", pr_info("MINI2440: Option string mini2440=%s\n",
mini2440_features_str); mini2440_features_str);
/* Parse the feature string */ /* Parse the feature string */
...@@ -674,17 +681,17 @@ static void __init mini2440_init(void) ...@@ -674,17 +681,17 @@ static void __init mini2440_init(void)
mini2440_fb_info.displays = mini2440_fb_info.displays =
&mini2440_lcd_cfg[features.lcd_index]; &mini2440_lcd_cfg[features.lcd_index];
printk(KERN_INFO "MINI2440: LCD"); pr_info("MINI2440: LCD");
for (li = 0; li < ARRAY_SIZE(mini2440_lcd_cfg); li++) for (li = 0; li < ARRAY_SIZE(mini2440_lcd_cfg); li++)
if (li == features.lcd_index) if (li == features.lcd_index)
printk(" [%d:%dx%d]", li, pr_cont(" [%d:%dx%d]", li,
mini2440_lcd_cfg[li].width, mini2440_lcd_cfg[li].width,
mini2440_lcd_cfg[li].height); mini2440_lcd_cfg[li].height);
else else
printk(" %d:%dx%d", li, pr_cont(" %d:%dx%d", li,
mini2440_lcd_cfg[li].width, mini2440_lcd_cfg[li].width,
mini2440_lcd_cfg[li].height); mini2440_lcd_cfg[li].height);
printk("\n"); pr_cont("\n");
s3c24xx_fb_set_platdata(&mini2440_fb_info); s3c24xx_fb_set_platdata(&mini2440_fb_info);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment