.. | .. |
---|
14 | 14 | |
---|
15 | 15 | #define PON_SOFT_RB_SPARE 0x8f |
---|
16 | 16 | |
---|
| 17 | +#define GEN1_REASON_SHIFT 2 |
---|
| 18 | +#define GEN2_REASON_SHIFT 1 |
---|
| 19 | + |
---|
17 | 20 | struct pm8916_pon { |
---|
18 | 21 | struct device *dev; |
---|
19 | 22 | struct regmap *regmap; |
---|
20 | 23 | u32 baseaddr; |
---|
21 | 24 | struct reboot_mode_driver reboot_mode; |
---|
| 25 | + long reason_shift; |
---|
22 | 26 | }; |
---|
23 | 27 | |
---|
24 | 28 | static int pm8916_reboot_mode_write(struct reboot_mode_driver *reboot, |
---|
.. | .. |
---|
30 | 34 | |
---|
31 | 35 | ret = regmap_update_bits(pon->regmap, |
---|
32 | 36 | pon->baseaddr + PON_SOFT_RB_SPARE, |
---|
33 | | - 0xfc, magic << 2); |
---|
| 37 | + GENMASK(7, pon->reason_shift), |
---|
| 38 | + magic << pon->reason_shift); |
---|
34 | 39 | if (ret < 0) |
---|
35 | 40 | dev_err(pon->dev, "update reboot mode bits failed\n"); |
---|
36 | 41 | |
---|
.. | .. |
---|
60 | 65 | return error; |
---|
61 | 66 | |
---|
62 | 67 | pon->reboot_mode.dev = &pdev->dev; |
---|
| 68 | + pon->reason_shift = (long)of_device_get_match_data(&pdev->dev); |
---|
63 | 69 | pon->reboot_mode.write = pm8916_reboot_mode_write; |
---|
64 | 70 | error = devm_reboot_mode_register(&pdev->dev, &pon->reboot_mode); |
---|
65 | 71 | if (error) { |
---|
.. | .. |
---|
73 | 79 | } |
---|
74 | 80 | |
---|
75 | 81 | static const struct of_device_id pm8916_pon_id_table[] = { |
---|
76 | | - { .compatible = "qcom,pm8916-pon" }, |
---|
| 82 | + { .compatible = "qcom,pm8916-pon", .data = (void *)GEN1_REASON_SHIFT }, |
---|
| 83 | + { .compatible = "qcom,pms405-pon", .data = (void *)GEN1_REASON_SHIFT }, |
---|
| 84 | + { .compatible = "qcom,pm8998-pon", .data = (void *)GEN2_REASON_SHIFT }, |
---|
77 | 85 | { } |
---|
78 | 86 | }; |
---|
79 | 87 | MODULE_DEVICE_TABLE(of, pm8916_pon_id_table); |
---|