forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-10 cde9070d9970eef1f7ec2360586c802a16230ad8
kernel/drivers/mfd/atmel-hlcdc.c
....@@ -1,20 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (C) 2014 Free Electrons
34 * Copyright (C) 2014 Atmel
45 *
56 * Author: Boris BREZILLON <boris.brezillon@free-electrons.com>
6
- *
7
- * This program is free software; you can redistribute it and/or modify it
8
- * under the terms of the GNU General Public License version 2 as published by
9
- * the Free Software Foundation.
10
- *
11
- * This program is distributed in the hope that it will be useful, but WITHOUT
12
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14
- * more details.
15
- *
16
- * You should have received a copy of the GNU General Public License along with
17
- * this program. If not, see <http://www.gnu.org/licenses/>.
187 */
198
209 #include <linux/clk.h>
....@@ -30,6 +19,7 @@
3019
3120 struct atmel_hlcdc_regmap {
3221 void __iomem *regs;
22
+ struct device *dev;
3323 };
3424
3525 static const struct mfd_cell atmel_hlcdc_cells[] = {
....@@ -50,10 +40,17 @@
5040
5141 if (reg <= ATMEL_HLCDC_DIS) {
5242 u32 status;
43
+ int ret;
5344
54
- readl_poll_timeout_atomic(hregmap->regs + ATMEL_HLCDC_SR,
55
- status, !(status & ATMEL_HLCDC_SIP),
56
- 1, 100);
45
+ ret = readl_poll_timeout_atomic(hregmap->regs + ATMEL_HLCDC_SR,
46
+ status,
47
+ !(status & ATMEL_HLCDC_SIP),
48
+ 1, 100);
49
+ if (ret) {
50
+ dev_err(hregmap->dev,
51
+ "Timeout! Clock domain synchronization is in progress!\n");
52
+ return ret;
53
+ }
5754 }
5855
5956 writel(val, hregmap->regs + reg);
....@@ -101,6 +98,8 @@
10198 if (IS_ERR(hregmap->regs))
10299 return PTR_ERR(hregmap->regs);
103100
101
+ hregmap->dev = &pdev->dev;
102
+
104103 hlcdc->irq = platform_get_irq(pdev, 0);
105104 if (hlcdc->irq < 0)
106105 return hlcdc->irq;
....@@ -141,6 +140,7 @@
141140 { .compatible = "atmel,sama5d2-hlcdc" },
142141 { .compatible = "atmel,sama5d3-hlcdc" },
143142 { .compatible = "atmel,sama5d4-hlcdc" },
143
+ { .compatible = "microchip,sam9x60-hlcdc" },
144144 { /* sentinel */ },
145145 };
146146 MODULE_DEVICE_TABLE(of, atmel_hlcdc_match);