hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/arch/arm/mach-lpc32xx/common.c
....@@ -1,28 +1,19 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * arch/arm/mach-lpc32xx/common.c
34 *
45 * Author: Kevin Wells <kevin.wells@nxp.com>
56 *
67 * Copyright (C) 2010 NXP Semiconductors
7
- *
8
- * This program is free software; you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License as published by
10
- * the Free Software Foundation; either version 2 of the License, or
11
- * (at your option) any later version.
12
- *
13
- * This program is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
- * GNU General Public License for more details.
178 */
189
1910 #include <linux/init.h>
11
+#include <linux/soc/nxp/lpc32xx-misc.h>
2012
2113 #include <asm/mach/map.h>
2214 #include <asm/system_info.h>
2315
24
-#include <mach/hardware.h>
25
-#include <mach/platform.h>
16
+#include "lpc32xx.h"
2617 #include "common.h"
2718
2819 /*
....@@ -41,7 +32,7 @@
4132 */
4233 #define LPC32XX_IRAM_BANK_SIZE SZ_128K
4334 static u32 iram_size;
44
-u32 lpc32xx_return_iram_size(void)
35
+u32 lpc32xx_return_iram(void __iomem **mapbase, dma_addr_t *dmaaddr)
4536 {
4637 if (iram_size == 0) {
4738 u32 savedval1, savedval2;
....@@ -62,10 +53,26 @@
6253 } else
6354 iram_size = LPC32XX_IRAM_BANK_SIZE * 2;
6455 }
56
+ if (dmaaddr)
57
+ *dmaaddr = LPC32XX_IRAM_BASE;
58
+ if (mapbase)
59
+ *mapbase = io_p2v(LPC32XX_IRAM_BASE);
6560
6661 return iram_size;
6762 }
68
-EXPORT_SYMBOL_GPL(lpc32xx_return_iram_size);
63
+EXPORT_SYMBOL_GPL(lpc32xx_return_iram);
64
+
65
+void lpc32xx_set_phy_interface_mode(phy_interface_t mode)
66
+{
67
+ u32 tmp = __raw_readl(LPC32XX_CLKPWR_MACCLK_CTRL);
68
+ tmp &= ~LPC32XX_CLKPWR_MACCTRL_PINS_MSK;
69
+ if (mode == PHY_INTERFACE_MODE_MII)
70
+ tmp |= LPC32XX_CLKPWR_MACCTRL_USE_MII_PINS;
71
+ else
72
+ tmp |= LPC32XX_CLKPWR_MACCTRL_USE_RMII_PINS;
73
+ __raw_writel(tmp, LPC32XX_CLKPWR_MACCLK_CTRL);
74
+}
75
+EXPORT_SYMBOL_GPL(lpc32xx_set_phy_interface_mode);
6976
7077 static struct map_desc lpc32xx_io_desc[] __initdata = {
7178 {