| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) 2014 Free Electrons |
|---|
| 3 | 4 | * Copyright (C) 2014 Atmel |
|---|
| 4 | 5 | * |
|---|
| 5 | 6 | * 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/>. |
|---|
| 18 | 7 | */ |
|---|
| 19 | 8 | |
|---|
| 20 | 9 | #include <linux/clk.h> |
|---|
| .. | .. |
|---|
| 30 | 19 | |
|---|
| 31 | 20 | struct atmel_hlcdc_regmap { |
|---|
| 32 | 21 | void __iomem *regs; |
|---|
| 22 | + struct device *dev; |
|---|
| 33 | 23 | }; |
|---|
| 34 | 24 | |
|---|
| 35 | 25 | static const struct mfd_cell atmel_hlcdc_cells[] = { |
|---|
| .. | .. |
|---|
| 50 | 40 | |
|---|
| 51 | 41 | if (reg <= ATMEL_HLCDC_DIS) { |
|---|
| 52 | 42 | u32 status; |
|---|
| 43 | + int ret; |
|---|
| 53 | 44 | |
|---|
| 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 | + } |
|---|
| 57 | 54 | } |
|---|
| 58 | 55 | |
|---|
| 59 | 56 | writel(val, hregmap->regs + reg); |
|---|
| .. | .. |
|---|
| 101 | 98 | if (IS_ERR(hregmap->regs)) |
|---|
| 102 | 99 | return PTR_ERR(hregmap->regs); |
|---|
| 103 | 100 | |
|---|
| 101 | + hregmap->dev = &pdev->dev; |
|---|
| 102 | + |
|---|
| 104 | 103 | hlcdc->irq = platform_get_irq(pdev, 0); |
|---|
| 105 | 104 | if (hlcdc->irq < 0) |
|---|
| 106 | 105 | return hlcdc->irq; |
|---|
| .. | .. |
|---|
| 141 | 140 | { .compatible = "atmel,sama5d2-hlcdc" }, |
|---|
| 142 | 141 | { .compatible = "atmel,sama5d3-hlcdc" }, |
|---|
| 143 | 142 | { .compatible = "atmel,sama5d4-hlcdc" }, |
|---|
| 143 | + { .compatible = "microchip,sam9x60-hlcdc" }, |
|---|
| 144 | 144 | { /* sentinel */ }, |
|---|
| 145 | 145 | }; |
|---|
| 146 | 146 | MODULE_DEVICE_TABLE(of, atmel_hlcdc_match); |
|---|