Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sysdk base kernel #1

Merged
merged 3 commits into from
Sep 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions arch/arm/boot/dts/imx6q-nitrogen6x.dts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@
*/

/dts-v1/;

/* Reserve last 64MB for TA to run properly, ideally it should be done
by bootloader/firmware.
*/
/memreserve/ 0x4c000000 0x4000000;

#include "imx6q.dtsi"
#include "imx6qdl-nitrogen6x.dtsi"

Expand Down
1 change: 1 addition & 0 deletions arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
};

chosen {
bootargs = "console=ttymxc1,115200 root=/dev/mmcblk0p2 rw ip=none video=mxcfb0:dev=ldb,1024x600M@60,if=RGB666 video=mxcfb1:off video=mxcfb2:off loglevel=3 rootwait";
stdout-path = &uart2;
};

Expand Down
12 changes: 12 additions & 0 deletions arch/arm/boot/dts/imx6qdl.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@
};
};

psci {
compatible = "arm,psci-0.2";
method = "smc";
};

soc {
#address-cells = <1>;
#size-cells = <1>;
Expand Down Expand Up @@ -286,6 +291,13 @@
status = "disabled";
};

firmware {
optee {
compatible = "linaro,optee-tz";
method = "smc";
};
};

aips-bus@02000000 { /* AIPS1 */
compatible = "fsl,aips-bus", "simple-bus";
#address-cells = <1>;
Expand Down
4 changes: 4 additions & 0 deletions arch/arm/configs/nitrogen6x_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -402,3 +402,7 @@ CONFIG_LIBCRC32C=y
CONFIG_FONTS=y
CONFIG_FONT_8x8=y
CONFIG_FONT_8x16=y
CONFIG_MX6_ADD_TIMER_OFFSET=y
CONFIG_TEE=y
CONFIG_OPTEE=y
CONFIG_ARM_PSCI=y
7 changes: 7 additions & 0 deletions drivers/clocksource/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,13 @@ config CLKSRC_IMX_GPT
depends on ARM && CLKDEV_LOOKUP
select CLKSRC_MMIO

config MX6_ADD_TIMER_OFFSET
bool "Add bootloader time offset to kernel timer time"
default n
help
Enabling this will using time since reset insted of time since
timer init.

config CLKSRC_IMX_TPM
bool "Clocksource using i.MX TPM" if COMPILE_TEST
depends on ARM && CLKDEV_LOOKUP && GENERIC_CLOCKEVENTS
Expand Down
18 changes: 18 additions & 0 deletions drivers/clocksource/timer-imx-gpt.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,16 @@ struct imx_gpt_data {
struct clock_event_device *ced);
};

#if defined(CONFIG_MX6_ADD_TIMER_OFFSET)
static s64 offset_ns = 0;

/* Getter method of start time offset (IBC till now ) */
inline s64 mxc_get_time_offset(void)
{
return offset_ns;
}
#endif

static inline struct imx_timer *to_imx_timer(struct clock_event_device *ced)
{
return container_of(ced, struct imx_timer, ced);
Expand Down Expand Up @@ -505,6 +515,14 @@ static int __init mxc_timer_init_dt(struct device_node *np, enum imx_gpt_type t

imxtm->type = type;

/* Using time since reset insted of time since timer init. */
#if defined(CONFIG_MX6_ADD_TIMER_OFFSET)
/* The GPT is running at 3MHz set from IBC. Thus, 1 tick is equivalent to 1/3 us (or 1us needs 3 ticks) */
offset_ns = (__raw_readl(imxtm->base + (V2_TCN)) / 3) * 1000 ;
pr_info("mxc_clocksource_init \n");
pr_info("Init and register the timer to the framework with a %lld ns offset. \n", offset_ns);
#endif

ret = _mxc_timer_init(imxtm);
if (ret)
return ret;
Expand Down
8 changes: 8 additions & 0 deletions include/linux/time.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ static inline int timeval_compare(const struct timeval *lhs, const struct timeva
return lhs->tv_usec - rhs->tv_usec;
}

#if defined(CONFIG_MX6_ADD_TIMER_OFFSET)
extern s64 mxc_get_time_offset(void);
#endif

extern time64_t mktime64(const unsigned int year, const unsigned int mon,
const unsigned int day, const unsigned int hour,
const unsigned int min, const unsigned int sec);
Expand Down Expand Up @@ -167,6 +171,10 @@ static inline bool timespec_inject_offset_valid(const struct timespec *ts)
extern u32 (*arch_gettimeoffset)(void);
#endif

#if defined(CONFIG_MX6_ADD_TIMER_OFFSET)
extern s64 mxc_get_time_offset(void);
#endif

struct itimerval;
extern int do_setitimer(int which, struct itimerval *value,
struct itimerval *ovalue);
Expand Down
4 changes: 4 additions & 0 deletions kernel/time/timekeeping.c
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,10 @@ static void timekeeping_forward_now(struct timekeeper *tk)
tk_normalize_xtime(tk);

nsec = clocksource_cyc2ns(delta, tk->tkr_raw.mult, tk->tkr_raw.shift);

#if defined(CONFIG_MX6_ADD_TIMER_OFFSET)
nsec += mxc_get_time_offset();
#endif
timespec64_add_ns(&tk->raw_time, nsec);
}

Expand Down