diff options
author | John Crispin <john@openwrt.org> | 2013-06-29 18:16:56 +0000 |
---|---|---|
committer | John Crispin <john@openwrt.org> | 2013-06-29 18:16:56 +0000 |
commit | 124ef95f5f3850a6f9bfe7dfdc48f082f996fa1b (patch) | |
tree | ce93844e9d84f39401a05f14ecac91d4f5b4f004 /target/linux/lantiq/patches-3.9/0012-MIPS-lantiq-adds-minimal-dcdc-driver.patch | |
parent | 6406414a40edfd911e4f2b7efd5337e42f877c85 (diff) | |
download | mtk-20170518-124ef95f5f3850a6f9bfe7dfdc48f082f996fa1b.zip mtk-20170518-124ef95f5f3850a6f9bfe7dfdc48f082f996fa1b.tar.gz mtk-20170518-124ef95f5f3850a6f9bfe7dfdc48f082f996fa1b.tar.bz2 |
lantiq: add v3.9 support
Signed-off-by: John Crispin <blogic@openwrt.org>
SVN-Revision: 37089
Diffstat (limited to 'target/linux/lantiq/patches-3.9/0012-MIPS-lantiq-adds-minimal-dcdc-driver.patch')
-rw-r--r-- | target/linux/lantiq/patches-3.9/0012-MIPS-lantiq-adds-minimal-dcdc-driver.patch | 106 |
1 files changed, 106 insertions, 0 deletions
diff --git a/target/linux/lantiq/patches-3.9/0012-MIPS-lantiq-adds-minimal-dcdc-driver.patch b/target/linux/lantiq/patches-3.9/0012-MIPS-lantiq-adds-minimal-dcdc-driver.patch new file mode 100644 index 0000000..b1813b3 --- /dev/null +++ b/target/linux/lantiq/patches-3.9/0012-MIPS-lantiq-adds-minimal-dcdc-driver.patch @@ -0,0 +1,106 @@ +From a810de459f90a62f5c1e27a2352b90318c5ef9a1 Mon Sep 17 00:00:00 2001 +From: John Crispin <blogic@openwrt.org> +Date: Wed, 5 Dec 2012 17:38:48 +0100 +Subject: [PATCH 12/22] MIPS: lantiq: adds minimal dcdc driver + +This driver so far only reads the core voltage. + +Signed-off-by: John Crispin <blogic@openwrt.org> +--- + arch/mips/lantiq/xway/Makefile | 2 +- + arch/mips/lantiq/xway/dcdc.c | 74 ++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 75 insertions(+), 1 deletion(-) + create mode 100644 arch/mips/lantiq/xway/dcdc.c + +diff --git a/arch/mips/lantiq/xway/Makefile b/arch/mips/lantiq/xway/Makefile +index 7a13660..087497d 100644 +--- a/arch/mips/lantiq/xway/Makefile ++++ b/arch/mips/lantiq/xway/Makefile +@@ -1,3 +1,3 @@ +-obj-y := prom.o sysctrl.o clk.o reset.o dma.o gptu.o ++obj-y := prom.o sysctrl.o clk.o reset.o dma.o gptu.o dcdc.o + + obj-$(CONFIG_XRX200_PHY_FW) += xrx200_phy_fw.o +diff --git a/arch/mips/lantiq/xway/dcdc.c b/arch/mips/lantiq/xway/dcdc.c +new file mode 100644 +index 0000000..8dd871a +--- /dev/null ++++ b/arch/mips/lantiq/xway/dcdc.c +@@ -0,0 +1,74 @@ ++/* ++ * 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. ++ * ++ * Copyright (C) 2012 John Crispin <blogic@openwrt.org> ++ * Copyright (C) 2010 Sameer Ahmad, Lantiq GmbH ++ */ ++ ++#include <linux/interrupt.h> ++#include <linux/ioport.h> ++#include <linux/module.h> ++#include <linux/of_platform.h> ++#include <linux/of_irq.h> ++ ++#include <lantiq_soc.h> ++ ++/* Bias and regulator Setup Register */ ++#define DCDC_BIAS_VREG0 0xa ++/* Bias and regulator Setup Register */ ++#define DCDC_BIAS_VREG1 0xb ++ ++#define dcdc_w8(x, y) ltq_w8((x), dcdc_membase + (y)) ++#define dcdc_r8(x) ltq_r8(dcdc_membase + (x)) ++ ++static void __iomem *dcdc_membase; ++ ++static int dcdc_probe(struct platform_device *pdev) ++{ ++ struct resource *res; ++ ++ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ if (!res) { ++ dev_err(&pdev->dev, "Failed to get resource\n"); ++ return -ENOMEM; ++ } ++ ++ /* remap dcdc register range */ ++ dcdc_membase = devm_request_and_ioremap(&pdev->dev, res); ++ if (!dcdc_membase) { ++ dev_err(&pdev->dev, "Failed to remap resource\n"); ++ return -ENOMEM; ++ } ++ ++ dev_info(&pdev->dev, "Core Voltage : %d mV\n", dcdc_r8(DCDC_BIAS_VREG1) * 8); ++ ++ return 0; ++} ++ ++static const struct of_device_id dcdc_match[] = { ++ { .compatible = "lantiq,dcdc-xrx200" }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, dcdc_match); ++ ++static struct platform_driver dcdc_driver = { ++ .probe = dcdc_probe, ++ .driver = { ++ .name = "dcdc-xrx200", ++ .owner = THIS_MODULE, ++ .of_match_table = dcdc_match, ++ }, ++}; ++ ++int __init dcdc_init(void) ++{ ++ int ret = platform_driver_register(&dcdc_driver); ++ ++ if (ret) ++ pr_info("dcdc: Error registering platform driver\n"); ++ return ret; ++} ++ ++arch_initcall(dcdc_init); +-- +1.7.10.4 + |