Add busfreq driver support on i.MX8MQ. The busfreq driver is
mainly used for dynamic DDR frequency change for power saving
feature. When there is no peripheral or DMA device has direct
access to DDR memory, we can lower the DDR frequency to save
power. Currently, we support frequency setpoint for LPDDR4:
(1): 3200mts, the DDRC core clock is sourced from 800MHz
dram_pll, the DDRC apb clock is 200MHz.
(2): 400mts, the DDRC core clock is source from sys1_pll_400m,
the DDRC apb clock is is sourced from sys1_pll_40m.
(3): 100mts, the DDRC core clock is sourced from sys1_pll_100m,
the DDRC apb clock is sourced from sys1_pll_40m.
In our busfreq driver, we have three mode supported:
* high bus mode <-----> 3200mts;
* audio bus mode <-----> 400mts;
* low bus mode <-----> 100mts;
The actual DDR frequency is done in ARM trusted firmware by calling
the SMCC SiP service call.
BuildInfo:
- IMX-MKIMAGE: 05d3d4a7d7, ATF: 724cc2b890
- SPL/Uboot: f72c10d2db;
Signed-off-by: Bai Ping <ping.bai@nxp.com>
Reviewed-by: Anson Huang <Anson.Huang@nxp.com>
78 lines
2.1 KiB
C
78 lines
2.1 KiB
C
/*
|
|
* Copyright 2012-2016 Freescale Semiconductor, Inc. All Rights Reserved.
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
* published by the Free Software Foundation.
|
|
*/
|
|
|
|
#ifndef __ASM_ARCH_MXC_BUSFREQ_H__
|
|
#define __ASM_ARCH_MXC_BUSFREQ_H__
|
|
|
|
#include <linux/notifier.h>
|
|
#include <linux/regulator/consumer.h>
|
|
|
|
/*
|
|
* This enumerates busfreq low power mode entry and exit.
|
|
*/
|
|
enum busfreq_event {
|
|
LOW_BUSFREQ_ENTER,
|
|
LOW_BUSFREQ_EXIT,
|
|
};
|
|
|
|
/*
|
|
* This enumerates the system bus and ddr frequencies in various modes.
|
|
* BUS_FREQ_HIGH - DDR @ 528MHz, AHB @ 132MHz.
|
|
* BUS_FREQ_MED - DDR @ 400MHz, AHB @ 132MHz
|
|
* BUS_FREQ_AUDIO - DDR @ 50MHz/100MHz, AHB @ 24MHz.
|
|
* BUS_FREQ_LOW - DDR @ 24MHz, AHB @ 24MHz.
|
|
* BUS_FREQ_ULTRA_LOW - DDR @ 1MHz, AHB - 3MHz.
|
|
*
|
|
* Drivers need to request/release the bus/ddr frequencies based on
|
|
* their performance requirements. Drivers cannot request/release
|
|
* BUS_FREQ_ULTRA_LOW mode as this mode is automatically entered from
|
|
* either BUS_FREQ_AUDIO or BUS_FREQ_LOW
|
|
* modes.
|
|
*/
|
|
enum bus_freq_mode {
|
|
BUS_FREQ_HIGH,
|
|
BUS_FREQ_MED,
|
|
BUS_FREQ_AUDIO,
|
|
BUS_FREQ_LOW,
|
|
BUS_FREQ_ULTRA_LOW,
|
|
};
|
|
|
|
#if defined(CONFIG_CPU_FREQ) && !defined(CONFIG_ARM64)
|
|
extern struct regulator *arm_reg;
|
|
extern struct regulator *soc_reg;
|
|
void request_bus_freq(enum bus_freq_mode mode);
|
|
void release_bus_freq(enum bus_freq_mode mode);
|
|
int register_busfreq_notifier(struct notifier_block *nb);
|
|
int unregister_busfreq_notifier(struct notifier_block *nb);
|
|
int get_bus_freq_mode(void);
|
|
#elif defined(CONFIG_ARCH_FSL_IMX8MQ)
|
|
void request_bus_freq(enum bus_freq_mode mode);
|
|
void release_bus_freq(enum bus_freq_mode mode);
|
|
int get_bus_freq_mode(void);
|
|
#else
|
|
static inline void request_bus_freq(enum bus_freq_mode mode)
|
|
{
|
|
}
|
|
static inline void release_bus_freq(enum bus_freq_mode mode)
|
|
{
|
|
}
|
|
static inline int register_busfreq_notifier(struct notifier_block *nb)
|
|
{
|
|
return 0;
|
|
}
|
|
static inline int unregister_busfreq_notifier(struct notifier_block *nb)
|
|
{
|
|
return 0;
|
|
}
|
|
static inline int get_bus_freq_mode(void)
|
|
{
|
|
return BUS_FREQ_HIGH;
|
|
}
|
|
#endif
|
|
#endif
|