| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * arch/arm/mach-lpc32xx/common.c |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Author: Kevin Wells <kevin.wells@nxp.com> |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * 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. |
|---|
| 17 | 8 | */ |
|---|
| 18 | 9 | |
|---|
| 19 | 10 | #include <linux/init.h> |
|---|
| 11 | +#include <linux/soc/nxp/lpc32xx-misc.h> |
|---|
| 20 | 12 | |
|---|
| 21 | 13 | #include <asm/mach/map.h> |
|---|
| 22 | 14 | #include <asm/system_info.h> |
|---|
| 23 | 15 | |
|---|
| 24 | | -#include <mach/hardware.h> |
|---|
| 25 | | -#include <mach/platform.h> |
|---|
| 16 | +#include "lpc32xx.h" |
|---|
| 26 | 17 | #include "common.h" |
|---|
| 27 | 18 | |
|---|
| 28 | 19 | /* |
|---|
| .. | .. |
|---|
| 41 | 32 | */ |
|---|
| 42 | 33 | #define LPC32XX_IRAM_BANK_SIZE SZ_128K |
|---|
| 43 | 34 | static u32 iram_size; |
|---|
| 44 | | -u32 lpc32xx_return_iram_size(void) |
|---|
| 35 | +u32 lpc32xx_return_iram(void __iomem **mapbase, dma_addr_t *dmaaddr) |
|---|
| 45 | 36 | { |
|---|
| 46 | 37 | if (iram_size == 0) { |
|---|
| 47 | 38 | u32 savedval1, savedval2; |
|---|
| .. | .. |
|---|
| 62 | 53 | } else |
|---|
| 63 | 54 | iram_size = LPC32XX_IRAM_BANK_SIZE * 2; |
|---|
| 64 | 55 | } |
|---|
| 56 | + if (dmaaddr) |
|---|
| 57 | + *dmaaddr = LPC32XX_IRAM_BASE; |
|---|
| 58 | + if (mapbase) |
|---|
| 59 | + *mapbase = io_p2v(LPC32XX_IRAM_BASE); |
|---|
| 65 | 60 | |
|---|
| 66 | 61 | return iram_size; |
|---|
| 67 | 62 | } |
|---|
| 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); |
|---|
| 69 | 76 | |
|---|
| 70 | 77 | static struct map_desc lpc32xx_io_desc[] __initdata = { |
|---|
| 71 | 78 | { |
|---|