History

Merge branch 'lpc32xx/multiplatform' into arm/soc

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

Arnd Bergmann committed 7 years ago

Commit d64a1fd2 parents 3584be9 75bf1bd27 files · +242 −272Browse files

Unified · Split

27 files
  1. arch/arm/Kconfig +2 −15
  2. arch/arm/configs/lpc32xx_defconfig +2 −0
  3. arch/arm/mach-lpc32xx/Kconfig +11 −0
  4. arch/arm/mach-lpc32xx/common.c +20 −4
  5. arch/arm/mach-lpc32xx/common.h +0 −1
  6. arch/arm/mach-lpc32xx/include/mach/board.h +0 −15
  7. arch/arm/mach-lpc32xx/include/mach/entry-macro.S +0 −28
  8. arch/arm/mach-lpc32xx/include/mach/hardware.h +0 −25
  9. arch/arm/mach-lpc32xx/include/mach/uncompress.h +0 −50
  10. arch/arm/mach-lpc32xx/lpc32xx.h +16 −2
  11. arch/arm/mach-lpc32xx/pm.c +1 −2
  12. arch/arm/mach-lpc32xx/serial.c +31 −2
  13. arch/arm/mach-lpc32xx/suspend.S +1 −2
  14. drivers/gpio/Kconfig +7 −0
  15. drivers/gpio/Makefile +1 −1
  16. drivers/gpio/gpio-lpc32xx.c +68 −50
  17. drivers/net/ethernet/nxp/Kconfig +1 −1
  18. drivers/net/ethernet/nxp/lpc_eth.c +18 −27
  19. drivers/tty/serial/Kconfig +2 −1
  20. drivers/tty/serial/lpc32xx_hs.c +4 −33
  21. drivers/usb/gadget/udc/Kconfig +2 −1
  22. drivers/usb/gadget/udc/lpc32xx_udc.c +1 −2
  23. drivers/usb/host/Kconfig +2 −1
  24. drivers/usb/host/ohci-nxp.c +18 −7
  25. drivers/watchdog/Kconfig +1 −1
  26. drivers/watchdog/pnx4008_wdt.c +0 −1
  27. include/linux/soc/nxp/lpc32xx-misc.h +33 −0
arch/arm/Kconfig+2−15
@@ -424,21 +424,6 @@ config ARCH_DOVE · 423 unmodified lines
424424 help
425425 Support for the Marvell Dove SoC 88AP510
426426
427−config ARCH_LPC32XX
428− bool "NXP LPC32XX"
429− select ARM_AMBA
430− select CLKDEV_LOOKUP
431− select CLKSRC_LPC32XX
432− select COMMON_CLK
433− select CPU_ARM926T
434− select GENERIC_CLOCKEVENTS
435− select GENERIC_IRQ_MULTI_HANDLER
436− select GPIOLIB
437− select SPARSE_IRQ
438− select USE_OF
439− help
440− Support for the NXP LPC32XX family of processors
441−
442427 config ARCH_PXA
443428 bool "PXA2xx/PXA3xx-based"
444429 depends on MMU
@@ -686,6 +671,8 @@ source "arch/arm/mach-ixp4xx/Kconfig" · 241 unmodified lines
686671
687672 source "arch/arm/mach-keystone/Kconfig"
688673
674+source "arch/arm/mach-lpc32xx/Kconfig"
675+
689676 source "arch/arm/mach-mediatek/Kconfig"
690677
691678 source "arch/arm/mach-meson/Kconfig"
arch/arm/configs/lpc32xx_defconfig+2−0
@@ -12,6 +12,7 @@ CONFIG_CC_OPTIMIZE_FOR_SIZE=y · 11 unmodified lines
1212 CONFIG_SYSCTL_SYSCALL=y
1313 CONFIG_EMBEDDED=y
1414 CONFIG_SLAB=y
15+# CONFIG_ARCH_MULTI_V7 is not set
1516 CONFIG_ARCH_LPC32XX=y
1617 CONFIG_AEABI=y
1718 CONFIG_ZBOOT_ROM_TEXT=0x0
@@ -93,6 +94,7 @@ CONFIG_SERIAL_HS_LPC32XX_CONSOLE=y · 75 unmodified lines
9394 # CONFIG_HW_RANDOM is not set
9495 CONFIG_I2C_CHARDEV=y
9596 CONFIG_I2C_PNX=y
97+CONFIG_GPIO_LPC32XX=y
9698 CONFIG_SPI=y
9799 CONFIG_SPI_PL022=y
98100 CONFIG_GPIO_SYSFS=y
arch/arm/mach-lpc32xx/Kconfig+11−0
@@ -0,0 +1,11 @@
1+# SPDX-License-Identifier: GPL-2.0-only
2+
3+config ARCH_LPC32XX
4+ bool "NXP LPC32XX"
5+ depends on ARCH_MULTI_V5
6+ select ARM_AMBA
7+ select CLKSRC_LPC32XX
8+ select CPU_ARM926T
9+ select GPIOLIB
10+ help
11+ Support for the NXP LPC32XX family of processors
arch/arm/mach-lpc32xx/common.c+20−4
@@ -8,12 +8,12 @@ · 7 unmodified lines
88 */
99
1010 #include <linux/init.h>
11+#include <linux/soc/nxp/lpc32xx-misc.h>
1112
1213 #include <asm/mach/map.h>
1314 #include <asm/system_info.h>
1415
15−#include <mach/hardware.h>
16−#include <mach/platform.h>
16+#include "lpc32xx.h"
1717 #include "common.h"
1818
1919 /*
@@ -32,7 +32,7 @@ void lpc32xx_get_uid(u32 devid[4]) · 12 unmodified lines
3232 */
3333 #define LPC32XX_IRAM_BANK_SIZE SZ_128K
3434 static u32 iram_size;
35−u32 lpc32xx_return_iram_size(void)
35+u32 lpc32xx_return_iram(void __iomem **mapbase, dma_addr_t *dmaaddr)
3636 {
3737 if (iram_size == 0) {
3838 u32 savedval1, savedval2;
@@ -53,10 +53,26 @@ u32 lpc32xx_return_iram_size(void) · 14 unmodified lines
5353 } else
5454 iram_size = LPC32XX_IRAM_BANK_SIZE * 2;
5555 }
56+ if (dmaaddr)
57+ *dmaaddr = LPC32XX_IRAM_BASE;
58+ if (mapbase)
59+ *mapbase = io_p2v(LPC32XX_IRAM_BASE);
5660
5761 return iram_size;
5862 }
59−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);
6076
6177 static struct map_desc lpc32xx_io_desc[] __initdata = {
6278 {
arch/arm/mach-lpc32xx/common.h+0−1
@@ -23,7 +23,6 @@ extern void __init lpc32xx_serial_init(void); · 22 unmodified lines
2323 */
2424 extern void lpc32xx_get_uid(u32 devid[4]);
2525
26−extern u32 lpc32xx_return_iram_size(void);
2726 /*
2827 * Pointers used for sizing and copying suspend function data
2928 */
arch/arm/mach-lpc32xx/include/mach/board.h+0−15
@@ -1,15 +0,0 @@
1−/* SPDX-License-Identifier: GPL-2.0-or-later */
2−/*
3− * arm/arch/mach-lpc32xx/include/mach/board.h
4− *
5− * Author: Kevin Wells <kevin.wells@nxp.com>
6− *
7− * Copyright (C) 2010 NXP Semiconductors
8− */
9−
10−#ifndef __ASM_ARCH_BOARD_H
11−#define __ASM_ARCH_BOARD_H
12−
13−extern u32 lpc32xx_return_iram_size(void);
14−
15−#endif /* __ASM_ARCH_BOARD_H */
arch/arm/mach-lpc32xx/include/mach/entry-macro.S+0−28
@@ -1,28 +0,0 @@
1−/* SPDX-License-Identifier: GPL-2.0-or-later */
2−/*
3− * arch/arm/mach-lpc32xx/include/mach/entry-macro.S
4− *
5− * Author: Kevin Wells <kevin.wells@nxp.com>
6− *
7− * Copyright (C) 2010 NXP Semiconductors
8− */
9−
10−#include <mach/hardware.h>
11−#include <mach/platform.h>
12−
13−#define LPC32XX_INTC_MASKED_STATUS_OFS 0x8
14−
15− .macro get_irqnr_preamble, base, tmp
16− ldr \base, =IO_ADDRESS(LPC32XX_MIC_BASE)
17− .endm
18−
19−/*
20− * Return IRQ number in irqnr. Also return processor Z flag status in CPSR
21− * as set if an interrupt is pending.
22− */
23− .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
24− ldr \irqstat, [\base, #LPC32XX_INTC_MASKED_STATUS_OFS]
25− clz \irqnr, \irqstat
26− rsb \irqnr, \irqnr, #31
27− teq \irqstat, #0
28− .endm
arch/arm/mach-lpc32xx/include/mach/hardware.h+0−25
@@ -1,25 +0,0 @@
1−/* SPDX-License-Identifier: GPL-2.0-or-later */
2−/*
3− * arch/arm/mach-lpc32xx/include/mach/hardware.h
4− *
5− * Copyright (c) 2005 MontaVista Software, Inc. <source@mvista.com>
6− */
7−
8−#ifndef __ASM_ARCH_HARDWARE_H
9−#define __ASM_ARCH_HARDWARE_H
10−
11−/*
12− * Start of virtual addresses for IO devices
13− */
14−#define IO_BASE 0xF0000000
15−
16−/*
17− * This macro relies on fact that for all HW i/o addresses bits 20-23 are 0
18− */
19−#define IO_ADDRESS(x) IOMEM(((((x) & 0xff000000) >> 4) | ((x) & 0xfffff)) |\
20− IO_BASE)
21−
22−#define io_p2v(x) ((void __iomem *) (unsigned long) IO_ADDRESS(x))
23−#define io_v2p(x) ((((x) & 0x0ff00000) << 4) | ((x) & 0x000fffff))
24−
25−#endif
arch/arm/mach-lpc32xx/include/mach/uncompress.h+0−50
@@ -1,50 +0,0 @@
1−/* SPDX-License-Identifier: GPL-2.0-or-later */
2−/*
3− * arch/arm/mach-lpc32xx/include/mach/uncompress.h
4− *
5− * Author: Kevin Wells <kevin.wells@nxp.com>
6− *
7− * Copyright (C) 2010 NXP Semiconductors
8− */
9−
10−#ifndef __ASM_ARM_ARCH_UNCOMPRESS_H
11−#define __ASM_ARM_ARCH_UNCOMPRESS_H
12−
13−#include <linux/io.h>
14−
15−#include <mach/hardware.h>
16−#include <mach/platform.h>
17−
18−/*
19− * Uncompress output is hardcoded to standard UART 5
20− */
21−
22−#define UART_FIFO_CTL_TX_RESET (1 << 2)
23−#define UART_STATUS_TX_MT (1 << 6)
24−
25−#define _UARTREG(x) (void __iomem *)(LPC32XX_UART5_BASE + (x))
26−
27−#define LPC32XX_UART_DLLFIFO_O 0x00
28−#define LPC32XX_UART_IIRFCR_O 0x08
29−#define LPC32XX_UART_LSR_O 0x14
30−
31−static inline void putc(int ch)
32−{
33− /* Wait for transmit FIFO to empty */
34− while ((__raw_readl(_UARTREG(LPC32XX_UART_LSR_O)) &
35− UART_STATUS_TX_MT) == 0)
36− ;
37−
38− __raw_writel((u32) ch, _UARTREG(LPC32XX_UART_DLLFIFO_O));
39−}
40−
41−static inline void flush(void)
42−{
43− __raw_writel(__raw_readl(_UARTREG(LPC32XX_UART_IIRFCR_O)) |
44− UART_FIFO_CTL_TX_RESET, _UARTREG(LPC32XX_UART_IIRFCR_O));
45−}
46−
47−/* NULL functions; we don't presently need them */
48−#define arch_decomp_setup()
49−
50−#endif
arch/arm/mach-lpc32xx/lpc32xx.hrenamed from arch/arm/mach-lpc32xx/include/mach/platform.h+16−2
@@ -7,8 +7,8 @@ · 6 unmodified lines
77 * Copyright (C) 2010 NXP Semiconductors
88 */
99
10−#ifndef __ASM_ARCH_PLATFORM_H
11−#define __ASM_ARCH_PLATFORM_H
10+#ifndef __ARM_LPC32XX_H
11+#define __ARM_LPC32XX_H
1212
1313 #define _SBF(f, v) ((v) << (f))
1414 #define _BIT(n) _SBF(n, 1)
@@ -700,4 +700,18 @@ · 685 unmodified lines
700700 #define LPC32XX_USB_OTG_DEV_CLOCK_ON _BIT(1)
701701 #define LPC32XX_USB_OTG_HOST_CLOCK_ON _BIT(0)
702702
703+/*
704+ * Start of virtual addresses for IO devices
705+ */
706+#define IO_BASE 0xF0000000
707+
708+/*
709+ * This macro relies on fact that for all HW i/o addresses bits 20-23 are 0
710+ */
711+#define IO_ADDRESS(x) IOMEM(((((x) & 0xff000000) >> 4) | ((x) & 0xfffff)) |\
712+ IO_BASE)
713+
714+#define io_p2v(x) ((void __iomem *) (unsigned long) IO_ADDRESS(x))
715+#define io_v2p(x) ((((x) & 0x0ff00000) << 4) | ((x) & 0x000fffff))
716+
703717 #endif
arch/arm/mach-lpc32xx/pm.c+1−2
@@ -70,8 +70,7 @@ · 69 unmodified lines
7070
7171 #include <asm/cacheflush.h>
7272
73−#include <mach/hardware.h>
74−#include <mach/platform.h>
73+#include "lpc32xx.h"
7574 #include "common.h"
7675
7776 #define TEMP_IRAM_AREA IO_ADDRESS(LPC32XX_IRAM_BASE)
arch/arm/mach-lpc32xx/serial.c+31−2
@@ -16,8 +16,7 @@ · 15 unmodified lines
1616 #include <linux/clk.h>
1717 #include <linux/io.h>
1818
19−#include <mach/hardware.h>
20−#include <mach/platform.h>
19+#include "lpc32xx.h"
2120 #include "common.h"
2221
2322 #define LPC32XX_SUART_FIFO_SIZE 64
@@ -60,6 +59,36 @@ static struct uartinit uartinit_data[] __initdata = { · 36 unmodified lines
6059 },
6160 };
6261
62+/* LPC3250 Errata HSUART.1: Hang workaround via loopback mode on inactivity */
63+void lpc32xx_loopback_set(resource_size_t mapbase, int state)
64+{
65+ int bit;
66+ u32 tmp;
67+
68+ switch (mapbase) {
69+ case LPC32XX_HS_UART1_BASE:
70+ bit = 0;
71+ break;
72+ case LPC32XX_HS_UART2_BASE:
73+ bit = 1;
74+ break;
75+ case LPC32XX_HS_UART7_BASE:
76+ bit = 6;
77+ break;
78+ default:
79+ WARN(1, "lpc32xx_hs: Warning: Unknown port at %08x\n", mapbase);
80+ return;
81+ }
82+
83+ tmp = readl(LPC32XX_UARTCTL_CLOOP);
84+ if (state)
85+ tmp |= (1 << bit);
86+ else
87+ tmp &= ~(1 << bit);
88+ writel(tmp, LPC32XX_UARTCTL_CLOOP);
89+}
90+EXPORT_SYMBOL_GPL(lpc32xx_loopback_set);
91+
6392 void __init lpc32xx_serial_init(void)
6493 {
6594 u32 tmp, clkmodes = 0;
arch/arm/mach-lpc32xx/suspend.S+1−2
@@ -11,8 +11,7 @@ · 10 unmodified lines
1111 */
1212 #include <linux/linkage.h>
1313 #include <asm/assembler.h>
14−#include <mach/platform.h>
15−#include <mach/hardware.h>
14+#include "lpc32xx.h"
1615
1716 /* Using named register defines makes the code easier to follow */
1817 #define WORK1_REG r0
drivers/gpio/Kconfig+7−0
@@ -311,6 +311,13 @@ config GPIO_LPC18XX · 310 unmodified lines
311311 Select this option to enable GPIO driver for
312312 NXP LPC18XX/43XX devices.
313313
314+config GPIO_LPC32XX
315+ tristate "NXP LPC32XX GPIO support"
316+ depends on OF_GPIO && (ARCH_LPC32XX || COMPILE_TEST)
317+ help
318+ Select this option to enable GPIO driver for
319+ NXP LPC32XX devices.
320+
314321 config GPIO_LYNXPOINT
315322 tristate "Intel Lynxpoint GPIO support"
316323 depends on ACPI && X86
drivers/gpio/Makefile+1−1
@@ -74,7 +74,7 @@ obj-$(CONFIG_GPIO_LP3943) += gpio-lp3943.o · 73 unmodified lines
7474 obj-$(CONFIG_GPIO_LP873X) += gpio-lp873x.o
7575 obj-$(CONFIG_GPIO_LP87565) += gpio-lp87565.o
7676 obj-$(CONFIG_GPIO_LPC18XX) += gpio-lpc18xx.o
77−obj-$(CONFIG_ARCH_LPC32XX) += gpio-lpc32xx.o
77+obj-$(CONFIG_GPIO_LPC32XX) += gpio-lpc32xx.o
7878 obj-$(CONFIG_GPIO_LYNXPOINT) += gpio-lynxpoint.o
7979 obj-$(CONFIG_GPIO_MADERA) += gpio-madera.o
8080 obj-$(CONFIG_GPIO_MAX3191X) += gpio-max3191x.o
drivers/gpio/gpio-lpc32xx.c+68−50
@@ -16,36 +16,33 @@ · 15 unmodified lines
1616 #include <linux/platform_device.h>
1717 #include <linux/module.h>
1818
19−#include <mach/hardware.h>
20−#include <mach/platform.h>
21−
22−#define LPC32XX_GPIO_P3_INP_STATE _GPREG(0x000)
23−#define LPC32XX_GPIO_P3_OUTP_SET _GPREG(0x004)
24−#define LPC32XX_GPIO_P3_OUTP_CLR _GPREG(0x008)
25−#define LPC32XX_GPIO_P3_OUTP_STATE _GPREG(0x00C)
26−#define LPC32XX_GPIO_P2_DIR_SET _GPREG(0x010)
27−#define LPC32XX_GPIO_P2_DIR_CLR _GPREG(0x014)
28−#define LPC32XX_GPIO_P2_DIR_STATE _GPREG(0x018)
29−#define LPC32XX_GPIO_P2_INP_STATE _GPREG(0x01C)
30−#define LPC32XX_GPIO_P2_OUTP_SET _GPREG(0x020)
31−#define LPC32XX_GPIO_P2_OUTP_CLR _GPREG(0x024)
32−#define LPC32XX_GPIO_P2_MUX_SET _GPREG(0x028)
33−#define LPC32XX_GPIO_P2_MUX_CLR _GPREG(0x02C)
34−#define LPC32XX_GPIO_P2_MUX_STATE _GPREG(0x030)
35−#define LPC32XX_GPIO_P0_INP_STATE _GPREG(0x040)
36−#define LPC32XX_GPIO_P0_OUTP_SET _GPREG(0x044)
37−#define LPC32XX_GPIO_P0_OUTP_CLR _GPREG(0x048)
38−#define LPC32XX_GPIO_P0_OUTP_STATE _GPREG(0x04C)
39−#define LPC32XX_GPIO_P0_DIR_SET _GPREG(0x050)
40−#define LPC32XX_GPIO_P0_DIR_CLR _GPREG(0x054)
41−#define LPC32XX_GPIO_P0_DIR_STATE _GPREG(0x058)
42−#define LPC32XX_GPIO_P1_INP_STATE _GPREG(0x060)
43−#define LPC32XX_GPIO_P1_OUTP_SET _GPREG(0x064)
44−#define LPC32XX_GPIO_P1_OUTP_CLR _GPREG(0x068)
45−#define LPC32XX_GPIO_P1_OUTP_STATE _GPREG(0x06C)
46−#define LPC32XX_GPIO_P1_DIR_SET _GPREG(0x070)
47−#define LPC32XX_GPIO_P1_DIR_CLR _GPREG(0x074)
48−#define LPC32XX_GPIO_P1_DIR_STATE _GPREG(0x078)
19+#define LPC32XX_GPIO_P3_INP_STATE (0x000)
20+#define LPC32XX_GPIO_P3_OUTP_SET (0x004)
21+#define LPC32XX_GPIO_P3_OUTP_CLR (0x008)
22+#define LPC32XX_GPIO_P3_OUTP_STATE (0x00C)
23+#define LPC32XX_GPIO_P2_DIR_SET (0x010)
24+#define LPC32XX_GPIO_P2_DIR_CLR (0x014)
25+#define LPC32XX_GPIO_P2_DIR_STATE (0x018)
26+#define LPC32XX_GPIO_P2_INP_STATE (0x01C)
27+#define LPC32XX_GPIO_P2_OUTP_SET (0x020)
28+#define LPC32XX_GPIO_P2_OUTP_CLR (0x024)
29+#define LPC32XX_GPIO_P2_MUX_SET (0x028)
30+#define LPC32XX_GPIO_P2_MUX_CLR (0x02C)
31+#define LPC32XX_GPIO_P2_MUX_STATE (0x030)
32+#define LPC32XX_GPIO_P0_INP_STATE (0x040)
33+#define LPC32XX_GPIO_P0_OUTP_SET (0x044)
34+#define LPC32XX_GPIO_P0_OUTP_CLR (0x048)
35+#define LPC32XX_GPIO_P0_OUTP_STATE (0x04C)
36+#define LPC32XX_GPIO_P0_DIR_SET (0x050)
37+#define LPC32XX_GPIO_P0_DIR_CLR (0x054)
38+#define LPC32XX_GPIO_P0_DIR_STATE (0x058)
39+#define LPC32XX_GPIO_P1_INP_STATE (0x060)
40+#define LPC32XX_GPIO_P1_OUTP_SET (0x064)
41+#define LPC32XX_GPIO_P1_OUTP_CLR (0x068)
42+#define LPC32XX_GPIO_P1_OUTP_STATE (0x06C)
43+#define LPC32XX_GPIO_P1_DIR_SET (0x070)
44+#define LPC32XX_GPIO_P1_DIR_CLR (0x074)
45+#define LPC32XX_GPIO_P1_DIR_STATE (0x078)
4946
5047 #define GPIO012_PIN_TO_BIT(x) (1 << (x))
5148 #define GPIO3_PIN_TO_BIT(x) (1 << ((x) + 25))
@@ -72,12 +69,12 @@ · 20 unmodified lines
7269 #define LPC32XX_GPO_P3_GRP (LPC32XX_GPI_P3_GRP + LPC32XX_GPI_P3_MAX)
7370
7471 struct gpio_regs {
75− void __iomem *inp_state;
76− void __iomem *outp_state;
77− void __iomem *outp_set;
78− void __iomem *outp_clr;
79− void __iomem *dir_set;
80− void __iomem *dir_clr;
72+ unsigned long inp_state;
73+ unsigned long outp_state;
74+ unsigned long outp_set;
75+ unsigned long outp_clr;
76+ unsigned long dir_set;
77+ unsigned long dir_clr;
8178 };
8279
8380 /*
@@ -165,16 +162,27 @@ static struct gpio_regs gpio_grp_regs_p3 = { · 81 unmodified lines
165162 struct lpc32xx_gpio_chip {
166163 struct gpio_chip chip;
167164 struct gpio_regs *gpio_grp;
165+ void __iomem *reg_base;
168166 };
169167
168+static inline u32 gpreg_read(struct lpc32xx_gpio_chip *group, unsigned long offset)
169+{
170+ return __raw_readl(group->reg_base + offset);
171+}
172+
173+static inline void gpreg_write(struct lpc32xx_gpio_chip *group, u32 val, unsigned long offset)
174+{
175+ __raw_writel(val, group->reg_base + offset);
176+}
177+
170178 static void __set_gpio_dir_p012(struct lpc32xx_gpio_chip *group,
171179 unsigned pin, int input)
172180 {
173181 if (input)
174− __raw_writel(GPIO012_PIN_TO_BIT(pin),
182+ gpreg_write(group, GPIO012_PIN_TO_BIT(pin),
175183 group->gpio_grp->dir_clr);
176184 else
177− __raw_writel(GPIO012_PIN_TO_BIT(pin),
185+ gpreg_write(group, GPIO012_PIN_TO_BIT(pin),
178186 group->gpio_grp->dir_set);
179187 }
180188
@@ -184,19 +192,19 @@ static void __set_gpio_dir_p3(struct lpc32xx_gpio_chip *group, · 3 unmodified lines
184192 u32 u = GPIO3_PIN_TO_BIT(pin);
185193
186194 if (input)
187− __raw_writel(u, group->gpio_grp->dir_clr);
195+ gpreg_write(group, u, group->gpio_grp->dir_clr);
188196 else
189− __raw_writel(u, group->gpio_grp->dir_set);
197+ gpreg_write(group, u, group->gpio_grp->dir_set);
190198 }
191199
192200 static void __set_gpio_level_p012(struct lpc32xx_gpio_chip *group,
193201 unsigned pin, int high)
194202 {
195203 if (high)
196− __raw_writel(GPIO012_PIN_TO_BIT(pin),
204+ gpreg_write(group, GPIO012_PIN_TO_BIT(pin),
197205 group->gpio_grp->outp_set);
198206 else
199− __raw_writel(GPIO012_PIN_TO_BIT(pin),
207+ gpreg_write(group, GPIO012_PIN_TO_BIT(pin),
200208 group->gpio_grp->outp_clr);
201209 }
202210
@@ -206,31 +214,31 @@ static void __set_gpio_level_p3(struct lpc32xx_gpio_chip *group, · 3 unmodified lines
206214 u32 u = GPIO3_PIN_TO_BIT(pin);
207215
208216 if (high)
209− __raw_writel(u, group->gpio_grp->outp_set);
217+ gpreg_write(group, u, group->gpio_grp->outp_set);
210218 else
211− __raw_writel(u, group->gpio_grp->outp_clr);
219+ gpreg_write(group, u, group->gpio_grp->outp_clr);
212220 }
213221
214222 static void __set_gpo_level_p3(struct lpc32xx_gpio_chip *group,
215223 unsigned pin, int high)
216224 {
217225 if (high)
218− __raw_writel(GPO3_PIN_TO_BIT(pin), group->gpio_grp->outp_set);
226+ gpreg_write(group, GPO3_PIN_TO_BIT(pin), group->gpio_grp->outp_set);
219227 else
220− __raw_writel(GPO3_PIN_TO_BIT(pin), group->gpio_grp->outp_clr);
228+ gpreg_write(group, GPO3_PIN_TO_BIT(pin), group->gpio_grp->outp_clr);
221229 }
222230
223231 static int __get_gpio_state_p012(struct lpc32xx_gpio_chip *group,
224232 unsigned pin)
225233 {
226− return GPIO012_PIN_IN_SEL(__raw_readl(group->gpio_grp->inp_state),
234+ return GPIO012_PIN_IN_SEL(gpreg_read(group, group->gpio_grp->inp_state),
227235 pin);
228236 }
229237
230238 static int __get_gpio_state_p3(struct lpc32xx_gpio_chip *group,
231239 unsigned pin)
232240 {
233− int state = __raw_readl(group->gpio_grp->inp_state);
241+ int state = gpreg_read(group, group->gpio_grp->inp_state);
234242
235243 /*
236244 * P3 GPIO pin input mapping is not contiguous, GPIOP3-0..4 is mapped
@@ -242,13 +250,13 @@ static int __get_gpio_state_p3(struct lpc32xx_gpio_chip *group, · 5 unmodified lines
242250 static int __get_gpi_state_p3(struct lpc32xx_gpio_chip *group,
243251 unsigned pin)
244252 {
245− return GPI3_PIN_IN_SEL(__raw_readl(group->gpio_grp->inp_state), pin);
253+ return GPI3_PIN_IN_SEL(gpreg_read(group, group->gpio_grp->inp_state), pin);
246254 }
247255
248256 static int __get_gpo_state_p3(struct lpc32xx_gpio_chip *group,
249257 unsigned pin)
250258 {
251− return GPO3_PIN_IN_SEL(__raw_readl(group->gpio_grp->outp_state), pin);
259+ return GPO3_PIN_IN_SEL(gpreg_read(group, group->gpio_grp->outp_state), pin);
252260 }
253261
254262 /*
@@ -497,12 +505,18 @@ static int lpc32xx_of_xlate(struct gpio_chip *gc, · 242 unmodified lines
497505 static int lpc32xx_gpio_probe(struct platform_device *pdev)
498506 {
499507 int i;
508+ void __iomem *reg_base;
509+
510+ reg_base = devm_platform_ioremap_resource(pdev, 0);
511+ if (IS_ERR(reg_base))
512+ return PTR_ERR(reg_base);
500513
501514 for (i = 0; i < ARRAY_SIZE(lpc32xx_gpiochip); i++) {
502515 if (pdev->dev.of_node) {
503516 lpc32xx_gpiochip[i].chip.of_xlate = lpc32xx_of_xlate;
504517 lpc32xx_gpiochip[i].chip.of_gpio_n_cells = 3;
505518 lpc32xx_gpiochip[i].chip.of_node = pdev->dev.of_node;
519+ lpc32xx_gpiochip[i].reg_base = reg_base;
506520 }
507521 devm_gpiochip_add_data(&pdev->dev, &lpc32xx_gpiochip[i].chip,
508522 &lpc32xx_gpiochip[i]);
@@ -527,3 +541,7 @@ static struct platform_driver lpc32xx_gpio_driver = { · 18 unmodified lines
527541 };
528542
529543 module_platform_driver(lpc32xx_gpio_driver);
544+
545+MODULE_AUTHOR("Kevin Wells <kevin.wells@nxp.com>");
546+MODULE_LICENSE("GPL");
547+MODULE_DESCRIPTION("GPIO driver for LPC32xx SoC");
drivers/net/ethernet/nxp/Kconfig+1−1
@@ -1,7 +1,7 @@
11 # SPDX-License-Identifier: GPL-2.0-only
22 config LPC_ENET
33 tristate "NXP ethernet MAC on LPC devices"
4− depends on ARCH_LPC32XX
4+ depends on ARCH_LPC32XX || COMPILE_TEST
55 select PHYLIB
66 help
77 Say Y or M here if you want to use the NXP ethernet MAC included on
drivers/net/ethernet/nxp/lpc_eth.c+18−27
@@ -14,14 +14,12 @@ · 13 unmodified lines
1414 #include <linux/crc32.h>
1515 #include <linux/etherdevice.h>
1616 #include <linux/module.h>
17+#include <linux/of.h>
1718 #include <linux/of_net.h>
1819 #include <linux/phy.h>
1920 #include <linux/platform_device.h>
2021 #include <linux/spinlock.h>
21−
22−#include <mach/board.h>
23−#include <mach/hardware.h>
24−#include <mach/platform.h>
22+#include <linux/soc/nxp/lpc32xx-misc.h>
2523
2624 #define MODNAME "lpc-eth"
2725 #define DRV_VERSION "1.00"
@@ -1237,16 +1235,9 @@ static int lpc_eth_drv_probe(struct platform_device *pdev) · 1209 unmodified lines
12371235 dma_addr_t dma_handle;
12381236 struct resource *res;
12391237 int irq, ret;
1240− u32 tmp;
12411238
12421239 /* Setup network interface for RMII or MII mode */
1243− tmp = __raw_readl(LPC32XX_CLKPWR_MACCLK_CTRL);
1244− tmp &= ~LPC32XX_CLKPWR_MACCTRL_PINS_MSK;
1245− if (lpc_phy_interface_mode(dev) == PHY_INTERFACE_MODE_MII)
1246− tmp |= LPC32XX_CLKPWR_MACCTRL_USE_MII_PINS;
1247− else
1248− tmp |= LPC32XX_CLKPWR_MACCTRL_USE_RMII_PINS;
1249− __raw_writel(tmp, LPC32XX_CLKPWR_MACCLK_CTRL);
1240+ lpc32xx_set_phy_interface_mode(lpc_phy_interface_mode(dev));
12501241
12511242 /* Get platform resources */
12521243 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -1311,19 +1302,18 @@ static int lpc_eth_drv_probe(struct platform_device *pdev) · 58 unmodified lines
13111302 /* Get size of DMA buffers/descriptors region */
13121303 pldat->dma_buff_size = (ENET_TX_DESC + ENET_RX_DESC) * (ENET_MAXF_SIZE +
13131304 sizeof(struct txrx_desc_t) + sizeof(struct rx_status_t));
1314− pldat->dma_buff_base_v = 0;
13151305
13161306 if (use_iram_for_net(dev)) {
1317− dma_handle = LPC32XX_IRAM_BASE;
1318− if (pldat->dma_buff_size <= lpc32xx_return_iram_size())
1319− pldat->dma_buff_base_v =
1320− io_p2v(LPC32XX_IRAM_BASE);
1321− else
1307+ if (pldat->dma_buff_size >
1308+ lpc32xx_return_iram(&pldat->dma_buff_base_v, &dma_handle)) {
1309+ pldat->dma_buff_base_v = NULL;
1310+ pldat->dma_buff_size = 0;
13221311 netdev_err(ndev,
13231312 "IRAM not big enough for net buffers, using SDRAM instead.\n");
1313+ }
13241314 }
13251315
1326− if (pldat->dma_buff_base_v == 0) {
1316+ if (pldat->dma_buff_base_v == NULL) {
13271317 ret = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(32));
13281318 if (ret)
13291319 goto err_out_free_irq;
@@ -1344,13 +1334,14 @@ static int lpc_eth_drv_probe(struct platform_device *pdev) · 14 unmodified lines
13441334 pldat->dma_buff_base_p = dma_handle;
13451335
13461336 netdev_dbg(ndev, "IO address space :%pR\n", res);
1347− netdev_dbg(ndev, "IO address size :%d\n", resource_size(res));
1337+ netdev_dbg(ndev, "IO address size :%zd\n",
1338+ (size_t)resource_size(res));
13481339 netdev_dbg(ndev, "IO address (mapped) :0x%p\n",
13491340 pldat->net_base);
13501341 netdev_dbg(ndev, "IRQ number :%d\n", ndev->irq);
1351− netdev_dbg(ndev, "DMA buffer size :%d\n", pldat->dma_buff_size);
1352− netdev_dbg(ndev, "DMA buffer P address :0x%08x\n",
1353− pldat->dma_buff_base_p);
1342+ netdev_dbg(ndev, "DMA buffer size :%zd\n", pldat->dma_buff_size);
1343+ netdev_dbg(ndev, "DMA buffer P address :%pad\n",
1344+ &pldat->dma_buff_base_p);
13541345 netdev_dbg(ndev, "DMA buffer V address :0x%p\n",
13551346 pldat->dma_buff_base_v);
13561347
@@ -1397,8 +1388,8 @@ static int lpc_eth_drv_probe(struct platform_device *pdev) · 40 unmodified lines
13971388 if (ret)
13981389 goto err_out_unregister_netdev;
13991390
1400− netdev_info(ndev, "LPC mac at 0x%08x irq %d\n",
1401− res->start, ndev->irq);
1391+ netdev_info(ndev, "LPC mac at 0x%08lx irq %d\n",
1392+ (unsigned long)res->start, ndev->irq);
14021393
14031394 device_init_wakeup(dev, 1);
14041395 device_set_wakeup_enable(dev, 0);
@@ -1409,7 +1400,7 @@ err_out_unregister_netdev: · 4 unmodified lines
14091400 unregister_netdev(ndev);
14101401 err_out_dma_unmap:
14111402 if (!use_iram_for_net(dev) ||
1412− pldat->dma_buff_size > lpc32xx_return_iram_size())
1403+ pldat->dma_buff_size > lpc32xx_return_iram(NULL, NULL))
14131404 dma_free_coherent(dev, pldat->dma_buff_size,
14141405 pldat->dma_buff_base_v,
14151406 pldat->dma_buff_base_p);
@@ -1436,7 +1427,7 @@ static int lpc_eth_drv_remove(struct platform_device *pdev) · 20 unmodified lines
14361427 unregister_netdev(ndev);
14371428
14381429 if (!use_iram_for_net(&pldat->pdev->dev) ||
1439− pldat->dma_buff_size > lpc32xx_return_iram_size())
1430+ pldat->dma_buff_size > lpc32xx_return_iram(NULL, NULL))
14401431 dma_free_coherent(&pldat->pdev->dev, pldat->dma_buff_size,
14411432 pldat->dma_buff_base_v,
14421433 pldat->dma_buff_base_p);
drivers/tty/serial/Kconfig+2−1
@@ -739,7 +739,8 @@ config SERIAL_PNX8XXX_CONSOLE · 738 unmodified lines
739739
740740 config SERIAL_HS_LPC32XX
741741 tristate "LPC32XX high speed serial port support"
742− depends on ARCH_LPC32XX && OF
742+ depends on ARCH_LPC32XX || COMPILE_TEST
743+ depends on OF
743744 select SERIAL_CORE
744745 help
745746 Support for the LPC32XX high speed serial ports (up to 900kbps).
drivers/tty/serial/lpc32xx_hs.c+4−33
@@ -25,8 +25,8 @@ · 24 unmodified lines
2525 #include <linux/irq.h>
2626 #include <linux/gpio.h>
2727 #include <linux/of.h>
28−#include <mach/platform.h>
29−#include <mach/hardware.h>
28+#include <linux/sizes.h>
29+#include <linux/soc/nxp/lpc32xx-misc.h>
3030
3131 /*
3232 * High Speed UART register offsets
@@ -81,6 +81,8 @@ · 48 unmodified lines
8181 #define LPC32XX_HSU_TX_TL8B (0x2 << 0)
8282 #define LPC32XX_HSU_TX_TL16B (0x3 << 0)
8383
84+#define LPC32XX_MAIN_OSC_FREQ 13000000
85+
8486 #define MODNAME "lpc32xx_hsuart"
8587
8688 struct lpc32xx_hsuart_port {
@@ -151,8 +153,6 @@ static void lpc32xx_hsuart_console_write(struct console *co, const char *s, · 64 unmodified lines
151153 local_irq_restore(flags);
152154 }
153155
154−static void lpc32xx_loopback_set(resource_size_t mapbase, int state);
155−
156156 static int __init lpc32xx_hsuart_console_setup(struct console *co,
157157 char *options)
158158 {
@@ -439,35 +439,6 @@ static void serial_lpc32xx_break_ctl(struct uart_port *port, · 280 unmodified lines
439439 spin_unlock_irqrestore(&port->lock, flags);
440440 }
441441
442−/* LPC3250 Errata HSUART.1: Hang workaround via loopback mode on inactivity */
443−static void lpc32xx_loopback_set(resource_size_t mapbase, int state)
444−{
445− int bit;
446− u32 tmp;
447−
448− switch (mapbase) {
449− case LPC32XX_HS_UART1_BASE:
450− bit = 0;
451− break;
452− case LPC32XX_HS_UART2_BASE:
453− bit = 1;
454− break;
455− case LPC32XX_HS_UART7_BASE:
456− bit = 6;
457− break;
458− default:
459− WARN(1, "lpc32xx_hs: Warning: Unknown port at %08x\n", mapbase);
460− return;
461− }
462−
463− tmp = readl(LPC32XX_UARTCTL_CLOOP);
464− if (state)
465− tmp |= (1 << bit);
466− else
467− tmp &= ~(1 << bit);
468− writel(tmp, LPC32XX_UARTCTL_CLOOP);
469−}
470−
471442 /* port->lock is not held. */
472443 static int serial_lpc32xx_startup(struct uart_port *port)
473444 {
drivers/usb/gadget/udc/Kconfig+2−1
@@ -45,7 +45,8 @@ config USB_AT91 · 44 unmodified lines
4545
4646 config USB_LPC32XX
4747 tristate "LPC32XX USB Peripheral Controller"
48− depends on ARCH_LPC32XX && I2C
48+ depends on ARCH_LPC32XX || COMPILE_TEST
49+ depends on I2C
4950 select USB_ISP1301
5051 help
5152 This option selects the USB device controller in the LPC32xx SoC.
drivers/usb/gadget/udc/lpc32xx_udc.c+1−2
@@ -24,6 +24,7 @@ · 23 unmodified lines
2424 #include <linux/module.h>
2525 #include <linux/of.h>
2626 #include <linux/platform_device.h>
27+#include <linux/prefetch.h>
2728 #include <linux/proc_fs.h>
2829 #include <linux/slab.h>
2930 #include <linux/usb/ch9.h>
@@ -35,8 +36,6 @@ · 5 unmodified lines
3536 #include <linux/seq_file.h>
3637 #endif
3738
38−#include <mach/hardware.h>
39−
4039 /*
4140 * USB device configuration structure
4241 */
drivers/usb/host/Kconfig+2−1
@@ -441,7 +441,8 @@ config USB_OHCI_HCD_S3C2410 · 440 unmodified lines
441441
442442 config USB_OHCI_HCD_LPC32XX
443443 tristate "Support for LPC on-chip OHCI USB controller"
444− depends on USB_OHCI_HCD && ARCH_LPC32XX
444+ depends on USB_OHCI_HCD
445+ depends on ARCH_LPC32XX || COMPILE_TEST
445446 depends on USB_ISP1301
446447 default y
447448 ---help---
drivers/usb/host/ohci-nxp.c+18−7
@@ -29,10 +29,7 @@ · 28 unmodified lines
2929
3030 #include "ohci.h"
3131
32−#include <mach/hardware.h>
33−
3432 #define USB_CONFIG_BASE 0x31020000
35−#define USB_OTG_STAT_CONTROL IO_ADDRESS(USB_CONFIG_BASE + 0x110)
3633
3734 /* USB_OTG_STAT_CONTROL bit defines */
3835 #define TRANSPARENT_I2C_EN (1 << 7)
@@ -122,19 +119,33 @@ static inline void isp1301_vbus_off(void) · 83 unmodified lines
122119
123120 static void ohci_nxp_start_hc(void)
124121 {
125− unsigned long tmp = __raw_readl(USB_OTG_STAT_CONTROL) | HOST_EN;
122+ void __iomem *usb_otg_stat_control = ioremap(USB_CONFIG_BASE + 0x110, 4);
123+ unsigned long tmp;
124+
125+ if (WARN_ON(!usb_otg_stat_control))
126+ return;
127+
128+ tmp = __raw_readl(usb_otg_stat_control) | HOST_EN;
126129
127− __raw_writel(tmp, USB_OTG_STAT_CONTROL);
130+ __raw_writel(tmp, usb_otg_stat_control);
128131 isp1301_vbus_on();
132+
133+ iounmap(usb_otg_stat_control);
129134 }
130135
131136 static void ohci_nxp_stop_hc(void)
132137 {
138+ void __iomem *usb_otg_stat_control = ioremap(USB_CONFIG_BASE + 0x110, 4);
133139 unsigned long tmp;
134140
141+ if (WARN_ON(!usb_otg_stat_control))
142+ return;
143+
135144 isp1301_vbus_off();
136− tmp = __raw_readl(USB_OTG_STAT_CONTROL) & ~HOST_EN;
137− __raw_writel(tmp, USB_OTG_STAT_CONTROL);
145+ tmp = __raw_readl(usb_otg_stat_control) & ~HOST_EN;
146+ __raw_writel(tmp, usb_otg_stat_control);
147+
148+ iounmap(usb_otg_stat_control);
138149 }
139150
140151 static int ohci_hcd_nxp_probe(struct platform_device *pdev)
drivers/watchdog/Kconfig+1−1
@@ -551,7 +551,7 @@ config OMAP_WATCHDOG · 550 unmodified lines
551551
552552 config PNX4008_WATCHDOG
553553 tristate "LPC32XX Watchdog"
554− depends on ARCH_LPC32XX
554+ depends on ARCH_LPC32XX || COMPILE_TEST
555555 select WATCHDOG_CORE
556556 help
557557 Say Y here if to include support for the watchdog timer
drivers/watchdog/pnx4008_wdt.c+0−1
@@ -30,7 +30,6 @@ · 29 unmodified lines
3030 #include <linux/of.h>
3131 #include <linux/delay.h>
3232 #include <linux/reboot.h>
33−#include <mach/hardware.h>
3433
3534 /* WatchDog Timer - Chapter 23 Page 207 */
3635
include/linux/soc/nxp/lpc32xx-misc.h+33−0
@@ -0,0 +1,33 @@
1+/* SPDX-License-Identifier: GPL-2.0-or-later */
2+/*
3+ * Author: Kevin Wells <kevin.wells@nxp.com>
4+ *
5+ * Copyright (C) 2010 NXP Semiconductors
6+ */
7+
8+#ifndef __SOC_LPC32XX_MISC_H
9+#define __SOC_LPC32XX_MISC_H
10+
11+#include <linux/types.h>
12+#include <linux/phy.h>
13+
14+#ifdef CONFIG_ARCH_LPC32XX
15+extern u32 lpc32xx_return_iram(void __iomem **mapbase, dma_addr_t *dmaaddr);
16+extern void lpc32xx_set_phy_interface_mode(phy_interface_t mode);
17+extern void lpc32xx_loopback_set(resource_size_t mapbase, int state);
18+#else
19+static inline u32 lpc32xx_return_iram(void __iomem **mapbase, dma_addr_t *dmaaddr)
20+{
21+ *mapbase = NULL;
22+ *dmaaddr = 0;
23+ return 0;
24+}
25+static inline void lpc32xx_set_phy_interface_mode(phy_interface_t mode)
26+{
27+}
28+static inline void lpc32xx_loopback_set(resource_size_t mapbase, int state)
29+{
30+}
31+#endif
32+
33+#endif /* __SOC_LPC32XX_MISC_H */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t