Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 41d9d44d authored by Dave Gerlach's avatar Dave Gerlach Committed by Tony Lindgren
Browse files

ARM: OMAP2+: pm33xx-core: Add platform code needed for PM



Most of the PM code needed for am335x and am437x can be moved into a
module under drivers but some core code must remain in mach-omap2 at the
moment. This includes some internal clockdomain APIs and low-level ARM
APIs which are also not exported for use by modules.

Implement a few functions that handle these low-level platform
operations can be passed to the pm33xx module through the use of
platform data.

In addition to this, to be able to share data structures between C and
the sleep33xx and sleep43xx assembly code, we can automatically generate
all of the C struct member offsets and sizes as macros by processing
pm-asm-offsets.c into assembly code and then extracting the relevant
data as is done for the generated platform asm-offsets.h files.

Finally, add amx3_common_pm_init to create a dummy platform_device for
pm33xx so that our soon to be introduced pm33xx module can probe on
am335x and am437x platforms to enable basic suspend to mem and standby
support.

Signed-off-by: default avatarDave Gerlach <d-gerlach@ti.com>
Acked-by: default avatarSantosh Shilimkar <ssantosh@kernel.org>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent 41d37e61
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -72,6 +72,7 @@ config SOC_AM43XX
	select ARM_ERRATA_754322
	select ARM_ERRATA_775420
	select OMAP_INTERCONNECT
	select ARM_CPU_SUSPEND if PM

config SOC_DRA7XX
	bool "TI DRA7XX"
+16 −0
Original line number Diff line number Diff line
@@ -88,6 +88,8 @@ omap-4-5-pm-common += pm44xx.o
obj-$(CONFIG_ARCH_OMAP4)		+= $(omap-4-5-pm-common)
obj-$(CONFIG_SOC_OMAP5)			+= $(omap-4-5-pm-common)
obj-$(CONFIG_SOC_DRA7XX)		+= $(omap-4-5-pm-common)
obj-$(CONFIG_SOC_AM33XX)		+= pm33xx-core.o sleep33xx.o
obj-$(CONFIG_SOC_AM43XX)		+= pm33xx-core.o sleep43xx.o
obj-$(CONFIG_PM_DEBUG)			+= pm-debug.o

obj-$(CONFIG_POWER_AVS_OMAP)		+= sr_device.o
@@ -95,6 +97,8 @@ obj-$(CONFIG_POWER_AVS_OMAP_CLASS3) += smartreflex-class3.o

AFLAGS_sleep24xx.o			:=-Wa,-march=armv6
AFLAGS_sleep34xx.o			:=-Wa,-march=armv7-a$(plus_sec)
AFLAGS_sleep33xx.o			:=-Wa,-march=armv7-a$(plus_sec)
AFLAGS_sleep43xx.o			:=-Wa,-march=armv7-a$(plus_sec)

endif

@@ -232,3 +236,15 @@ obj-y += $(omap-hsmmc-m) $(omap-hsmmc-y)
obj-y					+= omap_phy_internal.o

obj-$(CONFIG_MACH_OMAP2_TUSB6010)	+= usb-tusb6010.o

arch/arm/mach-omap2/pm-asm-offsets.s: arch/arm/mach-omap2/pm-asm-offsets.c
	$(call if_changed_dep,cc_s_c)

include/generated/ti-pm-asm-offsets.h: arch/arm/mach-omap2/pm-asm-offsets.s FORCE
	$(call filechk,offsets,__TI_PM_ASM_OFFSETS_H__)

# For rule to generate ti-emif-asm-offsets.h dependency
include drivers/memory/Makefile.asm-offsets

arch/arm/mach-omap2/sleep33xx.o: include/generated/ti-pm-asm-offsets.h include/generated/ti-emif-asm-offsets.h
arch/arm/mach-omap2/sleep43xx.o: include/generated/ti-pm-asm-offsets.h include/generated/ti-emif-asm-offsets.h
+7 −0
Original line number Diff line number Diff line
@@ -77,6 +77,13 @@ static inline int omap4_pm_init_early(void)
}
#endif

#if defined(CONFIG_PM) && (defined(CONFIG_SOC_AM33XX) || \
	defined(CONFIG_SOC_AM43XX))
void amx3_common_pm_init(void);
#else
static inline void amx3_common_pm_init(void) { }
#endif

extern void omap2_init_common_infrastructure(void);

extern void omap_init_time(void);
+2 −0
Original line number Diff line number Diff line
@@ -622,6 +622,7 @@ void __init am33xx_init_early(void)
void __init am33xx_init_late(void)
{
	omap_common_late_init();
	amx3_common_pm_init();
}
#endif

@@ -646,6 +647,7 @@ void __init am43xx_init_late(void)
{
	omap_common_late_init();
	omap2_clk_enable_autoidle_all();
	amx3_common_pm_init();
}
#endif

+31 −0
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0
/*
 * TI AM33XX and AM43XX PM Assembly Offsets
 *
 * Copyright (C) 2017-2018 Texas Instruments Inc.
 */

#include <linux/kbuild.h>
#include <linux/platform_data/pm33xx.h>

int main(void)
{
	DEFINE(AMX3_PM_WFI_FLAGS_OFFSET,
	       offsetof(struct am33xx_pm_sram_data, wfi_flags));
	DEFINE(AMX3_PM_L2_AUX_CTRL_VAL_OFFSET,
	       offsetof(struct am33xx_pm_sram_data, l2_aux_ctrl_val));
	DEFINE(AMX3_PM_L2_PREFETCH_CTRL_VAL_OFFSET,
	       offsetof(struct am33xx_pm_sram_data, l2_prefetch_ctrl_val));
	DEFINE(AMX3_PM_SRAM_DATA_SIZE, sizeof(struct am33xx_pm_sram_data));

	BLANK();

	DEFINE(AMX3_PM_RO_SRAM_DATA_VIRT_OFFSET,
	       offsetof(struct am33xx_pm_ro_sram_data, amx3_pm_sram_data_virt));
	DEFINE(AMX3_PM_RO_SRAM_DATA_PHYS_OFFSET,
	       offsetof(struct am33xx_pm_ro_sram_data, amx3_pm_sram_data_phys));
	DEFINE(AMX3_PM_RO_SRAM_DATA_SIZE,
	       sizeof(struct am33xx_pm_ro_sram_data));

	return 0;
}
Loading