v2: ARM: move lpc32xx to multiplatform
Subsystems (10)
v2 cover v2: ARM: move lpc32xx to multiplatform
Version 2 contains some minor changes based on earlier feedback and from the 0day build bot testing on other architectures. The only patch that changed significantly is the one for the gpio driver.
I would suggest we merge this version into the soc tree directly if there are no further concerns.
Arnd
Arnd Bergmann (12):
usb: ohci-nxp: enable compile-testing
usb: udc: lpc32xx: allow compile-testing
watchdog: pnx4008_wdt: allow compile-testing
serial: lpc32xx_hs: allow compile-testing
gpio: lpc32xx: allow building on non-lpc32xx targets
net: lpc-enet: factor out iram access
net: lpc-enet: move phy setup into platform code
net: lpc-enet: fix printk format strings
net: lpc-enet: allow compile testing
serial: lpc32xx: allow compile testing
ARM: lpc32xx: clean up header files
ARM: lpc32xx: allow multiplatform build
kbuild test robot (1):
net: lpc-enet: fix badzero.cocci warnings
arch/arm/Kconfig | 17 +--
arch/arm/configs/lpc32xx_defconfig | 2 +
arch/arm/mach-lpc32xx/Kconfig | 11 ++
arch/arm/mach-lpc32xx/common.c | 24 +++-
arch/arm/mach-lpc32xx/common.h | 1 -
arch/arm/mach-lpc32xx/include/mach/board.h | 15 ---
.../mach-lpc32xx/include/mach/entry-macro.S | 28 -----
arch/arm/mach-lpc32xx/include/mach/hardware.h | 25 ----
.../mach-lpc32xx/include/mach/uncompress.h | 50 --------
.../{include/mach/platform.h => lpc32xx.h} | 18 ++-
arch/arm/mach-lpc32xx/pm.c | 3 +-
arch/arm/mach-lpc32xx/serial.c | 33 ++++-
arch/arm/mach-lpc32xx/suspend.S | 3 +-
drivers/gpio/Kconfig | 7 ++
drivers/gpio/Makefile | 2 +-
drivers/gpio/gpio-lpc32xx.c | 118 ++++++++++--------
drivers/net/ethernet/nxp/Kconfig | 2 +-
drivers/net/ethernet/nxp/lpc_eth.c | 45 +++----
drivers/tty/serial/Kconfig | 3 +-
drivers/tty/serial/lpc32xx_hs.c | 37 +-----
drivers/usb/gadget/udc/Kconfig | 3 +-
drivers/usb/gadget/udc/lpc32xx_udc.c | 3 +-
drivers/usb/host/Kconfig | 3 +-
drivers/usb/host/ohci-nxp.c | 25 ++--
drivers/watchdog/Kconfig | 2 +-
drivers/watchdog/pnx4008_wdt.c | 1 -
include/linux/soc/nxp/lpc32xx-misc.h | 33 +++++
27 files changed, 242 insertions(+), 272 deletions(-)
create mode 100644 arch/arm/mach-lpc32xx/Kconfig
delete mode 100644 arch/arm/mach-lpc32xx/include/mach/board.h
delete mode 100644 arch/arm/mach-lpc32xx/include/mach/entry-macro.S
delete mode 100644 arch/arm/mach-lpc32xx/include/mach/hardware.h
delete mode 100644 arch/arm/mach-lpc32xx/include/mach/uncompress.h
rename arch/arm/mach-lpc32xx/{include/mach/platform.h => lpc32xx.h} (98%)
create mode 100644 include/linux/soc/nxp/lpc32xx-misc.hSignature · 16 lines
2.20.0 Cc: [email protected] Cc: [email protected] Cc: Vladimir Zapolskiy <[email protected]> Cc: Sylvain Lemieux <[email protected]> Cc: Linus Walleij <[email protected]> Cc: "David S. Miller" <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: Alan Stern <[email protected]> Cc: Guenter Roeck <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected]
PATCH v2 1/13 usb: ohci-nxp: enable compile-testing
The driver hardcodes a hardware I/O address the way one should generally not do, and this prevents both compile-testing, and moving the platform to CONFIG_ARCH_MULTIPLATFORM.
Change the code to be independent of the machine headers to allow those two. Removing the hardcoded address would be hard and is not necessary, so leave that in place for now.
--- drivers/usb/host/Kconfig | 3 ++- drivers/usb/host/ohci-nxp.c | 25 ++++++++++++++++++------- 2 files changed, 20 insertions(+), 8 deletions(-)
drivers/usb/host/Kconfig +2 -1
@@ -441,7 +441,8 @@ config USB_OHCI_HCD_S3C2410 config USB_OHCI_HCD_LPC32XX tristate "Support for LPC on-chip OHCI USB controller" - depends on USB_OHCI_HCD && ARCH_LPC32XX + depends on USB_OHCI_HCD + depends on ARCH_LPC32XX || COMPILE_TEST depends on USB_ISP1301 default y ---help---
drivers/usb/host/ohci-nxp.c +18 -7
@@ -29,10 +29,7 @@#include "ohci.h" -#include <mach/hardware.h> -#define USB_CONFIG_BASE 0x31020000 -#define USB_OTG_STAT_CONTROL IO_ADDRESS(USB_CONFIG_BASE + 0x110)/* USB_OTG_STAT_CONTROL bit defines */ #define TRANSPARENT_I2C_EN (1 << 7)
@@ -122,19 +119,33 @@ static inline void isp1301_vbus_off(void)static void ohci_nxp_start_hc (void ) { -unsigned long tmp =__raw_readl (USB_OTG_STAT_CONTROL ) |HOST_EN ; +void __iomem *usb_otg_stat_control =ioremap (USB_CONFIG_BASE +0x110 ,4 ); +unsigned long tmp; + +if (WARN_ON (!usb_otg_stat_control)) +return ; + + tmp =__raw_readl (usb_otg_stat_control) |HOST_EN ; -__raw_writel (tmp,USB_OTG_STAT_CONTROL ); +__raw_writel (tmp, usb_otg_stat_control);isp1301_vbus_on (); + +iounmap (usb_otg_stat_control); }static void ohci_nxp_stop_hc (void ) { +void __iomem *usb_otg_stat_control =ioremap (USB_CONFIG_BASE +0x110 ,4 );unsigned long tmp; +if (WARN_ON (!usb_otg_stat_control)) +return ; +isp1301_vbus_off (); - tmp =__raw_readl (USB_OTG_STAT_CONTROL ) & ~HOST_EN ; -__raw_writel (tmp,USB_OTG_STAT_CONTROL ); + tmp =__raw_readl (usb_otg_stat_control) & ~HOST_EN ; +__raw_writel (tmp, usb_otg_stat_control); + +iounmap (usb_otg_stat_control); }static int ohci_hcd_nxp_probe (struct platform_device *pdev)
Signature · 7 lines
2.20.0 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [PATCH v2 01/13] usb: ohci-nxp: enable compile-testing
Quoted 8 lines · Arnd Bergmann
The driver hardcodes a hardware I/O address the way one should generally not do, and this prevents both compile-testing, and moving the platform to
CONFIG_ARCH_MULTIPLATFORM.Change the code to be independent of the machine headers to allow those two. Removing the hardcoded address would be hard and is not necessary, so leave that in place for now.
Quoted 5 lines
Signed-off-by Arnd Bergmann <[email protected]>--- drivers/usb/host/Kconfig | 3 ++- drivers/usb/host/ohci-nxp.c | 25 ++++++++++++++++++------- 2 files changed, 20 insertions(+), 8 deletions(-)
PATCH v2 2/13 usb: udc: lpc32xx: allow compile-testing
In reply to Arnd BergmannThe only thing that prevents building this driver on other platforms is the mach/hardware.h include, which is not actually used here at all, so remove the line and allow CONFIG_COMPILE_TEST.
--- drivers/usb/gadget/udc/Kconfig | 3 ++- drivers/usb/gadget/udc/lpc32xx_udc.c | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/usb/gadget/udc/Kconfig +2 -1
@@ -45,7 +45,8 @@ config USB_AT91 config USB_LPC32XX tristate "LPC32XX USB Peripheral Controller" - depends on ARCH_LPC32XX && I2C + depends on ARCH_LPC32XX || COMPILE_TEST + depends on I2C select USB_ISP1301 help This option selects the USB device controller in the LPC32xx SoC.
drivers/usb/gadget/udc/lpc32xx_udc.c +1 -2
@@ -24,6 +24,7 @@#include <linux/module.h> #include <linux/of.h> #include <linux/platform_device.h> +#include <linux/prefetch.h> #include <linux/proc_fs.h> #include <linux/slab.h> #include <linux/usb/ch9.h>
@@ -35,8 +36,6 @@#include <linux/seq_file.h> #endif -#include <mach/hardware.h> -/* * USB device configuration structure */
Signature · 1 line
2.20.0
PATCH v2 3/13 watchdog: pnx4008_wdt: allow compile-testing
In reply to Arnd BergmannThe only thing that prevents building this driver on other platforms is the mach/hardware.h include, which is not actually used here at all, so remove the line and allow CONFIG_COMPILE_TEST.
--- drivers/watchdog/Kconfig | 2 +- drivers/watchdog/pnx4008_wdt.c | 1 - 2 files changed, 1 insertion(+), 2 deletions(-)
drivers/watchdog/Kconfig +1 -1
@@ -551,7 +551,7 @@ config OMAP_WATCHDOG config PNX4008_WATCHDOG tristate "LPC32XX Watchdog" - depends on ARCH_LPC32XX + depends on ARCH_LPC32XX || COMPILE_TEST select WATCHDOG_CORE help Say Y here if to include support for the watchdog timer
drivers/watchdog/pnx4008_wdt.c +0 -1
@@ -30,7 +30,6 @@#include <linux/of.h> #include <linux/delay.h> #include <linux/reboot.h> -#include <mach/hardware.h> /* WatchDog Timer - Chapter 23 Page 207 */
Signature · 7 lines
2.20.0 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH v2 4/13 serial: lpc32xx_hs: allow compile-testing
In reply to Arnd BergmannThe only thing that prevents building this driver on other platforms is the mach/hardware.h include, which is not actually used here at all, so remove the line and allow CONFIG_COMPILE_TEST.
--- drivers/tty/serial/Kconfig | 3 ++- drivers/tty/serial/lpc32xx_hs.c | 2 -- 2 files changed, 2 insertions(+), 3 deletions(-)
drivers/tty/serial/Kconfig +2 -1
@@ -739,7 +739,8 @@ config SERIAL_PNX8XXX_CONSOLE config SERIAL_HS_LPC32XX tristate "LPC32XX high speed serial port support" - depends on ARCH_LPC32XX && OF + depends on ARCH_LPC32XX || COMPILE_TEST + depends on OF select SERIAL_CORE help Support for the LPC32XX high speed serial ports (up to 900kbps).
drivers/tty/serial/lpc32xx_hs.c +0 -2
@@ -25,8 +25,6 @@#include <linux/irq.h> #include <linux/gpio.h> #include <linux/of.h> -#include <mach/platform.h> -#include <mach/hardware.h> /* * High Speed UART register offsets
Signature · 1 line
2.20.0
PATCH v2 5/13 gpio: lpc32xx: allow building on non-lpc32xx targets
In reply to Arnd BergmannThe driver uses hardwire MMIO addresses instead of the data that is passed in device tree. Change it over to only hardcode the register offset values and allow compile-testing.
--- arch/arm/configs/lpc32xx_defconfig | 1 + drivers/gpio/Kconfig | 7 ++ drivers/gpio/Makefile | 2 +- drivers/gpio/gpio-lpc32xx.c | 118 +++++++++++++++++------------ 4 files changed, 77 insertions(+), 51 deletions(-)
arch/arm/configs/lpc32xx_defconfig +1 -0
@@ -93,6 +93,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
drivers/gpio/Kconfig +7 -0
@@ -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
drivers/gpio/Makefile +1 -1
@@ -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
drivers/gpio/gpio-lpc32xx.c +68 -50
210 lines not on this page · raw message
Signature · 1 line
2.20.0
Bartosz Golaszewski
AppliedRe: [PATCH v2 05/13] gpio: lpc32xx: allow building on non-lpc32xx targets
pt., 9 sie 2019 o 16:43 Arnd Bergmann <[email protected]> napisał(a):
Quoted 281 lines
The driver uses hardwire MMIO addresses instead of the data that is passed in device tree. Change it over to only hardcode the register offset values and allow compile-testing.
Acked-by Sylvain Lemieux <[email protected]>Tested-by Sylvain Lemieux <[email protected]>Signed-off-by Arnd Bergmann <[email protected]>--- arch/arm/configs/lpc32xx_defconfig | 1 + drivers/gpio/Kconfig | 7 ++ drivers/gpio/Makefile | 2 +- drivers/gpio/gpio-lpc32xx.c | 118 +++++++++++++++++------------ 4 files changed, 77 insertions(+), 51 deletions(-)arch/arm/configs/lpc32xx_defconfig +1
-0@@ -93,6 +93,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=ydrivers/gpio/Kconfig +7
-0@@ -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 && X86drivers/gpio/Makefile +1
-1@@ -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.odrivers/gpio/gpio-lpc32xx.c +68
-51@@ -16,36 +16,33 @@#include <linux/platform_device.h> #include <linux/module.h> -#include <mach/hardware.h> -#include <mach/platform.h> - -#define LPC32XX_GPIO_P3_INP_STATE _GPREG(0x000) -#define LPC32XX_GPIO_P3_OUTP_SET _GPREG(0x004) -#define LPC32XX_GPIO_P3_OUTP_CLR _GPREG(0x008) -#define LPC32XX_GPIO_P3_OUTP_STATE _GPREG(0x00C) -#define LPC32XX_GPIO_P2_DIR_SET _GPREG(0x010) -#define LPC32XX_GPIO_P2_DIR_CLR _GPREG(0x014) -#define LPC32XX_GPIO_P2_DIR_STATE _GPREG(0x018) -#define LPC32XX_GPIO_P2_INP_STATE _GPREG(0x01C) -#define LPC32XX_GPIO_P2_OUTP_SET _GPREG(0x020) -#define LPC32XX_GPIO_P2_OUTP_CLR _GPREG(0x024) -#define LPC32XX_GPIO_P2_MUX_SET _GPREG(0x028) -#define LPC32XX_GPIO_P2_MUX_CLR _GPREG(0x02C) -#define LPC32XX_GPIO_P2_MUX_STATE _GPREG(0x030) -#define LPC32XX_GPIO_P0_INP_STATE _GPREG(0x040) -#define LPC32XX_GPIO_P0_OUTP_SET _GPREG(0x044) -#define LPC32XX_GPIO_P0_OUTP_CLR _GPREG(0x048) -#define LPC32XX_GPIO_P0_OUTP_STATE _GPREG(0x04C) -#define LPC32XX_GPIO_P0_DIR_SET _GPREG(0x050) -#define LPC32XX_GPIO_P0_DIR_CLR _GPREG(0x054) -#define LPC32XX_GPIO_P0_DIR_STATE _GPREG(0x058) -#define LPC32XX_GPIO_P1_INP_STATE _GPREG(0x060) -#define LPC32XX_GPIO_P1_OUTP_SET _GPREG(0x064) -#define LPC32XX_GPIO_P1_OUTP_CLR _GPREG(0x068) -#define LPC32XX_GPIO_P1_OUTP_STATE _GPREG(0x06C) -#define LPC32XX_GPIO_P1_DIR_SET _GPREG(0x070) -#define LPC32XX_GPIO_P1_DIR_CLR _GPREG(0x074) -#define LPC32XX_GPIO_P1_DIR_STATE _GPREG(0x078) +#define LPC32XX_GPIO_P3_INP_STATE (0x000) +#define LPC32XX_GPIO_P3_OUTP_SET (0x004) +#define LPC32XX_GPIO_P3_OUTP_CLR (0x008) +#define LPC32XX_GPIO_P3_OUTP_STATE (0x00C) +#define LPC32XX_GPIO_P2_DIR_SET (0x010) +#define LPC32XX_GPIO_P2_DIR_CLR (0x014) +#define LPC32XX_GPIO_P2_DIR_STATE (0x018) +#define LPC32XX_GPIO_P2_INP_STATE (0x01C) +#define LPC32XX_GPIO_P2_OUTP_SET (0x020) +#define LPC32XX_GPIO_P2_OUTP_CLR (0x024) +#define LPC32XX_GPIO_P2_MUX_SET (0x028) +#define LPC32XX_GPIO_P2_MUX_CLR (0x02C) +#define LPC32XX_GPIO_P2_MUX_STATE (0x030) +#define LPC32XX_GPIO_P0_INP_STATE (0x040) +#define LPC32XX_GPIO_P0_OUTP_SET (0x044) +#define LPC32XX_GPIO_P0_OUTP_CLR (0x048) +#define LPC32XX_GPIO_P0_OUTP_STATE (0x04C) +#define LPC32XX_GPIO_P0_DIR_SET (0x050) +#define LPC32XX_GPIO_P0_DIR_CLR (0x054) +#define LPC32XX_GPIO_P0_DIR_STATE (0x058) +#define LPC32XX_GPIO_P1_INP_STATE (0x060) +#define LPC32XX_GPIO_P1_OUTP_SET (0x064) +#define LPC32XX_GPIO_P1_OUTP_CLR (0x068) +#define LPC32XX_GPIO_P1_OUTP_STATE (0x06C) +#define LPC32XX_GPIO_P1_DIR_SET (0x070) +#define LPC32XX_GPIO_P1_DIR_CLR (0x074) +#define LPC32XX_GPIO_P1_DIR_STATE (0x078)#define GPIO012_PIN_TO_BIT (x) (1 << (x))#define GPIO3_PIN_TO_BIT (x) (1 << ((x) + 25))@@ -72,12 +69,12 @@#define LPC32XX_GPO_P3_GRP (LPC32XX_GPI_P3_GRP + LPC32XX_GPI_P3_MAX)struct gpio_regs { -void __iomem *inp_state; -void __iomem *outp_state; -void __iomem *outp_set; -void __iomem *outp_clr; -void __iomem *dir_set; -void __iomem *dir_clr; +unsigned long inp_state; +unsigned long outp_state; +unsigned long outp_set; +unsigned long outp_clr; +unsigned long dir_set; +unsigned long dir_clr; };/* @@ -165,16 +162,27 @@ static struct gpio_regs gpio_grp_regs_p3 = {struct lpc32xx_gpio_chip {struct gpio_chip chip;struct gpio_regs *gpio_grp; +void __iomem *reg_base; }; +static inline u32 gpreg_read (struct lpc32xx_gpio_chip *group,unsigned long offset) +{ +return __raw_readl (group->reg_base + offset); +} + +static inline void gpreg_write (struct lpc32xx_gpio_chip *group,u32 val,unsigned long offset) +{ +__raw_writel (val, group->reg_base + offset); +} +static void __set_gpio_dir_p012 (struct lpc32xx_gpio_chip *group,unsigned pin,int input) {if (input) -__raw_writel (GPIO012_PIN_TO_BIT (pin), +gpreg_write (group,GPIO012_PIN_TO_BIT (pin), group->gpio_grp->dir_clr);else -__raw_writel (GPIO012_PIN_TO_BIT (pin), +gpreg_write (group,GPIO012_PIN_TO_BIT (pin), group->gpio_grp->dir_set); }@@ -184,19 +192,19 @@ static void __set_gpio_dir_p3(struct lpc32xx_gpio_chip *group,u32 u =GPIO3_PIN_TO_BIT (pin);if (input) -__raw_writel (u, group->gpio_grp->dir_clr); +gpreg_write (group, u, group->gpio_grp->dir_clr);else -__raw_writel (u, group->gpio_grp->dir_set); +gpreg_write (group, u, group->gpio_grp->dir_set); }static void __set_gpio_level_p012 (struct lpc32xx_gpio_chip *group,unsigned pin,int high) {if (high) -__raw_writel (GPIO012_PIN_TO_BIT (pin), +gpreg_write (group,GPIO012_PIN_TO_BIT (pin), group->gpio_grp->outp_set);else -__raw_writel (GPIO012_PIN_TO_BIT (pin), +gpreg_write (group,GPIO012_PIN_TO_BIT (pin), group->gpio_grp->outp_clr); }@@ -206,31 +214,31 @@ static void __set_gpio_level_p3(struct lpc32xx_gpio_chip *group,u32 u =GPIO3_PIN_TO_BIT (pin);if (high) -__raw_writel (u, group->gpio_grp->outp_set); +gpreg_write (group, u, group->gpio_grp->outp_set);else -__raw_writel (u, group->gpio_grp->outp_clr); +gpreg_write (group, u, group->gpio_grp->outp_clr); }static void __set_gpo_level_p3 (struct lpc32xx_gpio_chip *group,unsigned pin,int high) {if (high) -__raw_writel (GPO3_PIN_TO_BIT (pin), group->gpio_grp->outp_set); +gpreg_write (group,GPO3_PIN_TO_BIT (pin), group->gpio_grp->outp_set);else -__raw_writel (GPO3_PIN_TO_BIT (pin), group->gpio_grp->outp_clr); +gpreg_write (group,GPO3_PIN_TO_BIT (pin), group->gpio_grp->outp_clr); }static int __get_gpio_state_p012 (struct lpc32xx_gpio_chip *group,unsigned pin) { -return GPIO012_PIN_IN_SEL (__raw_readl (group->gpio_grp->inp_state), +return GPIO012_PIN_IN_SEL (gpreg_read (group, group->gpio_grp->inp_state), pin); }static int __get_gpio_state_p3 (struct lpc32xx_gpio_chip *group,unsigned pin) { -int state =__raw_readl (group->gpio_grp->inp_state); +int state =gpreg_read (group, group->gpio_grp->inp_state);/* * 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,static int __get_gpi_state_p3 (struct lpc32xx_gpio_chip *group,unsigned pin) { -return GPI3_PIN_IN_SEL (__raw_readl (group->gpio_grp->inp_state), pin); +return GPI3_PIN_IN_SEL (gpreg_read (group, group->gpio_grp->inp_state), pin); }static int __get_gpo_state_p3 (struct lpc32xx_gpio_chip *group,unsigned pin) { -return GPO3_PIN_IN_SEL (__raw_readl (group->gpio_grp->outp_state), pin); +return GPO3_PIN_IN_SEL (gpreg_read (group, group->gpio_grp->outp_state), pin); }/* @@ -497,12 +505,18 @@ static int lpc32xx_of_xlate(struct gpio_chip *gc,static int lpc32xx_gpio_probe (struct platform_device *pdev) {int i; +void __iomem *reg_base; + + reg_base =devm_platform_ioremap_resource (pdev,0 ); +if (IS_ERR (reg_base)) +return PTR_ERR (reg_base);for (i =0 ; i <ARRAY_SIZE (lpc32xx_gpiochip); i++) {if (pdev->dev.of_node) { lpc32xx_gpiochip[i].chip.of_xlate = lpc32xx_of_xlate; lpc32xx_gpiochip[i].chip.of_gpio_n_cells =3 ; lpc32xx_gpiochip[i].chip.of_node = pdev->dev.of_node; + lpc32xx_gpiochip[i].reg_base = reg_base; }devm_gpiochip_add_data (&pdev->dev, &lpc32xx_gpiochip[i].chip, &lpc32xx_gpiochip[i]);@@ -527,3 +541,7 @@ static struct platform_driver lpc32xx_gpio_driver = { };module_platform_driver (lpc32xx_gpio_driver); + +MODULE_AUTHOR ("Kevin Wells <[email protected]>" ); +MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("GPIO driver for LPC32xx SoC" ); --
Quoted 2 lines
2.20.0
Applied, thanks!
Bart
PATCH v2 6/13 net: lpc-enet: factor out iram access
In reply to Arnd BergmannThe lpc_eth driver uses a platform specific method to find the internal sram. This prevents building it on other machines.
Rework to only use one function call and keep the other platform internals where they belong. Ideally this would look up the sram location from DT, but as this is a rarely used driver, I want to keep the modifications to a minimum.
--- arch/arm/mach-lpc32xx/common.c | 9 ++++++-- arch/arm/mach-lpc32xx/common.h | 1 - arch/arm/mach-lpc32xx/include/mach/board.h | 15 -------------- drivers/net/ethernet/nxp/lpc_eth.c | 17 ++++++++------- include/linux/soc/nxp/lpc32xx-misc.h | 24 ++++++++++++++++++++++ 5 files changed, 39 insertions(+), 27 deletions(-) delete mode 100644 arch/arm/mach-lpc32xx/include/mach/board.h create mode 100644 include/linux/soc/nxp/lpc32xx-misc.h
arch/arm/mach-lpc32xx/common.c +7 -2
@@ -8,6 +8,7 @@*/ #include <linux/init.h> +#include <linux/soc/nxp/lpc32xx-misc.h> #include <asm/mach/map.h> #include <asm/system_info.h>
@@ -32,7 +33,7 @@ void lpc32xx_get_uid(u32 devid[4])*/ #define LPC32XX_IRAM_BANK_SIZE SZ_128Kstatic 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;
@@ -53,10 +54,14 @@ 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);static struct map_desc lpc32xx_io_desc[]__initdata = { {
arch/arm/mach-lpc32xx/common.h +0 -1
@@ -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 */
arch/arm/mach-lpc32xx/include/mach/board.h deleted +0 -15
@@ -1,15 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ -/* -* arm/arch/mach-lpc32xx/include/mach/board.h -* -* Author: Kevin Wells <[email protected]> -* -* Copyright (C) 2010 NXP Semiconductors -*/ - -#ifndef __ASM_ARCH_BOARD_H -#define __ASM_ARCH_BOARD_H - -extern u32 lpc32xx_return_iram_size (void ); - -#endif /* __ASM_ARCH_BOARD_H */
drivers/net/ethernet/nxp/lpc_eth.c +8 -9
@@ -18,8 +18,8 @@#include <linux/phy.h> #include <linux/platform_device.h> #include <linux/spinlock.h> +#include <linux/soc/nxp/lpc32xx-misc.h> -#include <mach/board.h> #include <mach/hardware.h> #include <mach/platform.h>
@@ -1311,16 +1311,15 @@ static int lpc_eth_drv_probe(struct platform_device *pdev)/* Get size of DMA buffers/descriptors region */ pldat->dma_buff_size = (ENET_TX_DESC +ENET_RX_DESC ) * (ENET_MAXF_SIZE +sizeof (struct txrx_desc_t ) +sizeof (struct rx_status_t )); - pldat->dma_buff_base_v =0 ;if (use_iram_for_net (dev)) { - dma_handle =LPC32XX_IRAM_BASE ; -if (pldat->dma_buff_size <=lpc32xx_return_iram_size ()) - pldat->dma_buff_base_v = -io_p2v (LPC32XX_IRAM_BASE ); -else +if (pldat->dma_buff_size > +lpc32xx_return_iram (&pldat->dma_buff_base_v, &dma_handle)) { + pldat->dma_buff_base_v =NULL ; + pldat->dma_buff_size =0 ;netdev_err (ndev,"IRAM not big enough for net buffers, using SDRAM instead.\n" ); + } }if (pldat->dma_buff_base_v ==0 ) {
@@ -1409,7 +1408,7 @@ static int lpc_eth_drv_probe(struct platform_device *pdev)unregister_netdev (ndev); err_out_dma_unmap:if (!use_iram_for_net (dev) || - pldat->dma_buff_size >lpc32xx_return_iram_size ()) + pldat->dma_buff_size >lpc32xx_return_iram (NULL ,NULL ))dma_free_coherent (dev, pldat->dma_buff_size, pldat->dma_buff_base_v, pldat->dma_buff_base_p);
@@ -1436,7 +1435,7 @@ static int lpc_eth_drv_remove(struct platform_device *pdev)unregister_netdev (ndev);if (!use_iram_for_net (&pldat->pdev->dev) || - pldat->dma_buff_size >lpc32xx_return_iram_size ()) + pldat->dma_buff_size >lpc32xx_return_iram (NULL ,NULL ))dma_free_coherent (&pldat->pdev->dev, pldat->dma_buff_size, pldat->dma_buff_base_v, pldat->dma_buff_base_p);
include/linux/soc/nxp/lpc32xx-misc.h new file +24 -0
@@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* +* Author: Kevin Wells <[email protected]> +* +* Copyright (C) 2010 NXP Semiconductors +*/ + +#ifndef __SOC_LPC32XX_MISC_H +#define __SOC_LPC32XX_MISC_H + +#include <linux/types.h> + +#ifdef CONFIG_ARCH_LPC32XX +extern u32 lpc32xx_return_iram (void __iomem **mapbase,dma_addr_t *dmaaddr); +#else +static inline u32 lpc32xx_return_iram (void __iomem **mapbase,dma_addr_t *dmaaddr) +{ + *mapbase =NULL ; + *dmaaddr =0 ; +return 0 ; +} +#endif + +#endif /* __SOC_LPC32XX_MISC_H */
Signature · 7 lines
2.20.0 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH v2 7/13 net: lpc-enet: move phy setup into platform code
In reply to Arnd BergmannSetting the phy mode requires touching a platform specific register, which prevents us from building the driver without its header files.
Move it into a separate function in arch/arm/mach/lpc32xx to hide the core registers from the network driver.
--- arch/arm/mach-lpc32xx/common.c | 12 ++++++++++++ drivers/net/ethernet/nxp/lpc_eth.c | 12 +----------- include/linux/soc/nxp/lpc32xx-misc.h | 5 +++++ 3 files changed, 18 insertions(+), 11 deletions(-)
arch/arm/mach-lpc32xx/common.c +12 -0
@@ -63,6 +63,18 @@ u32 lpc32xx_return_iram(void __iomem **mapbase, dma_addr_t *dmaaddr) }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 = { { .virtual = (unsigned long )IO_ADDRESS (LPC32XX_AHB0_START ),
drivers/net/ethernet/nxp/lpc_eth.c +1 -11
@@ -20,9 +20,6 @@#include <linux/spinlock.h> #include <linux/soc/nxp/lpc32xx-misc.h> -#include <mach/hardware.h> -#include <mach/platform.h> -#define MODNAME "lpc-eth"#define DRV_VERSION "1.00"
@@ -1237,16 +1234,9 @@ static int lpc_eth_drv_probe(struct platform_device *pdev)dma_addr_t dma_handle;struct resource *res;int irq, ret; -u32 tmp;/* Setup network interface for RMII or MII mode */ - tmp =__raw_readl (LPC32XX_CLKPWR_MACCLK_CTRL ); - tmp &= ~LPC32XX_CLKPWR_MACCTRL_PINS_MSK ; -if (lpc_phy_interface_mode (dev) ==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 ); +lpc32xx_set_phy_interface_mode (lpc_phy_interface_mode (dev));/* Get platform resources */ res =platform_get_resource (pdev,IORESOURCE_MEM ,0 );
include/linux/soc/nxp/lpc32xx-misc.h +5 -0
@@ -9,9 +9,11 @@#define __SOC_LPC32XX_MISC_H#include <linux/types.h> +#include <linux/phy.h> #ifdef CONFIG_ARCH_LPC32XX extern u32 lpc32xx_return_iram (void __iomem **mapbase,dma_addr_t *dmaaddr); +extern void lpc32xx_set_phy_interface_mode (phy_interface_t mode);#else static inline u32 lpc32xx_return_iram (void __iomem **mapbase,dma_addr_t *dmaaddr) {
@@ -19,6 +21,9 @@ static inline u32 lpc32xx_return_iram(void __iomem **mapbase, dma_addr_t *dmaadd *dmaaddr =0 ;return 0 ; } +static inline void lpc32xx_set_phy_interface_mode (phy_interface_t mode) +{ +}#endif #endif /* __SOC_LPC32XX_MISC_H */
Signature · 1 line
2.20.0
PATCH v2 8/13 net: lpc-enet: fix badzero.cocci warnings
In reply to Arnd BergmannFrom: kbuild test robot <[email protected]>
drivers/net/ethernet/nxp/lpc_eth.c:1316:31-32: WARNING comparing pointer to 0
Compare pointer-typed values to NULL rather than 0
Semantic patch information:
This makes an effort to choose between !x and x == NULL. !x is used if it has previously been used with the function used to initialize x. This relies on type information. More type information can be obtained using the option -all_includes and the option -I to specify an include path.
Generated by: scripts/coccinelle/null/badzero.cocci
--- drivers/net/ethernet/nxp/lpc_eth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/nxp/lpc_eth.c +1 -1
@@ -1312,7 +1312,7 @@ static int lpc_eth_drv_probe(struct platform_device *pdev) } } -if (pldat->dma_buff_base_v ==0 ) { +if (pldat->dma_buff_base_v ==NULL ) { ret =dma_coerce_mask_and_coherent (dev,DMA_BIT_MASK (32 ));if (ret) goto err_out_free_irq;
Signature · 7 lines
2.20.0 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH v2 9/13 net: lpc-enet: fix printk format strings
In reply to Arnd Bergmanncompile-testing this driver on other architectures showed multiple warnings:
drivers/net/ethernet/nxp/lpc_eth.c: In function 'lpc_eth_drv_probe':
drivers/net/ethernet/nxp/lpc_eth.c:1337:19: warning: format '%d' expects argument of type 'int', but argument 4 has type 'resource_size_t {aka long long unsigned int}' [-Wformat=]
drivers/net/ethernet/nxp/lpc_eth.c:1342:19: warning: format '%x' expects argument of type 'unsigned int', but argument 4 has type 'dma_addr_t {aka long long unsigned int}' [-Wformat=]
Use format strings that work on all architectures.
--- drivers/net/ethernet/nxp/lpc_eth.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/net/ethernet/nxp/lpc_eth.c +7 -6
@@ -1333,13 +1333,14 @@ static int lpc_eth_drv_probe(struct platform_device *pdev) pldat->dma_buff_base_p = dma_handle;netdev_dbg (ndev,"IO address space :%pR\n" , res); -netdev_dbg (ndev,"IO address size :%d\n" ,resource_size (res)); +netdev_dbg (ndev,"IO address size :%zd\n" , + (size_t )resource_size (res));netdev_dbg (ndev,"IO address (mapped) :0x%p\n" , pldat->net_base);netdev_dbg (ndev,"IRQ number :%d\n" , ndev->irq); -netdev_dbg (ndev,"DMA buffer size :%d\n" , pldat->dma_buff_size); -netdev_dbg (ndev,"DMA buffer P address :0x%08x\n" , - pldat->dma_buff_base_p); +netdev_dbg (ndev,"DMA buffer size :%zd\n" , pldat->dma_buff_size); +netdev_dbg (ndev,"DMA buffer P address :%pad\n" , + &pldat->dma_buff_base_p);netdev_dbg (ndev,"DMA buffer V address :0x%p\n" , pldat->dma_buff_base_v);
@@ -1386,8 +1387,8 @@ static int lpc_eth_drv_probe(struct platform_device *pdev)if (ret) goto err_out_unregister_netdev; -netdev_info (ndev,"LPC mac at 0x%08x irq %d\n" , - res->start, ndev->irq); +netdev_info (ndev,"LPC mac at 0x%08lx irq %d\n" , + (unsigned long )res->start, ndev->irq);device_init_wakeup (dev,1 );device_set_wakeup_enable (dev,0 );
Signature · 1 line
2.20.0
Re: [PATCH v2 09/13] net: lpc-enet: fix printk format strings
Quoted 9 lines · Arnd Bergmann
compile-testing this driver on other architectures showed multiple warnings:
drivers/net/ethernet/nxp/lpc_eth.c: In function 'lpc_eth_drv_probe':
drivers/net/ethernet/nxp/lpc_eth.c:1337:19: warning: format '%d' expects argument of type 'int', but argument 4 has type 'resource_size_t{aka long long unsigned int}' [-Wformat=]
drivers/net/ethernet/nxp/lpc_eth.c:1342:19: warning: format '%x' expects argument of type 'unsigned int', but argument 4 has type 'dma_addr_t{aka long long unsigned int}' [-Wformat=]Use format strings that work on all architectures.
[]
drivers/net/ethernet/nxp/lpc_eth.c
Quoted 1 line
drivers/net/ethernet/nxp/lpc_eth.c +0
-0
[]
drivers/net/ethernet/nxp/lpc_eth.c static int lpc_eth_drv_probe(struct platform_device *pdev) · line 1337
Quoted 7 lines
drivers/net/ethernet/nxp/lpc_eth.c +2
-1@@ -1333,13 +1333,14 @@ static int lpc_eth_drv_probe(struct platform_device *pdev) pldat->dma_buff_base_p = dma_handle;netdev_dbg (ndev,"IO address space :%pR\n" , res); -netdev_dbg (ndev,"IO address size :%d\n" ,resource_size (res)); +netdev_dbg (ndev,"IO address size :%zd\n" , + (size_t )resource_size (res));
Ideally all these would use %zu not %zd
Re: [PATCH v2 09/13] net: lpc-enet: fix printk format strings
Quoted 9 lines · Joe Perches
drivers/net/ethernet/nxp/lpc_eth.c static int lpc_eth_drv_probe(struct platform_device *pdev) · line 1337
Quoted 7 lines
drivers/net/ethernet/nxp/lpc_eth.c +2
-1@@ -1333,13 +1333,14 @@ static int lpc_eth_drv_probe(struct platform_device *pdev) pldat->dma_buff_base_p = dma_handle;netdev_dbg (ndev,"IO address space :%pR\n" , res); -netdev_dbg (ndev,"IO address size :%d\n" ,resource_size (res)); +netdev_dbg (ndev,"IO address size :%zd\n" , + (size_t )resource_size (res));Ideally all these would use %zu not %zd
Ok, changed now.
Arnd
PATCH v2 10/13 net: lpc-enet: allow compile testing
In reply to Arnd BergmannThe lpc-enet driver can now be built on all platforms, so allow compile testing as well.
Add one missing header inclusion that is required in some configurations.
--- drivers/net/ethernet/nxp/Kconfig | 2 +- drivers/net/ethernet/nxp/lpc_eth.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/nxp/Kconfig +1 -1
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only config LPC_ENET tristate "NXP ethernet MAC on LPC devices" - depends on ARCH_LPC32XX + depends on ARCH_LPC32XX || COMPILE_TEST select PHYLIB help Say Y or M here if you want to use the NXP ethernet MAC included on
drivers/net/ethernet/nxp/lpc_eth.c +1 -0
@@ -14,6 +14,7 @@#include <linux/crc32.h> #include <linux/etherdevice.h> #include <linux/module.h> +#include <linux/of.h> #include <linux/of_net.h> #include <linux/phy.h> #include <linux/platform_device.h>
Signature · 1 line
2.20.0
PATCH v2 11/13 serial: lpc32xx: allow compile testing
In reply to Arnd BergmannThe lpc32xx_loopback_set() function in hte lpc32xx_hs driver is the one thing that relies on platform header files. Move that into the core platform code so we only need a variable declaration for it, and enable COMPILE_TEST building.
--- arch/arm/mach-lpc32xx/serial.c | 30 ++++++++++++++++++++++++ drivers/tty/serial/lpc32xx_hs.c | 35 ++++------------------------ include/linux/soc/nxp/lpc32xx-misc.h | 4 ++++ 3 files changed, 38 insertions(+), 31 deletions(-)
arch/arm/mach-lpc32xx/serial.c +30 -0
@@ -60,6 +60,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 ;
drivers/tty/serial/lpc32xx_hs.c +4 -31
@@ -25,6 +25,8 @@#include <linux/irq.h> #include <linux/gpio.h> #include <linux/of.h> +#include <linux/sizes.h> +#include <linux/soc/nxp/lpc32xx-misc.h> /* * High Speed UART register offsets
@@ -79,6 +81,8 @@#define LPC32XX_HSU_TX_TL8B (0x2 << 0)#define LPC32XX_HSU_TX_TL16B (0x3 << 0) +#define LPC32XX_MAIN_OSC_FREQ 13000000 +#define MODNAME "lpc32xx_hsuart"struct lpc32xx_hsuart_port {
@@ -149,8 +153,6 @@ static void lpc32xx_hsuart_console_write(struct console *co, const char *s,local_irq_restore (flags); } -static void lpc32xx_loopback_set (resource_size_t mapbase,int state); -static int __init lpc32xx_hsuart_console_setup (struct console *co,char *options) {
@@ -437,35 +439,6 @@ static void serial_lpc32xx_break_ctl(struct uart_port *port,spin_unlock_irqrestore (&port->lock, flags); } -/* LPC3250 Errata HSUART.1: Hang workaround via loopback mode on inactivity */ -static 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 ); -} -/* port->lock is not held. */ static int serial_lpc32xx_startup (struct uart_port *port) {
include/linux/soc/nxp/lpc32xx-misc.h +4 -0
@@ -14,6 +14,7 @@#ifdef CONFIG_ARCH_LPC32XX extern u32 lpc32xx_return_iram (void __iomem **mapbase,dma_addr_t *dmaaddr);extern void lpc32xx_set_phy_interface_mode (phy_interface_t mode); +extern void lpc32xx_loopback_set (resource_size_t mapbase,int state);#else static inline u32 lpc32xx_return_iram (void __iomem **mapbase,dma_addr_t *dmaaddr) {
@@ -24,6 +25,9 @@ static inline u32 lpc32xx_return_iram(void __iomem **mapbase, dma_addr_t *dmaaddstatic inline void lpc32xx_set_phy_interface_mode (phy_interface_t mode) { } +static inline void lpc32xx_loopback_set (resource_size_t mapbase,int state) +{ +}#endif #endif /* __SOC_LPC32XX_MISC_H */
Signature · 1 line
2.20.0
Re: [PATCH v2 11/13] serial: lpc32xx: allow compile testing
Quoted 6 lines · Arnd Bergmann
The
lpc32xx_loopback_set()function in htelpc32xx_hsdriver is the one thing that relies on platform header files. Move that into the core platform code so we only need a variable declaration for it, and enableCOMPILE_TESTbuilding.Signed-off-by Arnd Bergmann <[email protected]>
PATCH v2 12/13 ARM: lpc32xx: clean up header files
In reply to Arnd BergmannAll device drivers have stopped relying on mach/*.h headers, so move the remaining headers into arch/arm/mach-lpc32xx/lpc32xx.h to prepare for multiplatform builds.
The mach/entry-macro.S file has been unused for a long time now and can simply get removed.
---
arch/arm/mach-lpc32xx/common.c | 3 +-
.../mach-lpc32xx/include/mach/entry-macro.S | 28 -------------------
arch/arm/mach-lpc32xx/include/mach/hardware.h | 25 -----------------
.../mach-lpc32xx/include/mach/uncompress.h | 4 +--
.../{include/mach/platform.h => lpc32xx.h} | 18 ++++++++++--
arch/arm/mach-lpc32xx/pm.c | 3 +-
arch/arm/mach-lpc32xx/serial.c | 3 +-
arch/arm/mach-lpc32xx/suspend.S | 3 +-
8 files changed, 21 insertions(+), 66 deletions(-)
delete mode 100644 arch/arm/mach-lpc32xx/include/mach/entry-macro.S
delete mode 100644 arch/arm/mach-lpc32xx/include/mach/hardware.h
rename arch/arm/mach-lpc32xx/{include/mach/platform.h => lpc32xx.h} (98%)arch/arm/mach-lpc32xx/common.c +1 -2
@@ -13,8 +13,7 @@#include <asm/mach/map.h> #include <asm/system_info.h> -#include <mach/hardware.h> -#include <mach/platform.h> +#include "lpc32xx.h" #include "common.h" /*
arch/arm/mach-lpc32xx/include/mach/entry-macro.S deleted +0 -28
@@ -1,28 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ -/* - * arch/arm/mach-lpc32xx/include/mach/entry-macro.S - * - * Author: Kevin Wells <[email protected]> - * - * Copyright (C) 2010 NXP Semiconductors - */ - -#include <mach/hardware.h> -#include <mach/platform.h> - -#define LPC32XX_INTC_MASKED_STATUS_OFS 0x8 - - .macro get_irqnr_preamble, base, tmp - ldr \base, =IO_ADDRESS(LPC32XX_MIC_BASE) - .endm - -/* - * Return IRQ number in irqnr. Also return processor Z flag status in CPSR - * as set if an interrupt is pending. - */ - .macro get_irqnr_and_base, irqnr, irqstat, base, tmp - ldr \irqstat, [\base, #LPC32XX_INTC_MASKED_STATUS_OFS] - clz \irqnr, \irqstat - rsb \irqnr, \irqnr, #31 - teq \irqstat, #0 - .endm
arch/arm/mach-lpc32xx/include/mach/hardware.h deleted +0 -25
@@ -1,25 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ -/* -* arch/arm/mach-lpc32xx/include/mach/hardware.h -* -* Copyright (c) 2005 MontaVista Software, Inc. <[email protected]> -*/ - -#ifndef __ASM_ARCH_HARDWARE_H -#define __ASM_ARCH_HARDWARE_H - -/* -* 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
arch/arm/mach-lpc32xx/include/mach/uncompress.h +1 -3
@@ -12,15 +12,13 @@#include <linux/io.h> -#include <mach/hardware.h> -#include <mach/platform.h> -/* * Uncompress output is hardcoded to standard UART 5 */ #define UART_FIFO_CTL_TX_RESET (1 << 2)#define UART_STATUS_TX_MT (1 << 6) +#define LPC32XX_UART5_BASE 0x40090000#define _UARTREG (x) (void __iomem *)(LPC32XX_UART5_BASE + (x))
arch/arm/mach-lpc32xx/lpc32xx.h renamed from arch/arm/mach-lpc32xx/include/mach/platform.h +16 -2
@@ -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)
@@ -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
arch/arm/mach-lpc32xx/pm.c +1 -2
@@ -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)
arch/arm/mach-lpc32xx/serial.c +1 -2
@@ -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
arch/arm/mach-lpc32xx/suspend.S +1 -2
@@ -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
Signature · 1 line
2.20.0
PATCH v2 13/13 ARM: lpc32xx: allow multiplatform build
In reply to Arnd BergmannAll preparation work is done, so the platform can finally be moved into ARCH_MULTIPLATFORM. This requires a small change to the defconfig file to enable the platform.
--- arch/arm/Kconfig | 17 +------ arch/arm/configs/lpc32xx_defconfig | 1 + arch/arm/mach-lpc32xx/Kconfig | 11 +++++ .../mach-lpc32xx/include/mach/uncompress.h | 48 ------------------- 4 files changed, 14 insertions(+), 63 deletions(-) create mode 100644 arch/arm/mach-lpc32xx/Kconfig delete mode 100644 arch/arm/mach-lpc32xx/include/mach/uncompress.h
arch/arm/Kconfig +2 -15
@@ -478,21 +478,6 @@ config ARCH_W90X900 <http://www.nuvoton.com/hq/enu/ProductAndSales/ProductLines/ ConsumerElectronicsIC/ARMMicrocontroller/ARMMicrocontroller> -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
@@ -746,6 +731,8 @@ source "arch/arm/mach-keystone/Kconfig" source "arch/arm/mach-ks8695/Kconfig" +source "arch/arm/mach-lpc32xx/Kconfig" + source "arch/arm/mach-mediatek/Kconfig" source "arch/arm/mach-meson/Kconfig"
arch/arm/configs/lpc32xx_defconfig +1 -0
@@ -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
arch/arm/mach-lpc32xx/Kconfig new file +11 -0
@@ -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
arch/arm/mach-lpc32xx/include/mach/uncompress.h deleted +0 -48
48 lines not on this page · raw message
Signature · 1 line
2.20.0