Skip to content

Commit

Permalink
Merge branch 'lpc32xx/multiplatform' into arm/soc
Browse files Browse the repository at this point in the history
I revisited some older patches here, getting two of the remaining
ARM platforms to build with ARCH_MULTIPLATFORM like most others do.

In case of lpc32xx, I created a new set of patches, which seemed
easier than digging out what I did for an older release many
years ago.

* lpc32xx/multiplatform:
  ARM: lpc32xx: allow multiplatform build
  ARM: lpc32xx: clean up header files
  serial: lpc32xx: allow compile testing
  net: lpc-enet: allow compile testing
  net: lpc-enet: fix printk format strings
  net: lpc-enet: fix badzero.cocci warnings
  net: lpc-enet: move phy setup into platform code
  net: lpc-enet: factor out iram access
  gpio: lpc32xx: allow building on non-lpc32xx targets
  serial: lpc32xx_hs: allow compile-testing
  watchdog: pnx4008_wdt: allow compile-testing
  usb: udc: lpc32xx: allow compile-testing
  usb: ohci-nxp: enable compile-testing

Signed-off-by: Arnd Bergmann <[email protected]>
  • Loading branch information
arndb committed Aug 15, 2019
2 parents 3584be9 + 75bf1bd commit d64a1fd
Show file tree
Hide file tree
Showing 27 changed files with 242 additions and 272 deletions.
17 changes: 2 additions & 15 deletions arch/arm/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -424,21 +424,6 @@ config ARCH_DOVE
help
Support for the Marvell Dove SoC 88AP510

config ARCH_LPC32XX
bool "NXP LPC32XX"
select ARM_AMBA
select CLKDEV_LOOKUP
select CLKSRC_LPC32XX
select COMMON_CLK
select CPU_ARM926T
select GENERIC_CLOCKEVENTS
select GENERIC_IRQ_MULTI_HANDLER
select GPIOLIB
select SPARSE_IRQ
select USE_OF
help
Support for the NXP LPC32XX family of processors

config ARCH_PXA
bool "PXA2xx/PXA3xx-based"
depends on MMU
Expand Down Expand Up @@ -686,6 +671,8 @@ source "arch/arm/mach-ixp4xx/Kconfig"

source "arch/arm/mach-keystone/Kconfig"

source "arch/arm/mach-lpc32xx/Kconfig"

source "arch/arm/mach-mediatek/Kconfig"

source "arch/arm/mach-meson/Kconfig"
Expand Down
2 changes: 2 additions & 0 deletions arch/arm/configs/lpc32xx_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ CONFIG_CC_OPTIMIZE_FOR_SIZE=y
CONFIG_SYSCTL_SYSCALL=y
CONFIG_EMBEDDED=y
CONFIG_SLAB=y
# CONFIG_ARCH_MULTI_V7 is not set
CONFIG_ARCH_LPC32XX=y
CONFIG_AEABI=y
CONFIG_ZBOOT_ROM_TEXT=0x0
Expand Down Expand Up @@ -93,6 +94,7 @@ CONFIG_SERIAL_HS_LPC32XX_CONSOLE=y
# CONFIG_HW_RANDOM is not set
CONFIG_I2C_CHARDEV=y
CONFIG_I2C_PNX=y
CONFIG_GPIO_LPC32XX=y
CONFIG_SPI=y
CONFIG_SPI_PL022=y
CONFIG_GPIO_SYSFS=y
Expand Down
11 changes: 11 additions & 0 deletions arch/arm/mach-lpc32xx/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# SPDX-License-Identifier: GPL-2.0-only

config ARCH_LPC32XX
bool "NXP LPC32XX"
depends on ARCH_MULTI_V5
select ARM_AMBA
select CLKSRC_LPC32XX
select CPU_ARM926T
select GPIOLIB
help
Support for the NXP LPC32XX family of processors
24 changes: 20 additions & 4 deletions arch/arm/mach-lpc32xx/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
*/

#include <linux/init.h>
#include <linux/soc/nxp/lpc32xx-misc.h>

#include <asm/mach/map.h>
#include <asm/system_info.h>

#include <mach/hardware.h>
#include <mach/platform.h>
#include "lpc32xx.h"
#include "common.h"

/*
Expand All @@ -32,7 +32,7 @@ void lpc32xx_get_uid(u32 devid[4])
*/
#define LPC32XX_IRAM_BANK_SIZE SZ_128K
static u32 iram_size;
u32 lpc32xx_return_iram_size(void)
u32 lpc32xx_return_iram(void __iomem **mapbase, dma_addr_t *dmaaddr)
{
if (iram_size == 0) {
u32 savedval1, savedval2;
Expand All @@ -53,10 +53,26 @@ u32 lpc32xx_return_iram_size(void)
} else
iram_size = LPC32XX_IRAM_BANK_SIZE * 2;
}
if (dmaaddr)
*dmaaddr = LPC32XX_IRAM_BASE;
if (mapbase)
*mapbase = io_p2v(LPC32XX_IRAM_BASE);

return iram_size;
}
EXPORT_SYMBOL_GPL(lpc32xx_return_iram_size);
EXPORT_SYMBOL_GPL(lpc32xx_return_iram);

void lpc32xx_set_phy_interface_mode(phy_interface_t mode)
{
u32 tmp = __raw_readl(LPC32XX_CLKPWR_MACCLK_CTRL);
tmp &= ~LPC32XX_CLKPWR_MACCTRL_PINS_MSK;
if (mode == PHY_INTERFACE_MODE_MII)
tmp |= LPC32XX_CLKPWR_MACCTRL_USE_MII_PINS;
else
tmp |= LPC32XX_CLKPWR_MACCTRL_USE_RMII_PINS;
__raw_writel(tmp, LPC32XX_CLKPWR_MACCLK_CTRL);
}
EXPORT_SYMBOL_GPL(lpc32xx_set_phy_interface_mode);

static struct map_desc lpc32xx_io_desc[] __initdata = {
{
Expand Down
1 change: 0 additions & 1 deletion arch/arm/mach-lpc32xx/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ extern void __init lpc32xx_serial_init(void);
*/
extern void lpc32xx_get_uid(u32 devid[4]);

extern u32 lpc32xx_return_iram_size(void);
/*
* Pointers used for sizing and copying suspend function data
*/
Expand Down
15 changes: 0 additions & 15 deletions arch/arm/mach-lpc32xx/include/mach/board.h

This file was deleted.

28 changes: 0 additions & 28 deletions arch/arm/mach-lpc32xx/include/mach/entry-macro.S

This file was deleted.

25 changes: 0 additions & 25 deletions arch/arm/mach-lpc32xx/include/mach/hardware.h

This file was deleted.

50 changes: 0 additions & 50 deletions arch/arm/mach-lpc32xx/include/mach/uncompress.h

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
* Copyright (C) 2010 NXP Semiconductors
*/

#ifndef __ASM_ARCH_PLATFORM_H
#define __ASM_ARCH_PLATFORM_H
#ifndef __ARM_LPC32XX_H
#define __ARM_LPC32XX_H

#define _SBF(f, v) ((v) << (f))
#define _BIT(n) _SBF(n, 1)
Expand Down Expand Up @@ -700,4 +700,18 @@
#define LPC32XX_USB_OTG_DEV_CLOCK_ON _BIT(1)
#define LPC32XX_USB_OTG_HOST_CLOCK_ON _BIT(0)

/*
* Start of virtual addresses for IO devices
*/
#define IO_BASE 0xF0000000

/*
* This macro relies on fact that for all HW i/o addresses bits 20-23 are 0
*/
#define IO_ADDRESS(x) IOMEM(((((x) & 0xff000000) >> 4) | ((x) & 0xfffff)) |\
IO_BASE)

#define io_p2v(x) ((void __iomem *) (unsigned long) IO_ADDRESS(x))
#define io_v2p(x) ((((x) & 0x0ff00000) << 4) | ((x) & 0x000fffff))

#endif
3 changes: 1 addition & 2 deletions arch/arm/mach-lpc32xx/pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@

#include <asm/cacheflush.h>

#include <mach/hardware.h>
#include <mach/platform.h>
#include "lpc32xx.h"
#include "common.h"

#define TEMP_IRAM_AREA IO_ADDRESS(LPC32XX_IRAM_BASE)
Expand Down
33 changes: 31 additions & 2 deletions arch/arm/mach-lpc32xx/serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
#include <linux/clk.h>
#include <linux/io.h>

#include <mach/hardware.h>
#include <mach/platform.h>
#include "lpc32xx.h"
#include "common.h"

#define LPC32XX_SUART_FIFO_SIZE 64
Expand Down Expand Up @@ -60,6 +59,36 @@ static struct uartinit uartinit_data[] __initdata = {
},
};

/* LPC3250 Errata HSUART.1: Hang workaround via loopback mode on inactivity */
void lpc32xx_loopback_set(resource_size_t mapbase, int state)
{
int bit;
u32 tmp;

switch (mapbase) {
case LPC32XX_HS_UART1_BASE:
bit = 0;
break;
case LPC32XX_HS_UART2_BASE:
bit = 1;
break;
case LPC32XX_HS_UART7_BASE:
bit = 6;
break;
default:
WARN(1, "lpc32xx_hs: Warning: Unknown port at %08x\n", mapbase);
return;
}

tmp = readl(LPC32XX_UARTCTL_CLOOP);
if (state)
tmp |= (1 << bit);
else
tmp &= ~(1 << bit);
writel(tmp, LPC32XX_UARTCTL_CLOOP);
}
EXPORT_SYMBOL_GPL(lpc32xx_loopback_set);

void __init lpc32xx_serial_init(void)
{
u32 tmp, clkmodes = 0;
Expand Down
3 changes: 1 addition & 2 deletions arch/arm/mach-lpc32xx/suspend.S
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
*/
#include <linux/linkage.h>
#include <asm/assembler.h>
#include <mach/platform.h>
#include <mach/hardware.h>
#include "lpc32xx.h"

/* Using named register defines makes the code easier to follow */
#define WORK1_REG r0
Expand Down
7 changes: 7 additions & 0 deletions drivers/gpio/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,13 @@ config GPIO_LPC18XX
Select this option to enable GPIO driver for
NXP LPC18XX/43XX devices.

config GPIO_LPC32XX
tristate "NXP LPC32XX GPIO support"
depends on OF_GPIO && (ARCH_LPC32XX || COMPILE_TEST)
help
Select this option to enable GPIO driver for
NXP LPC32XX devices.

config GPIO_LYNXPOINT
tristate "Intel Lynxpoint GPIO support"
depends on ACPI && X86
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ obj-$(CONFIG_GPIO_LP3943) += gpio-lp3943.o
obj-$(CONFIG_GPIO_LP873X) += gpio-lp873x.o
obj-$(CONFIG_GPIO_LP87565) += gpio-lp87565.o
obj-$(CONFIG_GPIO_LPC18XX) += gpio-lpc18xx.o
obj-$(CONFIG_ARCH_LPC32XX) += gpio-lpc32xx.o
obj-$(CONFIG_GPIO_LPC32XX) += gpio-lpc32xx.o
obj-$(CONFIG_GPIO_LYNXPOINT) += gpio-lynxpoint.o
obj-$(CONFIG_GPIO_MADERA) += gpio-madera.o
obj-$(CONFIG_GPIO_MAX3191X) += gpio-max3191x.o
Expand Down
Loading

0 comments on commit d64a1fd

Please sign in to comment.