lpc32xx: Kconfig: switch to CONFIG_CONS_INDEX
Subsystems (6)
PATCH v2 1/8 lpc32xx: Kconfig: switch to CONFIG_CONS_INDEX
There's nothing special or unique to the lpc32xx that requires its own config parameter for specifying the console uart index. Therefore instead of using the lpc32xx-specific CONFIG_SYS_LPC32XX_UART include parameter, use the already-available CONFIG_CONS_INDEX from Kconfig.
---
(no changes since v1)
arch/arm/include/asm/arch-lpc32xx/config.h | 4 ++-- arch/arm/mach-lpc32xx/devices.c | 3 +-- board/timll/devkit3250/devkit3250.c | 2 +- board/timll/devkit3250/devkit3250_spl.c | 2 +- board/work-microwave/work_92105/work_92105.c | 2 +- board/work-microwave/work_92105/work_92105_spl.c | 2 +- configs/devkit3250_defconfig | 2 ++ configs/work_92105_defconfig | 2 ++ include/configs/devkit3250.h | 5 ----- include/configs/work_92105.h | 5 ----- scripts/config_whitelist.txt | 1 - 11 files changed, 11 insertions(+), 19 deletions(-)
arch/arm/include/asm/arch-lpc32xx/config.h +2 -2
@@ -12,8 +12,8 @@/* Basic CPU architecture */ /* UART configuration */ -#if (CONFIG_SYS_LPC32XX_UART ==1 ) || (CONFIG_SYS_LPC32XX_UART ==2 ) || \ - (CONFIG_SYS_LPC32XX_UART ==7 ) +#if (CONFIG_CONS_INDEX ==1 ) || (CONFIG_CONS_INDEX ==2 ) || \ + (CONFIG_CONS_INDEX ==7 )#if !defined(CONFIG_LPC32XX_HSUART )#define CONFIG_LPC32XX_HSUART #endif
arch/arm/mach-lpc32xx/devices.c +1 -2
@@ -23,8 +23,7 @@ void lpc32xx_uart_init(unsigned int uart_id)return ;/* Disable loopback mode, if it is set by S1L bootloader */ -clrbits_le32 (&ctrl->loop, -UART_LOOPBACK (CONFIG_SYS_LPC32XX_UART )); +clrbits_le32 (&ctrl->loop,UART_LOOPBACK (uart_id));if (uart_id <3 || uart_id >6 )return ;
board/timll/devkit3250/devkit3250.c +1 -1
@@ -38,7 +38,7 @@ void reset_periph(void)int board_early_init_f (void ) { -lpc32xx_uart_init (CONFIG_SYS_LPC32XX_UART ); +lpc32xx_uart_init (CONFIG_CONS_INDEX );lpc32xx_i2c_init (1 );lpc32xx_i2c_init (2 );lpc32xx_ssp_init ();
board/timll/devkit3250/devkit3250_spl.c +1 -1
@@ -49,7 +49,7 @@ void spl_board_init(void)/* First of all silence buzzer controlled by GPO_20 */ writel ((1 <<20 ), &gpio->p3_outp_clr); -lpc32xx_uart_init (CONFIG_SYS_LPC32XX_UART ); +lpc32xx_uart_init (CONFIG_CONS_INDEX );preloader_console_init ();ddr_init (&dram_64mb);
board/work-microwave/work_92105/work_92105.c +1 -1
@@ -37,7 +37,7 @@ void reset_periph(void)int board_early_init_f (void ) {/* initialize serial port for console */ -lpc32xx_uart_init (CONFIG_SYS_LPC32XX_UART ); +lpc32xx_uart_init (CONFIG_CONS_INDEX );/* enable I2C, SSP, MAC, NAND */ lpc32xx_i2c_init (1 );/* only I2C1 has devices, I2C2 has none */ lpc32xx_ssp_init ();
board/work-microwave/work_92105/work_92105_spl.c +1 -1
@@ -58,7 +58,7 @@ const struct emc_dram_settings dram_128mb = {void spl_board_init (void ) {/* initialize serial port for console */ -lpc32xx_uart_init (CONFIG_SYS_LPC32XX_UART ); +lpc32xx_uart_init (CONFIG_CONS_INDEX );/* initialize console */ preloader_console_init ();/* init DDR and NAND to chainload U-Boot */
configs/devkit3250_defconfig +2 -0
@@ -51,6 +51,8 @@ CONFIG_PHYLIB=y CONFIG_PHY_ADDR_ENABLE=y CONFIG_PHY_ADDR=31 CONFIG_PHY_SMSC=y +CONFIG_SPECIFY_CONSOLE_INDEX=y +CONFIG_CONS_INDEX=5 CONFIG_SYS_NS16550=y CONFIG_SPI=y CONFIG_USB=y
configs/work_92105_defconfig +2 -0
@@ -48,5 +48,7 @@ CONFIG_MTD_RAW_NAND=y CONFIG_PHYLIB=y CONFIG_PHY_ADDR_ENABLE=y CONFIG_PHY_SMSC=y +CONFIG_SPECIFY_CONSOLE_INDEX=y +CONFIG_CONS_INDEX=5 CONFIG_SYS_NS16550=y CONFIG_SPI=y
include/configs/devkit3250.h +0 -5
@@ -30,11 +30,6 @@#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_SDRAM_BASE + SZ_4K \ - GENERATED_GBL_DATA_SIZE) -/* -* Serial Driver -*/ -#define CONFIG_SYS_LPC32XX_UART 5/* UART5 */ -/* * DMA */
include/configs/work_92105.h +0 -5
@@ -35,11 +35,6 @@#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_SDRAM_BASE + SZ_512K \ - GENERATED_GBL_DATA_SIZE) -/* -* Serial Driver -*/ -#define CONFIG_SYS_LPC32XX_UART 5/* UART5 - NS16550 */ -/* * Ethernet Driver */
scripts/config_whitelist.txt +0 -1
@@ -2735,7 +2735,6 @@ CONFIG_SYS_LOW CONFIG_SYS_LOWMEM_BASE CONFIG_SYS_LOW_RES_TIMER CONFIG_SYS_LPAE_SDRAM_BASE -CONFIG_SYS_LPC32XX_UART CONFIG_SYS_LS1_DDR_BLOCK1_SIZE CONFIG_SYS_LS_MC_AIOP_IMG_MAX_LENGTH CONFIG_SYS_LS_MC_BOOT_TIMEOUT_MS
Signature · 1 line
2.30.0.rc0
PATCH v2 2/8 lpc32xx: import device tree from Linux
Import the dtsi, dts, and clock binding files for the lpc32xx ea3250 board directly and unmodified from the latest Linux kernel.
---
(no changes since v1)
arch/arm/dts/lpc3250-ea3250.dts | 273 ++++++++++++ arch/arm/dts/lpc32xx.dtsi | 508 ++++++++++++++++++++++ include/dt-bindings/clock/lpc32xx-clock.h | 58 +++ 3 files changed, 839 insertions(+) create mode 100644 arch/arm/dts/lpc3250-ea3250.dts create mode 100644 arch/arm/dts/lpc32xx.dtsi create mode 100644 include/dt-bindings/clock/lpc32xx-clock.h
arch/arm/dts/lpc3250-ea3250.dts new file +273 -0
@@ -0,0 +1,273 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Embedded Artists LPC3250 board + * + * Copyright 2012 Roland Stigge <[email protected]> + */ + +/dts-v1/; +#include "lpc32xx.dtsi" + +/ { + model = "Embedded Artists LPC3250 board based on NXP LPC3250"; + compatible = "ea,ea3250", "nxp,lpc3250"; + + memory@80000000 { + device_type = "memory"; + reg = <0x80000000 0x4000000>; + }; + + gpio-keys { + compatible = "gpio-keys"; + autorepeat; + + button { + label = "Interrupt Key"; + linux,code = <103>; + gpios = <&gpio 4 1 0>; /* GPI_P3 1 */ + }; + + key1 { + label = "KEY1"; + linux,code = <1>; + gpios = <&pca9532 0 0>; + }; + + key2 { + label = "KEY2"; + linux,code = <2>; + gpios = <&pca9532 1 0>; + }; + + key3 { + label = "KEY3"; + linux,code = <3>; + gpios = <&pca9532 2 0>; + }; + + key4 { + label = "KEY4"; + linux,code = <4>; + gpios = <&pca9532 3 0>; + }; + + joy0 { + label = "Joystick Key 0"; + linux,code = <10>; + gpios = <&gpio 2 0 0>; /* P2.0 */ + }; + + joy1 { + label = "Joystick Key 1"; + linux,code = <11>; + gpios = <&gpio 2 1 0>; /* P2.1 */ + }; + + joy2 { + label = "Joystick Key 2"; + linux,code = <12>; + gpios = <&gpio 2 2 0>; /* P2.2 */ + }; + + joy3 { + label = "Joystick Key 3"; + linux,code = <13>; + gpios = <&gpio 2 3 0>; /* P2.3 */ + }; + + joy4 { + label = "Joystick Key 4"; + linux,code = <14>; + gpios = <&gpio 2 4 0>; /* P2.4 */ + }; + }; + + leds { + compatible = "gpio-leds"; + + /* LEDs on OEM Board */ + + led1 { + gpios = <&gpio 5 14 1>; /* GPO_P3 14, GPIO 93, active low */ + linux,default-trigger = "timer"; + default-state = "off"; + }; + + led2 { + gpios = <&gpio 2 10 1>; /* P2.10, active low */ + default-state = "off"; + }; + + led3 { + gpios = <&gpio 2 11 1>; /* P2.11, active low */ + default-state = "off"; + }; + + led4 { + gpios = <&gpio 2 12 1>; /* P2.12, active low */ + default-state = "off"; + }; + + /* LEDs on Base Board */ + + lede1 { + gpios = <&pca9532 8 0>; + default-state = "off"; + }; + lede2 { + gpios = <&pca9532 9 0>; + default-state = "off"; + }; + lede3 { + gpios = <&pca9532 10 0>; + default-state = "off"; + }; + lede4 { + gpios = <&pca9532 11 0>; + default-state = "off"; + }; + lede5 { + gpios = <&pca9532 12 0>; + default-state = "off"; + }; + lede6 { + gpios = <&pca9532 13 0>; + default-state = "off"; + }; + lede7 { + gpios = <&pca9532 14 0>; + default-state = "off"; + }; + lede8 { + gpios = <&pca9532 15 0>; + default-state = "off"; + }; + }; +}; + +/* 3-axis accelerometer X,Y,Z (or AD-IN instead of Z) */ +&adc { + status = "okay"; +}; + +&i2c1 { + clock-frequency = <100000>; + + uda1380: uda1380@18 { + compatible = "nxp,uda1380"; + reg = <0x18>; + power-gpio = <&gpio 3 10 0>; + reset-gpio = <&gpio 3 2 0>; + dac-clk = "wspll"; + }; + + eeprom@50 { + compatible = "atmel,24c256"; + reg = <0x50>; + }; + + eeprom@57 { + compatible = "atmel,24c64"; + reg = <0x57>; + }; + + pca9532: pca9532@60 { + compatible = "nxp,pca9532"; + gpio-controller; + #gpio-cells = <2>; + reg = <0x60>; + }; +}; + +&i2c2 { + clock-frequency = <100000>; +}; + +&i2cusb { + clock-frequency = <100000>; + + isp1301: usb-transceiver@2d { + compatible = "nxp,isp1301"; + reg = <0x2d>; + }; +}; + +&mac { + phy-mode = "rmii"; + use-iram; + status = "okay"; +}; + +/* Here, choose exactly one from: ohci, usbd */ +&ohci /* &usbd */ { + transceiver = <&isp1301>; + status = "okay"; +}; + +&sd { + wp-gpios = <&pca9532 5 0>; + cd-gpios = <&pca9532 4 0>; + cd-inverted; + bus-width = <4>; + status = "okay"; +}; + +/* 128MB Flash via SLC NAND controller */ +&slc { + status = "okay"; + + nxp,wdr-clks = <14>; + nxp,wwidth = <260000000>; + nxp,whold = <104000000>; + nxp,wsetup = <200000000>; + nxp,rdr-clks = <14>; + nxp,rwidth = <34666666>; + nxp,rhold = <104000000>; + nxp,rsetup = <200000000>; + nand-on-flash-bbt; + gpios = <&gpio 5 19 1>; /* GPO_P3 19, active low */ + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + mtd0@0 { + label = "ea3250-boot"; + reg = <0x00000000 0x00080000>; + read-only; + }; + + mtd1@80000 { + label = "ea3250-uboot"; + reg = <0x00080000 0x000c0000>; + read-only; + }; + + mtd2@140000 { + label = "ea3250-kernel"; + reg = <0x00140000 0x00400000>; + }; + + mtd3@540000 { + label = "ea3250-rootfs"; + reg = <0x00540000 0x07ac0000>; + }; + }; +}; + +&uart1 { + status = "okay"; +}; + +&uart3 { + status = "okay"; +}; + +&uart5 { + status = "okay"; +}; + +&uart6 { + status = "okay"; +};
arch/arm/dts/lpc32xx.dtsi new file +508 -0
508 lines not on this page · raw message
include/dt-bindings/clock/lpc32xx-clock.h new file +58 -0
58 lines not on this page · raw message
Signature · 1 line
2.30.0.rc0
PATCH v2 3/8 arm: lpc32xx: add EA LPC3250 DevKitv2 board support
In reply to Trevor WoernerAdd basic support for running U-Boot on the Embedded Artists LPC3250 Developer's Kit v2 board by launching U-Boot from the board's s1l loader (which comes pre-installed on the board).
---
(no changes since v1)
arch/arm/dts/Makefile | 2 + arch/arm/dts/lpc3250-ea3250-u-boot.dtsi | 15 ++ arch/arm/mach-lpc32xx/Kconfig | 4 + board/ea/ea-lpc3250devkitv2/Kconfig | 15 ++ board/ea/ea-lpc3250devkitv2/MAINTAINERS | 9 ++ board/ea/ea-lpc3250devkitv2/Makefile | 4 + board/ea/ea-lpc3250devkitv2/README.rst | 132 ++++++++++++++++++ .../ea-lpc3250devkitv2/ea-lpc3250devkitv2.c | 37 +++++ configs/ea-lpc3250devkitv2_defconfig | 23 +++ include/configs/ea-lpc3250devkitv2.h | 37 +++++ 10 files changed, 278 insertions(+) create mode 100644 arch/arm/dts/lpc3250-ea3250-u-boot.dtsi create mode 100644 board/ea/ea-lpc3250devkitv2/Kconfig create mode 100644 board/ea/ea-lpc3250devkitv2/MAINTAINERS create mode 100644 board/ea/ea-lpc3250devkitv2/Makefile create mode 100644 board/ea/ea-lpc3250devkitv2/README.rst create mode 100644 board/ea/ea-lpc3250devkitv2/ea-lpc3250devkitv2.c create mode 100644 configs/ea-lpc3250devkitv2_defconfig create mode 100644 include/configs/ea-lpc3250devkitv2.h
arch/arm/dts/Makefile +2 -0
@@ -1103,6 +1103,8 @@ dtb-$(CONFIG_TARGET_PRESIDIO_ASIC) += ca-presidio-engboard.dtb dtb-$(CONFIG_TARGET_IMX8MM_CL_IOT_GATE) += imx8mm-cl-iot-gate.dtb +dtb-$(CONFIG_TARGET_EA_LPC3250DEVKITV2) += lpc3250-ea3250.dtb + targets += $(dtb-y) # Add any required device tree compiler flags here
arch/arm/dts/lpc3250-ea3250-u-boot.dtsi new file +15 -0
@@ -0,0 +1,15 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2021 Trevor Woerner <[email protected]> + */ + +/{ + model = "Embedded Artists LPC3250 DevKit v2 board based on the NXP LPC3250 SoC"; + chosen { + stdout-path = &uart5; + }; +}; + +&uart5 { + compatible = "nxp,lpc3220-uart", "ns16550a"; +};
arch/arm/mach-lpc32xx/Kconfig +4 -0
@@ -12,9 +12,13 @@ config TARGET_DEVKIT3250 config TARGET_WORK_92105 bool "Work Microwave Work_92105" +config TARGET_EA_LPC3250DEVKITV2 + bool "Embedded Artists LPC3250 Developer's Kit v2" + endchoice source "board/timll/devkit3250/Kconfig" source "board/work-microwave/work_92105/Kconfig" +source "board/ea/ea-lpc3250devkitv2/Kconfig" endif
board/ea/ea-lpc3250devkitv2/Kconfig new file +15 -0
@@ -0,0 +1,15 @@ +if TARGET_EA_LPC3250DEVKITV2 + +config SYS_BOARD + default "ea-lpc3250devkitv2" + +config SYS_VENDOR + default "ea" + +config SYS_SOC + default "lpc32xx" + +config SYS_CONFIG_NAME + default "ea-lpc3250devkitv2" + +endif
board/ea/ea-lpc3250devkitv2/MAINTAINERS new file +9 -0
@@ -0,0 +1,9 @@ +EMBEDDED ARTISTS LPC3250 DEVKIT v2 +M: Trevor Woerner <[email protected]> +S: Maintained +F: board/ea/ea-lpc3250devkitv2 +F: include/configs/ea-lpc3250devkitv2.h +F: configs/ea-lpc3250devkitv2_defconfig +F: arch/arm/dts/lpc32xx.dtsi +F: arch/arm/dts/lpc3250-ea3250.dts +F: arch/arm/dts/lpc3250-ea3250-u-boot.dtsi
board/ea/ea-lpc3250devkitv2/Makefile new file +4 -0
@@ -0,0 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0+ +# Copyright (C) 2021 Trevor Woerner <[email protected]> + +obj-y += ea-lpc3250devkitv2.o
board/ea/ea-lpc3250devkitv2/README.rst new file +132 -0
132 lines not on this page · raw message
board/ea/ea-lpc3250devkitv2/ea-lpc3250devkitv2.c new file +37 -0
@@ -0,0 +1,37 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Board init file for Embedded Artists LPC3250 DevKit v2 +* Copyright (C) 2021 Trevor Woerner <[email protected]> +*/ + +#include <init.h> +#include <common.h> +#include <asm/io.h> +#include <asm/global_data.h> + +#include <asm/arch/clk.h> +#include <asm/arch/wdt.h> +#include <asm/arch/sys_proto.h> + +DECLARE_GLOBAL_DATA_PTR ; + +int +board_early_init_f (void ) +{ +lpc32xx_uart_init (CONFIG_CONS_INDEX ); +return 0 ; +} + +int +board_init (void ) +{ + gd->bd->bi_boot_params =CONFIG_SYS_SDRAM_BASE +0x2000 ; +return 0 ; +} + +int +dram_init (void ) +{ + gd->ram_size =get_ram_size ((void *)CONFIG_SYS_SDRAM_BASE ,SZ_64M ); +return 0 ; +}
configs/ea-lpc3250devkitv2_defconfig new file +23 -0
@@ -0,0 +1,23 @@ +CONFIG_ARM=y +CONFIG_SYS_ICACHE_OFF=y +CONFIG_SYS_DCACHE_OFF=y +CONFIG_ARCH_CPU_INIT=y +CONFIG_ARCH_LPC32XX=y +CONFIG_SYS_TEXT_BASE=0x83000000 +CONFIG_NR_DRAM_BANKS=1 +CONFIG_TARGET_EA_LPC3250DEVKITV2=y +CONFIG_DEFAULT_DEVICE_TREE="lpc3250-ea3250" +CONFIG_DISTRO_DEFAULTS=y +# CONFIG_ARCH_FIXUP_FDT_MEMORY is not set +# CONFIG_AUTOBOOT is not set +# CONFIG_USE_BOOTCOMMAND is not set +CONFIG_BOARD_EARLY_INIT_F=y +CONFIG_SYS_PROMPT="EA-LPC3250v2=> " +CONFIG_CMD_GPIO=y +CONFIG_OF_CONTROL=y +# CONFIG_NET is not set +CONFIG_LPC32XX_GPIO=y +CONFIG_SPECIFY_CONSOLE_INDEX=y +CONFIG_CONS_INDEX=5 +CONFIG_SYS_NS16550=y +CONFIG_PANIC_HANG=y
include/configs/ea-lpc3250devkitv2.h new file +37 -0
@@ -0,0 +1,37 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Embedded Artists LPC3250 DevKit v2 +* Copyright (C) 2021 Trevor Woerner <[email protected]> +*/ + +#ifndef __CONFIG_EA_LPC3250DEVKITV2_H__ +#define __CONFIG_EA_LPC3250DEVKITV2_H__ + +#include <linux/sizes.h> +#include <asm/arch/cpu.h> + +/* +* SoC and board defines +*/ +#define CONFIG_MACH_TYPE MACH_TYPE_LPC3XXX +#define CONFIG_SKIP_LOWLEVEL_INIT +#define CONFIG_BOARD_SIZE_LIMIT 0x000fffff/* maximum allowable size for full U-Boot binary */ + +/* +* RAM +*/ +#define CONFIG_SYS_MALLOC_LEN SZ_4M +#define CONFIG_SYS_SDRAM_BASE EMC_DYCS0_BASE + +/* +* cmd +*/ +#define CONFIG_SYS_LOAD_ADDR 0x80100000 +#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_SDRAM_BASE + SZ_4K - GENERATED_GBL_DATA_SIZE) + +/* +* SoC-specific config +*/ +#include <asm/arch/config.h> + +#endif
Signature · 1 line
2.30.0.rc0
PATCH v2 4/8 lpc32xx: i2c: remove unused define
In reply to Trevor WoernerThe LPC32XX_I2C_STAT_DRMI is not used anywhere so remove it.
---
Changes in v2:
- added
drivers/i2c/lpc32xx_i2c.c | 1 - 1 file changed, 1 deletion(-)
drivers/i2c/lpc32xx_i2c.c +0 -1
@@ -38,7 +38,6 @@/* Status register values */ #define LPC32XX_I2C_STAT_TFF 0x00000400#define LPC32XX_I2C_STAT_RFE 0x00000200 -#define LPC32XX_I2C_STAT_DRMI 0x00000008#define LPC32XX_I2C_STAT_NAI 0x00000004#define LPC32XX_I2C_STAT_TDI 0x00000001
Signature · 1 line
2.30.0.rc0
PATCH v2 5/8 lpc32xx: i2c: fix base address
In reply to Trevor WoernerThe lpc32xx driver was not obtaining the per-device base address correctly from the device tree. Fix the FIXME in order to get the correct base address.
---
Changes in v2:
- added
drivers/i2c/lpc32xx_i2c.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/i2c/lpc32xx_i2c.c +1 -5
@@ -282,11 +282,7 @@ static int lpc32xx_i2c_probe(struct udevice *bus) {struct lpc32xx_i2c_dev *dev =dev_get_plat (bus); -/* -* FIXME: This is not permitted -* dev_seq(bus) = dev->index; -*/ - + dev->base =dev_read_addr_ptr (bus);__i2c_init (dev->base, dev->speed,0 , dev->index);return 0 ; }
Signature · 1 line
2.30.0.rc0
PATCH v2 6/8 lpc32xx: i2c: finish DM/OF code
In reply to Trevor WoernerAdd the of_match/compatible string to the lpc32xx i2c driver so it works correctly with device-tree.
---
Changes in v2:
- added
drivers/i2c/lpc32xx_i2c.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/i2c/lpc32xx_i2c.c +7 -1
@@ -348,9 +348,15 @@ static const struct dm_i2c_ops lpc32xx_i2c_ops = { .set_bus_speed = lpc32xx_i2c_set_bus_speed, }; +static const struct udevice_id lpc32xx_i2c_ids[] = { + { .compatible ="nxp,pnx-i2c" }, + { } +}; +U_BOOT_DRIVER (i2c_lpc32xx) = { - .id =UCLASS_I2C , .name ="i2c_lpc32xx" , + .id =UCLASS_I2C , + .of_match = lpc32xx_i2c_ids, .probe = lpc32xx_i2c_probe, .ops = &lpc32xx_i2c_ops, };
Signature · 1 line
2.30.0.rc0
PATCH v2 8/8 lpc32xx: ea-lpc3250devkitv2: enable i2c (DM)
In reply to Trevor WoernerEnable a DMed i2c driver for the ea-lpc3250devkitv2 board. Include some sample commands/output for testing.
---
Changes in v2:
- added
board/ea/ea-lpc3250devkitv2/README.rst | 54 +++++++++++++++++++ .../ea-lpc3250devkitv2/ea-lpc3250devkitv2.c | 4 ++ configs/ea-lpc3250devkitv2_defconfig | 3 ++ 3 files changed, 61 insertions(+)
board/ea/ea-lpc3250devkitv2/README.rst +54 -0
@@ -4,6 +4,7 @@ ToC: - Introduction - Booting - Debugging +- i2c Introduction
@@ -130,3 +131,56 @@ dongle from Olimex successfully as follows: # openocd \ -f interface/ftdi/olimex-arm-usb-ocd-h.cfg \ -f board/phytec_lpc3250.cfg + + +i2c +=== +Some of the LEDs on the board are connected via an I/O Expander (PCA9532) that +is attached to the i2c1 bus. Here is a sample session of toggling some of +these LEDs via i2c in U-Boot: + +show the existing i2c busses: + EA-LPC3250v2=> i2c bus + Bus 0: i2c@300 + Bus 1: i2c@400a0000 + Bus 2: i2c@400a8000 + +set i2c1 as the current bus: + EA-LPC3250v2=> i2c dev 1 + Setting bus to 1 + +see what potential devices are found with rudimentary probing on i2c1: + EA-LPC3250v2=> i2c probe + Valid chip addresses: 1A 1D 48 50 57 60 66 6E + +According to the schematics the i2c slave address of the PCA9532 is 0x60. + +dump all of the 10 registers from the I/O Expander; NOTE that the 0x10 in the +command specifies the self-incrementing mode of the PCA9532; also NOTE that +the values repeat themseves to fill out a full 16 bytes: + EA-LPC3250v2=> i2c md 0x60 0x10 10 + 0010: 00 ff 00 80 00 80 00 00 00 00 4f ff 00 80 00 80 ..........O..... + +turn on LEDs 23, 25, 27, and 29 (green): + EA-LPC3250v2=> i2c mw 0x60 9 0x55 + +turn on LEDs 22, 24, 26, and 28 (red): + EA-LPC3250v2=> i2c mw 0x60 8 0x55 + +dim the green LEDs (23, 25, 27, 29): + EA-LPC3250v2=> i2c mw 0x60 3 0x20 + EA-LPC3250v2=> i2c mw 0x60 9 0xaa + +turn off all LEDs (23-29): + EA-LPC3250v2=> i2c mw 0x60 8 0 + EA-LPC3250v2=> i2c mw 0x60 9 0 + +read value of switches (input): + EA-LPC3250v2=> i2c md 0x60 0 1 + 0000: 4f O +[none are pressed] + +press and hold SW2 while running the following: + EA-LPC3250v2=> i2c md 0x60 0 1 + 0000: 4e N +[SW2 is pressed]
board/ea/ea-lpc3250devkitv2/ea-lpc3250devkitv2.c +4 -0
@@ -19,6 +19,10 @@ intboard_early_init_f (void) {lpc32xx_uart_init (CONFIG_CONS_INDEX ); +if (IS_ENABLED (CONFIG_SYS_I2C_LPC32XX )) { +lpc32xx_i2c_init (1 ); +lpc32xx_i2c_init (2 ); + }return 0 ; }
configs/ea-lpc3250devkitv2_defconfig +3 -0
@@ -14,9 +14,12 @@ CONFIG_DISTRO_DEFAULTS=y CONFIG_BOARD_EARLY_INIT_F=y CONFIG_SYS_PROMPT="EA-LPC3250v2=> " CONFIG_CMD_GPIO=y +CONFIG_CMD_I2C=y CONFIG_OF_CONTROL=y # CONFIG_NET is not set CONFIG_LPC32XX_GPIO=y +CONFIG_DM_I2C=y +CONFIG_SYS_I2C_LPC32XX=y CONFIG_SPECIFY_CONSOLE_INDEX=y CONFIG_CONS_INDEX=5 CONFIG_SYS_NS16550=y
Signature · 1 line
2.30.0.rc0
PATCH v2 7/8 Kconfig: convert CONFIG_SYS_I2C_LPC32XX
In reply to Trevor WoernerConvert the CONFIG_SYS_I2C_LPC32XX configuration symbol from an include directive to a Kconfig value.
---
Changes in v2:
- added
configs/devkit3250_defconfig | 1 + configs/work_92105_defconfig | 1 + drivers/i2c/Kconfig | 6 ++++++ include/configs/devkit3250.h | 1 - include/configs/work_92105.h | 1 - scripts/config_whitelist.txt | 1 - 6 files changed, 8 insertions(+), 3 deletions(-)
configs/devkit3250_defconfig +1 -0
@@ -38,6 +38,7 @@ CONFIG_CMD_JFFS2=y CONFIG_ENV_IS_IN_NAND=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_VERSION_VARIABLE=y +CONFIG_SYS_I2C_LPC32XX=y # CONFIG_MMC is not set CONFIG_MTD=y CONFIG_MTD_NOR_FLASH=y
configs/work_92105_defconfig +1 -0
@@ -42,6 +42,7 @@ CONFIG_DOS_PARTITION=y CONFIG_ENV_IS_IN_NAND=y CONFIG_SYS_REDUNDAND_ENVIRONMENT=y CONFIG_VERSION_VARIABLE=y +CONFIG_SYS_I2C_LPC32XX=y # CONFIG_MMC is not set CONFIG_MTD=y CONFIG_MTD_RAW_NAND=y
drivers/i2c/Kconfig +6 -0
@@ -169,6 +169,12 @@ config SYS_I2C_IMX_LPI2C help Add support for the NXP i.MX LPI2C driver. +config SYS_I2C_LPC32XX + bool "LPC32XX I2C driver" + depends on ARCH_LPC32XX + help + Enable support for the LPC32xx I2C driver. + config SYS_I2C_MESON bool "Amlogic Meson I2C driver" depends on DM_I2C && ARCH_MESON
include/configs/devkit3250.h +0 -1
@@ -41,7 +41,6 @@* I2C */ #define CONFIG_SYS_I2C -#define CONFIG_SYS_I2C_LPC32XX #define CONFIG_SYS_I2C_SPEED 100000/*
include/configs/work_92105.h +0 -1
@@ -47,7 +47,6 @@* I2C driver */ -#define CONFIG_SYS_I2C_LPC32XX #define CONFIG_SYS_I2C #define CONFIG_SYS_I2C_SPEED 350000
scripts/config_whitelist.txt +0 -1
@@ -2543,7 +2543,6 @@ CONFIG_SYS_I2C_INIT_BOARD CONFIG_SYS_I2C_LDI_ADDR CONFIG_SYS_I2C_LM75_ADDR CONFIG_SYS_I2C_LM90_ADDR -CONFIG_SYS_I2C_LPC32XX CONFIG_SYS_I2C_LPC32XX_SLAVE CONFIG_SYS_I2C_LPC32XX_SPEED CONFIG_SYS_I2C_MAC1_BUS
Signature · 1 line
2.30.0.rc0
Re: [PATCH v2 7/8] Kconfig: convert CONFIG_SYS_I2C_LPC32XX
Quoted 11 lines · Trevor Woerner
Convert the
CONFIG_SYS_I2C_LPC32XXconfiguration symbol from an include directive to aKconfigvalue.Signed-off-by Trevor Woerner <[email protected]>---
Changes in v2:
- added
Quoted 7 lines
configs/devkit3250_defconfig | 1 + configs/work_92105_defconfig | 1 + drivers/i2c/Kconfig | 6 ++++++ include/configs/devkit3250.h | 1 - include/configs/work_92105.h | 1 - scripts/config_whitelist.txt | 1 - 6 files changed, 8 insertions(+), 3 deletions(-)
Could use more help on the Kconfig though
Quoted 11 lines · Trevor Woerner
There's nothing special or unique to the lpc32xx that requires its own config parameter for specifying the console uart index. Therefore instead of using the lpc32xx-specific
CONFIG_SYS_LPC32XX_UARTinclude parameter, use the already-availableCONFIG_CONS_INDEXfromKconfig.Signed-off-by Trevor Woerner <[email protected]>---
(no changes since v1)
Quoted 13 lines
arch/arm/include/asm/arch-lpc32xx/config.h | 4 ++-- arch/arm/mach-lpc32xx/devices.c | 3 +-- board/timll/devkit3250/devkit3250.c | 2 +- board/timll/devkit3250/devkit3250_spl.c | 2 +- board/work-microwave/work_92105/work_92105.c | 2 +- board/work-microwave/work_92105/work_92105_spl.c | 2 +- configs/devkit3250_defconfig | 2 ++ configs/work_92105_defconfig | 2 ++ include/configs/devkit3250.h | 5 ----- include/configs/work_92105.h | 5 ----- scripts/config_whitelist.txt | 1 - 11 files changed, 11 insertions(+), 19 deletions(-)
Quoted 7 lines · Trevor Woerner
There's nothing special or unique to the lpc32xx that requires its own config parameter for specifying the console uart index. Therefore instead of using the lpc32xx-specific
CONFIG_SYS_LPC32XX_UARTinclude parameter, use the already-availableCONFIG_CONS_INDEXfromKconfig.Signed-off-by Trevor Woerner <[email protected]>Reviewed-by Simon Glass <[email protected]>
For the series, applied to u-boot/master, thanks!
Signature · 1 line
Tom