1 // SPDX-License-Identifier: GPL-2.0-only
4 * Copyright (C) 2012 John Crispin <john@phrozen.org>
5 * Copyright (C) 2010 Sameer Ahmad, Lantiq GmbH
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
)
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);
38 static const struct of_device_id dcdc_match
[] = {
39 { .compatible
= "lantiq,dcdc-xrx200" },
43 static struct platform_driver dcdc_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
);
56 pr_info("dcdc: Error registering platform driver\n");
60 arch_initcall(dcdc_init
);