mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-23 17:30:02 +00:00
Exynos5440 drivers removal
The Exynos5440 (quad-core A15 with GMAC, PCIe, SATA) was targeting server platforms but it did not make it to the market really. There are no development boards with it and probably there are no real products neither. The development for Exynos5440 ended in 2013 and since then the platform is in maintenance mode. Removing Exynos5440 makes our life slightly easier: less maintenance, smaller code, reduced number of quirks, no need to preserve DTB backward-compatibility. The Device Tree sources and some of the drivers for Exynos5440 were already removed. This removes remaining drivers. -----BEGIN PGP SIGNATURE----- iQItBAABCAAXBQJbWKG7EBxrcnprQGtlcm5lbC5vcmcACgkQwTdm5oaLg9fNiA// U/dI+ihiIXHOxtrVRZXNGsmI5545pUqLI5uTE9utvD2j10Ef+T45wOzcJEtVN5ro +Mnqt32+LC0UfAo721Vfziu91t9HCYdeq6gFfgKS3mm5GPqqmsD7havl/UpT4jvL JZZLTPoInT2zJ0oZanzIRoM5I7KCOrUikkoVYEq9Z2/DupZ/S1GJLYXq1kY00eXS xrtNxTyhi6Hmg80h1u93jUfilWPuYvXAuTfK+nyHNXLDkVRAprEXEc0HCdKp0gKT hCEVd/k2+FsREQSCq5+dCTvYwa/FATqvwU/pKZmhSuN4GOM6b/0kFFvTt0sUswY3 ZFGnEhnXQ9JGHf3/1cXdRn3e/1/5vOyjchKzCdF5Pyo40HIvI1qSK4mhCSO355PO sIgI2OEEBCqVuu4HUeWDu13M7Q4haSHRCtqVyulT2LsNGRrm3Ko13lCz+knanMqH 4Cs7dLSz4ZqCSC4XYs8lnUvOFu2e/71vYs39QMi9yGro9Wn5T7H4qPNLVUuMER3K Hwrj5CpGKqBnMt3qFAfsxB0CnHU+yIRb55qp9nTZSUzZ9B++qnDhoDd1ikYtc/yh EHAnszKGPox2JbBzJRRQtpUq+qegnFaAkjssZf2eY89KKkjw/sHtssMA60dpV1tY txpP7KiTiM3Cq0/Jdqi5D2kiiiFtpABo1Jb3CLzxlTk= =3x4x -----END PGP SIGNATURE----- Merge tag 'samsung-drivers-exynos5440-4.19' of https://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux into next/drivers Exynos5440 drivers removal The Exynos5440 (quad-core A15 with GMAC, PCIe, SATA) was targeting server platforms but it did not make it to the market really. There are no development boards with it and probably there are no real products neither. The development for Exynos5440 ended in 2013 and since then the platform is in maintenance mode. Removing Exynos5440 makes our life slightly easier: less maintenance, smaller code, reduced number of quirks, no need to preserve DTB backward-compatibility. The Device Tree sources and some of the drivers for Exynos5440 were already removed. This removes remaining drivers. * tag 'samsung-drivers-exynos5440-4.19' of https://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux: usb: host: exynos: Remove support for Exynos5440 clk: samsung: Remove support for Exynos5440 cpufreq: exynos: Remove support for Exynos5440 ata: ahci-platform: Remove support for Exynos5440 Signed-off-by: Olof Johansson <olof@lixom.net>
This commit is contained in:
commit
692b12c756
12 changed files with 0 additions and 750 deletions
|
@ -17,7 +17,6 @@ Required properties:
|
|||
- "marvell,armada-380-ahci"
|
||||
- "marvell,armada-3700-ahci"
|
||||
- "snps,dwc-ahci"
|
||||
- "snps,exynos5440-ahci"
|
||||
- "snps,spear-ahci"
|
||||
- "generic-ahci"
|
||||
- interrupts : <interrupt mapping for SATA IRQ>
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
* Samsung Exynos5440 Clock Controller
|
||||
|
||||
The Exynos5440 clock controller generates and supplies clock to various
|
||||
controllers within the Exynos5440 SoC.
|
||||
|
||||
Required Properties:
|
||||
|
||||
- compatible: should be "samsung,exynos5440-clock".
|
||||
|
||||
- reg: physical base address of the controller and length of memory mapped
|
||||
region.
|
||||
|
||||
- #clock-cells: should be 1.
|
||||
|
||||
Each clock is assigned an identifier and client nodes can use this identifier
|
||||
to specify the clock which they consume.
|
||||
|
||||
All available clocks are defined as preprocessor macros in
|
||||
dt-bindings/clock/exynos5440.h header and can be used in device
|
||||
tree sources.
|
||||
|
||||
Example: An example of a clock controller node is listed below.
|
||||
|
||||
clock: clock-controller@10010000 {
|
||||
compatible = "samsung,exynos5440-clock";
|
||||
reg = <0x160000 0x10000>;
|
||||
#clock-cells = <1>;
|
||||
};
|
|
@ -1,28 +0,0 @@
|
|||
|
||||
Exynos5440 cpufreq driver
|
||||
-------------------
|
||||
|
||||
Exynos5440 SoC cpufreq driver for CPU frequency scaling.
|
||||
|
||||
Required properties:
|
||||
- interrupts: Interrupt to know the completion of cpu frequency change.
|
||||
- operating-points: Table of frequencies and voltage CPU could be transitioned into,
|
||||
in the decreasing order. Frequency should be in KHz units and voltage
|
||||
should be in microvolts.
|
||||
|
||||
Optional properties:
|
||||
- clock-latency: Clock monitor latency in microsecond.
|
||||
|
||||
All the required listed above must be defined under node cpufreq.
|
||||
|
||||
Example:
|
||||
--------
|
||||
cpufreq@160000 {
|
||||
compatible = "samsung,exynos5440-cpufreq";
|
||||
reg = <0x160000 0x1000>;
|
||||
interrupts = <0 57 0>;
|
||||
operating-points = <
|
||||
1000000 975000
|
||||
800000 925000>;
|
||||
clock-latency = <100000>;
|
||||
};
|
|
@ -75,7 +75,6 @@ static const struct of_device_id ahci_of_match[] = {
|
|||
{ .compatible = "generic-ahci", },
|
||||
/* Keep the following compatibles for device tree compatibility */
|
||||
{ .compatible = "snps,spear-ahci", },
|
||||
{ .compatible = "snps,exynos5440-ahci", },
|
||||
{ .compatible = "ibm,476gtr-ahci", },
|
||||
{ .compatible = "snps,dwc-ahci", },
|
||||
{ .compatible = "hisilicon,hisi-ahci", },
|
||||
|
|
|
@ -14,7 +14,6 @@ obj-$(CONFIG_SOC_EXYNOS5410) += clk-exynos5410.o
|
|||
obj-$(CONFIG_SOC_EXYNOS5420) += clk-exynos5420.o
|
||||
obj-$(CONFIG_SOC_EXYNOS5420) += clk-exynos5-subcmu.o
|
||||
obj-$(CONFIG_EXYNOS_ARM64_COMMON_CLK) += clk-exynos5433.o
|
||||
obj-$(CONFIG_SOC_EXYNOS5440) += clk-exynos5440.o
|
||||
obj-$(CONFIG_EXYNOS_AUDSS_CLK_CON) += clk-exynos-audss.o
|
||||
obj-$(CONFIG_ARCH_EXYNOS) += clk-exynos-clkout.o
|
||||
obj-$(CONFIG_EXYNOS_ARM64_COMMON_CLK) += clk-exynos7.o
|
||||
|
|
|
@ -1,167 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2013 Samsung Electronics Co., Ltd.
|
||||
* Author: Thomas Abraham <thomas.ab@samsung.com>
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Common Clock Framework support for Exynos5440 SoC.
|
||||
*/
|
||||
|
||||
#include <dt-bindings/clock/exynos5440.h>
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_address.h>
|
||||
#include <linux/notifier.h>
|
||||
#include <linux/reboot.h>
|
||||
|
||||
#include "clk.h"
|
||||
#include "clk-pll.h"
|
||||
|
||||
#define CLKEN_OV_VAL 0xf8
|
||||
#define CPU_CLK_STATUS 0xfc
|
||||
#define MISC_DOUT1 0x558
|
||||
|
||||
static void __iomem *reg_base;
|
||||
|
||||
/* parent clock name list */
|
||||
PNAME(mout_armclk_p) = { "cplla", "cpllb" };
|
||||
PNAME(mout_spi_p) = { "div125", "div200" };
|
||||
|
||||
/* fixed rate clocks generated outside the soc */
|
||||
static struct samsung_fixed_rate_clock exynos5440_fixed_rate_ext_clks[] __initdata = {
|
||||
FRATE(0, "xtal", NULL, 0, 0),
|
||||
};
|
||||
|
||||
/* fixed rate clocks */
|
||||
static const struct samsung_fixed_rate_clock exynos5440_fixed_rate_clks[] __initconst = {
|
||||
FRATE(0, "ppll", NULL, 0, 1000000000),
|
||||
FRATE(0, "usb_phy0", NULL, 0, 60000000),
|
||||
FRATE(0, "usb_phy1", NULL, 0, 60000000),
|
||||
FRATE(0, "usb_ohci12", NULL, 0, 12000000),
|
||||
FRATE(0, "usb_ohci48", NULL, 0, 48000000),
|
||||
};
|
||||
|
||||
/* fixed factor clocks */
|
||||
static const struct samsung_fixed_factor_clock exynos5440_fixed_factor_clks[] __initconst = {
|
||||
FFACTOR(0, "div250", "ppll", 1, 4, 0),
|
||||
FFACTOR(0, "div200", "ppll", 1, 5, 0),
|
||||
FFACTOR(0, "div125", "div250", 1, 2, 0),
|
||||
};
|
||||
|
||||
/* mux clocks */
|
||||
static const struct samsung_mux_clock exynos5440_mux_clks[] __initconst = {
|
||||
MUX(0, "mout_spi", mout_spi_p, MISC_DOUT1, 5, 1),
|
||||
MUX(CLK_ARM_CLK, "arm_clk", mout_armclk_p, CPU_CLK_STATUS, 0, 1),
|
||||
};
|
||||
|
||||
/* divider clocks */
|
||||
static const struct samsung_div_clock exynos5440_div_clks[] __initconst = {
|
||||
DIV(CLK_SPI_BAUD, "div_spi", "mout_spi", MISC_DOUT1, 3, 2),
|
||||
};
|
||||
|
||||
/* gate clocks */
|
||||
static const struct samsung_gate_clock exynos5440_gate_clks[] __initconst = {
|
||||
GATE(CLK_PB0_250, "pb0_250", "div250", CLKEN_OV_VAL, 3, 0, 0),
|
||||
GATE(CLK_PR0_250, "pr0_250", "div250", CLKEN_OV_VAL, 4, 0, 0),
|
||||
GATE(CLK_PR1_250, "pr1_250", "div250", CLKEN_OV_VAL, 5, 0, 0),
|
||||
GATE(CLK_B_250, "b_250", "div250", CLKEN_OV_VAL, 9, 0, 0),
|
||||
GATE(CLK_B_125, "b_125", "div125", CLKEN_OV_VAL, 10, 0, 0),
|
||||
GATE(CLK_B_200, "b_200", "div200", CLKEN_OV_VAL, 11, 0, 0),
|
||||
GATE(CLK_SATA, "sata", "div200", CLKEN_OV_VAL, 12, 0, 0),
|
||||
GATE(CLK_USB, "usb", "div200", CLKEN_OV_VAL, 13, 0, 0),
|
||||
GATE(CLK_GMAC0, "gmac0", "div200", CLKEN_OV_VAL, 14, 0, 0),
|
||||
GATE(CLK_CS250, "cs250", "div250", CLKEN_OV_VAL, 19, 0, 0),
|
||||
GATE(CLK_PB0_250_O, "pb0_250_o", "pb0_250", CLKEN_OV_VAL, 3, 0, 0),
|
||||
GATE(CLK_PR0_250_O, "pr0_250_o", "pr0_250", CLKEN_OV_VAL, 4, 0, 0),
|
||||
GATE(CLK_PR1_250_O, "pr1_250_o", "pr1_250", CLKEN_OV_VAL, 5, 0, 0),
|
||||
GATE(CLK_B_250_O, "b_250_o", "b_250", CLKEN_OV_VAL, 9, 0, 0),
|
||||
GATE(CLK_B_125_O, "b_125_o", "b_125", CLKEN_OV_VAL, 10, 0, 0),
|
||||
GATE(CLK_B_200_O, "b_200_o", "b_200", CLKEN_OV_VAL, 11, 0, 0),
|
||||
GATE(CLK_SATA_O, "sata_o", "sata", CLKEN_OV_VAL, 12, 0, 0),
|
||||
GATE(CLK_USB_O, "usb_o", "usb", CLKEN_OV_VAL, 13, 0, 0),
|
||||
GATE(CLK_GMAC0_O, "gmac0_o", "gmac", CLKEN_OV_VAL, 14, 0, 0),
|
||||
GATE(CLK_CS250_O, "cs250_o", "cs250", CLKEN_OV_VAL, 19, 0, 0),
|
||||
};
|
||||
|
||||
static const struct of_device_id ext_clk_match[] __initconst = {
|
||||
{ .compatible = "samsung,clock-xtal", .data = (void *)0, },
|
||||
{},
|
||||
};
|
||||
|
||||
static int exynos5440_clk_restart_notify(struct notifier_block *this,
|
||||
unsigned long code, void *unused)
|
||||
{
|
||||
u32 val, status;
|
||||
|
||||
status = readl_relaxed(reg_base + 0xbc);
|
||||
val = readl_relaxed(reg_base + 0xcc);
|
||||
val = (val & 0xffff0000) | (status & 0xffff);
|
||||
writel_relaxed(val, reg_base + 0xcc);
|
||||
|
||||
return NOTIFY_DONE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Exynos5440 Clock restart notifier, handles restart functionality
|
||||
*/
|
||||
static struct notifier_block exynos5440_clk_restart_handler = {
|
||||
.notifier_call = exynos5440_clk_restart_notify,
|
||||
.priority = 128,
|
||||
};
|
||||
|
||||
static const struct samsung_pll_clock exynos5440_plls[] __initconst = {
|
||||
PLL(pll_2550x, CLK_CPLLA, "cplla", "xtal", 0, 0x4c, NULL),
|
||||
PLL(pll_2550x, CLK_CPLLB, "cpllb", "xtal", 0, 0x50, NULL),
|
||||
};
|
||||
|
||||
/*
|
||||
* Clock aliases for legacy clkdev look-up.
|
||||
*/
|
||||
static const struct samsung_clock_alias exynos5440_aliases[] __initconst = {
|
||||
ALIAS(CLK_ARM_CLK, NULL, "armclk"),
|
||||
};
|
||||
|
||||
/* register exynos5440 clocks */
|
||||
static void __init exynos5440_clk_init(struct device_node *np)
|
||||
{
|
||||
struct samsung_clk_provider *ctx;
|
||||
|
||||
reg_base = of_iomap(np, 0);
|
||||
if (!reg_base) {
|
||||
pr_err("%s: failed to map clock controller registers,"
|
||||
" aborting clock initialization\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
ctx = samsung_clk_init(np, reg_base, CLK_NR_CLKS);
|
||||
|
||||
samsung_clk_of_register_fixed_ext(ctx, exynos5440_fixed_rate_ext_clks,
|
||||
ARRAY_SIZE(exynos5440_fixed_rate_ext_clks), ext_clk_match);
|
||||
|
||||
samsung_clk_register_pll(ctx, exynos5440_plls,
|
||||
ARRAY_SIZE(exynos5440_plls), ctx->reg_base);
|
||||
|
||||
samsung_clk_register_fixed_rate(ctx, exynos5440_fixed_rate_clks,
|
||||
ARRAY_SIZE(exynos5440_fixed_rate_clks));
|
||||
samsung_clk_register_fixed_factor(ctx, exynos5440_fixed_factor_clks,
|
||||
ARRAY_SIZE(exynos5440_fixed_factor_clks));
|
||||
samsung_clk_register_mux(ctx, exynos5440_mux_clks,
|
||||
ARRAY_SIZE(exynos5440_mux_clks));
|
||||
samsung_clk_register_div(ctx, exynos5440_div_clks,
|
||||
ARRAY_SIZE(exynos5440_div_clks));
|
||||
samsung_clk_register_gate(ctx, exynos5440_gate_clks,
|
||||
ARRAY_SIZE(exynos5440_gate_clks));
|
||||
samsung_clk_register_alias(ctx, exynos5440_aliases,
|
||||
ARRAY_SIZE(exynos5440_aliases));
|
||||
|
||||
samsung_clk_of_add_provider(np, ctx);
|
||||
|
||||
if (register_restart_handler(&exynos5440_clk_restart_handler))
|
||||
pr_warn("exynos5440 clock can't register restart handler\n");
|
||||
|
||||
pr_info("Exynos5440: arm_clk = %ldHz\n", _get_rate("arm_clk"));
|
||||
pr_info("exynos5440 clock initialization complete\n");
|
||||
}
|
||||
CLK_OF_DECLARE(exynos5440_clk, "samsung,exynos5440-clock", exynos5440_clk_init);
|
|
@ -71,20 +71,6 @@ config ARM_BRCMSTB_AVS_CPUFREQ
|
|||
|
||||
Say Y, if you have a Broadcom SoC with AVS support for DFS or DVFS.
|
||||
|
||||
config ARM_EXYNOS5440_CPUFREQ
|
||||
tristate "SAMSUNG EXYNOS5440"
|
||||
depends on SOC_EXYNOS5440
|
||||
depends on HAVE_CLK && OF
|
||||
select PM_OPP
|
||||
default y
|
||||
help
|
||||
This adds the CPUFreq driver for Samsung EXYNOS5440
|
||||
SoC. The nature of exynos5440 clock controller is
|
||||
different than previous exynos controllers so not using
|
||||
the common exynos framework.
|
||||
|
||||
If in doubt, say N.
|
||||
|
||||
config ARM_HIGHBANK_CPUFREQ
|
||||
tristate "Calxeda Highbank-based"
|
||||
depends on ARCH_HIGHBANK && CPUFREQ_DT && REGULATOR
|
||||
|
|
|
@ -56,7 +56,6 @@ obj-$(CONFIG_ARM_ARMADA_37XX_CPUFREQ) += armada-37xx-cpufreq.o
|
|||
obj-$(CONFIG_ARM_BRCMSTB_AVS_CPUFREQ) += brcmstb-avs-cpufreq.o
|
||||
obj-$(CONFIG_ACPI_CPPC_CPUFREQ) += cppc_cpufreq.o
|
||||
obj-$(CONFIG_ARCH_DAVINCI) += davinci-cpufreq.o
|
||||
obj-$(CONFIG_ARM_EXYNOS5440_CPUFREQ) += exynos5440-cpufreq.o
|
||||
obj-$(CONFIG_ARM_HIGHBANK_CPUFREQ) += highbank-cpufreq.o
|
||||
obj-$(CONFIG_ARM_IMX6Q_CPUFREQ) += imx6q-cpufreq.o
|
||||
obj-$(CONFIG_ARM_KIRKWOOD_CPUFREQ) += kirkwood-cpufreq.o
|
||||
|
|
|
@ -1,452 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2013 Samsung Electronics Co., Ltd.
|
||||
* http://www.samsung.com
|
||||
*
|
||||
* Amit Daniel Kachhap <amit.daniel@samsung.com>
|
||||
*
|
||||
* EXYNOS5440 - CPU frequency scaling support
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <linux/clk.h>
|
||||
#include <linux/cpu.h>
|
||||
#include <linux/cpufreq.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/of_address.h>
|
||||
#include <linux/of_irq.h>
|
||||
#include <linux/pm_opp.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
/* Register definitions */
|
||||
#define XMU_DVFS_CTRL 0x0060
|
||||
#define XMU_PMU_P0_7 0x0064
|
||||
#define XMU_C0_3_PSTATE 0x0090
|
||||
#define XMU_P_LIMIT 0x00a0
|
||||
#define XMU_P_STATUS 0x00a4
|
||||
#define XMU_PMUEVTEN 0x00d0
|
||||
#define XMU_PMUIRQEN 0x00d4
|
||||
#define XMU_PMUIRQ 0x00d8
|
||||
|
||||
/* PMU mask and shift definations */
|
||||
#define P_VALUE_MASK 0x7
|
||||
|
||||
#define XMU_DVFS_CTRL_EN_SHIFT 0
|
||||
|
||||
#define P0_7_CPUCLKDEV_SHIFT 21
|
||||
#define P0_7_CPUCLKDEV_MASK 0x7
|
||||
#define P0_7_ATBCLKDEV_SHIFT 18
|
||||
#define P0_7_ATBCLKDEV_MASK 0x7
|
||||
#define P0_7_CSCLKDEV_SHIFT 15
|
||||
#define P0_7_CSCLKDEV_MASK 0x7
|
||||
#define P0_7_CPUEMA_SHIFT 28
|
||||
#define P0_7_CPUEMA_MASK 0xf
|
||||
#define P0_7_L2EMA_SHIFT 24
|
||||
#define P0_7_L2EMA_MASK 0xf
|
||||
#define P0_7_VDD_SHIFT 8
|
||||
#define P0_7_VDD_MASK 0x7f
|
||||
#define P0_7_FREQ_SHIFT 0
|
||||
#define P0_7_FREQ_MASK 0xff
|
||||
|
||||
#define C0_3_PSTATE_VALID_SHIFT 8
|
||||
#define C0_3_PSTATE_CURR_SHIFT 4
|
||||
#define C0_3_PSTATE_NEW_SHIFT 0
|
||||
|
||||
#define PSTATE_CHANGED_EVTEN_SHIFT 0
|
||||
|
||||
#define PSTATE_CHANGED_IRQEN_SHIFT 0
|
||||
|
||||
#define PSTATE_CHANGED_SHIFT 0
|
||||
|
||||
/* some constant values for clock divider calculation */
|
||||
#define CPU_DIV_FREQ_MAX 500
|
||||
#define CPU_DBG_FREQ_MAX 375
|
||||
#define CPU_ATB_FREQ_MAX 500
|
||||
|
||||
#define PMIC_LOW_VOLT 0x30
|
||||
#define PMIC_HIGH_VOLT 0x28
|
||||
|
||||
#define CPUEMA_HIGH 0x2
|
||||
#define CPUEMA_MID 0x4
|
||||
#define CPUEMA_LOW 0x7
|
||||
|
||||
#define L2EMA_HIGH 0x1
|
||||
#define L2EMA_MID 0x3
|
||||
#define L2EMA_LOW 0x4
|
||||
|
||||
#define DIV_TAB_MAX 2
|
||||
/* frequency unit is 20MHZ */
|
||||
#define FREQ_UNIT 20
|
||||
#define MAX_VOLTAGE 1550000 /* In microvolt */
|
||||
#define VOLTAGE_STEP 12500 /* In microvolt */
|
||||
|
||||
#define CPUFREQ_NAME "exynos5440_dvfs"
|
||||
#define DEF_TRANS_LATENCY 100000
|
||||
|
||||
enum cpufreq_level_index {
|
||||
L0, L1, L2, L3, L4,
|
||||
L5, L6, L7, L8, L9,
|
||||
};
|
||||
#define CPUFREQ_LEVEL_END (L7 + 1)
|
||||
|
||||
struct exynos_dvfs_data {
|
||||
void __iomem *base;
|
||||
struct resource *mem;
|
||||
int irq;
|
||||
struct clk *cpu_clk;
|
||||
unsigned int latency;
|
||||
struct cpufreq_frequency_table *freq_table;
|
||||
unsigned int freq_count;
|
||||
struct device *dev;
|
||||
bool dvfs_enabled;
|
||||
struct work_struct irq_work;
|
||||
};
|
||||
|
||||
static struct exynos_dvfs_data *dvfs_info;
|
||||
static DEFINE_MUTEX(cpufreq_lock);
|
||||
static struct cpufreq_freqs freqs;
|
||||
|
||||
static int init_div_table(void)
|
||||
{
|
||||
struct cpufreq_frequency_table *pos, *freq_tbl = dvfs_info->freq_table;
|
||||
unsigned int tmp, clk_div, ema_div, freq, volt_id, idx;
|
||||
struct dev_pm_opp *opp;
|
||||
|
||||
cpufreq_for_each_entry_idx(pos, freq_tbl, idx) {
|
||||
opp = dev_pm_opp_find_freq_exact(dvfs_info->dev,
|
||||
pos->frequency * 1000, true);
|
||||
if (IS_ERR(opp)) {
|
||||
dev_err(dvfs_info->dev,
|
||||
"failed to find valid OPP for %u KHZ\n",
|
||||
pos->frequency);
|
||||
return PTR_ERR(opp);
|
||||
}
|
||||
|
||||
freq = pos->frequency / 1000; /* In MHZ */
|
||||
clk_div = ((freq / CPU_DIV_FREQ_MAX) & P0_7_CPUCLKDEV_MASK)
|
||||
<< P0_7_CPUCLKDEV_SHIFT;
|
||||
clk_div |= ((freq / CPU_ATB_FREQ_MAX) & P0_7_ATBCLKDEV_MASK)
|
||||
<< P0_7_ATBCLKDEV_SHIFT;
|
||||
clk_div |= ((freq / CPU_DBG_FREQ_MAX) & P0_7_CSCLKDEV_MASK)
|
||||
<< P0_7_CSCLKDEV_SHIFT;
|
||||
|
||||
/* Calculate EMA */
|
||||
volt_id = dev_pm_opp_get_voltage(opp);
|
||||
|
||||
volt_id = (MAX_VOLTAGE - volt_id) / VOLTAGE_STEP;
|
||||
if (volt_id < PMIC_HIGH_VOLT) {
|
||||
ema_div = (CPUEMA_HIGH << P0_7_CPUEMA_SHIFT) |
|
||||
(L2EMA_HIGH << P0_7_L2EMA_SHIFT);
|
||||
} else if (volt_id > PMIC_LOW_VOLT) {
|
||||
ema_div = (CPUEMA_LOW << P0_7_CPUEMA_SHIFT) |
|
||||
(L2EMA_LOW << P0_7_L2EMA_SHIFT);
|
||||
} else {
|
||||
ema_div = (CPUEMA_MID << P0_7_CPUEMA_SHIFT) |
|
||||
(L2EMA_MID << P0_7_L2EMA_SHIFT);
|
||||
}
|
||||
|
||||
tmp = (clk_div | ema_div | (volt_id << P0_7_VDD_SHIFT)
|
||||
| ((freq / FREQ_UNIT) << P0_7_FREQ_SHIFT));
|
||||
|
||||
__raw_writel(tmp, dvfs_info->base + XMU_PMU_P0_7 + 4 * idx);
|
||||
dev_pm_opp_put(opp);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void exynos_enable_dvfs(unsigned int cur_frequency)
|
||||
{
|
||||
unsigned int tmp, cpu;
|
||||
struct cpufreq_frequency_table *freq_table = dvfs_info->freq_table;
|
||||
struct cpufreq_frequency_table *pos;
|
||||
/* Disable DVFS */
|
||||
__raw_writel(0, dvfs_info->base + XMU_DVFS_CTRL);
|
||||
|
||||
/* Enable PSTATE Change Event */
|
||||
tmp = __raw_readl(dvfs_info->base + XMU_PMUEVTEN);
|
||||
tmp |= (1 << PSTATE_CHANGED_EVTEN_SHIFT);
|
||||
__raw_writel(tmp, dvfs_info->base + XMU_PMUEVTEN);
|
||||
|
||||
/* Enable PSTATE Change IRQ */
|
||||
tmp = __raw_readl(dvfs_info->base + XMU_PMUIRQEN);
|
||||
tmp |= (1 << PSTATE_CHANGED_IRQEN_SHIFT);
|
||||
__raw_writel(tmp, dvfs_info->base + XMU_PMUIRQEN);
|
||||
|
||||
/* Set initial performance index */
|
||||
cpufreq_for_each_entry(pos, freq_table)
|
||||
if (pos->frequency == cur_frequency)
|
||||
break;
|
||||
|
||||
if (pos->frequency == CPUFREQ_TABLE_END) {
|
||||
dev_crit(dvfs_info->dev, "Boot up frequency not supported\n");
|
||||
/* Assign the highest frequency */
|
||||
pos = freq_table;
|
||||
cur_frequency = pos->frequency;
|
||||
}
|
||||
|
||||
dev_info(dvfs_info->dev, "Setting dvfs initial frequency = %uKHZ",
|
||||
cur_frequency);
|
||||
|
||||
for (cpu = 0; cpu < CONFIG_NR_CPUS; cpu++) {
|
||||
tmp = __raw_readl(dvfs_info->base + XMU_C0_3_PSTATE + cpu * 4);
|
||||
tmp &= ~(P_VALUE_MASK << C0_3_PSTATE_NEW_SHIFT);
|
||||
tmp |= ((pos - freq_table) << C0_3_PSTATE_NEW_SHIFT);
|
||||
__raw_writel(tmp, dvfs_info->base + XMU_C0_3_PSTATE + cpu * 4);
|
||||
}
|
||||
|
||||
/* Enable DVFS */
|
||||
__raw_writel(1 << XMU_DVFS_CTRL_EN_SHIFT,
|
||||
dvfs_info->base + XMU_DVFS_CTRL);
|
||||
}
|
||||
|
||||
static int exynos_target(struct cpufreq_policy *policy, unsigned int index)
|
||||
{
|
||||
unsigned int tmp;
|
||||
int i;
|
||||
struct cpufreq_frequency_table *freq_table = dvfs_info->freq_table;
|
||||
|
||||
mutex_lock(&cpufreq_lock);
|
||||
|
||||
freqs.old = policy->cur;
|
||||
freqs.new = freq_table[index].frequency;
|
||||
|
||||
cpufreq_freq_transition_begin(policy, &freqs);
|
||||
|
||||
/* Set the target frequency in all C0_3_PSTATE register */
|
||||
for_each_cpu(i, policy->cpus) {
|
||||
tmp = __raw_readl(dvfs_info->base + XMU_C0_3_PSTATE + i * 4);
|
||||
tmp &= ~(P_VALUE_MASK << C0_3_PSTATE_NEW_SHIFT);
|
||||
tmp |= (index << C0_3_PSTATE_NEW_SHIFT);
|
||||
|
||||
__raw_writel(tmp, dvfs_info->base + XMU_C0_3_PSTATE + i * 4);
|
||||
}
|
||||
mutex_unlock(&cpufreq_lock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void exynos_cpufreq_work(struct work_struct *work)
|
||||
{
|
||||
unsigned int cur_pstate, index;
|
||||
struct cpufreq_policy *policy = cpufreq_cpu_get(0); /* boot CPU */
|
||||
struct cpufreq_frequency_table *freq_table = dvfs_info->freq_table;
|
||||
|
||||
/* Ensure we can access cpufreq structures */
|
||||
if (unlikely(dvfs_info->dvfs_enabled == false))
|
||||
goto skip_work;
|
||||
|
||||
mutex_lock(&cpufreq_lock);
|
||||
freqs.old = policy->cur;
|
||||
|
||||
cur_pstate = __raw_readl(dvfs_info->base + XMU_P_STATUS);
|
||||
if (cur_pstate >> C0_3_PSTATE_VALID_SHIFT & 0x1)
|
||||
index = (cur_pstate >> C0_3_PSTATE_CURR_SHIFT) & P_VALUE_MASK;
|
||||
else
|
||||
index = (cur_pstate >> C0_3_PSTATE_NEW_SHIFT) & P_VALUE_MASK;
|
||||
|
||||
if (likely(index < dvfs_info->freq_count)) {
|
||||
freqs.new = freq_table[index].frequency;
|
||||
} else {
|
||||
dev_crit(dvfs_info->dev, "New frequency out of range\n");
|
||||
freqs.new = freqs.old;
|
||||
}
|
||||
cpufreq_freq_transition_end(policy, &freqs, 0);
|
||||
|
||||
cpufreq_cpu_put(policy);
|
||||
mutex_unlock(&cpufreq_lock);
|
||||
skip_work:
|
||||
enable_irq(dvfs_info->irq);
|
||||
}
|
||||
|
||||
static irqreturn_t exynos_cpufreq_irq(int irq, void *id)
|
||||
{
|
||||
unsigned int tmp;
|
||||
|
||||
tmp = __raw_readl(dvfs_info->base + XMU_PMUIRQ);
|
||||
if (tmp >> PSTATE_CHANGED_SHIFT & 0x1) {
|
||||
__raw_writel(tmp, dvfs_info->base + XMU_PMUIRQ);
|
||||
disable_irq_nosync(irq);
|
||||
schedule_work(&dvfs_info->irq_work);
|
||||
}
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
static void exynos_sort_descend_freq_table(void)
|
||||
{
|
||||
struct cpufreq_frequency_table *freq_tbl = dvfs_info->freq_table;
|
||||
int i = 0, index;
|
||||
unsigned int tmp_freq;
|
||||
/*
|
||||
* Exynos5440 clock controller state logic expects the cpufreq table to
|
||||
* be in descending order. But the OPP library constructs the table in
|
||||
* ascending order. So to make the table descending we just need to
|
||||
* swap the i element with the N - i element.
|
||||
*/
|
||||
for (i = 0; i < dvfs_info->freq_count / 2; i++) {
|
||||
index = dvfs_info->freq_count - i - 1;
|
||||
tmp_freq = freq_tbl[i].frequency;
|
||||
freq_tbl[i].frequency = freq_tbl[index].frequency;
|
||||
freq_tbl[index].frequency = tmp_freq;
|
||||
}
|
||||
}
|
||||
|
||||
static int exynos_cpufreq_cpu_init(struct cpufreq_policy *policy)
|
||||
{
|
||||
policy->clk = dvfs_info->cpu_clk;
|
||||
return cpufreq_generic_init(policy, dvfs_info->freq_table,
|
||||
dvfs_info->latency);
|
||||
}
|
||||
|
||||
static struct cpufreq_driver exynos_driver = {
|
||||
.flags = CPUFREQ_STICKY | CPUFREQ_ASYNC_NOTIFICATION |
|
||||
CPUFREQ_NEED_INITIAL_FREQ_CHECK,
|
||||
.verify = cpufreq_generic_frequency_table_verify,
|
||||
.target_index = exynos_target,
|
||||
.get = cpufreq_generic_get,
|
||||
.init = exynos_cpufreq_cpu_init,
|
||||
.name = CPUFREQ_NAME,
|
||||
.attr = cpufreq_generic_attr,
|
||||
};
|
||||
|
||||
static const struct of_device_id exynos_cpufreq_match[] = {
|
||||
{
|
||||
.compatible = "samsung,exynos5440-cpufreq",
|
||||
},
|
||||
{},
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, exynos_cpufreq_match);
|
||||
|
||||
static int exynos_cpufreq_probe(struct platform_device *pdev)
|
||||
{
|
||||
int ret = -EINVAL;
|
||||
struct device_node *np;
|
||||
struct resource res;
|
||||
unsigned int cur_frequency;
|
||||
|
||||
np = pdev->dev.of_node;
|
||||
if (!np)
|
||||
return -ENODEV;
|
||||
|
||||
dvfs_info = devm_kzalloc(&pdev->dev, sizeof(*dvfs_info), GFP_KERNEL);
|
||||
if (!dvfs_info) {
|
||||
ret = -ENOMEM;
|
||||
goto err_put_node;
|
||||
}
|
||||
|
||||
dvfs_info->dev = &pdev->dev;
|
||||
|
||||
ret = of_address_to_resource(np, 0, &res);
|
||||
if (ret)
|
||||
goto err_put_node;
|
||||
|
||||
dvfs_info->base = devm_ioremap_resource(dvfs_info->dev, &res);
|
||||
if (IS_ERR(dvfs_info->base)) {
|
||||
ret = PTR_ERR(dvfs_info->base);
|
||||
goto err_put_node;
|
||||
}
|
||||
|
||||
dvfs_info->irq = irq_of_parse_and_map(np, 0);
|
||||
if (!dvfs_info->irq) {
|
||||
dev_err(dvfs_info->dev, "No cpufreq irq found\n");
|
||||
ret = -ENODEV;
|
||||
goto err_put_node;
|
||||
}
|
||||
|
||||
ret = dev_pm_opp_of_add_table(dvfs_info->dev);
|
||||
if (ret) {
|
||||
dev_err(dvfs_info->dev, "failed to init OPP table: %d\n", ret);
|
||||
goto err_put_node;
|
||||
}
|
||||
|
||||
ret = dev_pm_opp_init_cpufreq_table(dvfs_info->dev,
|
||||
&dvfs_info->freq_table);
|
||||
if (ret) {
|
||||
dev_err(dvfs_info->dev,
|
||||
"failed to init cpufreq table: %d\n", ret);
|
||||
goto err_free_opp;
|
||||
}
|
||||
dvfs_info->freq_count = dev_pm_opp_get_opp_count(dvfs_info->dev);
|
||||
exynos_sort_descend_freq_table();
|
||||
|
||||
if (of_property_read_u32(np, "clock-latency", &dvfs_info->latency))
|
||||
dvfs_info->latency = DEF_TRANS_LATENCY;
|
||||
|
||||
dvfs_info->cpu_clk = devm_clk_get(dvfs_info->dev, "armclk");
|
||||
if (IS_ERR(dvfs_info->cpu_clk)) {
|
||||
dev_err(dvfs_info->dev, "Failed to get cpu clock\n");
|
||||
ret = PTR_ERR(dvfs_info->cpu_clk);
|
||||
goto err_free_table;
|
||||
}
|
||||
|
||||
cur_frequency = clk_get_rate(dvfs_info->cpu_clk);
|
||||
if (!cur_frequency) {
|
||||
dev_err(dvfs_info->dev, "Failed to get clock rate\n");
|
||||
ret = -EINVAL;
|
||||
goto err_free_table;
|
||||
}
|
||||
cur_frequency /= 1000;
|
||||
|
||||
INIT_WORK(&dvfs_info->irq_work, exynos_cpufreq_work);
|
||||
ret = devm_request_irq(dvfs_info->dev, dvfs_info->irq,
|
||||
exynos_cpufreq_irq, IRQF_TRIGGER_NONE,
|
||||
CPUFREQ_NAME, dvfs_info);
|
||||
if (ret) {
|
||||
dev_err(dvfs_info->dev, "Failed to register IRQ\n");
|
||||
goto err_free_table;
|
||||
}
|
||||
|
||||
ret = init_div_table();
|
||||
if (ret) {
|
||||
dev_err(dvfs_info->dev, "Failed to initialise div table\n");
|
||||
goto err_free_table;
|
||||
}
|
||||
|
||||
exynos_enable_dvfs(cur_frequency);
|
||||
ret = cpufreq_register_driver(&exynos_driver);
|
||||
if (ret) {
|
||||
dev_err(dvfs_info->dev,
|
||||
"%s: failed to register cpufreq driver\n", __func__);
|
||||
goto err_free_table;
|
||||
}
|
||||
|
||||
of_node_put(np);
|
||||
dvfs_info->dvfs_enabled = true;
|
||||
return 0;
|
||||
|
||||
err_free_table:
|
||||
dev_pm_opp_free_cpufreq_table(dvfs_info->dev, &dvfs_info->freq_table);
|
||||
err_free_opp:
|
||||
dev_pm_opp_of_remove_table(dvfs_info->dev);
|
||||
err_put_node:
|
||||
of_node_put(np);
|
||||
dev_err(&pdev->dev, "%s: failed initialization\n", __func__);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int exynos_cpufreq_remove(struct platform_device *pdev)
|
||||
{
|
||||
cpufreq_unregister_driver(&exynos_driver);
|
||||
dev_pm_opp_free_cpufreq_table(dvfs_info->dev, &dvfs_info->freq_table);
|
||||
dev_pm_opp_of_remove_table(dvfs_info->dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct platform_driver exynos_cpufreq_platdrv = {
|
||||
.driver = {
|
||||
.name = "exynos5440-cpufreq",
|
||||
.of_match_table = exynos_cpufreq_match,
|
||||
},
|
||||
.probe = exynos_cpufreq_probe,
|
||||
.remove = exynos_cpufreq_remove,
|
||||
};
|
||||
module_platform_driver(exynos_cpufreq_platdrv);
|
||||
|
||||
MODULE_AUTHOR("Amit Daniel Kachhap <amit.daniel@samsung.com>");
|
||||
MODULE_DESCRIPTION("Exynos5440 cpufreq driver");
|
||||
MODULE_LICENSE("GPL");
|
|
@ -161,16 +161,10 @@ static int exynos_ehci_probe(struct platform_device *pdev)
|
|||
}
|
||||
exynos_ehci = to_exynos_ehci(hcd);
|
||||
|
||||
if (of_device_is_compatible(pdev->dev.of_node,
|
||||
"samsung,exynos5440-ehci"))
|
||||
goto skip_phy;
|
||||
|
||||
err = exynos_ehci_get_phy(&pdev->dev, exynos_ehci);
|
||||
if (err)
|
||||
goto fail_clk;
|
||||
|
||||
skip_phy:
|
||||
|
||||
exynos_ehci->clk = devm_clk_get(&pdev->dev, "usbhost");
|
||||
|
||||
if (IS_ERR(exynos_ehci->clk)) {
|
||||
|
@ -304,7 +298,6 @@ static const struct dev_pm_ops exynos_ehci_pm_ops = {
|
|||
#ifdef CONFIG_OF
|
||||
static const struct of_device_id exynos_ehci_match[] = {
|
||||
{ .compatible = "samsung,exynos4210-ehci" },
|
||||
{ .compatible = "samsung,exynos5440-ehci" },
|
||||
{},
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, exynos_ehci_match);
|
||||
|
|
|
@ -130,15 +130,10 @@ static int exynos_ohci_probe(struct platform_device *pdev)
|
|||
|
||||
exynos_ohci = to_exynos_ohci(hcd);
|
||||
|
||||
if (of_device_is_compatible(pdev->dev.of_node,
|
||||
"samsung,exynos5440-ohci"))
|
||||
goto skip_phy;
|
||||
|
||||
err = exynos_ohci_get_phy(&pdev->dev, exynos_ohci);
|
||||
if (err)
|
||||
goto fail_clk;
|
||||
|
||||
skip_phy:
|
||||
exynos_ohci->clk = devm_clk_get(&pdev->dev, "usbhost");
|
||||
|
||||
if (IS_ERR(exynos_ohci->clk)) {
|
||||
|
@ -270,7 +265,6 @@ static const struct dev_pm_ops exynos_ohci_pm_ops = {
|
|||
#ifdef CONFIG_OF
|
||||
static const struct of_device_id exynos_ohci_match[] = {
|
||||
{ .compatible = "samsung,exynos4210-ohci" },
|
||||
{ .compatible = "samsung,exynos5440-ohci" },
|
||||
{},
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, exynos_ohci_match);
|
||||
|
|
|
@ -1,44 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2013 Samsung Electronics Co., Ltd.
|
||||
* Author: Andrzej Hajda <a.hajda@samsung.com>
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Device Tree binding constants for Exynos5440 clock controller.
|
||||
*/
|
||||
|
||||
#ifndef _DT_BINDINGS_CLOCK_EXYNOS_5440_H
|
||||
#define _DT_BINDINGS_CLOCK_EXYNOS_5440_H
|
||||
|
||||
#define CLK_XTAL 1
|
||||
#define CLK_ARM_CLK 2
|
||||
#define CLK_CPLLA 3
|
||||
#define CLK_CPLLB 4
|
||||
#define CLK_SPI_BAUD 16
|
||||
#define CLK_PB0_250 17
|
||||
#define CLK_PR0_250 18
|
||||
#define CLK_PR1_250 19
|
||||
#define CLK_B_250 20
|
||||
#define CLK_B_125 21
|
||||
#define CLK_B_200 22
|
||||
#define CLK_SATA 23
|
||||
#define CLK_USB 24
|
||||
#define CLK_GMAC0 25
|
||||
#define CLK_CS250 26
|
||||
#define CLK_PB0_250_O 27
|
||||
#define CLK_PR0_250_O 28
|
||||
#define CLK_PR1_250_O 29
|
||||
#define CLK_B_250_O 30
|
||||
#define CLK_B_125_O 31
|
||||
#define CLK_B_200_O 32
|
||||
#define CLK_SATA_O 33
|
||||
#define CLK_USB_O 34
|
||||
#define CLK_GMAC0_O 35
|
||||
#define CLK_CS250_O 36
|
||||
|
||||
/* must be greater than maximal clock id */
|
||||
#define CLK_NR_CLKS 37
|
||||
|
||||
#endif /* _DT_BINDINGS_CLOCK_EXYNOS_5440_H */
|
Loading…
Reference in a new issue