|
5 | 5 | *
|
6 | 6 | * Author: Søren Andersen <[email protected]>
|
7 | 7 | * Maintainers: http://www.nslu2-linux.org/
|
| 8 | + * |
| 9 | + * Copyright (C) 2019 Micro Crystal AG |
| 10 | + * Author: Alexandre Belloni <[email protected]> |
8 | 11 | */
|
9 | 12 | #include <linux/i2c.h>
|
10 | 13 | #include <linux/bcd.h>
|
|
22 | 25 | *
|
23 | 26 | * PCF85063A -- Rev. 6 — 18 November 2015
|
24 | 27 | * PCF85063TP -- Rev. 4 — 6 May 2015
|
25 |
| -*/ |
| 28 | + * |
| 29 | + * https://www.microcrystal.com/fileadmin/Media/Products/RTC/App.Manual/RV-8263-C7_App-Manual.pdf |
| 30 | + * RV8263 -- Rev. 1.0 — January 2019 |
| 31 | + */ |
26 | 32 |
|
27 | 33 | #define PCF85063_REG_CTRL1 0x00 /* status */
|
28 | 34 | #define PCF85063_REG_CTRL1_CAP_SEL BIT(0)
|
|
41 | 47 | struct pcf85063_config {
|
42 | 48 | struct regmap_config regmap;
|
43 | 49 | unsigned has_alarms:1;
|
| 50 | + unsigned force_cap_7000:1; |
44 | 51 | };
|
45 | 52 |
|
46 | 53 | struct pcf85063 {
|
@@ -230,12 +237,17 @@ static const struct rtc_class_ops pcf85063_rtc_ops_alarm = {
|
230 | 237 | };
|
231 | 238 |
|
232 | 239 | static int pcf85063_load_capacitance(struct pcf85063 *pcf85063,
|
233 |
| - const struct device_node *np) |
| 240 | + const struct device_node *np, |
| 241 | + unsigned int force_cap) |
234 | 242 | {
|
235 | 243 | u32 load = 7000;
|
236 | 244 | u8 reg = 0;
|
237 | 245 |
|
238 |
| - of_property_read_u32(np, "quartz-load-femtofarads", &load); |
| 246 | + if (force_cap) |
| 247 | + load = force_cap; |
| 248 | + else |
| 249 | + of_property_read_u32(np, "quartz-load-femtofarads", &load); |
| 250 | + |
239 | 251 | switch (load) {
|
240 | 252 | default:
|
241 | 253 | dev_warn(&pcf85063->rtc->dev, "Unknown quartz-load-femtofarads value: %d. Assuming 7000",
|
@@ -269,6 +281,16 @@ static const struct pcf85063_config pcf85063tp_config = {
|
269 | 281 | },
|
270 | 282 | };
|
271 | 283 |
|
| 284 | +static const struct pcf85063_config rv8263_config = { |
| 285 | + .regmap = { |
| 286 | + .reg_bits = 8, |
| 287 | + .val_bits = 8, |
| 288 | + .max_register = 0x11, |
| 289 | + }, |
| 290 | + .has_alarms = 1, |
| 291 | + .force_cap_7000 = 1, |
| 292 | +}; |
| 293 | + |
272 | 294 | static int pcf85063_probe(struct i2c_client *client)
|
273 | 295 | {
|
274 | 296 | struct pcf85063 *pcf85063;
|
@@ -303,7 +325,8 @@ static int pcf85063_probe(struct i2c_client *client)
|
303 | 325 | if (IS_ERR(pcf85063->rtc))
|
304 | 326 | return PTR_ERR(pcf85063->rtc);
|
305 | 327 |
|
306 |
| - err = pcf85063_load_capacitance(pcf85063, client->dev.of_node); |
| 328 | + err = pcf85063_load_capacitance(pcf85063, client->dev.of_node, |
| 329 | + config->force_cap_7000 ? 7000 : 0); |
307 | 330 | if (err < 0)
|
308 | 331 | dev_warn(&client->dev, "failed to set xtal load capacitance: %d",
|
309 | 332 | err);
|
@@ -339,6 +362,7 @@ static const struct of_device_id pcf85063_of_match[] = {
|
339 | 362 | { .compatible = "nxp,pcf85063", .data = &pcf85063tp_config },
|
340 | 363 | { .compatible = "nxp,pcf85063tp", .data = &pcf85063tp_config },
|
341 | 364 | { .compatible = "nxp,pcf85063a", .data = &pcf85063a_config },
|
| 365 | + { .compatible = "microcrystal,rv8263", .data = &rv8263_config }, |
342 | 366 | {}
|
343 | 367 | };
|
344 | 368 | MODULE_DEVICE_TABLE(of, pcf85063_of_match);
|
|
0 commit comments