Merge tag 'usb-5.11-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
[linux/fpc-iii.git] / arch / mips / lantiq / xway / dcdc.c
blob4960bee0a99d461b0b98d6d1b439f1975d815fe5
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
4 * Copyright (C) 2012 John Crispin <john@phrozen.org>
5 * Copyright (C) 2010 Sameer Ahmad, Lantiq GmbH
6 */
8 #include <linux/ioport.h>
9 #include <linux/of_platform.h>
11 #include <lantiq_soc.h>
13 /* Bias and regulator Setup Register */
14 #define DCDC_BIAS_VREG0 0xa
15 /* Bias and regulator Setup Register */
16 #define DCDC_BIAS_VREG1 0xb
18 #define dcdc_w8(x, y) ltq_w8((x), dcdc_membase + (y))
19 #define dcdc_r8(x) ltq_r8(dcdc_membase + (x))
21 static void __iomem *dcdc_membase;
23 static int dcdc_probe(struct platform_device *pdev)
25 struct resource *res;
27 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
28 dcdc_membase = devm_ioremap_resource(&pdev->dev, res);
29 if (IS_ERR(dcdc_membase))
30 return PTR_ERR(dcdc_membase);
32 dev_info(&pdev->dev, "Core Voltage : %d mV\n",
33 dcdc_r8(DCDC_BIAS_VREG1) * 8);
35 return 0;
38 static const struct of_device_id dcdc_match[] = {
39 { .compatible = "lantiq,dcdc-xrx200" },
40 {},
43 static struct platform_driver dcdc_driver = {
44 .probe = dcdc_probe,
45 .driver = {
46 .name = "dcdc-xrx200",
47 .of_match_table = dcdc_match,
51 int __init dcdc_init(void)
53 int ret = platform_driver_register(&dcdc_driver);
55 if (ret)
56 pr_info("dcdc: Error registering platform driver\n");
57 return ret;
60 arch_initcall(dcdc_init);