| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * MX31 CPU type detection |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (c) 2009 Daniel Mack <daniel@caiaq.de> |
|---|
| 5 | | - * |
|---|
| 6 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 7 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 8 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 9 | | - * (at your option) any later version. |
|---|
| 10 | 6 | */ |
|---|
| 11 | 7 | |
|---|
| 12 | 8 | #include <linux/module.h> |
|---|
| 9 | +#include <linux/of_address.h> |
|---|
| 13 | 10 | #include <linux/io.h> |
|---|
| 14 | 11 | |
|---|
| 15 | 12 | #include "common.h" |
|---|
| .. | .. |
|---|
| 36 | 33 | |
|---|
| 37 | 34 | static int mx31_read_cpu_rev(void) |
|---|
| 38 | 35 | { |
|---|
| 36 | + void __iomem *iim_base; |
|---|
| 37 | + struct device_node *np; |
|---|
| 39 | 38 | u32 i, srev; |
|---|
| 40 | 39 | |
|---|
| 40 | + np = of_find_compatible_node(NULL, NULL, "fsl,imx31-iim"); |
|---|
| 41 | + iim_base = of_iomap(np, 0); |
|---|
| 42 | + BUG_ON(!iim_base); |
|---|
| 43 | + |
|---|
| 41 | 44 | /* read SREV register from IIM module */ |
|---|
| 42 | | - srev = imx_readl(MX31_IO_ADDRESS(MX31_IIM_BASE_ADDR + MXC_IIMSREV)); |
|---|
| 45 | + srev = imx_readl(iim_base + MXC_IIMSREV); |
|---|
| 43 | 46 | srev &= 0xff; |
|---|
| 44 | 47 | |
|---|
| 45 | 48 | for (i = 0; i < ARRAY_SIZE(mx31_cpu_type); i++) |
|---|