Extend LPC32xx functionality and add LPC32xx-based work_92015 board
Subsystems (11)
v2 cover Extend LPC32xx functionality and add LPC32xx-based work_92015 board
This series extends functionality for the LPC32xx platform and introduces the WORK Microwave work_92105 board which makes use of the extended functionality.
NOTES:
The series is not entirely checkpatch-clean. The following warnings and checks were not fixed:
1. "warning: arch/arm/Kconfig,241: please write a paragraph that describes the config symbol fully"
Other symbols in the same file have no description either. For consistency, I did not add the requested description.
1. "check: include/configs/work_92105.h,177: spaces required around that ':' (ctx:VxV)
(5 occurrences on the same line)
This is due to the value of CONFIG_ETHADDR not being in quotes. As it never is in any other definition of CONFIG_ETHADDR, I left it unchanged.
Changes in v2:
- move from legacy to Driver Model support
- added MUX setting for SSP0
- cosmetic: added a blank line before copyright
- move boot image generation to mkimage framework
Albert ARIBAUD (3ADEV) (8):
lpc32xx: add Ethernet support
lpc32xx: mtd: nand: add MLC NAND controller
lpc32xx: i2c: add LPC32xx I2C interface support
lpc32xx: add GPIO support
lpc32xx: add LPC32xx SSP support (SPI mode)
dtt: add ds620 support
lpc32xx: add lpc32xx-spl.bin boot image target
lpc32xx: add support for board work_92105
arch/arm/Kconfig | 6 + arch/arm/cpu/arm926ejs/lpc32xx/Makefile | 2 + arch/arm/cpu/arm926ejs/lpc32xx/clk.c | 34 ++ arch/arm/cpu/arm926ejs/lpc32xx/cpu.c | 13 + arch/arm/cpu/arm926ejs/lpc32xx/devices.c | 43 ++ arch/arm/cpu/arm926ejs/lpc32xx/dram.c | 80 +++ arch/arm/cpu/arm926ejs/lpc32xx/lowlevel_init.S | 45 ++ arch/arm/include/asm/arch-lpc32xx/clk.h | 16 + arch/arm/include/asm/arch-lpc32xx/config.h | 3 + arch/arm/include/asm/arch-lpc32xx/cpu.h | 3 + arch/arm/include/asm/arch-lpc32xx/gpio.h | 43 ++ arch/arm/include/asm/arch-lpc32xx/mux.h | 18 + arch/arm/include/asm/arch-lpc32xx/sys_proto.h | 8 +- board/work-microwave/work_92105/Kconfig | 15 + board/work-microwave/work_92105/MAINTAINERS | 6 + board/work-microwave/work_92105/Makefile | 8 + board/work-microwave/work_92105/README | 23 + board/work-microwave/work_92105/work_92105.c | 86 +++ .../work-microwave/work_92105/work_92105_display.c | 349 +++++++++++ .../work-microwave/work_92105/work_92105_display.h | 14 + common/image.c | 1 + configs/work_92105_defconfig | 5 + drivers/gpio/Makefile | 1 + drivers/gpio/lpc32xx_gpio.c | 268 +++++++++ drivers/hwmon/Makefile | 1 + drivers/hwmon/ds620.c | 65 +++ drivers/i2c/Makefile | 1 + drivers/i2c/lpc32xx_i2c.c | 249 ++++++++ drivers/mtd/nand/Makefile | 1 + drivers/mtd/nand/lpc32xx_nand_mlc.c | 589 +++++++++++++++++++ drivers/net/Makefile | 1 + drivers/net/lpc32xx_eth.c | 636 +++++++++++++++++++++ drivers/spi/Makefile | 1 + drivers/spi/lpc32xx_ssp.c | 132 +++++ include/configs/work_92105.h | 259 +++++++++ include/dtt.h | 15 +- include/image.h | 1 + include/netdev.h | 1 + scripts/Makefile.spl | 9 + tools/Makefile | 1 + tools/lpc32xximage.c | 178 ++++++ 41 files changed, 3222 insertions(+), 8 deletions(-) create mode 100644 arch/arm/cpu/arm926ejs/lpc32xx/dram.c create mode 100644 arch/arm/cpu/arm926ejs/lpc32xx/lowlevel_init.S create mode 100644 arch/arm/include/asm/arch-lpc32xx/gpio.h create mode 100644 arch/arm/include/asm/arch-lpc32xx/mux.h create mode 100644 board/work-microwave/work_92105/Kconfig create mode 100644 board/work-microwave/work_92105/MAINTAINERS create mode 100644 board/work-microwave/work_92105/Makefile create mode 100644 board/work-microwave/work_92105/README create mode 100644 board/work-microwave/work_92105/work_92105.c create mode 100644 board/work-microwave/work_92105/work_92105_display.c create mode 100644 board/work-microwave/work_92105/work_92105_display.h create mode 100644 configs/work_92105_defconfig create mode 100644 drivers/gpio/lpc32xx_gpio.c create mode 100644 drivers/hwmon/ds620.c create mode 100644 drivers/i2c/lpc32xx_i2c.c create mode 100644 drivers/mtd/nand/lpc32xx_nand_mlc.c create mode 100644 drivers/net/lpc32xx_eth.c create mode 100644 drivers/spi/lpc32xx_ssp.c create mode 100644 include/configs/work_92105.h create mode 100644 tools/lpc32xximage.c
Signature · 1 line
2.1.0
PATCH v2 1/8 lpc32xx: add Ethernet support
---
Changes in v2: None
arch/arm/cpu/arm926ejs/lpc32xx/cpu.c | 9 + arch/arm/cpu/arm926ejs/lpc32xx/devices.c | 7 + arch/arm/include/asm/arch-lpc32xx/config.h | 3 + arch/arm/include/asm/arch-lpc32xx/sys_proto.h | 1 + drivers/net/Makefile | 1 + drivers/net/lpc32xx_eth.c | 636 ++++++++++++++++++++++++++ include/netdev.h | 1 + 7 files changed, 658 insertions(+) create mode 100644 drivers/net/lpc32xx_eth.c
arch/arm/cpu/arm926ejs/lpc32xx/cpu.c +9 -0
@@ -5,6 +5,7 @@*/ #include <common.h> +#include <netdev.h> #include <asm/arch/cpu.h> #include <asm/arch/clk.h> #include <asm/arch/wdt.h>
@@ -55,3 +56,11 @@ int print_cpuinfo(void) return 0; }#endif + +#ifdef CONFIG_LPC32XX_ETH +int cpu_eth_init (bd_t *bis) +{ +lpc32xx_eth_initialize (bis); +return 0 ; +} +#endif
arch/arm/cpu/arm926ejs/lpc32xx/devices.c +7 -0
@@ -37,3 +37,10 @@ void lpc32xx_uart_init(unsigned int uart_id)writel (CLK_UART_X_DIV (1 ) |CLK_UART_Y_DIV (1 ), &clk->u3clk + (uart_id -3 )); } + +void lpc32xx_mac_init (void ) +{ +/* Enable MAC interface */ +writel (CLK_MAC_REG |CLK_MAC_SLAVE |CLK_MAC_MASTER + |CLK_MAC_MII , &clk->macclk_ctrl); +}
arch/arm/include/asm/arch-lpc32xx/config.h +3 -0
@@ -50,6 +50,9 @@#define CONFIG_SYS_BAUDRATE_TABLE \ { 9600, 19200, 38400, 57600, 115200, 230400, 460800 } +/* Ethernet */ +#define LPC32XX_ETH_BASE ETHERNET_BASE +/* NOR Flash */ #if defined(CONFIG_SYS_FLASH_CFI )#define CONFIG_FLASH_CFI_DRIVER
arch/arm/include/asm/arch-lpc32xx/sys_proto.h +1 -0
@@ -8,5 +8,6 @@#define _LPC32XX_SYS_PROTO_Hvoid lpc32xx_uart_init (unsigned int uart_id); +void lpc32xx_mac_init (void );#endif /* _LPC32XX_SYS_PROTO_H */
drivers/net/Makefile +1 -0
@@ -36,6 +36,7 @@ obj-$(CONFIG_DRIVER_TI_KEYSTONE_NET) += keystone_net.o obj-$(CONFIG_DRIVER_KS8695ETH) += ks8695eth.o obj-$(CONFIG_KS8851_MLL) += ks8851_mll.o obj-$(CONFIG_LAN91C96) += lan91c96.o +obj-$(CONFIG_LPC32XX_ETH) += lpc32xx_eth.o obj-$(CONFIG_MACB) += macb.o obj-$(CONFIG_MCFFEC) += mcffec.o mcfmii.o obj-$(CONFIG_MPC5xxx_FEC) += mpc5xxx_fec.o
drivers/net/lpc32xx_eth.c new file +636 -0
636 lines not on this page · raw message
include/netdev.h +1 -0
@@ -58,6 +58,7 @@ void gt6426x_eth_initialize(bd_t *bis);int ks8695_eth_initialize (void );int ks8851_mll_initialize (u8 dev_num,int base_addr);int lan91c96_initialize (u8 dev_num,int base_addr); +int lpc32xx_eth_initialize (bd_t *bis);int macb_eth_initialize (int id,void *regs,unsigned int phy_addr);int mcdmafec_initialize (bd_t *bis);int mcffec_initialize (bd_t *bis);
Signature · 1 line
2.1.0
PATCH v2 2/8 lpc32xx: mtd: nand: add MLC NAND controller
The controller's Reed-Solomon ECC hardware is
used except of course for raw reads and writes.
It covers in- and out-of-band data together.
The SPL framework is supported.
---
Changes in v2: None
arch/arm/cpu/arm926ejs/lpc32xx/devices.c | 6 + arch/arm/include/asm/arch-lpc32xx/clk.h | 4 + arch/arm/include/asm/arch-lpc32xx/sys_proto.h | 1 + drivers/mtd/nand/Makefile | 1 + drivers/mtd/nand/lpc32xx_nand_mlc.c | 589 ++++++++++++++++++++++++++ 5 files changed, 601 insertions(+) create mode 100644 drivers/mtd/nand/lpc32xx_nand_mlc.c
arch/arm/cpu/arm926ejs/lpc32xx/devices.c +6 -0
@@ -44,3 +44,9 @@ void lpc32xx_mac_init(void)writel (CLK_MAC_REG |CLK_MAC_SLAVE |CLK_MAC_MASTER |CLK_MAC_MII , &clk->macclk_ctrl); } + +void lpc32xx_mlc_nand_init (void ) +{ +/* Enable NAND interface */ +writel (CLK_NAND_MLC |CLK_NAND_MLC_INT , &clk->flashclk_ctrl); +}
arch/arm/include/asm/arch-lpc32xx/clk.h +4 -0
@@ -147,6 +147,10 @@ struct clk_pm_regs {/* DMA Clock Control Register bits */ #define CLK_DMA_ENABLE (1 << 0) +/* NAND Clock Control Register bits */ +#define CLK_NAND_MLC (1 << 1) +#define CLK_NAND_MLC_INT (1 << 5) +unsigned int get_sys_clk_rate (void );unsigned int get_hclk_pll_rate (void );unsigned int get_hclk_clk_div (void );
arch/arm/include/asm/arch-lpc32xx/sys_proto.h +1 -0
@@ -9,5 +9,6 @@void lpc32xx_uart_init (unsigned int uart_id);void lpc32xx_mac_init (void ); +void lpc32xx_mlc_nand_init (void );#endif /* _LPC32XX_SYS_PROTO_H */
drivers/mtd/nand/Makefile +1 -0
@@ -52,6 +52,7 @@ obj-$(CONFIG_NAND_JZ4740) += jz4740_nand.o obj-$(CONFIG_NAND_KB9202) += kb9202_nand.o obj-$(CONFIG_NAND_KIRKWOOD) += kirkwood_nand.o obj-$(CONFIG_NAND_KMETER1) += kmeter1_nand.o +obj-$(CONFIG_NAND_LPC32XX_MLC) += lpc32xx_nand_mlc.o obj-$(CONFIG_NAND_MPC5121_NFC) += mpc5121_nfc.o obj-$(CONFIG_NAND_VF610_NFC) += vf610_nfc.o obj-$(CONFIG_NAND_MXC) += mxc_nand.o
drivers/mtd/nand/lpc32xx_nand_mlc.c new file +589 -0
589 lines not on this page · raw message
Signature · 1 line
2.1.0
PATCH v2 3/8 lpc32xx: i2c: add LPC32xx I2C interface support
---
Changes in v2: None
arch/arm/cpu/arm926ejs/lpc32xx/devices.c | 11 ++ arch/arm/include/asm/arch-lpc32xx/clk.h | 4 + arch/arm/include/asm/arch-lpc32xx/cpu.h | 2 + arch/arm/include/asm/arch-lpc32xx/sys_proto.h | 1 + drivers/i2c/Makefile | 1 + drivers/i2c/lpc32xx_i2c.c | 249 ++++++++++++++++++++++++++ 6 files changed, 268 insertions(+) create mode 100644 drivers/i2c/lpc32xx_i2c.c
arch/arm/cpu/arm926ejs/lpc32xx/devices.c +11 -0
@@ -50,3 +50,14 @@ void lpc32xx_mlc_nand_init(void)/* Enable NAND interface */ writel (CLK_NAND_MLC |CLK_NAND_MLC_INT , &clk->flashclk_ctrl); } + +void lpc32xx_i2c_init (unsigned int devnum) +{ +/* Enable I2C interface */ +uint32_t ctrl =readl (&clk->i2cclk_ctrl); +if (devnum ==1 ) + ctrl |=CLK_I2C1_ENABLE ; +if (devnum ==2 ) + ctrl |=CLK_I2C2_ENABLE ; +writel (ctrl, &clk->i2cclk_ctrl); +}
arch/arm/include/asm/arch-lpc32xx/clk.h +4 -0
@@ -123,6 +123,10 @@ struct clk_pm_regs {#define CLK_MAC_SLAVE (1 << 1)#define CLK_MAC_REG (1 << 0) +/* I2C Clock Control Register bits */ +#define CLK_I2C2_ENABLE (1 << 1) +#define CLK_I2C1_ENABLE (1 << 0) +/* Timer Clock Control1 Register bits */ #define CLK_TIMCLK_MOTOR (1 << 6)#define CLK_TIMCLK_TIMER3 (1 << 5)
arch/arm/include/asm/arch-lpc32xx/cpu.h +2 -0
@@ -37,6 +37,8 @@#define UART4_BASE 0x40088000/* UART 4 registers base */ #define UART5_BASE 0x40090000/* UART 5 registers base */ #define UART6_BASE 0x40098000/* UART 6 registers base */ +#define I2C1_BASE 0x400A0000/* I2C 1 registers base */ +#define I2C2_BASE 0x400A8000/* I2C 2 registers base */ /* External SDRAM Memory Bank base addresses */ #define EMC_DYCS0_BASE 0x80000000/* SDRAM DYCS0 base address */
arch/arm/include/asm/arch-lpc32xx/sys_proto.h +1 -0
@@ -10,5 +10,6 @@void lpc32xx_uart_init (unsigned int uart_id);void lpc32xx_mac_init (void );void lpc32xx_mlc_nand_init (void ); +void lpc32xx_i2c_init (unsigned int devnum);#endif /* _LPC32XX_SYS_PROTO_H */
drivers/i2c/Makefile +1 -0
@@ -20,6 +20,7 @@ obj-$(CONFIG_SYS_I2C_FSL) += fsl_i2c.o obj-$(CONFIG_SYS_I2C_FTI2C010) += fti2c010.o obj-$(CONFIG_SYS_I2C_IHS) += ihs_i2c.o obj-$(CONFIG_SYS_I2C_KONA) += kona_i2c.o +obj-$(CONFIG_SYS_I2C_LPC32XX) += lpc32xx_i2c.o obj-$(CONFIG_SYS_I2C_MVTWSI) += mvtwsi.o obj-$(CONFIG_SYS_I2C_MXC) += mxc_i2c.o obj-$(CONFIG_SYS_I2C_MXS) += mxs_i2c.o
drivers/i2c/lpc32xx_i2c.c new file +249 -0
249 lines not on this page · raw message
Signature · 1 line
2.1.0
PATCH v2 4/8 lpc32xx: add GPIO support
This driver only supports Driver Model, not legacy model.
---
Changes in v2:
- move from legacy to Driver Model support
arch/arm/cpu/arm926ejs/lpc32xx/devices.c | 5 + arch/arm/include/asm/arch-lpc32xx/gpio.h | 43 +++++ drivers/gpio/Makefile | 1 + drivers/gpio/lpc32xx_gpio.c | 268 +++++++++++++++++++++++++++++++ 4 files changed, 317 insertions(+) create mode 100644 arch/arm/include/asm/arch-lpc32xx/gpio.h create mode 100644 drivers/gpio/lpc32xx_gpio.c
arch/arm/cpu/arm926ejs/lpc32xx/devices.c +5 -0
@@ -9,6 +9,7 @@#include <asm/arch/clk.h> #include <asm/arch/uart.h> #include <asm/io.h> +#include <dm.h> static struct clk_pm_regs *clk = (struct clk_pm_regs *)CLK_PM_BASE ;static struct uart_ctrl_regs *ctrl = (struct uart_ctrl_regs *)UART_CTRL_BASE ;
@@ -61,3 +62,7 @@ void lpc32xx_i2c_init(unsigned int devnum) ctrl |=CLK_I2C2_ENABLE ;writel (ctrl, &clk->i2cclk_ctrl); } + +U_BOOT_DEVICE (lpc32xx_gpios) = { + .name ="gpio_lpc32xx" +};
arch/arm/include/asm/arch-lpc32xx/gpio.h new file +43 -0
43 lines not on this page · raw message
drivers/gpio/Makefile +1 -0
@@ -37,3 +37,4 @@ obj-$(CONFIG_ADI_GPIO2) += adi_gpio2.o obj-$(CONFIG_TCA642X) += tca642x.o oby-$(CONFIG_SX151X) += sx151x.o obj-$(CONFIG_SUNXI_GPIO) += sunxi_gpio.o +obj-$(CONFIG_LPC32XX_GPIO) += lpc32xx_gpio.o
drivers/gpio/lpc32xx_gpio.c new file +268 -0
268 lines not on this page · raw message
Signature · 1 line
2.1.0
PATCH v2 5/8 lpc32xx: add LPC32xx SSP support (SPI mode)
---
Changes in v2:
- added MUX setting for SSP0
arch/arm/cpu/arm926ejs/lpc32xx/devices.c | 14 +++ arch/arm/include/asm/arch-lpc32xx/clk.h | 3 + arch/arm/include/asm/arch-lpc32xx/sys_proto.h | 1 + drivers/spi/Makefile | 1 + drivers/spi/lpc32xx_ssp.c | 132 ++++++++++++++++++++++++++ 5 files changed, 151 insertions(+) create mode 100644 drivers/spi/lpc32xx_ssp.c
arch/arm/cpu/arm926ejs/lpc32xx/devices.c +14 -0
@@ -8,11 +8,13 @@#include <asm/arch/cpu.h> #include <asm/arch/clk.h> #include <asm/arch/uart.h> +#include <asm/arch/mux.h> #include <asm/io.h> #include <dm.h> static struct clk_pm_regs *clk = (struct clk_pm_regs *)CLK_PM_BASE ;static struct uart_ctrl_regs *ctrl = (struct uart_ctrl_regs *)UART_CTRL_BASE ; +static struct mux_regs *mux = (struct mux_regs *)MUX_BASE ;void lpc32xx_uart_init (unsigned int uart_id) {
@@ -66,3 +68,15 @@ void lpc32xx_i2c_init(unsigned int devnum)U_BOOT_DEVICE (lpc32xx_gpios) = { .name ="gpio_lpc32xx" }; + +/* Mux for SCK0, MISO0, MOSI0. We do not use SSEL0. */ + +#define P_MUX_SET_SSP0 0x1600 + +void lpc32xx_ssp_init (void ) +{ +/* Enable SSP0 interface */ +writel (CLK_SSP0_ENABLE_CLOCK , &clk->ssp_ctrl); +/* Mux SSP0 pins */ +writel (P_MUX_SET_SSP0 , &mux->p_mux_set); +}
arch/arm/include/asm/arch-lpc32xx/clk.h +3 -0
@@ -155,6 +155,9 @@ struct clk_pm_regs {#define CLK_NAND_MLC (1 << 1)#define CLK_NAND_MLC_INT (1 << 5) +/* SSP Clock Control Register bits */ +#define CLK_SSP0_ENABLE_CLOCK (1 << 0) +unsigned int get_sys_clk_rate (void );unsigned int get_hclk_pll_rate (void );unsigned int get_hclk_clk_div (void );
arch/arm/include/asm/arch-lpc32xx/sys_proto.h +1 -0
@@ -11,5 +11,6 @@ void lpc32xx_uart_init(unsigned int uart_id);void lpc32xx_mac_init (void );void lpc32xx_mlc_nand_init (void );void lpc32xx_i2c_init (unsigned int devnum); +void lpc32xx_ssp_init (void );#endif /* _LPC32XX_SYS_PROTO_H */
drivers/spi/Makefile +1 -0
@@ -32,6 +32,7 @@ obj-$(CONFIG_EXYNOS_SPI) += exynos_spi.o obj-$(CONFIG_FTSSP010_SPI) += ftssp010_spi.o obj-$(CONFIG_ICH_SPI) += ich.o obj-$(CONFIG_KIRKWOOD_SPI) += kirkwood_spi.o +obj-$(CONFIG_LPC32XX_SSP) += lpc32xx_ssp.o obj-$(CONFIG_MPC52XX_SPI) += mpc52xx_spi.o obj-$(CONFIG_MPC8XXX_SPI) += mpc8xxx_spi.o obj-$(CONFIG_MXC_SPI) += mxc_spi.o
drivers/spi/lpc32xx_ssp.c new file +132 -0
132 lines not on this page · raw message
Signature · 1 line
2.1.0
PATCH v2 6/8 dtt: add ds620 support
---
Changes in v2:
- cosmetic: added a blank line before copyright
drivers/hwmon/Makefile | 1 + drivers/hwmon/ds620.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++ include/dtt.h | 15 ++++++------ 3 files changed, 74 insertions(+), 7 deletions(-) create mode 100644 drivers/hwmon/ds620.c
drivers/hwmon/Makefile +1 -0
@@ -15,6 +15,7 @@ obj-$(CONFIG_DTT_ADT7460) += adt7460.o obj-$(CONFIG_DTT_DS1621) += ds1621.o obj-$(CONFIG_DTT_DS1722) += ds1722.o obj-$(CONFIG_DTT_DS1775) += ds1775.o +obj-$(CONFIG_DTT_DS620) += ds620.o obj-$(CONFIG_DTT_LM63) += lm63.o obj-$(CONFIG_DTT_LM73) += lm73.o obj-$(CONFIG_DTT_LM75) += lm75.o
drivers/hwmon/ds620.c new file +65 -0
65 lines not on this page · raw message
include/dtt.h +8 -7
@@ -12,13 +12,14 @@#define _DTT_H_#if defined(CONFIG_DTT_ADM1021 ) || \ - defined(CONFIG_DTT_ADT7460 ) || \ - defined(CONFIG_DTT_DS1621 ) || \ - defined(CONFIG_DTT_DS1775 ) || \ - defined(CONFIG_DTT_LM63 ) || \ - defined(CONFIG_DTT_LM73 ) || \ - defined(CONFIG_DTT_LM75 ) || \ - defined(CONFIG_DTT_LM81 ) + defined(CONFIG_DTT_ADT7460 ) || \ + defined(CONFIG_DTT_DS1621 ) || \ + defined(CONFIG_DTT_DS1775 ) || \ + defined(CONFIG_DTT_DS620 ) || \ + defined(CONFIG_DTT_LM63 ) || \ + defined(CONFIG_DTT_LM73 ) || \ + defined(CONFIG_DTT_LM75 ) || \ + defined(CONFIG_DTT_LM81 )#define CONFIG_DTT /* We have a DTT */
Signature · 1 line
2.1.0
PATCH v2 7/8 lpc32xx: add lpc32xx-spl.bin boot image target
---
Changes in v2:
- move boot image generation to mkimage framework
common/image.c | 1 + include/image.h | 1 + scripts/Makefile.spl | 9 +++ tools/Makefile | 1 + tools/lpc32xximage.c | 178 +++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 190 insertions(+) create mode 100644 tools/lpc32xximage.c
common/image.c +1 -0
@@ -149,6 +149,7 @@ static const table_entry_t uimage_type[] = { { IH_TYPE_MXSIMAGE, "mxsimage", "Freescale MXS Boot Image",}, { IH_TYPE_ATMELIMAGE, "atmelimage", "ATMEL ROM-Boot Image",}, { IH_TYPE_X86_SETUP, "x86_setup", "x86 setup.bin", }, + { IH_TYPE_LPC32XXIMAGE, "lpc32xximage", "LPC32XX Boot Image", }, { -1, "", "", }, };
include/image.h +1 -0
@@ -242,6 +242,7 @@ struct lmb;#define IH_TYPE_ATMELIMAGE 18/* ATMEL ROM bootable Image */ #define IH_TYPE_SOCFPGAIMAGE 19/* Altera SOCFPGA Preloader */ #define IH_TYPE_X86_SETUP 20/* x86 setup.bin Image */ +#define IH_TYPE_LPC32XXIMAGE 21/* x86 setup.bin Image */ /* * Compression Types
scripts/Makefile.spl +9 -0
@@ -147,6 +147,11 @@ endif boot.bin: $(obj)/u-boot-spl.bin $(call if_changed,mkimage) +MKIMAGEFLAGS_lpc32xx-boot.bin = -T lpc32xximage -a $(CONFIG_SPL_TEXT_BASE) + +lpc32xx-boot.bin: $(obj)/u-boot-spl.bin + $(call if_changed,mkimage) + ALL-y += $(obj)/$(SPL_BIN).bin ifdef CONFIG_SAMSUNG
@@ -159,6 +164,10 @@ ALL-y += $(obj)/sunxi-spl.bin endif endif +ifdef CONFIG_LPC32XX_SPL +ALL-y += lpc32xx-boot.bin +endif + ifeq ($(CONFIG_SYS_SOC),"at91") ALL-y += boot.bin endif
tools/Makefile +1 -0
@@ -83,6 +83,7 @@ dumpimage-mkimage-objs := aisimage.o \ imximage.o \ kwbimage.o \ lib/md5.o \ + lpc32xximage.o \ mxsimage.o \ omapimage.o \ os_support.o \
tools/lpc32xximage.c new file +178 -0
178 lines not on this page · raw message
Signature · 1 line
2.1.0
PATCH v2 8/8 lpc32xx: add support for board work_92105
Work_92105 from Work Microwave is an LPC3250-
based board with the following features:
- 64MB SDR DRAM
- 1 GB SLC NAND, managed through MLC controller.
- Ethernet
- Ethernet + PHY SMSC8710
- I2C:
- EEPROM (24M01-compatible)
- RTC (DS1374-compatible)
- Temperature sensor (DS620)
- DACs (2 x MAX518)
- SPI (through SSP interface)
- Port expander MAX6957
- LCD display (HD44780-compatible), controlled
through the port expander and DACs
This board has SPL support, and uses the LPC32XX boot image format.
---
Changes in v2: None
arch/arm/Kconfig | 6 + arch/arm/cpu/arm926ejs/lpc32xx/Makefile | 2 + arch/arm/cpu/arm926ejs/lpc32xx/clk.c | 34 ++ arch/arm/cpu/arm926ejs/lpc32xx/cpu.c | 4 + arch/arm/cpu/arm926ejs/lpc32xx/dram.c | 80 +++++ arch/arm/cpu/arm926ejs/lpc32xx/lowlevel_init.S | 45 +++ arch/arm/include/asm/arch-lpc32xx/clk.h | 5 + arch/arm/include/asm/arch-lpc32xx/cpu.h | 1 + arch/arm/include/asm/arch-lpc32xx/mux.h | 18 ++ arch/arm/include/asm/arch-lpc32xx/sys_proto.h | 4 +- board/work-microwave/work_92105/Kconfig | 15 + board/work-microwave/work_92105/MAINTAINERS | 6 + board/work-microwave/work_92105/Makefile | 8 + board/work-microwave/work_92105/README | 23 ++ board/work-microwave/work_92105/work_92105.c | 86 +++++ .../work-microwave/work_92105/work_92105_display.c | 349 +++++++++++++++++++++ .../work-microwave/work_92105/work_92105_display.h | 14 + configs/work_92105_defconfig | 5 + include/configs/work_92105.h | 259 +++++++++++++++ 19 files changed, 963 insertions(+), 1 deletion(-) create mode 100644 arch/arm/cpu/arm926ejs/lpc32xx/dram.c create mode 100644 arch/arm/cpu/arm926ejs/lpc32xx/lowlevel_init.S create mode 100644 arch/arm/include/asm/arch-lpc32xx/mux.h create mode 100644 board/work-microwave/work_92105/Kconfig create mode 100644 board/work-microwave/work_92105/MAINTAINERS create mode 100644 board/work-microwave/work_92105/Makefile create mode 100644 board/work-microwave/work_92105/README create mode 100644 board/work-microwave/work_92105/work_92105.c create mode 100644 board/work-microwave/work_92105/work_92105_display.c create mode 100644 board/work-microwave/work_92105/work_92105_display.h create mode 100644 configs/work_92105_defconfig create mode 100644 include/configs/work_92105.h
arch/arm/Kconfig +6 -0
@@ -247,6 +247,11 @@ config TARGET_DEVKIT3250 bool "Support devkit3250" select CPU_ARM926EJS +config TARGET_WORK_92105 + bool "Support work_92105" + select CPU_ARM926EJS + select SUPPORT_SPL + config TARGET_JADECPU bool "Support jadecpu" select CPU_ARM926EJS
@@ -999,6 +1004,7 @@ source "board/udoo/Kconfig" source "board/vpac270/Kconfig" source "board/wandboard/Kconfig" source "board/woodburn/Kconfig" +source "board/work-microwave/work_92105/Kconfig" source "board/xaeniax/Kconfig" source "board/zipitz2/Kconfig"
arch/arm/cpu/arm926ejs/lpc32xx/Makefile +2 -0
@@ -6,3 +6,5 @@ # obj-y = cpu.o clk.o devices.o timer.o + +obj-$(CONFIG_SPL_BUILD) += dram.o lowlevel_init.o
arch/arm/cpu/arm926ejs/lpc32xx/clk.c +34 -0
@@ -98,6 +98,40 @@ unsigned int get_periph_clk_rate(void)return get_hclk_pll_rate () /get_periph_clk_div (); } +unsigned int get_sdram_clk_rate (void ) +{ +unsigned int src_clk; + +if (!(readl (&clk->pwr_ctrl) &CLK_PWR_NORMAL_RUN )) +return get_sys_clk_rate (); + + src_clk =get_hclk_pll_rate (); + +if (readl (&clk->sdramclk_ctrl) &CLK_SDRAM_DDR_SEL ) { +/* using DDR */ +switch (readl (&clk->hclkdiv_ctrl) &CLK_HCLK_DDRAM_MASK ) { +case CLK_HCLK_DDRAM_HALF : +return src_clk/2 ; +case CLK_HCLK_DDRAM_NOMINAL : +return src_clk; +default : +return 0 ; + } + }else { +/* using SDR */ +switch (readl (&clk->hclkdiv_ctrl) &CLK_HCLK_ARM_PLL_DIV_MASK ) { +case CLK_HCLK_ARM_PLL_DIV_4 : +return src_clk/4 ; +case CLK_HCLK_ARM_PLL_DIV_2 : +return src_clk/2 ; +case CLK_HCLK_ARM_PLL_DIV_1 : +return src_clk; +default : +return 0 ; + } + } +} +int get_serial_clock (void ) {return get_periph_clk_rate ();
arch/arm/cpu/arm926ejs/lpc32xx/cpu.c +4 -0
@@ -9,6 +9,7 @@#include <asm/arch/cpu.h> #include <asm/arch/clk.h> #include <asm/arch/wdt.h> +#include <asm/arch/sys_proto.h> #include <asm/io.h> static struct clk_pm_regs *clk = (struct clk_pm_regs *)CLK_PM_BASE ;
@@ -33,6 +34,9 @@ void reset_cpu(ulong addr)#if defined(CONFIG_ARCH_CPU_INIT )int arch_cpu_init (void ) { +#if defined(CONFIG_SPL_BUILD ) +ddr_init (); +#endif /* * It might be necessary to flush data cache, if U-boot is loaded * from kickstart bootloader, e.g. from S1L loader
arch/arm/cpu/arm926ejs/lpc32xx/dram.c new file +80 -0
80 lines not on this page · raw message
arch/arm/cpu/arm926ejs/lpc32xx/lowlevel_init.S new file +45 -0
45 lines not on this page · raw message
arch/arm/include/asm/arch-lpc32xx/clk.h +5 -0
@@ -71,6 +71,7 @@ struct clk_pm_regs { };/* HCLK Divider Control Register bits */ +#define CLK_HCLK_DDRAM_MASK (0x3 << 7)#define CLK_HCLK_DDRAM_HALF (0x2 << 7)#define CLK_HCLK_DDRAM_NOMINAL (0x1 << 7)#define CLK_HCLK_DDRAM_STOPPED (0x0 << 7)
@@ -158,11 +159,15 @@ struct clk_pm_regs {/* SSP Clock Control Register bits */ #define CLK_SSP0_ENABLE_CLOCK (1 << 0) +/* SDRAMCLK register bits */ +#define CLK_SDRAM_DDR_SEL (1 << 1) +unsigned int get_sys_clk_rate (void );unsigned int get_hclk_pll_rate (void );unsigned int get_hclk_clk_div (void );unsigned int get_hclk_clk_rate (void );unsigned int get_periph_clk_div (void );unsigned int get_periph_clk_rate (void ); +unsigned int get_sdram_clk_rate (void );#endif /* _LPC32XX_CLK_H */
arch/arm/include/asm/arch-lpc32xx/cpu.h +1 -0
@@ -27,6 +27,7 @@#define HS_UART7_BASE 0x4001C000/* High speed UART 7 registers base */ #define RTC_BASE 0x40024000/* RTC registers base */ #define GPIO_BASE 0x40028000/* GPIO registers base */ +#define MUX_BASE 0x40028100/* MUX registers base */ #define WDT_BASE 0x4003C000/* Watchdog timer registers base */ #define TIMER0_BASE 0x40044000/* Timer0 registers base */ #define TIMER1_BASE 0x4004C000/* Timer1 registers base */
arch/arm/include/asm/arch-lpc32xx/mux.h new file +18 -0
@@ -0,0 +1,18 @@ +/* +* LPC32xx MUX interface +* +* (C) Copyright 2015 DENX Software Engineering GmbH +* Written-by: Albert ARIBAUD <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +/** +* MUX register map for LPC32xx +*/ + +struct mux_regs { +u32 p_mux_set; +u32 p_mux_clr; +u32 p_mux_state; +};
arch/arm/include/asm/arch-lpc32xx/sys_proto.h +3 -1
@@ -12,5 +12,7 @@ void lpc32xx_mac_init(void);void lpc32xx_mlc_nand_init (void );void lpc32xx_i2c_init (unsigned int devnum);void lpc32xx_ssp_init (void ); - +#if defined(CONFIG_SPL_BUILD ) +void ddr_init (void ); +#endif #endif /* _LPC32XX_SYS_PROTO_H */
board/work-microwave/work_92105/Kconfig new file +15 -0
@@ -0,0 +1,15 @@ +if TARGET_WORK_92105 + +config SYS_BOARD + default "work_92105" + +config SYS_VENDOR + default "work-microwave" + +config SYS_SOC + default "lpc32xx" + +config SYS_CONFIG_NAME + default "work_92105" + +endif
board/work-microwave/work_92105/MAINTAINERS new file +6 -0
@@ -0,0 +1,6 @@ +WORK_92105 BOARD +M: Albert ARIBAUD <[email protected]> +S: Maintained +F: board/work-microwave/work_92105/ +F: include/configs/work_92105.h +F: configs/work_92105_defconfig
board/work-microwave/work_92105/Makefile new file +8 -0
@@ -0,0 +1,8 @@ +# +# (C) Copyright 2014 DENX Software Engineering GmbH +# Written-by: Albert ARIBAUD <[email protected]> +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y := work_92105.o work_92105_display.o
board/work-microwave/work_92105/README new file +23 -0
@@ -0,0 +1,23 @@ +Work_92105 from Work Microwave is an LPC3250- based board with the +following features: + + - 64MB SDR DRAM + - 1 GB SLC NAND, managed through MLC controller. + - Ethernet + - Ethernet + PHY SMSC8710 + - I2C: + - EEPROM (24M01-compatible) + - RTC (DS1374-compatible) + - Temperature sensor (DS620) + - DACs (2 x MAX518) + - SPI (through SSP interface) + - Port expander MAX6957 + - LCD display (HD44780-compatible), controlled + through the port expander and DACs + +This board has SPL support, and uses the LPC32XX boot image format. +Once the U-Boot target "work_92105" is built, the following two files +can be flashed: + + spl/lpc32xx-spl.bin at offset 0x0 + u-boot.bin at offset 0x40000
board/work-microwave/work_92105/work_92105.c new file +86 -0
86 lines not on this page · raw message
board/work-microwave/work_92105/work_92105_display.c new file +349 -0
349 lines not on this page · raw message
board/work-microwave/work_92105/work_92105_display.h new file +14 -0
@@ -0,0 +1,14 @@ +/* +* work_92105 display support interface +* +* (C) Copyright 2014 DENX Software Engineering GmbH +* Written-by: Albert ARIBAUD <[email protected]> +* +* The work_92105 display is a HD44780-compatible module +* controlled through a MAX6957AAX SPI port expander, two +* MAX518 I2C DACs and native LPC32xx GPO 15. +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +void work_92105_display_init (void );
configs/work_92105_defconfig new file +5 -0
@@ -0,0 +1,5 @@ +CONFIG_DM=y +CONFIG_DM_GPIO=y +CONFIG_SPL=y ++S:CONFIG_ARM=y ++S:CONFIG_TARGET_WORK_92105=y
include/configs/work_92105.h new file +259 -0
259 lines not on this page · raw message
Signature · 1 line
2.1.0
PATCH v2 8/8 lpc32xx: add support for board work_92105
Hi Albert,
please find some review comments below.
Quoted 182 lines · On 12.02.2015 18:37, Albert ARIBAUD (3ADEV) wrote:
Work_92105from Work Microwave is an LPC3250-
based board with the following features:
- 64MB SDR DRAM
- 1 GB SLC NAND, managed through MLC controller.
- Ethernet
- Ethernet + PHY SMSC8710
- I2C:
- EEPROM (24M01-compatible)
- RTC (DS1374-compatible)
- Temperature sensor (DS620)
- DACs (2 x MAX518)
- SPI (through SSP interface)
- Port expander MAX6957
- LCD display (HD44780-compatible), controlled
through the port expander and DACsThis board has SPL support, and uses the LPC32XX boot image format.
Signed-off-by Albert ARIBAUD (3ADEV) <[email protected]>---
Changes in v2: None
arch/arm/Kconfig | 6 + arch/arm/cpu/arm926ejs/lpc32xx/Makefile | 2 + arch/arm/cpu/arm926ejs/lpc32xx/clk.c | 34 ++ arch/arm/cpu/arm926ejs/lpc32xx/cpu.c | 4 + arch/arm/cpu/arm926ejs/lpc32xx/dram.c | 80 +++++ arch/arm/cpu/arm926ejs/lpc32xx/lowlevel_init.S | 45 +++ arch/arm/include/asm/arch-lpc32xx/clk.h | 5 + arch/arm/include/asm/arch-lpc32xx/cpu.h | 1 + arch/arm/include/asm/arch-lpc32xx/mux.h | 18 ++ arch/arm/include/asm/arch-lpc32xx/sys_proto.h | 4 +- board/work-microwave/work_92105/Kconfig | 15 + board/work-microwave/work_92105/MAINTAINERS | 6 + board/work-microwave/work_92105/Makefile | 8 + board/work-microwave/work_92105/README | 23 ++ board/work-microwave/work_92105/work_92105.c | 86 +++++ .../work-microwave/work_92105/work_92105_display.c | 349 +++++++++++++++++++++ .../work-microwave/work_92105/work_92105_display.h | 14 + configs/work_92105_defconfig | 5 + include/configs/work_92105.h | 259 +++++++++++++++ 19 files changed, 963 insertions(+), 1 deletion(-)create mode 100644
arch/arm/cpu/arm926ejs/lpc32xx/dram.ccreate mode 100644arch/arm/cpu/arm926ejs/lpc32xx/lowlevel_init.Screate mode 100644arch/arm/include/asm/arch-lpc32xx/mux.hcreate mode 100644 board/work-microwave/work_92105/Kconfig create mode 100644 board/work-microwave/work_92105/MAINTAINERS create mode 100644 board/work-microwave/work_92105/Makefile create mode 100644 board/work-microwave/work_92105/README create mode 100644board/work-microwave/work_92105/work_92105.ccreate mode 100644board/work-microwave/work_92105/work_92105_display.ccreate mode 100644board/work-microwave/work_92105/work_92105_display.hcreate mode 100644 configs/work_92105_defconfig
create mode 100644include/configs/work_92105.harch/arm/Kconfig +6
-0@@ -247,6 +247,11 @@ config TARGET_DEVKIT3250 bool "Support devkit3250" select CPU_ARM926EJS +config TARGET_WORK_92105 + bool "Support work_92105" + select CPU_ARM926EJS + select SUPPORT_SPL + config TARGET_JADECPU bool "Support jadecpu" select CPU_ARM926EJS@@ -999,6 +1004,7 @@ source "board/udoo/Kconfig" source "board/vpac270/Kconfig" source "board/wandboard/Kconfig" source "board/woodburn/Kconfig" +source "board/work-microwave/work_92105/Kconfig" source "board/xaeniax/Kconfig" source "board/zipitz2/Kconfig"arch/arm/cpu/arm926ejs/lpc32xx/Makefile +2
-0@@ -6,3 +6,5 @@ # obj-y = cpu.o clk.o devices.o timer.o + +obj-$(CONFIG_SPL_BUILD) += dram.o lowlevel_init.oarch/arm/cpu/arm926ejs/lpc32xx/clk.c +34
-0@@ -98,6 +98,40 @@ unsigned int get_periph_clk_rate(void)return get_hclk_pll_rate () /get_periph_clk_div (); } +unsigned int get_sdram_clk_rate (void ) +{ +unsigned int src_clk; + +if (!(readl (&clk->pwr_ctrl) &CLK_PWR_NORMAL_RUN )) +return get_sys_clk_rate (); + + src_clk =get_hclk_pll_rate (); + +if (readl (&clk->sdramclk_ctrl) &CLK_SDRAM_DDR_SEL ) { +/* using DDR */ +switch (readl (&clk->hclkdiv_ctrl) &CLK_HCLK_DDRAM_MASK ) { +case CLK_HCLK_DDRAM_HALF : +return src_clk/2 ; +case CLK_HCLK_DDRAM_NOMINAL : +return src_clk; +default : +return 0 ; + } + }else { +/* using SDR */ +switch (readl (&clk->hclkdiv_ctrl) &CLK_HCLK_ARM_PLL_DIV_MASK ) { +case CLK_HCLK_ARM_PLL_DIV_4 : +return src_clk/4 ; +case CLK_HCLK_ARM_PLL_DIV_2 : +return src_clk/2 ; +case CLK_HCLK_ARM_PLL_DIV_1 : +return src_clk; +default : +return 0 ; + } + } +} +int get_serial_clock (void ) {return get_periph_clk_rate ();arch/arm/cpu/arm926ejs/lpc32xx/cpu.c +4
-0@@ -9,6 +9,7 @@#include <asm/arch/cpu.h> #include <asm/arch/clk.h> #include <asm/arch/wdt.h> +#include <asm/arch/sys_proto.h> #include <asm/io.h> static struct clk_pm_regs *clk = (struct clk_pm_regs *)CLK_PM_BASE ;@@ -33,6 +34,9 @@ void reset_cpu(ulong addr)#if defined(CONFIG_ARCH_CPU_INIT )int arch_cpu_init (void ) { +#if defined(CONFIG_SPL_BUILD ) +ddr_init (); +#endif /* * It might be necessary to flush data cache, if U-boot is loaded * from kickstart bootloader, e.g. from S1L loader arch/arm/cpu/arm926ejs/lpc32xx/dram.c new file +18
-0@@ -0,0 +1,80 @@ +/* +* LPC32xx dram init +* +* (C) Copyright 2014 DENX Software Engineering GmbH +* Written-by: Albert ARIBAUD <[email protected]> +* +* This is called by SPL to gain access to the SDR DRAM. +* +* This code runs from SRAM. +* +* Actual CONFIG_LPC32XX_SDRAM_* parameters must be provided +* by the board configuration file. +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <netdev.h>
arch/arm/cpu/arm926ejs/lpc32xx/dram.c line 28
Quoted 10 lines
arch/arm/cpu/arm926ejs/lpc32xx/dram.c new file +10
-0+#include <asm/arch/cpu.h> +#include <asm/arch/clk.h> +#include <asm/arch/wdt.h> +#include <asm/arch/emc.h> +#include <asm/io.h> + +static struct clk_pm_regs *clk = (struct clk_pm_regs *)CLK_PM_BASE ; +static struct emc_regs *emc = (struct emc_regs *)EMC_BASE ; + +#if defined(CONFIG_SPL_BUILD )
Why don't you move this compiler switch to the Makefiles instead?
Quoted 246 lines
arch/arm/cpu/arm926ejs/lpc32xx/dram.c new file +52
-0+ +void ddr_init (void ) +{ +uint32_t ck; + +/* Enable EMC interface and choose little endian mode */ + emc->ctrl =1 ; + emc->config =0 ; +/* Select maximum EMC Dynamic Memory Refresh Time */ + emc->refresh =0x7FF ; +/* Determine CLK */ + ck =get_sdram_clk_rate (); +/* Configure SDRAM */ + clk->sdramclk_ctrl = (CONFIG_LPC32XX_SDRAM_COMMAND_DELAY <<14 ); + emc->config0 =CONFIG_LPC32XX_SDRAM_CONFIG0 ; + emc->rascas0 =CONFIG_LPC32XX_SDRAM_RASCAS0 ; + emc->read_config =CONFIG_LPC32XX_SDRAM_READ_CONFIG ; +/* Set timings */ + emc->t_rp = (ck /CONFIG_LPC32XX_SDRAM_T_RP ) &0x0000000F ; + emc->t_ras = (ck /CONFIG_LPC32XX_SDRAM_T_RAS ) &0x0000000F ; + emc->t_srex = (ck /CONFIG_LPC32XX_SDRAM_T_SREX ) &0x0000007F ; + emc->t_wr = (ck /CONFIG_LPC32XX_SDRAM_T_WR ) &0x0000000F ; + emc->t_rc = (ck /CONFIG_LPC32XX_SDRAM_T_RC ) &0x0000001F ; + emc->t_rfc = (ck /CONFIG_LPC32XX_SDRAM_T_RFC ) &0x0000001F ; + emc->t_xsr = (ck /CONFIG_LPC32XX_SDRAM_T_XSR ) &0x000000FF ; + emc->t_rrd =CONFIG_LPC32XX_SDRAM_T_RRD ; + emc->t_mrd =CONFIG_LPC32XX_SDRAM_T_MRD ; + emc->t_cdlr =CONFIG_LPC32XX_SDRAM_T_CDLR ; +/* Dynamic refresh */ + emc->refresh = (((ck /CONFIG_LPC32XX_SDRAM_REFRESH ) >>4 ) &0x7FF ); +udelay (10 ); +/* Force all clocks, enable inverted ck, issue NOP command */ + emc->control =0x00000193 ; +udelay (100 ); +/* Keep all clocks enabled, issue a PRECHARGE ALL command */ + emc->control =0x00000113 ; +/* Fast dynamic refresh for at least a few SDRAM ck cycles */ + emc->refresh = (((128 ) >>4 ) &0x7FF ); +udelay (10 ); +/* set correct dynamic refresh timing */ + emc->refresh = (((ck /CONFIG_LPC32XX_SDRAM_REFRESH ) >>4 ) &0x7FF ); +udelay (10 ); +/* set normal mode to CAS=3 */ + emc->control =0x00000093 ; +readl (EMC_DYCS0_BASE |CONFIG_LPC32XX_DRAM_MODE ); +/* set extended mode to all zeroes */ + emc->control =0x00000093 ; +readl (EMC_DYCS0_BASE |CONFIG_LPC32XX_DRAM_EMODE ); +/* stop forcing clocks, keep inverted clock, issue normal mode */ + emc->control =0x00000010 ; +} +#endif arch/arm/cpu/arm926ejs/lpc32xx/lowlevel_init.S new file +45
-0@@ -0,0 +1,45 @@ +/* + * WORK Microwave work_92105 board low level init + * + * (C) Copyright 2014 DENX Software Engineering GmbH + * Written-by: Albert ARIBAUD <[email protected]> + * + * Low level init is called from SPL to set up the clocks. + * On entry, the LPC3250 is in Direct Run mode with all clocks + * running at 13 MHz; on exit, ARM clock is 208 MHz, HCLK is + * 104 MHz and PCLK is 13 MHz. + * + * This code must run from SRAM so that the clock changes do + * not prevent it from executing. + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +.globl lowlevel_init + +lowlevel_init: + + /* Set ARM, HCLK, PCLK dividers for normal mode */ + ldr r0, =0x0000003D + ldr r1, =0x40004040 + str r0, [r1] + + /* Start HCLK PLL for 208 MHz */ + ldr r0, =0x0001401E + ldr r1, =0x40004058 + str r0, [r1] + + /* wait for HCLK PLL to lock */ +1: + ldr r0, [r1] + ands r0, r0, #1 + beq 1b + + /* switch to normal mode */ + ldr r1, =0x40004044 + ldr r0, [r1] + orr r0, #0x00000004 + str r0, [r1] + + /* Return to U-boot via saved link register */ + mov pc, lrarch/arm/include/asm/arch-lpc32xx/clk.h +5
-0@@ -71,6 +71,7 @@ struct clk_pm_regs { };/* HCLK Divider Control Register bits */ +#define CLK_HCLK_DDRAM_MASK (0x3 << 7)#define CLK_HCLK_DDRAM_HALF (0x2 << 7)#define CLK_HCLK_DDRAM_NOMINAL (0x1 << 7)#define CLK_HCLK_DDRAM_STOPPED (0x0 << 7)@@ -158,11 +159,15 @@ struct clk_pm_regs {/* SSP Clock Control Register bits */ #define CLK_SSP0_ENABLE_CLOCK (1 << 0) +/* SDRAMCLK register bits */ +#define CLK_SDRAM_DDR_SEL (1 << 1) +unsigned int get_sys_clk_rate (void );unsigned int get_hclk_pll_rate (void );unsigned int get_hclk_clk_div (void );unsigned int get_hclk_clk_rate (void );unsigned int get_periph_clk_div (void );unsigned int get_periph_clk_rate (void ); +unsigned int get_sdram_clk_rate (void );#endif /* _LPC32XX_CLK_H */ arch/arm/include/asm/arch-lpc32xx/cpu.h +1
-0@@ -27,6 +27,7 @@#define HS_UART7_BASE 0x4001C000/* High speed UART 7 registers base */ #define RTC_BASE 0x40024000/* RTC registers base */ #define GPIO_BASE 0x40028000/* GPIO registers base */ +#define MUX_BASE 0x40028100/* MUX registers base */ #define WDT_BASE 0x4003C000/* Watchdog timer registers base */ #define TIMER0_BASE 0x40044000/* Timer0 registers base */ #define TIMER1_BASE 0x4004C000/* Timer1 registers base */ arch/arm/include/asm/arch-lpc32xx/mux.h new file +18
-0@@ -0,0 +1,18 @@ +/* +* LPC32xx MUX interface +* +* (C) Copyright 2015 DENX Software Engineering GmbH +* Written-by: Albert ARIBAUD <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +/** +* MUX register map for LPC32xx +*/ + +struct mux_regs { +u32 p_mux_set; +u32 p_mux_clr; +u32 p_mux_state; +};arch/arm/include/asm/arch-lpc32xx/sys_proto.h +3
-1@@ -12,5 +12,7 @@ void lpc32xx_mac_init(void);void lpc32xx_mlc_nand_init (void );void lpc32xx_i2c_init (unsigned int devnum);void lpc32xx_ssp_init (void ); - +#if defined(CONFIG_SPL_BUILD ) +void ddr_init (void ); +#endif #endif /* _LPC32XX_SYS_PROTO_H */ board/work-microwave/work_92105/Kconfig new file +15
-0@@ -0,0 +1,15 @@ +if TARGET_WORK_92105 + +config SYS_BOARD + default "work_92105" + +config SYS_VENDOR + default "work-microwave" + +config SYS_SOC + default "lpc32xx" + +config SYS_CONFIG_NAME + default "work_92105" + +endifboard/work-microwave/work_92105/MAINTAINERS new file +6
-0@@ -0,0 +1,6 @@ +WORK_92105 BOARD +M: Albert ARIBAUD <[email protected]> +S: Maintained +F: board/work-microwave/work_92105/ +F: include/configs/work_92105.h +F: configs/work_92105_defconfigboard/work-microwave/work_92105/Makefile new file +8
-0@@ -0,0 +1,8 @@ +# +# (C) Copyright 2014 DENX Software Engineering GmbH +# Written-by: Albert ARIBAUD <[email protected]> +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y := work_92105.o work_92105_display.oboard/work-microwave/work_92105/README new file +13
-0@@ -0,0 +1,23 @@ +Work_92105 from Work Microwave is an LPC3250- based board with the +following features: + + - 64MB SDR DRAM + - 1 GB SLC NAND, managed through MLC controller. + - Ethernet + - Ethernet + PHY SMSC8710 + - I2C: + - EEPROM (24M01-compatible) + - RTC (DS1374-compatible) + - Temperature sensor (DS620) + - DACs (2 x MAX518) + - SPI (through SSP interface)
board/work-microwave/work_92105/README line 23
Quoted 10 lines
board/work-microwave/work_92105/README new file +10
-0+ - Port expander MAX6957 + - LCD display (HD44780-compatible), controlled + through the port expander and DACs + +This board has SPL support, and uses the LPC32XX boot image format. +Once the U-Boot target "work_92105" is built, the following two files +can be flashed: + + spl/lpc32xx-spl.bin at offset 0x0 + u-boot.bin at offset 0x40000
Really u-boot.bin? Why don't you use u-boot.img with the header / CRC instead? This is commonly used by other SPL platforms.
And wouldn't it be nice to combine (concatenate) those two images into one image that can be flashed to the board? There are already some Makefile rules for doing this.
Quoted 17 lines
board/work-microwave/work_92105/work_92105.c new file +11
-0@@ -0,0 +1,86 @@ +/* +* WORK Microwave work_92105 board support +* +* (C) Copyright 2014 DENX Software Engineering GmbH +* Written-by: Albert ARIBAUD <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <asm/io.h>
board/work-microwave/work_92105/work_92105.c line 21
Quoted 10 lines
board/work-microwave/work_92105/work_92105.c new file +10
-0+#include <asm/arch/sys_proto.h> +#include <asm/arch/cpu.h> +#include <asm/arch/emc.h> +#include <asm/gpio.h> +#include <spl.h> +#include "work_92105_display.h" + +DECLARE_GLOBAL_DATA_PTR ; + +#if defined(CONFIG_SPL_BUILD )
I would perfer to move those SPL related function into a seperate file (e.g. spl.c) instead. And the Makefile can handle the conditional compilation then.
Quoted 626 lines
board/work-microwave/work_92105/work_92105.c new file +64
-0+void spl_board_init (void ) +{ +/* initialize serial port for console */ +lpc32xx_uart_init (CONFIG_SYS_LPC32XX_UART ); +/* initialize console */ +preloader_console_init (); +/* init DDR and NAND to chainload U-Boot */ +ddr_init (); +lpc32xx_mlc_nand_init (); +} + +#else /* ! defined(CONFIG_SPL_BUILD) */ + +int board_early_init_f (void ) +{ +/* initialize serial port for console */ +lpc32xx_uart_init (CONFIG_SYS_LPC32XX_UART ); +/* enable I2C, SSP, MAC, NAND */ +lpc32xx_i2c_init (1 );/* only I2C1 has devices, I2C2 has none */ +lpc32xx_ssp_init (); +lpc32xx_mac_init (); +lpc32xx_mlc_nand_init (); +/* Display must wait until after relocation and devices init */ +return 0 ; +} + +#define GPO_19 115 + +int board_early_init_r (void ) +{ +/* Set NAND !WP to 1 through GPO_19 */ +gpio_request (GPO_19 ,"NAND_nWP" ); +gpio_direction_output (GPO_19 ,1 ); + +/* initialize display */ +work_92105_display_init (); + +return 0 ; +} + +#endif /* CONFIG_SPL_BUILD */ + +int board_init (void ) +{ +/* adress of boot parameters */ + gd->bd->bi_boot_params =CONFIG_SYS_SDRAM_BASE +0x100 ; + +return 0 ; +} + +int dram_init (void ) +{ + gd->ram_size =get_ram_size ((void *)CONFIG_SYS_SDRAM_BASE , +CONFIG_SYS_SDRAM_SIZE ); + +return 0 ; +} + +#if defined(CONFIG_SPL_BUILD ) +u32 spl_boot_device (void ) +{ +return BOOT_DEVICE_NAND ; +} +#endif board/work-microwave/work_92105/work_92105_display.c new file +349
-0@@ -0,0 +1,349 @@ +/* +* work_92105 display support +* +* (C) Copyright 2014 DENX Software Engineering GmbH +* Written-by: Albert ARIBAUD <[email protected]> +* +* The work_92105 display is a HD44780-compatible module +* controlled through a MAX6957AAX SPI port expander, two +* MAX518 I2C DACs and native LPC32xx GPO 15. +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <asm/arch/sys_proto.h> +#include <asm/arch/cpu.h> +#include <asm/arch/emc.h> +#include <asm/gpio.h> +#include <spi.h> +#include <i2c.h> +#include <version.h> +#include <vsprintf.h> + +/* +* GPO 15 in port 3 is gpio 3*32+15 = 111 +*/ + +#define GPO_15 111 + +/** +* MAX6957AAX registers that we will be using +*/ + +#define MAX6957_CONF 0x04 + +#define MAX6957_CONF_08_11 0x0A +#define MAX6957_CONF_12_15 0x0B +#define MAX6957_CONF_16_19 0x0C + +/** +* Individual gpio ports (one per gpio) to HD44780 +*/ + +#define MAX6957AAX_HD44780_RS 0x29 +#define MAX6957AAX_HD44780_R_W 0x2A +#define MAX6957AAX_HD44780_EN 0x2B +#define MAX6957AAX_HD44780_DATA 0x4C + +/** +* Display controller instructions +*/ + +/* Function set: eight bits, two lines, 8-dot font */ +#define HD44780_FUNCTION_SET 0x38 + +/* Display ON / OFF: turn display on */ +#define HD44780_DISPLAY_ON_OFF_CONTROL 0x0C + +/* Entry mode: increment */ +#define HD44780_ENTRY_MODE_SET 0x06 + +/* Clear */ +#define HD44780_CLEAR_DISPLAY 0x01 + +/* Set DDRAM addr (to be ORed with exact address) */ +#define HD44780_SET_DDRAM_ADDR 0x80 + +/* Set CGRAM addr (to be ORed with exact address) */ +#define HD44780_SET_CGRAM_ADDR 0x40 + +/** +* Default value for contrats +*/ + +#define CONTRAST_DEFAULT 25 + +/** +* Define slave as a module-wide local to save passing it around, +* plus we will need it after init for the "hd44780" command. +*/ + +static struct spi_slave *slave; + +/* +* Write a value into a MAX6957AAX register. +*/ + +static void max6957aax_write (uint8_t reg,uint8_t value) +{ +uint8_t dout[2 ]; + + dout[0 ] = reg; + dout[1 ] = value; +gpio_set_value (GPO_15 ,0 ); +/* do SPI read/write (passing din==dout is OK) */ +spi_xfer (slave,16 , dout, dout,SPI_XFER_BEGIN |SPI_XFER_END ); +gpio_set_value (GPO_15 ,1 ); +} + +/* +* Read a value from a MAX6957AAX register. +* +* According to the MAX6957AAX datasheet, we should release the chip +* select halfway through the read sequence, when the actual register +* value is read; but the WORK_92105 hardware prevents the MAX6957AAX +* SPI OUT from reaching the LPC32XX SIP MISO if chip is not selected. +* so let's release the CS an hold it again while reading the result. +*/ + +static uint8_t max6957aax_read (uint8_t reg) +{ +uint8_t dout[2 ], din[2 ]; + +/* send read command */ + dout[0 ] = reg |0x80 ;/* set bit 7 to indicate read */ + dout[1 ] =0 ; +gpio_set_value (GPO_15 ,0 ); +/* do SPI read/write (passing din==dout is OK) */ +spi_xfer (slave,16 , dout, dout,SPI_XFER_BEGIN |SPI_XFER_END ); +/* latch read command */ +gpio_set_value (GPO_15 ,1 ); +/* read register -- din = noop on xmit, din[1] = reg on recv */ + din[0 ] =0 ; + din[1 ] =0 ; +gpio_set_value (GPO_15 ,0 ); +/* do SPI read/write (passing din==dout is OK) */ +spi_xfer (slave,16 , din, din,SPI_XFER_BEGIN |SPI_XFER_END ); +/* end of read. */ +gpio_set_value (GPO_15 ,1 ); +return din[1 ]; +} + +static void hd44780_instruction (unsigned long instruction) +{ +max6957aax_write (MAX6957AAX_HD44780_RS ,0 ); +max6957aax_write (MAX6957AAX_HD44780_R_W ,0 ); +max6957aax_write (MAX6957AAX_HD44780_EN ,1 ); +max6957aax_write (MAX6957AAX_HD44780_DATA , instruction); +max6957aax_write (MAX6957AAX_HD44780_EN ,0 ); +/* HD44780 takes 37 us for most instructions, 1520 for clear */ +if (instruction ==HD44780_CLEAR_DISPLAY ) +udelay (2000 ); +else +udelay (100 ); +} + +static void hd44780_write_char (char c) +{ +max6957aax_write (MAX6957AAX_HD44780_RS ,1 ); +max6957aax_write (MAX6957AAX_HD44780_R_W ,0 ); +max6957aax_write (MAX6957AAX_HD44780_EN ,1 ); +max6957aax_write (MAX6957AAX_HD44780_DATA , c); +max6957aax_write (MAX6957AAX_HD44780_EN ,0 ); +/* HD44780 takes 37 us to write to DDRAM or CGRAM */ +udelay (100 ); +} + +static void hd44780_write_str (char *s) +{ +max6957aax_write (MAX6957AAX_HD44780_RS ,1 ); +max6957aax_write (MAX6957AAX_HD44780_R_W ,0 ); +while (*s) { +max6957aax_write (MAX6957AAX_HD44780_EN ,1 ); +max6957aax_write (MAX6957AAX_HD44780_DATA , *s); +max6957aax_write (MAX6957AAX_HD44780_EN ,0 ); + s++; +/* HD44780 takes 37 us to write to DDRAM or CGRAM */ +udelay (100 ); + } +} + +/* +* Existing user code might expect these custom characters to be +* recognized and displayed on the LCD +*/ + +static u8 char_gen_chars[] = { +/* #8, empty rectangle */ +0x1F ,0x11 ,0x11 ,0x11 ,0x11 ,0x11 ,0x11 ,0x1F , +/* #9, filled right arrow */ +0x10 ,0x18 ,0x1C ,0x1E ,0x1C ,0x18 ,0x10 ,0x00 , +/* #10, filled left arrow */ +0x01 ,0x03 ,0x07 ,0x0F ,0x07 ,0x03 ,0x01 ,0x00 , +/* #11, up and down arrow */ +0x04 ,0x0E ,0x1F ,0x00 ,0x00 ,0x1F ,0x0E ,0x04 , +/* #12, plus/minus */ +0x04 ,0x04 ,0x1F ,0x04 ,0x04 ,0x00 ,0x1F ,0x00 , +/* #13, fat exclamation mark */ +0x06 ,0x06 ,0x06 ,0x06 ,0x00 ,0x06 ,0x06 ,0x00 , +/* #14, empty square */ +0x00 ,0x1F ,0x11 ,0x11 ,0x11 ,0x1F ,0x00 ,0x00 , +/* #15, struck out square */ +0x00 ,0x1F ,0x19 ,0x15 ,0x13 ,0x1F ,0x00 ,0x00 , +}; + +static void hd44780_init_char_gen (void ) +{ +int i; + +hd44780_instruction (HD44780_SET_CGRAM_ADDR ); + +for (i =0 ; i <sizeof (char_gen_chars); i++) +hd44780_write_char (char_gen_chars[i]); + +hd44780_instruction (HD44780_SET_DDRAM_ADDR ); +} + +void work_92105_display_init (void ) +{ +int claim_err; +char *display_contrast_str; +uint8_t display_contrast =CONTRAST_DEFAULT ; +uint8_t enable_backlight =0x96 ; + + slave =spi_setup_slave (0 ,0 ,500000 ,0 ); + +if (!slave) { +printf ("Failed to set up SPI slave\n" ); +return ; + } + + claim_err =spi_claim_bus (slave); + +if (claim_err) +debug ("Failed to claim SPI bus: %d\n" , claim_err); + +/* enable backlight */ +i2c_write (0x2c ,0x01 ,1 , &enable_backlight,1 ); + +/* set display contrast */ + display_contrast_str =getenv ("fwopt_dispcontrast" ); +if (display_contrast_str) + display_contrast =simple_strtoul (display_contrast_str, +NULL ,10 ); +i2c_write (0x2c ,0x00 ,1 , &display_contrast,1 ); + +/* request GPO_15 as an output initially set to 1 */ +gpio_request (GPO_15 ,"MAX6957_nCS" ); +gpio_direction_output (GPO_15 ,1 ); + +/* enable MAX6957 portexpander */ +max6957aax_write (MAX6957_CONF ,0x01 ); +/* configure pin 8 as input, pins 9..19 as outputs */ +max6957aax_write (MAX6957_CONF_08_11 ,0x56 ); +max6957aax_write (MAX6957_CONF_12_15 ,0x55 ); +max6957aax_write (MAX6957_CONF_16_19 ,0x55 ); + +/* initialize HD44780 */ +max6957aax_write (MAX6957AAX_HD44780_EN ,0 ); +hd44780_instruction (HD44780_FUNCTION_SET ); +hd44780_instruction (HD44780_DISPLAY_ON_OFF_CONTROL ); +hd44780_instruction (HD44780_ENTRY_MODE_SET ); + +/* write custom character glyphs */ +hd44780_init_char_gen (); + +/* Show U-Boot version, date and time as a sign-of-life */ +hd44780_instruction (HD44780_CLEAR_DISPLAY ); +hd44780_instruction (HD44780_SET_DDRAM_ADDR |0 ); +hd44780_write_str (U_BOOT_VERSION ); +hd44780_instruction (HD44780_SET_DDRAM_ADDR |64 ); +hd44780_write_str (U_BOOT_DATE ); +hd44780_instruction (HD44780_SET_DDRAM_ADDR |64 |20 ); +hd44780_write_str (U_BOOT_TIME ); +} + +#ifdef CONFIG_CMD_MAX6957 + +static int do_max6957aax (cmd_tbl_t *cmdtp,int flag,int argc, +char *const argv[]) +{ +int reg, val; + +if (argc !=3 ) +return CMD_RET_USAGE ; +switch (argv[1 ][0 ]) { +case 'r' : +case 'R' : + reg =simple_strtoul (argv[2 ],NULL ,0 ); + val =max6957aax_read (reg); +printf ("MAX6957 reg 0x%02x read 0x%02x\n" , reg, val); +return 0 ; +default : + reg =simple_strtoul (argv[1 ],NULL ,0 ); + val =simple_strtoul (argv[2 ],NULL ,0 ); +max6957aax_write (reg, val); +printf ("MAX6957 reg 0x%02x wrote 0x%02x\n" , reg, val); +return 0 ; + } +return 1 ; +} + +#ifdef CONFIG_SYS_LONGHELP +static char max6957aax_help_text[] = +"max6957aax - write or read display register:\n" +"\tmax6957aax R|r reg - read display register;\n" +"\tmax6957aax reg val - write display register." ; +#endif + +U_BOOT_CMD ( + max6957aax,6 ,1 , do_max6957aax, +"SPI MAX6957 display write/read" , + max6957aax_help_text +); +#endif /* CONFIG_CMD_MAX6957 */ + +#ifdef CONFIG_CMD_HD44760 + +/* +* We need the HUSH parser because we need string arguments, and +* only HUSH can understand them. +*/ + +#if !defined(CONFIG_SYS_HUSH_PARSER ) +#error CONFIG_CMD_HD44760 requires CONFIG_SYS_HUSH_PARSER +#endif + +static int do_hd44780 (cmd_tbl_t *cmdtp,int flag,int argc,char *const argv[]) +{ +char *cmd; + +if (argc !=3 ) +return CMD_RET_USAGE ; + + cmd = argv[1 ]; + +if (strcasecmp (cmd,"cmd" ) ==0 ) +hd44780_instruction (simple_strtol (argv[2 ],NULL ,0 )); +else if (strcasecmp (cmd,"data" ) ==0 ) +hd44780_write_char (simple_strtol (argv[2 ],NULL ,0 )); +else if (strcasecmp (cmd,"str" ) ==0 ) +hd44780_write_str (argv[2 ]); +return 0 ; +} + +#ifdef CONFIG_SYS_LONGHELP +static char hd44780_help_text[] = +"hd44780 - control LCD driver:\n" +"\thd44780 cmd <val> - send command <val> to driver;\n" +"\thd44780 data <val> - send data <val> to driver;\n" +"\thd44780 str \"<text>\" - send \"<text>\" to driver." ; +#endif + +U_BOOT_CMD ( + hd44780,6 ,1 , do_hd44780, +"HD44780 LCD driver control" , + hd44780_help_text +); +#endif /* CONFIG_CMD_HD44780 */ board/work-microwave/work_92105/work_92105_display.h new file +14
-0@@ -0,0 +1,14 @@ +/* +* work_92105 display support interface +* +* (C) Copyright 2014 DENX Software Engineering GmbH +* Written-by: Albert ARIBAUD <[email protected]> +* +* The work_92105 display is a HD44780-compatible module +* controlled through a MAX6957AAX SPI port expander, two +* MAX518 I2C DACs and native LPC32xx GPO 15. +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +void work_92105_display_init (void );configs/work_92105_defconfig new file +5
-0@@ -0,0 +1,5 @@ +CONFIG_DM=y +CONFIG_DM_GPIO=y +CONFIG_SPL=y ++S:CONFIG_ARM=y ++S:CONFIG_TARGET_WORK_92105=yinclude/configs/work_92105.h new file +170
-0@@ -0,0 +1,259 @@ +/* +* WORK Microwave work_92105 board configuration file +* +* (C) Copyright 2014 DENX Software Engineering GmbH +* Written-by: Albert ARIBAUD <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef __CONFIG_WORK_92105_H__ +#define __CONFIG_WORK_92105_H__ + +/* SoC and board defines */ +#include <linux/sizes.h> +#include <asm/arch/cpu.h> + +/* +* Define work_92105 machine type by hand -- done only for compatibility +* with original board code +*/ +#define MACH_TYPE_WORK_92105 736 +#define CONFIG_MACH_TYPE MACH_TYPE_WORK_92105 + +#define CONFIG_SYS_ICACHE_OFF +#define CONFIG_SYS_DCACHE_OFF +#if !defined(CONFIG_SPL_BUILD ) +#define CONFIG_SKIP_LOWLEVEL_INIT +#endif +#define CONFIG_BOARD_EARLY_INIT_F +#define CONFIG_BOARD_EARLY_INIT_R + +/* generate LPC32XX-specific SPL image */ +#define CONFIG_LPC32XX_SPL + +/* +* Memory configurations +*/ +#define CONFIG_NR_DRAM_BANKS 1 +#define CONFIG_SYS_MALLOC_LEN SZ_1M +#define CONFIG_SYS_SDRAM_BASE EMC_DYCS0_BASE +#define CONFIG_SYS_SDRAM_SIZE SZ_64M +#define CONFIG_SYS_TEXT_BASE 0x80100000 +#define CONFIG_SYS_MEMTEST_START (CONFIG_SYS_SDRAM_BASE + SZ_32K) +#define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_TEXT_BASE - SZ_1M) + +#define CONFIG_SYS_LOAD_ADDR (CONFIG_SYS_SDRAM_BASE + SZ_32K) + +#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 */ +#define CONFIG_BAUDRATE 115200 + +/* +* Ethernet Driver +*/ + +#define CONFIG_PHY_SMSC +#define CONFIG_LPC32XX_ETH +#define CONFIG_PHYLIB +#define CONFIG_PHY_ADDR 0 +#define CONFIG_SYS_FAULT_ECHO_LINK_DOWN +#define CONFIG_CMD_MII +#define CONFIG_CMD_PING +#define CONFIG_CMD_DHCP +/* FIXME: remove "Waiting for PHY auto negotiation to complete..." message */ + +/* +* I2C driver +*/ + +#define CONFIG_SYS_I2C_LPC32XX +#define CONFIG_SYS_I2C +#define CONFIG_CMD_I2C +#define CONFIG_SYS_I2C_SPEED 350000 + +/* +* I2C EEPROM +*/ + +#define CONFIG_CMD_EEPROM +#define CONFIG_SYS_I2C_EEPROM_ADDR 0x56 +#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2 + +/* +* I2C RTC +*/ + +#define CONFIG_CMD_DATE +#define CONFIG_RTC_DS1374 + +/* +* I2C Temperature Sensor (DTT) +*/ + +#define CONFIG_CMD_DTT +#define CONFIG_DTT_SENSORS { 0, 1 } +#define CONFIG_DTT_DS620 + +/* +* U-Boot General Configurations +*/ +#define CONFIG_SYS_GENERIC_BOARD +#define CONFIG_SYS_LONGHELP +#define CONFIG_SYS_CBSIZE 1024 +#define CONFIG_SYS_PBSIZE \ + (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16) +#define CONFIG_SYS_MAXARGS 16 +#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE + +#define CONFIG_SYS_HUSH_PARSER + +#define CONFIG_AUTO_COMPLETE +#define CONFIG_CMDLINE_EDITING +#define CONFIG_VERSION_VARIABLE +#define CONFIG_DISPLAY_CPUINFO +#define CONFIG_DOS_PARTITION + +#define CONFIG_CMD_DM + +/* +* No NOR +*/ + +#define CONFIG_SYS_NO_FLASH + +/* +* NAND chip timings for FIXME: which one? +*/ + +#define CONFIG_LPC32XX_NAND_MLC_TCEA_DELAY 333333333 +#define CONFIG_LPC32XX_NAND_MLC_BUSY_DELAY 10000000 +#define CONFIG_LPC32XX_NAND_MLC_NAND_TA 18181818 +#define CONFIG_LPC32XX_NAND_MLC_RD_HIGH 31250000 +#define CONFIG_LPC32XX_NAND_MLC_RD_LOW 45454545 +#define CONFIG_LPC32XX_NAND_MLC_WR_HIGH 40000000 +#define CONFIG_LPC32XX_NAND_MLC_WR_LOW 83333333 + +/* +* NAND +*/ + +/* driver configuration */ +#define CONFIG_SYS_MAX_NAND_DEVICE 1 +#define CONFIG_SYS_NAND_BASE MLC_NAND_BASE +#define CONFIG_NAND_LPC32XX_MLC + +#define CONFIG_CMD_NAND + +/* +* GPIO +*/ + +#define CONFIG_CMD_GPIO +#define CONFIG_LPC32XX_GPIO + +/* +* SSP/SPI/DISPLAY +*/ + +#define CONFIG_CMD_SPI +#define CONFIG_LPC32XX_SSP +#define CONFIG_LPC32XX_SSP_TIMEOUT 100000 +#define CONFIG_CMD_MAX6957 +#define CONFIG_CMD_HD44760 +/* +* Environment
include/configs/work_92105.h line 180
Quoted 10 lines
include/configs/work_92105.h new file +10
-0+*/ + +#define CONFIG_ENV_IS_IN_NAND 1 +#define CONFIG_ENV_SIZE 0x00020000 +#define CONFIG_ENV_OFFSET 0x00100000 +#define CONFIG_ENV_OFFSET_REDUND 0x00120000 +#define CONFIG_ENV_ADDR 0x80000100 +/* provide default ethernet address */ +#define CONFIG_ETHADDR 00:12:B4:00:AF:FE +#define CONFIG_OVERWRITE_ETHADDR_ONCE
We usually don't allow MAC addresses to be set in the board config files. Is this really needed?
Thanks,
Stefan
PATCH v2 8/8 lpc32xx: add support for board work_92105
Hi Stefan,
Le Fri, 13 Feb 2015 10:36:52 +0100, Stefan Roese <[email protected]> a ?crit :
Quoted 24 lines
Quoted 24 lines
+++
b/arch/arm/cpu/arm926ejs/lpc32xx/dram.carch/arm/cpu/arm926ejs/lpc32xx/dram.c new file +22
-0@@ -0,0 +1,80 @@ +/* +* LPC32xx dram init +* +* (C) Copyright 2014 DENX Software Engineering GmbH +* Written-by: Albert ARIBAUD <[email protected]> +* +* This is called by SPL to gain access to the SDR DRAM. +* +* This code runs from SRAM. +* +* Actual CONFIG_LPC32XX_SDRAM_* parameters must be provided +* by the board configuration file. +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <netdev.h> +#include <asm/arch/cpu.h> +#include <asm/arch/clk.h> +#include <asm/arch/wdt.h> +#include <asm/arch/emc.h>
Quoted 8 lines
arch/arm/cpu/arm926ejs/lpc32xx/dram.c line 28
Quoted 6 lines
arch/arm/cpu/arm926ejs/lpc32xx/dram.c new file +6
-0+#include <asm/io.h> + +static struct clk_pm_regs *clk = (struct clk_pm_regs *)CLK_PM_BASE ; +static struct emc_regs *emc = (struct emc_regs *)EMC_BASE ; + +#if defined(CONFIG_SPL_BUILD )Why don't you move this compiler switch to the Makefiles instead?
Indeed, why? :)
Will do in v3.
Quoted 11 lines
board/work-microwave/work_92105/README line 23
Quoted 8 lines
board/work-microwave/work_92105/README new file +7
-0+++ b/board/work-microwave/work_92105/README +This board has SPL support, and uses the LPC32XX boot image format. +Once the U-Boot target "work_92105" is built, the following two files +can be flashed: + + spl/lpc32xx-spl.bin at offset 0x0 + u-boot.bin at offset 0x40000Really u-boot.bin? Why don't you use u-boot.img with the header / CRC instead? This is commonly used by other SPL platforms.
u-boot.bin (headerless) is what the old process used, so I went for the least change path, but of course u-boot.img works too. I'll fix the text to mention u-boot.img and just note that u-boot.bin would work too but would not be checked for integrity.
(plus I need to fix the SPL image name anyway, since I changed it when switching to mkimage.)
Quoted 3 lines
And wouldn't it be nice to combine (concatenate) those two images into one image that can be flashed to the board? There are already some
Makefilerules for doing this.
Actually it would have to concatenate two (redundant) copies of the SPL image then one of U-Boot, bu yes, you're right. I'll look into it -- and add notes to this effect in the board README file.
Quoted 19 lines
Quoted 19 lines
+++
b/board/work-microwave/work_92105/work_92105.cboard/work-microwave/work_92105/work_92105.c new file +17
-0@@ -0,0 +1,86 @@ +/* +* WORK Microwave work_92105 board support +* +* (C) Copyright 2014 DENX Software Engineering GmbH +* Written-by: Albert ARIBAUD <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <asm/io.h> +#include <asm/arch/sys_proto.h> +#include <asm/arch/cpu.h> +#include <asm/arch/emc.h> +#include <asm/gpio.h> +#include <spl.h> +#include "work_92105_display.h"
Quoted 8 lines
board/work-microwave/work_92105/work_92105.c line 21
Quoted 4 lines
board/work-microwave/work_92105/work_92105.c new file +4
-0+ +DECLARE_GLOBAL_DATA_PTR ; + +#if defined(CONFIG_SPL_BUILD )I would perfer to move those SPL related function into a seperate file (e.g.
spl.c) instead. And theMakefilecan handle the conditional compilation then.
Ok.
Quoted 7 lines
include/configs/work_92105.h line 180
Quoted 4 lines
include/configs/work_92105.h new file +3
-0+++ b/include/configs/work_92105.h +#define CONFIG_ETHADDR 00:12:B4:00:AF:FE +#define CONFIG_OVERWRITE_ETHADDR_ONCE We usually don't allow MAC addresses to be set in the board config files. Is this really needed?
If CONFIG_ETH.*ADDR are not to be allowed, then maybe ./README should be updated to reflect this, and the more than 08 existing definitions in include/configs should be fixed. :)
This is what was in the boards's default config initially. I'd rather leave it there in case the actual board provisioning process assumes the board to have this eth MAC address on very first boot. I can add a big red blinking comment though.
Quoted 2 lines
Thanks,
Stefan
Thanks for your review!
Cordialement,
Albert ARIBAUD
3ADEV
PATCH v2 8/8 lpc32xx: add support for board work_92105
Hi Albert,
Quoted 12 lines · Albert ARIBAUD
Quoted 11 lines
board/work-microwave/work_92105/README line 23
Quoted 8 lines
+++ b/board/work-microwave/work_92105/README
board/work-microwave/work_92105/README new file +6
-0+This board has SPL support, and uses the LPC32XX boot image format. +Once the U-Boot target "work_92105" is built, the following two files +can be flashed: + + spl/lpc32xx-spl.bin at offset 0x0 + u-boot.bin at offset 0x40000Really u-boot.bin? Why don't you use u-boot.img with the header / CRC instead? This is commonly used by other SPL platforms.
Quoted 4 lines
u-boot.bin (headerless) is what the old process used, so I went for the least change path, but of course u-boot.img works too. I'll fix the text to mention u-boot.img and just note that u-boot.bin would work too but would not be checked for integrity.
Good. Thanks.
Quoted 10 lines
(plus I need to fix the SPL image name anyway, since I changed it when switching to mkimage.)
Quoted 3 lines
And wouldn't it be nice to combine (concatenate) those two images into one image that can be flashed to the board? There are already some
Makefilerules for doing this.Actually it would have to concatenate two (redundant) copies of the SPL image then one of U-Boot, bu yes, you're right. I'll look into it -- and add notes to this effect in the board README file.
Thanks.
Quoted 11 lines
Quoted 7 lines
include/configs/work_92105.h line 180
Quoted 4 lines
+++
b/include/configs/work_92105.hinclude/configs/work_92105.h new file +2
-0+#define CONFIG_ETHADDR 00:12:B4:00:AF:FE +#define CONFIG_OVERWRITE_ETHADDR_ONCE We usually don't allow MAC addresses to be set in the board config files. Is this really needed?
If CONFIG_ETH.*ADDR are not to be allowed, then maybe ./README should be updated to reflect this, and the more than 08 existing definitions in
include/configsshould be fixed. :)
Yes. We've been less strict with code reviews a few years ago. Thats most likely when those defines "slipped in".
Quoted 4 lines
This is what was in the boards's default config initially. I'd rather leave it there in case the actual board provisioning process assumes the board to have this eth MAC address on very first boot. I can add a big red blinking comment though.
Okay.
Thanks,
Stefan
PATCH v2 8/8 lpc32xx: add support for board work_92105
In reply to Albert ARIBAUD (3ADEV)Quoted 16 lines · On Thu, Feb 12, 2015 at 06:37:07PM +0100, Albert ARIBAUD (3ADEV) wrote:
Work_92105from Work Microwave is an LPC3250-
based board with the following features:
- 64MB SDR DRAM
- 1 GB SLC NAND, managed through MLC controller.
- Ethernet
- Ethernet + PHY SMSC8710
- I2C:
- EEPROM (24M01-compatible)
- RTC (DS1374-compatible)
- Temperature sensor (DS620)
- DACs (2 x MAX518)
- SPI (through SSP interface)
- Port expander MAX6957
- LCD display (HD44780-compatible), controlled
through the port expander and DACs
Quoted 4 lines
This board has SPL support, and uses the LPC32XX boot image format.
Signed-off-by Albert ARIBAUD (3ADEV) <[email protected]>
This adds a warning about CONFIG_CMD_DM being redefined for every file, please fix. Thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150216/00dca215/attachment.sig>
PATCH v2 8/8 lpc32xx: add support for board work_92105
Bonjour Tom,
Le Mon, 16 Feb 2015 20:08:29 -0500, Tom Rini <[email protected]> a ?crit :
Quoted 18 lines · On Thu, Feb 12, 2015 at 06:37:07PM +0100, Albert ARIBAUD (3ADEV) wrote:
Quoted 17 lines
Work_92105from Work Microwave is an LPC3250-
based board with the following features:
- 64MB SDR DRAM
- 1 GB SLC NAND, managed through MLC controller.
- Ethernet
- Ethernet + PHY SMSC8710
- I2C:
- EEPROM (24M01-compatible)
- RTC (DS1374-compatible)
- Temperature sensor (DS620)
- DACs (2 x MAX518)
- SPI (through SSP interface)
- Port expander MAX6957
- LCD display (HD44780-compatible), controlled
through the port expander and DACs
Quoted 7 lines
Quoted 4 lines
This board has SPL support, and uses the LPC32XX boot image format.
Signed-off-by Albert ARIBAUD (3ADEV) <[email protected]>This adds a warning about
CONFIG_CMD_DMbeing redefined for every file, please fix. Thanks!
Weird... I didn't hit this warning here. Will fix, of course.
Cordialement,
Albert ARIBAUD
3ADEV
PATCH v2 7/8 lpc32xx: add lpc32xx-spl.bin boot image target
In reply to Albert ARIBAUD (3ADEV)Quoted 6 lines · On 12 February 2015 at 10:37, Albert ARIBAUD (3ADEV) <[email protected]>…
Signed-off-by Albert ARIBAUD (3ADEV) <[email protected]>---
Changes in v2:
- move boot image generation to mkimage framework
Quoted 7 lines
common/image.c | 1 + include/image.h | 1 + scripts/Makefile.spl | 9 +++ tools/Makefile | 1 + tools/lpc32xximage.c | 178 +++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 190 insertions(+) create mode 100644 tools/lpc32xximage.c
PATCH v2 5/8 lpc32xx: add LPC32xx SSP support (SPI mode)
In reply to Albert ARIBAUD (3ADEV)Quoted 120 lines · On 12 February 2015 at 23:07, Albert ARIBAUD (3ADEV) <[email protected]>…
Signed-off-by Albert ARIBAUD (3ADEV) <[email protected]>---
Changes in v2:
- added MUX setting for SSP0arch/arm/cpu/arm926ejs/lpc32xx/devices.c | 14 +++ arch/arm/include/asm/arch-lpc32xx/clk.h | 3 + arch/arm/include/asm/arch-lpc32xx/sys_proto.h | 1 + drivers/spi/Makefile | 1 + drivers/spi/lpc32xx_ssp.c | 132 ++++++++++++++++++++++++++ 5 files changed, 151 insertions(+) create mode 100644 drivers/spi/lpc32xx_ssp.carch/arm/cpu/arm926ejs/lpc32xx/devices.c +14
-0@@ -8,11 +8,13 @@#include <asm/arch/cpu.h> #include <asm/arch/clk.h> #include <asm/arch/uart.h> +#include <asm/arch/mux.h> #include <asm/io.h> #include <dm.h> static struct clk_pm_regs *clk = (struct clk_pm_regs *)CLK_PM_BASE ;static struct uart_ctrl_regs *ctrl = (struct uart_ctrl_regs *)UART_CTRL_BASE ; +static struct mux_regs *mux = (struct mux_regs *)MUX_BASE ;void lpc32xx_uart_init (unsigned int uart_id) {@@ -66,3 +68,15 @@ void lpc32xx_i2c_init(unsigned int devnum)U_BOOT_DEVICE (lpc32xx_gpios) = { .name ="gpio_lpc32xx" }; + +/* Mux for SCK0, MISO0, MOSI0. We do not use SSEL0. */ + +#define P_MUX_SET_SSP0 0x1600 + +void lpc32xx_ssp_init (void ) +{ +/* Enable SSP0 interface */ +writel (CLK_SSP0_ENABLE_CLOCK , &clk->ssp_ctrl); +/* Mux SSP0 pins */ +writel (P_MUX_SET_SSP0 , &mux->p_mux_set); +}arch/arm/include/asm/arch-lpc32xx/clk.h +3
-0@@ -155,6 +155,9 @@ struct clk_pm_regs {#define CLK_NAND_MLC (1 << 1)#define CLK_NAND_MLC_INT (1 << 5) +/* SSP Clock Control Register bits */ +#define CLK_SSP0_ENABLE_CLOCK (1 << 0) +unsigned int get_sys_clk_rate (void );unsigned int get_hclk_pll_rate (void );unsigned int get_hclk_clk_div (void );arch/arm/include/asm/arch-lpc32xx/sys_proto.h +1
-0@@ -11,5 +11,6 @@ void lpc32xx_uart_init(unsigned int uart_id);void lpc32xx_mac_init (void );void lpc32xx_mlc_nand_init (void );void lpc32xx_i2c_init (unsigned int devnum); +void lpc32xx_ssp_init (void );#endif /* _LPC32XX_SYS_PROTO_H */ drivers/spi/Makefile +1
-0@@ -32,6 +32,7 @@ obj-$(CONFIG_EXYNOS_SPI) += exynos_spi.o obj-$(CONFIG_FTSSP010_SPI) += ftssp010_spi.o obj-$(CONFIG_ICH_SPI) += ich.o obj-$(CONFIG_KIRKWOOD_SPI) += kirkwood_spi.o +obj-$(CONFIG_LPC32XX_SSP) += lpc32xx_ssp.o obj-$(CONFIG_MPC52XX_SPI) += mpc52xx_spi.o obj-$(CONFIG_MPC8XXX_SPI) += mpc8xxx_spi.o obj-$(CONFIG_MXC_SPI) += mxc_spi.odrivers/spi/lpc32xx_ssp.c new file +29
-0@@ -0,0 +1,132 @@ +/* +* LPC32xx SSP interface (SPI mode) +* +* (C) Copyright 2014 DENX Software Engineering GmbH +* Written-by: Albert ARIBAUD <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <linux/compat.h> +#include <asm/io.h> +#include <malloc.h> +#include <spi.h> +#include <asm/arch/clk.h> + +/* SSP chip registers */ +struct ssp_regs { +u32 cr0; +u32 cr1; +u32 data; +u32 sr; +u32 cpsr; +u32 imsc; +u32 ris; +u32 mis; +u32 icr; +u32 dmacr; +};
drivers/spi/lpc32xx_ssp.c line 39
Quoted 10 lines
drivers/spi/lpc32xx_ssp.c new file +10
-0+ +/* CR1 register defines */ +#define SSP_CR1_SSP_ENABLE 0x0002 + +/* SR register defines */ +#define SSP_SR_TNF 0x0002 +/* SSP status RX FIFO not empty bit */ +#define SSP_SR_RNE 0x0004 + +static struct ssp_regs *ssp0_regs = (struct ssp_regs *)SSP0_BASE ;
Pls- use static inline instead of direct macro assignment.
drivers/spi/lpc32xx_ssp.c line 51
Quoted 12 lines
drivers/spi/lpc32xx_ssp.c new file +12
-0+ +static struct spi_slave ssp0_slave = { + .bus =0 , + .cs =0 , + .op_mode_rx =0 , + .op_mode_tx =0 , + .wordlen =8 , + .max_write_size =1 ,/* this is for SPI FLASHes -- don't care */ + .memory_map =NULL ,/* for SPI FLASHes too */ + .option =0 , + .flags =0 +};
This wouldn't require - spi_alloc_slave() is a generic func to do all the stuff. See comments below...
Quoted 4 lines
drivers/spi/lpc32xx_ssp.c new file +4
-0+ +/* spi_init is called during boot when CONFIG_CMD_SPI is defined */ +void spi_init (void ) +{
drivers/spi/lpc32xx_ssp.c line 65
Quoted 10 lines
drivers/spi/lpc32xx_ssp.c new file +10
-0+/* +* nothing to do: clocking was enabled in lpc32xx_ssp_enable() +* and configuration will be done in spi_setup_slave() +*/ +} + +/* the following is called in sequence by do_spi_xfer() */ + +struct spi_slave *spi_setup_slave (uint bus,uint cs,uint max_hz,uint mode) +{
Define spi_cs_is_valid() that wikk ensure the controlling bus and cs options command prompt
use spi_alloc_slave() and members will be having reg_base and slave that's. See drivers/spi/zynq_spi.c for more info.
Suggested code:
static struct ssp0_spi_slave {
struct spi_slave slave;
struct ssp_regs *base;
};static inline struct ssp0_regs *get_ssp0_spi_base(void)
{
return (struct ssp0_regs *) SSP0_BASE;
}in spi_setup_slave()
{
struct ssp0_spi_slave *ssp0;
/* valid bus and cs */
/* allocate */
ssp0 = spi_alloc_slave(struct ssp0_spi_slave, bus, cs);
ssp0->base = get_ssp0_spi_base();}
Quoted 68 lines
drivers/spi/lpc32xx_ssp.c new file +67
-1+/* we only set up SSP0 for now, so ignore bus */ + +if (mode &SPI_3WIRE ) { +error ("3-wire mode not supported" ); +return NULL ; + } + +if (mode &SPI_SLAVE ) { +error ("slave mode not supported\n" ); +return NULL ; + } + +if (mode &SPI_PREAMBLE ) { +error ("preamble byte skipping not supported\n" ); +return NULL ; + } + +/* +* 8 bit frame, SPI fmt, 500kbps -> clock divider is 26. +* Set SCR to 0 and CPSDVSR to 26. +*/ + +writel (0x7 , &ssp0_regs->cr0);/* 8-bit chunks, SPI, 1 clk/bit */ +writel (26 , &ssp0_regs->cpsr);/* SSP clock = HCLK/26 = 500kbps */ +writel (0 , &ssp0_regs->imsc);/* do not raise any interrupts */ +writel (0 , &ssp0_regs->icr);/* clear any pending interrupt */ +writel (0 , &ssp0_regs->dmacr);/* do not do DMAs */ +writel (SSP_CR1_SSP_ENABLE , &ssp0_regs->cr1);/* enable SSP0 */ +return &ssp0_slave; +} + +int spi_claim_bus (struct spi_slave *slave) +{ +/* only one bus and slave so far, always available */ +return 0 ; +} + +int spi_xfer (struct spi_slave *slave,unsigned int bitlen, +const void *dout,void *din,unsigned long flags) +{ +int bytelen = bitlen >>3 ; +int idx_out =0 ; +int idx_in =0 ; +int start_time; + + start_time =get_timer (0 ); +while ((idx_out < bytelen) || (idx_in < bytelen)) { +int status =readl (&ssp0_regs->sr); +if ((idx_out < bytelen) && (status &SSP_SR_TNF )) +writel (((u8 *)dout)[idx_out++], &ssp0_regs->data); +if ((idx_in < bytelen) && (status & status &SSP_SR_RNE )) + ((u8 *)din)[idx_in++] =readl (&ssp0_regs->data); +if (get_timer (start_time) >=CONFIG_LPC32XX_SSP_TIMEOUT ) +return -1 ; + } +return 0 ; +} + +void spi_release_bus (struct spi_slave *slave) +{ +/* do nothing */ +} + +void spi_free_slave (struct spi_slave *slave) +{ +/* do nothing */ +} --
Quoted 2 lines
2.1.0
thanks!
Signature · 1 line
Jagan.
PATCH v2 5/8 lpc32xx: add LPC32xx SSP support (SPI mode)
Bonjour Jagan,
Le Tue, 17 Feb 2015 15:03:16 +0530, Jagan Teki
<[email protected]> a ?crit :
Quoted 126 lines
Quoted 124 lines · On 12 February 2015 at 23:07, Albert ARIBAUD (3ADEV) <[email protected]>…
Signed-off-by Albert ARIBAUD (3ADEV) <[email protected]>---
Changes in v2:
- added MUX setting for SSP0arch/arm/cpu/arm926ejs/lpc32xx/devices.c | 14 +++ arch/arm/include/asm/arch-lpc32xx/clk.h | 3 + arch/arm/include/asm/arch-lpc32xx/sys_proto.h | 1 + drivers/spi/Makefile | 1 + drivers/spi/lpc32xx_ssp.c | 132 ++++++++++++++++++++++++++ 5 files changed, 151 insertions(+) create mode 100644 drivers/spi/lpc32xx_ssp.carch/arm/cpu/arm926ejs/lpc32xx/devices.c +14
-0@@ -8,11 +8,13 @@#include <asm/arch/cpu.h> #include <asm/arch/clk.h> #include <asm/arch/uart.h> +#include <asm/arch/mux.h> #include <asm/io.h> #include <dm.h> static struct clk_pm_regs *clk = (struct clk_pm_regs *)CLK_PM_BASE ;static struct uart_ctrl_regs *ctrl = (struct uart_ctrl_regs *)UART_CTRL_BASE ; +static struct mux_regs *mux = (struct mux_regs *)MUX_BASE ;void lpc32xx_uart_init (unsigned int uart_id) {@@ -66,3 +68,15 @@ void lpc32xx_i2c_init(unsigned int devnum)U_BOOT_DEVICE (lpc32xx_gpios) = { .name ="gpio_lpc32xx" }; + +/* Mux for SCK0, MISO0, MOSI0. We do not use SSEL0. */ + +#define P_MUX_SET_SSP0 0x1600 + +void lpc32xx_ssp_init (void ) +{ +/* Enable SSP0 interface */ +writel (CLK_SSP0_ENABLE_CLOCK , &clk->ssp_ctrl); +/* Mux SSP0 pins */ +writel (P_MUX_SET_SSP0 , &mux->p_mux_set); +}arch/arm/include/asm/arch-lpc32xx/clk.h +3
-0@@ -155,6 +155,9 @@ struct clk_pm_regs {#define CLK_NAND_MLC (1 << 1)#define CLK_NAND_MLC_INT (1 << 5) +/* SSP Clock Control Register bits */ +#define CLK_SSP0_ENABLE_CLOCK (1 << 0) +unsigned int get_sys_clk_rate (void );unsigned int get_hclk_pll_rate (void );unsigned int get_hclk_clk_div (void );arch/arm/include/asm/arch-lpc32xx/sys_proto.h +1
-0@@ -11,5 +11,6 @@ void lpc32xx_uart_init(unsigned int uart_id);void lpc32xx_mac_init (void );void lpc32xx_mlc_nand_init (void );void lpc32xx_i2c_init (unsigned int devnum); +void lpc32xx_ssp_init (void );#endif /* _LPC32XX_SYS_PROTO_H */ drivers/spi/Makefile +1
-0@@ -32,6 +32,7 @@ obj-$(CONFIG_EXYNOS_SPI) += exynos_spi.o obj-$(CONFIG_FTSSP010_SPI) += ftssp010_spi.o obj-$(CONFIG_ICH_SPI) += ich.o obj-$(CONFIG_KIRKWOOD_SPI) += kirkwood_spi.o +obj-$(CONFIG_LPC32XX_SSP) += lpc32xx_ssp.o obj-$(CONFIG_MPC52XX_SPI) += mpc52xx_spi.o obj-$(CONFIG_MPC8XXX_SPI) += mpc8xxx_spi.o obj-$(CONFIG_MXC_SPI) += mxc_spi.odrivers/spi/lpc32xx_ssp.c new file +33
-0@@ -0,0 +1,132 @@ +/* +* LPC32xx SSP interface (SPI mode) +* +* (C) Copyright 2014 DENX Software Engineering GmbH +* Written-by: Albert ARIBAUD <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <linux/compat.h> +#include <asm/io.h> +#include <malloc.h> +#include <spi.h> +#include <asm/arch/clk.h> + +/* SSP chip registers */ +struct ssp_regs { +u32 cr0; +u32 cr1; +u32 data; +u32 sr; +u32 cpsr; +u32 imsc; +u32 ris; +u32 mis; +u32 icr; +u32 dmacr; +}; + +/* CR1 register defines */ +#define SSP_CR1_SSP_ENABLE 0x0002 +
Quoted 8 lines
drivers/spi/lpc32xx_ssp.c line 39
Quoted 6 lines
drivers/spi/lpc32xx_ssp.c new file +6
-0+/* SR register defines */ +#define SSP_SR_TNF 0x0002 +/* SSP status RX FIFO not empty bit */ +#define SSP_SR_RNE 0x0004 + +static struct ssp_regs *ssp0_regs = (struct ssp_regs *)SSP0_BASE ;Pls- use static inline instead of direct macro assignment.
Hmm... What's the benefit of going through a static inline function when all that is performed is an assignment?
Quoted 25 lines
drivers/spi/lpc32xx_ssp.c line 51
Quoted 12 lines
drivers/spi/lpc32xx_ssp.c new file +12
-0+ +static struct spi_slave ssp0_slave = { + .bus =0 , + .cs =0 , + .op_mode_rx =0 , + .op_mode_tx =0 , + .wordlen =8 , + .max_write_size =1 ,/* this is for SPI FLASHes -- don't care */ + .memory_map =NULL ,/* for SPI FLASHes too */ + .option =0 , + .flags =0 +};This wouldn't require -
spi_alloc_slave()is a generic func to do all the stuff. See comments below...Quoted 9 lines
drivers/spi/lpc32xx_ssp.c new file +9
-0+ +/* spi_init is called during boot when CONFIG_CMD_SPI is defined */ +void spi_init (void ) +{ +/* +* nothing to do: clocking was enabled in lpc32xx_ssp_enable() +* and configuration will be done in spi_setup_slave() +*/ +}
Quoted 8 lines
drivers/spi/lpc32xx_ssp.c line 65
Quoted 5 lines
drivers/spi/lpc32xx_ssp.c new file +5
-0+ +/* the following is called in sequence by do_spi_xfer() */ + +struct spi_slave *spi_setup_slave (uint bus,uint cs,uint max_hz,uint mode) +{Define
spi_cs_is_valid()that wikk ensure the controlling bus and cs options command prompt
Not sure I understand what you mean here.
Quoted 26 lines
use
spi_alloc_slave()and members will be havingreg_baseand slave that's. Seedrivers/spi/zynq_spi.cfor more info.Suggested code:
static struct ssp0_spi_slave { struct spi_slave slave; struct ssp_regs *base; };static inline struct
ssp0_regs*get_ssp0_spi_base(void){ return (struct ssp0_regs *) SSP0_BASE; }in
spi_setup_slave(){ struct ssp0_spi_slave *ssp0; /* valid bus and cs */ /* allocate */ ssp0 = spi_alloc_slave(struct ssp0_spi_slave, bus, cs); ssp0->base = get_ssp0_spi_base();
Quoted 1 line
}
Ditto -- I don't see in what respect the code you suggest is supposed to improve things. Can you please develop?
Quoted 64 lines
Quoted 64 lines
drivers/spi/lpc32xx_ssp.c new file +64
-0+/* we only set up SSP0 for now, so ignore bus */ + +if (mode &SPI_3WIRE ) { +error ("3-wire mode not supported" ); +return NULL ; + } + +if (mode &SPI_SLAVE ) { +error ("slave mode not supported\n" ); +return NULL ; + } + +if (mode &SPI_PREAMBLE ) { +error ("preamble byte skipping not supported\n" ); +return NULL ; + } + +/* +* 8 bit frame, SPI fmt, 500kbps -> clock divider is 26. +* Set SCR to 0 and CPSDVSR to 26. +*/ + +writel (0x7 , &ssp0_regs->cr0);/* 8-bit chunks, SPI, 1 clk/bit */ +writel (26 , &ssp0_regs->cpsr);/* SSP clock = HCLK/26 = 500kbps */ +writel (0 , &ssp0_regs->imsc);/* do not raise any interrupts */ +writel (0 , &ssp0_regs->icr);/* clear any pending interrupt */ +writel (0 , &ssp0_regs->dmacr);/* do not do DMAs */ +writel (SSP_CR1_SSP_ENABLE , &ssp0_regs->cr1);/* enable SSP0 */ +return &ssp0_slave; +} + +int spi_claim_bus (struct spi_slave *slave) +{ +/* only one bus and slave so far, always available */ +return 0 ; +} + +int spi_xfer (struct spi_slave *slave,unsigned int bitlen, +const void *dout,void *din,unsigned long flags) +{ +int bytelen = bitlen >>3 ; +int idx_out =0 ; +int idx_in =0 ; +int start_time; + + start_time =get_timer (0 ); +while ((idx_out < bytelen) || (idx_in < bytelen)) { +int status =readl (&ssp0_regs->sr); +if ((idx_out < bytelen) && (status &SSP_SR_TNF )) +writel (((u8 *)dout)[idx_out++], &ssp0_regs->data); +if ((idx_in < bytelen) && (status & status &SSP_SR_RNE )) + ((u8 *)din)[idx_in++] =readl (&ssp0_regs->data); +if (get_timer (start_time) >=CONFIG_LPC32XX_SSP_TIMEOUT ) +return -1 ; + } +return 0 ; +} + +void spi_release_bus (struct spi_slave *slave) +{ +/* do nothing */ +} + +void spi_free_slave (struct spi_slave *slave)
Quoted 8 lines
Quoted 6 lines
drivers/spi/lpc32xx_ssp.c new file +3
-1+{ +/* do nothing */ +} --2.1.0
thanks!
Cordialement,
Albert ARIBAUD
3ADEV
PATCH v2 5/8 lpc32xx: add LPC32xx SSP support (SPI mode)
Hi Albert,
Quoted 140 lines · Albert ARIBAUD
Bonjour Jagan,
Le Tue, 17 Feb 2015 15:03:16 +0530, Jagan Teki
<[email protected]> a ?crit :Quoted 126 lines
Quoted 124 lines · On 12 February 2015 at 23:07, Albert ARIBAUD (3ADEV) <[email protected]>…
Signed-off-by Albert ARIBAUD (3ADEV) <[email protected]>---
Changes in v2:
- added MUX setting for SSP0arch/arm/cpu/arm926ejs/lpc32xx/devices.c | 14 +++ arch/arm/include/asm/arch-lpc32xx/clk.h | 3 + arch/arm/include/asm/arch-lpc32xx/sys_proto.h | 1 + drivers/spi/Makefile | 1 + drivers/spi/lpc32xx_ssp.c | 132 ++++++++++++++++++++++++++ 5 files changed, 151 insertions(+) create mode 100644 drivers/spi/lpc32xx_ssp.carch/arm/cpu/arm926ejs/lpc32xx/devices.c +14
-0@@ -8,11 +8,13 @@#include <asm/arch/cpu.h> #include <asm/arch/clk.h> #include <asm/arch/uart.h> +#include <asm/arch/mux.h> #include <asm/io.h> #include <dm.h> static struct clk_pm_regs *clk = (struct clk_pm_regs *)CLK_PM_BASE ;static struct uart_ctrl_regs *ctrl = (struct uart_ctrl_regs *)UART_CTRL_BASE ; +static struct mux_regs *mux = (struct mux_regs *)MUX_BASE ;void lpc32xx_uart_init (unsigned int uart_id) {@@ -66,3 +68,15 @@ void lpc32xx_i2c_init(unsigned int devnum)U_BOOT_DEVICE (lpc32xx_gpios) = { .name ="gpio_lpc32xx" }; + +/* Mux for SCK0, MISO0, MOSI0. We do not use SSEL0. */ + +#define P_MUX_SET_SSP0 0x1600 + +void lpc32xx_ssp_init (void ) +{ +/* Enable SSP0 interface */ +writel (CLK_SSP0_ENABLE_CLOCK , &clk->ssp_ctrl); +/* Mux SSP0 pins */ +writel (P_MUX_SET_SSP0 , &mux->p_mux_set); +}arch/arm/include/asm/arch-lpc32xx/clk.h +3
-0@@ -155,6 +155,9 @@ struct clk_pm_regs {#define CLK_NAND_MLC (1 << 1)#define CLK_NAND_MLC_INT (1 << 5) +/* SSP Clock Control Register bits */ +#define CLK_SSP0_ENABLE_CLOCK (1 << 0) +unsigned int get_sys_clk_rate (void );unsigned int get_hclk_pll_rate (void );unsigned int get_hclk_clk_div (void );arch/arm/include/asm/arch-lpc32xx/sys_proto.h +1
-0@@ -11,5 +11,6 @@ void lpc32xx_uart_init(unsigned int uart_id);void lpc32xx_mac_init (void );void lpc32xx_mlc_nand_init (void );void lpc32xx_i2c_init (unsigned int devnum); +void lpc32xx_ssp_init (void );#endif /* _LPC32XX_SYS_PROTO_H */ drivers/spi/Makefile +1
-0@@ -32,6 +32,7 @@ obj-$(CONFIG_EXYNOS_SPI) += exynos_spi.o obj-$(CONFIG_FTSSP010_SPI) += ftssp010_spi.o obj-$(CONFIG_ICH_SPI) += ich.o obj-$(CONFIG_KIRKWOOD_SPI) += kirkwood_spi.o +obj-$(CONFIG_LPC32XX_SSP) += lpc32xx_ssp.o obj-$(CONFIG_MPC52XX_SPI) += mpc52xx_spi.o obj-$(CONFIG_MPC8XXX_SPI) += mpc8xxx_spi.o obj-$(CONFIG_MXC_SPI) += mxc_spi.odrivers/spi/lpc32xx_ssp.c new file +33
-0@@ -0,0 +1,132 @@ +/* +* LPC32xx SSP interface (SPI mode) +* +* (C) Copyright 2014 DENX Software Engineering GmbH +* Written-by: Albert ARIBAUD <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <linux/compat.h> +#include <asm/io.h> +#include <malloc.h> +#include <spi.h> +#include <asm/arch/clk.h> + +/* SSP chip registers */ +struct ssp_regs { +u32 cr0; +u32 cr1; +u32 data; +u32 sr; +u32 cpsr; +u32 imsc; +u32 ris; +u32 mis; +u32 icr; +u32 dmacr; +}; + +/* CR1 register defines */ +#define SSP_CR1_SSP_ENABLE 0x0002 +Quoted 8 lines
drivers/spi/lpc32xx_ssp.c line 39
Quoted 6 lines
drivers/spi/lpc32xx_ssp.c new file +6
-0+/* SR register defines */ +#define SSP_SR_TNF 0x0002 +/* SSP status RX FIFO not empty bit */ +#define SSP_SR_RNE 0x0004 + +static struct ssp_regs *ssp0_regs = (struct ssp_regs *)SSP0_BASE ;Pls- use static inline instead of direct macro assignment.
Quoted 2 lines
Hmm... What's the benefit of going through a static inline function when all that is performed is an assignment?
Sorry, it's my mistake i thought the driver handling more than one controller base.
Your macro assignment is correct in that sense.
All I'm explained below is that changes in spi driver like how well it uses the generic spi calls
and the format of the driver resembles same as others (reff. driver drivers/spi/zynq_spi.c)
All (most) of the drivers will follow the same.
If you still confused, may be I will look at it but pls- understand.
Quoted 61 lines
Quoted 26 lines
drivers/spi/lpc32xx_ssp.c line 51
Quoted 13 lines
drivers/spi/lpc32xx_ssp.c new file +12
-0+ +static struct spi_slave ssp0_slave = { + .bus =0 , + .cs =0 , + .op_mode_rx =0 , + .op_mode_tx =0 , + .wordlen =8 , + .max_write_size =1 ,/* this is for SPI FLASHes -- don't care */ + .memory_map =NULL ,/* for SPI FLASHes too */ + .option =0 , + .flags =0 +};This wouldn't require -
spi_alloc_slave()is a generic func to do all the stuff. See comments below...Quoted 9 lines
drivers/spi/lpc32xx_ssp.c new file +9
-0+ +/* spi_init is called during boot when CONFIG_CMD_SPI is defined */ +void spi_init (void ) +{ +/* +* nothing to do: clocking was enabled in lpc32xx_ssp_enable() +* and configuration will be done in spi_setup_slave() +*/ +}Quoted 8 lines
drivers/spi/lpc32xx_ssp.c line 65
Quoted 5 lines
drivers/spi/lpc32xx_ssp.c new file +5
-0+ +/* the following is called in sequence by do_spi_xfer() */ + +struct spi_slave *spi_setup_slave (uint bus,uint cs,uint max_hz,uint mode) +{Define
spi_cs_is_valid()that wikk ensure the controlling bus and cs options command promptNot sure I understand what you mean here.
Quoted 24 lines
use
spi_alloc_slave()and members will be havingreg_baseand slave that's. Seedrivers/spi/zynq_spi.cfor more info.Suggested code:
static struct ssp0_spi_slave { struct spi_slave slave; struct ssp_regs *base; };static inline struct
ssp0_regs*get_ssp0_spi_base(void){ return (struct ssp0_regs *) SSP0_BASE; }in
spi_setup_slave(){ struct ssp0_spi_slave *ssp0; /* valid bus and cs */ /* allocate */ ssp0 = spi_alloc_slave(struct ssp0_spi_slave, bus, cs);
Quoted 79 lines
Quoted 3 lines
ssp0->base = get_ssp0_spi_base();}
Ditto -- I don't see in what respect the code you suggest is supposed to improve things. Can you please develop?
Quoted 72 lines
Quoted 68 lines
drivers/spi/lpc32xx_ssp.c new file +67
-1+/* we only set up SSP0 for now, so ignore bus */ + +if (mode &SPI_3WIRE ) { +error ("3-wire mode not supported" ); +return NULL ; + } + +if (mode &SPI_SLAVE ) { +error ("slave mode not supported\n" ); +return NULL ; + } + +if (mode &SPI_PREAMBLE ) { +error ("preamble byte skipping not supported\n" ); +return NULL ; + } + +/* +* 8 bit frame, SPI fmt, 500kbps -> clock divider is 26. +* Set SCR to 0 and CPSDVSR to 26. +*/ + +writel (0x7 , &ssp0_regs->cr0);/* 8-bit chunks, SPI, 1 clk/bit */ +writel (26 , &ssp0_regs->cpsr);/* SSP clock = HCLK/26 = 500kbps */ +writel (0 , &ssp0_regs->imsc);/* do not raise any interrupts */ +writel (0 , &ssp0_regs->icr);/* clear any pending interrupt */ +writel (0 , &ssp0_regs->dmacr);/* do not do DMAs */ +writel (SSP_CR1_SSP_ENABLE , &ssp0_regs->cr1);/* enable SSP0 */ +return &ssp0_slave; +} + +int spi_claim_bus (struct spi_slave *slave) +{ +/* only one bus and slave so far, always available */ +return 0 ; +} + +int spi_xfer (struct spi_slave *slave,unsigned int bitlen, +const void *dout,void *din,unsigned long flags) +{ +int bytelen = bitlen >>3 ; +int idx_out =0 ; +int idx_in =0 ; +int start_time; + + start_time =get_timer (0 ); +while ((idx_out < bytelen) || (idx_in < bytelen)) { +int status =readl (&ssp0_regs->sr); +if ((idx_out < bytelen) && (status &SSP_SR_TNF )) +writel (((u8 *)dout)[idx_out++], &ssp0_regs->data); +if ((idx_in < bytelen) && (status & status &SSP_SR_RNE )) + ((u8 *)din)[idx_in++] =readl (&ssp0_regs->data); +if (get_timer (start_time) >=CONFIG_LPC32XX_SSP_TIMEOUT ) +return -1 ; + } +return 0 ; +} + +void spi_release_bus (struct spi_slave *slave) +{ +/* do nothing */ +} + +void spi_free_slave (struct spi_slave *slave) +{ +/* do nothing */ +} --Quoted 2 lines
2.1.0
thanks!
thanks!
Signature · 1 line
Jagan.
PATCH v2 4/8 lpc32xx: add GPIO support
In reply to Albert ARIBAUD (3ADEV)Hi Albert,
Quoted 105 lines · On 12 February 2015 at 10:37, Albert ARIBAUD (3ADEV) <[email protected]>…
This driver only supports Driver Model, not legacy model.
Signed-off-by Albert ARIBAUD (3ADEV) <[email protected]>---
Changes in v2:
- move from legacy to Driver Model supportarch/arm/cpu/arm926ejs/lpc32xx/devices.c | 5 + arch/arm/include/asm/arch-lpc32xx/gpio.h | 43 +++++ drivers/gpio/Makefile | 1 + drivers/gpio/lpc32xx_gpio.c | 268 +++++++++++++++++++++++++++++++ 4 files changed, 317 insertions(+) create mode 100644 arch/arm/include/asm/arch-lpc32xx/gpio.h create mode 100644 drivers/gpio/lpc32xx_gpio.carch/arm/cpu/arm926ejs/lpc32xx/devices.c +5
-0@@ -9,6 +9,7 @@#include <asm/arch/clk.h> #include <asm/arch/uart.h> #include <asm/io.h> +#include <dm.h> static struct clk_pm_regs *clk = (struct clk_pm_regs *)CLK_PM_BASE ;static struct uart_ctrl_regs *ctrl = (struct uart_ctrl_regs *)UART_CTRL_BASE ;@@ -61,3 +62,7 @@ void lpc32xx_i2c_init(unsigned int devnum) ctrl |=CLK_I2C2_ENABLE ;writel (ctrl, &clk->i2cclk_ctrl); } + +U_BOOT_DEVICE (lpc32xx_gpios) = { + .name ="gpio_lpc32xx" +};arch/arm/include/asm/arch-lpc32xx/gpio.h new file +43
-0@@ -0,0 +1,43 @@ +/* +* LPC32xx GPIO interface +* +* (C) Copyright 2014 DENX Software Engineering GmbH +* Written-by: Albert ARIBAUD <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +/** +* GPIO Register map for LPC32xx +*/ + +struct gpio_regs { +u32 p3_inp_state; +u32 p3_outp_set; +u32 p3_outp_clr; +u32 p3_outp_state; +/* Watch out! the following are shared between p2 and p3 */ +u32 p2_p3_dir_set; +u32 p2_p3_dir_clr; +u32 p2_p3_dir_state; +/* Now back to 'one register for one port' */ +u32 p2_inp_state; +u32 p2_outp_set; +u32 p2_outp_clr; +u32 reserved1[6 ]; +u32 p0_inp_state; +u32 p0_outp_set; +u32 p0_outp_clr; +u32 p0_outp_state; +u32 p0_dir_set; +u32 p0_dir_clr; +u32 p0_dir_state; +u32 reserved2; +u32 p1_inp_state; +u32 p1_outp_set; +u32 p1_outp_clr; +u32 p1_outp_state; +u32 p1_dir_set; +u32 p1_dir_clr; +u32 p1_dir_state; +};drivers/gpio/Makefile +1
-0@@ -37,3 +37,4 @@ obj-$(CONFIG_ADI_GPIO2) += adi_gpio2.o obj-$(CONFIG_TCA642X) += tca642x.o oby-$(CONFIG_SX151X) += sx151x.o obj-$(CONFIG_SUNXI_GPIO) += sunxi_gpio.o +obj-$(CONFIG_LPC32XX_GPIO) += lpc32xx_gpio.odrivers/gpio/lpc32xx_gpio.c new file +5
-0@@ -0,0 +1,268 @@ +/* +* LPC32xxGPIO driver +* +* (C) Copyright 2014 DENX Software Engineering GmbH +* Written-by: Albert ARIBAUD <[email protected]>
drivers/gpio/lpc32xx_gpio.c line 15
Quoted 10 lines
drivers/gpio/lpc32xx_gpio.c new file +10
-0+* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +/** +* We only support driver model +*/ +#ifndef CONFIG_DM_GPIO +#error Please enable Driver Model GPIO in your target configuration. +#endif
Minor note - if you base this on dm/master you can use Kconfig 'depends on DM' in this driver's Kconfig bit.
(pull request to mainline coming soon)
Quoted 19 lines
drivers/gpio/lpc32xx_gpio.c new file +19
-0+ +#include <asm/io.h> +#include <asm/arch-lpc32xx/cpu.h> +#include <asm/arch-lpc32xx/gpio.h> +#include <asm-generic/gpio.h> +#include <dm.h> +#include <malloc.h> + +/** +* LPC32xx GPIOs work in banks but are non-homogeneous: +* - each bank holds a different number of GPIOs +* - some GPIOs are input/ouput, some input only, some output only; +* - some GPIOs have different meanings as an input and as an output; +* - some GPIOs are controlled on a given port and bit index, but +* read on another one. +* +* In order to keep this code simple, GPIOS are considered here as +* homogeneous and linear, from 0 to 127. +*
drivers/gpio/lpc32xx_gpio.c line 44
Quoted 10 lines
drivers/gpio/lpc32xx_gpio.c new file +10
-0+* ** WARNING ** +* +* Client code is responsible for properly using valid GPIO numbers, +* including cases where a single physical GPIO has differing numbers +* for setting its direction, reading it and/or writing to it. +*/ + +#define LPC32XX_GPIOS 128 + +static struct gpio_regs *regs = (struct gpio_regs *)GPIO_BASE ;
Normally this would go in a
struct lpc32xx_priv
in the driver.
Quoted 7 lines
drivers/gpio/lpc32xx_gpio.c new file +7
-0+ +/** +* We have 4 GPIO ports of 32 bits each +*/ + +#define MAX_GPIO 128 +
drivers/gpio/lpc32xx_gpio.c line 61
Quoted 10 lines
drivers/gpio/lpc32xx_gpio.c new file +10
-0+#define GPIO_TO_PORT (gpio) ((gpio / 32) & 3) +#define GPIO_TO_RANK (gpio) (gpio % 32) +#define GPIO_TO_MASK (gpio) (1 << (gpio % 32)) + +/** +* Array of current GPIO functions. Allocated as unsigned chars to +* limit memory consumption. +*/ + +static signed char lpc32xx_function[LPC32XX_GPIOS ];
...along with this.
Quoted 19 lines
drivers/gpio/lpc32xx_gpio.c new file +19
-0+ +/** +* Configure a GPIO number 'offset' as input +*/ + +static int lpc32xx_gpio_direction_input (struct udevice *dev,unsigned offset) +{ +int port, mask; + + port =GPIO_TO_PORT (offset); + mask =GPIO_TO_MASK (offset); + +switch (port) { +case 0 : +writel (mask, ®s->p0_dir_clr); +break ; +case 1 : +writel (mask, ®s->p1_dir_clr); +break ;
drivers/gpio/lpc32xx_gpio.c line 90
Quoted 10 lines
drivers/gpio/lpc32xx_gpio.c new file +10
-0+case 2 : +/* ports 2 and 3 share a common direction */ +case 3 : +writel (mask, ®s->p2_p3_dir_clr); +break ; +default : +return -1 ; + } + + lpc32xx_function[offset] =GPIOF_INPUT ;
Another way of doing this is to read the status from the hardware. This might allow you to support GPIOF_FUNCTION - i.e. the GPIO is currently used by a function.
Quoted 167 lines
drivers/gpio/lpc32xx_gpio.c new file +167
-0+ +return 0 ; +} + +/** +* Get the value of a GPIO +*/ + +static int lpc32xx_gpio_get_value (struct udevice *dev,unsigned offset) +{ +int port, rank, mask, value; + + port =GPIO_TO_PORT (offset); + +switch (port) { +case 0 : + value =readl (®s->p0_inp_state); +break ; +case 1 : + value =readl (®s->p1_inp_state); +break ; +case 2 : + value =readl (®s->p2_inp_state); +break ; +case 3 : + value =readl (®s->p3_inp_state); +break ; +default : +return -1 ; + } + + rank =GPIO_TO_RANK (offset); + mask =GPIO_TO_MASK (offset); + +return (value & mask) >> rank; +} + +/** +* Set a GPIO +*/ + +static int gpio_set (unsigned gpio) +{ +int port, mask; + + port =GPIO_TO_PORT (gpio); + mask =GPIO_TO_MASK (gpio); + +switch (port) { +case 0 : +writel (mask, ®s->p0_outp_set); +break ; +case 1 : +writel (mask, ®s->p1_outp_set); +break ; +case 2 : +writel (mask, ®s->p2_outp_set); +break ; +case 3 : +writel (mask, ®s->p3_outp_set); +break ; +default : +return -1 ; + } +return 0 ; +} + +/** +* Clear a GPIO +*/ + +static int gpio_clr (unsigned gpio) +{ +int port, mask; + + port =GPIO_TO_PORT (gpio); + mask =GPIO_TO_MASK (gpio); + +switch (port) { +case 0 : +writel (mask, ®s->p0_outp_clr); +break ; +case 1 : +writel (mask, ®s->p1_outp_clr); +break ; +case 2 : +writel (mask, ®s->p2_outp_clr); +break ; +case 3 : +writel (mask, ®s->p3_outp_clr); +break ; +default : +return -1 ; + } +return 0 ; +} + +/** +* Set the value of a GPIO +*/ + +static int lpc32xx_gpio_set_value (struct udevice *dev,unsigned offset, +int value) +{ +if (value) +return gpio_set (offset); +else +return gpio_clr (offset); +} + +/** +* Configure a GPIO number 'offset' as output with given initial value. +*/ + +static int lpc32xx_gpio_direction_output (struct udevice *dev,unsigned offset, +int value) +{ +int port, mask; + + port =GPIO_TO_PORT (offset); + mask =GPIO_TO_MASK (offset); + +switch (port) { +case 0 : +writel (mask, ®s->p0_dir_set); +break ; +case 1 : +writel (mask, ®s->p1_dir_set); +break ; +case 2 : +/* ports 2 and 3 share a common direction */ +case 3 : +writel (mask, ®s->p2_p3_dir_set); +break ; +default : +return -1 ; + } + + lpc32xx_function[offset] =GPIOF_OUTPUT ; + +return lpc32xx_gpio_set_value (dev, offset, value); +} + +static int lpc32xx_gpio_get_function (struct udevice *dev,unsigned offset) +{ +return lpc32xx_function[offset]; +} + +static const struct dm_gpio_ops gpio_lpc32xx_ops = { + .direction_input = lpc32xx_gpio_direction_input, + .direction_output = lpc32xx_gpio_direction_output, + .get_value = lpc32xx_gpio_get_value, + .set_value = lpc32xx_gpio_set_value, + .get_function = lpc32xx_gpio_get_function, +}; + +static int lpc32xx_gpio_probe (struct udevice *dev) +{ +struct gpio_dev_priv *uc_priv = dev->uclass_priv; + +if (dev->of_offset ==-1 ) { +/* Tell the uclass how many GPIOs we have */ + uc_priv->gpio_count =LPC32XX_GPIOS ; + } + +/* all GPIO functions are unknown until requested */ +memset (lpc32xx_function,GPIOF_UNKNOWN ,LPC32XX_GPIOS );
drivers/gpio/lpc32xx_gpio.c line 267
Quoted 10 lines
drivers/gpio/lpc32xx_gpio.c new file +10
-0+ +return 0 ; +} + +U_BOOT_DRIVER (gpio_lpc32xx) = { + .name ="gpio_lpc32xx" , + .id =UCLASS_GPIO , + .ops = &gpio_lpc32xx_ops, + .probe = lpc32xx_gpio_probe, + .priv_auto_alloc_size =0 ,
You can use sizeof(struct lpc32xx_priv) here and it will automatically allocate your structure when the device is probed.
Quoted 4 lines
drivers/gpio/lpc32xx_gpio.c new file +1
-1+}; --2.1.0
Regards,
Simon
PATCH v2 4/8 lpc32xx: add GPIO support
Hi Simon,
Le Thu, 12 Feb 2015 22:06:51 -0700, Simon Glass <[email protected]> a ?crit :
Quoted 123 lines
Hi Albert,
Quoted 105 lines · On 12 February 2015 at 10:37, Albert ARIBAUD (3ADEV) <[email protected]>…
This driver only supports Driver Model, not legacy model.
Signed-off-by Albert ARIBAUD (3ADEV) <[email protected]>---
Changes in v2:
- move from legacy to Driver Model supportarch/arm/cpu/arm926ejs/lpc32xx/devices.c | 5 + arch/arm/include/asm/arch-lpc32xx/gpio.h | 43 +++++ drivers/gpio/Makefile | 1 + drivers/gpio/lpc32xx_gpio.c | 268 +++++++++++++++++++++++++++++++ 4 files changed, 317 insertions(+) create mode 100644 arch/arm/include/asm/arch-lpc32xx/gpio.h create mode 100644 drivers/gpio/lpc32xx_gpio.carch/arm/cpu/arm926ejs/lpc32xx/devices.c +5
-0@@ -9,6 +9,7 @@#include <asm/arch/clk.h> #include <asm/arch/uart.h> #include <asm/io.h> +#include <dm.h> static struct clk_pm_regs *clk = (struct clk_pm_regs *)CLK_PM_BASE ;static struct uart_ctrl_regs *ctrl = (struct uart_ctrl_regs *)UART_CTRL_BASE ;@@ -61,3 +62,7 @@ void lpc32xx_i2c_init(unsigned int devnum) ctrl |=CLK_I2C2_ENABLE ;writel (ctrl, &clk->i2cclk_ctrl); } + +U_BOOT_DEVICE (lpc32xx_gpios) = { + .name ="gpio_lpc32xx" +};arch/arm/include/asm/arch-lpc32xx/gpio.h new file +43
-0@@ -0,0 +1,43 @@ +/* +* LPC32xx GPIO interface +* +* (C) Copyright 2014 DENX Software Engineering GmbH +* Written-by: Albert ARIBAUD <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +/** +* GPIO Register map for LPC32xx +*/ + +struct gpio_regs { +u32 p3_inp_state; +u32 p3_outp_set; +u32 p3_outp_clr; +u32 p3_outp_state; +/* Watch out! the following are shared between p2 and p3 */ +u32 p2_p3_dir_set; +u32 p2_p3_dir_clr; +u32 p2_p3_dir_state; +/* Now back to 'one register for one port' */ +u32 p2_inp_state; +u32 p2_outp_set; +u32 p2_outp_clr; +u32 reserved1[6 ]; +u32 p0_inp_state; +u32 p0_outp_set; +u32 p0_outp_clr; +u32 p0_outp_state; +u32 p0_dir_set; +u32 p0_dir_clr; +u32 p0_dir_state; +u32 reserved2; +u32 p1_inp_state; +u32 p1_outp_set; +u32 p1_outp_clr; +u32 p1_outp_state; +u32 p1_dir_set; +u32 p1_dir_clr; +u32 p1_dir_state; +};drivers/gpio/Makefile +1
-0@@ -37,3 +37,4 @@ obj-$(CONFIG_ADI_GPIO2) += adi_gpio2.o obj-$(CONFIG_TCA642X) += tca642x.o oby-$(CONFIG_SX151X) += sx151x.o obj-$(CONFIG_SUNXI_GPIO) += sunxi_gpio.o +obj-$(CONFIG_LPC32XX_GPIO) += lpc32xx_gpio.odrivers/gpio/lpc32xx_gpio.c new file +5
-0@@ -0,0 +1,268 @@ +/* +* LPC32xxGPIO driver +* +* (C) Copyright 2014 DENX Software Engineering GmbH +* Written-by: Albert ARIBAUD <[email protected]> drivers/gpio/lpc32xx_gpio.c line 15
Quoted 10 lines
drivers/gpio/lpc32xx_gpio.c new file +10
-0+* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +/** +* We only support driver model +*/ +#ifndef CONFIG_DM_GPIO +#error Please enable Driver Model GPIO in your target configuration. +#endif Minor note - if you base this on dm/master you can use
Kconfig'depends on DM' in this driver'sKconfigbit.
Quoted 1 line
(pull request to mainline coming soon)
I will rebase then for v3.
Quoted 31 lines
Quoted 18 lines
drivers/gpio/lpc32xx_gpio.c new file +18
-0+#include <asm/io.h> +#include <asm/arch-lpc32xx/cpu.h> +#include <asm/arch-lpc32xx/gpio.h> +#include <asm-generic/gpio.h> +#include <dm.h> +#include <malloc.h> + +/** +* LPC32xx GPIOs work in banks but are non-homogeneous: +* - each bank holds a different number of GPIOs +* - some GPIOs are input/ouput, some input only, some output only; +* - some GPIOs have different meanings as an input and as an output; +* - some GPIOs are controlled on a given port and bit index, but +* read on another one. +* +* In order to keep this code simple, GPIOS are considered here as +* homogeneous and linear, from 0 to 127. +* drivers/gpio/lpc32xx_gpio.c line 44
Quoted 10 lines
drivers/gpio/lpc32xx_gpio.c new file +10
-0+* ** WARNING ** +* +* Client code is responsible for properly using valid GPIO numbers, +* including cases where a single physical GPIO has differing numbers +* for setting its direction, reading it and/or writing to it. +*/ + +#define LPC32XX_GPIOS 128 + +static struct gpio_regs *regs = (struct gpio_regs *)GPIO_BASE ;Normally this would go in a
Quoted 3 lines
struct
lpc32xx_privin the driver.
Will change this.
Quoted 11 lines
Quoted 11 lines
drivers/gpio/lpc32xx_gpio.c new file +11
-0+ +/** +* We have 4 GPIO ports of 32 bits each +*/ + +#define MAX_GPIO 128 + +#define GPIO_TO_PORT (gpio) ((gpio / 32) & 3) +#define GPIO_TO_RANK (gpio) (gpio % 32) +#define GPIO_TO_MASK (gpio) (1 << (gpio % 32)) +
Quoted 8 lines
drivers/gpio/lpc32xx_gpio.c line 61
Quoted 6 lines
drivers/gpio/lpc32xx_gpio.c new file +6
-0+/** +* Array of current GPIO functions. Allocated as unsigned chars to +* limit memory consumption. +*/ + +static signed char lpc32xx_function[LPC32XX_GPIOS ];...along with this.
Ditto.
Quoted 25 lines
Quoted 25 lines
drivers/gpio/lpc32xx_gpio.c new file +25
-0+ +/** +* Configure a GPIO number 'offset' as input +*/ + +static int lpc32xx_gpio_direction_input (struct udevice *dev,unsigned offset) +{ +int port, mask; + + port =GPIO_TO_PORT (offset); + mask =GPIO_TO_MASK (offset); + +switch (port) { +case 0 : +writel (mask, ®s->p0_dir_clr); +break ; +case 1 : +writel (mask, ®s->p1_dir_clr); +break ; +case 2 : +/* ports 2 and 3 share a common direction */ +case 3 : +writel (mask, ®s->p2_p3_dir_clr); +break ; +default :
Quoted 8 lines
drivers/gpio/lpc32xx_gpio.c line 90
Quoted 4 lines
drivers/gpio/lpc32xx_gpio.c new file +4
-0+return -1 ; + } + + lpc32xx_function[offset] =GPIOF_INPUT ;Another way of doing this is to read the status from the hardware. This might allow you to support
GPIOF_FUNCTION- i.e. the GPIO is currently used by a function.
Even under the simplified model I used for LPC32XX GPIOs, finding out the state of an individual gpio would be quite complicated and would incur much work for a feature which is actually only useful for the 'gpio' command -- a commodity but not a necessity as far a the actual board user is concerned.
Quoted 172 lines
Quoted 172 lines
drivers/gpio/lpc32xx_gpio.c new file +172
-0+ +return 0 ; +} + +/** +* Get the value of a GPIO +*/ + +static int lpc32xx_gpio_get_value (struct udevice *dev,unsigned offset) +{ +int port, rank, mask, value; + + port =GPIO_TO_PORT (offset); + +switch (port) { +case 0 : + value =readl (®s->p0_inp_state); +break ; +case 1 : + value =readl (®s->p1_inp_state); +break ; +case 2 : + value =readl (®s->p2_inp_state); +break ; +case 3 : + value =readl (®s->p3_inp_state); +break ; +default : +return -1 ; + } + + rank =GPIO_TO_RANK (offset); + mask =GPIO_TO_MASK (offset); + +return (value & mask) >> rank; +} + +/** +* Set a GPIO +*/ + +static int gpio_set (unsigned gpio) +{ +int port, mask; + + port =GPIO_TO_PORT (gpio); + mask =GPIO_TO_MASK (gpio); + +switch (port) { +case 0 : +writel (mask, ®s->p0_outp_set); +break ; +case 1 : +writel (mask, ®s->p1_outp_set); +break ; +case 2 : +writel (mask, ®s->p2_outp_set); +break ; +case 3 : +writel (mask, ®s->p3_outp_set); +break ; +default : +return -1 ; + } +return 0 ; +} + +/** +* Clear a GPIO +*/ + +static int gpio_clr (unsigned gpio) +{ +int port, mask; + + port =GPIO_TO_PORT (gpio); + mask =GPIO_TO_MASK (gpio); + +switch (port) { +case 0 : +writel (mask, ®s->p0_outp_clr); +break ; +case 1 : +writel (mask, ®s->p1_outp_clr); +break ; +case 2 : +writel (mask, ®s->p2_outp_clr); +break ; +case 3 : +writel (mask, ®s->p3_outp_clr); +break ; +default : +return -1 ; + } +return 0 ; +} + +/** +* Set the value of a GPIO +*/ + +static int lpc32xx_gpio_set_value (struct udevice *dev,unsigned offset, +int value) +{ +if (value) +return gpio_set (offset); +else +return gpio_clr (offset); +} + +/** +* Configure a GPIO number 'offset' as output with given initial value. +*/ + +static int lpc32xx_gpio_direction_output (struct udevice *dev,unsigned offset, +int value) +{ +int port, mask; + + port =GPIO_TO_PORT (offset); + mask =GPIO_TO_MASK (offset); + +switch (port) { +case 0 : +writel (mask, ®s->p0_dir_set); +break ; +case 1 : +writel (mask, ®s->p1_dir_set); +break ; +case 2 : +/* ports 2 and 3 share a common direction */ +case 3 : +writel (mask, ®s->p2_p3_dir_set); +break ; +default : +return -1 ; + } + + lpc32xx_function[offset] =GPIOF_OUTPUT ; + +return lpc32xx_gpio_set_value (dev, offset, value); +} + +static int lpc32xx_gpio_get_function (struct udevice *dev,unsigned offset) +{ +return lpc32xx_function[offset]; +} + +static const struct dm_gpio_ops gpio_lpc32xx_ops = { + .direction_input = lpc32xx_gpio_direction_input, + .direction_output = lpc32xx_gpio_direction_output, + .get_value = lpc32xx_gpio_get_value, + .set_value = lpc32xx_gpio_set_value, + .get_function = lpc32xx_gpio_get_function, +}; + +static int lpc32xx_gpio_probe (struct udevice *dev) +{ +struct gpio_dev_priv *uc_priv = dev->uclass_priv; + +if (dev->of_offset ==-1 ) { +/* Tell the uclass how many GPIOs we have */ + uc_priv->gpio_count =LPC32XX_GPIOS ; + } + +/* all GPIO functions are unknown until requested */ +memset (lpc32xx_function,GPIOF_UNKNOWN ,LPC32XX_GPIOS ); + +return 0 ; +} + +U_BOOT_DRIVER (gpio_lpc32xx) = {
Quoted 8 lines
drivers/gpio/lpc32xx_gpio.c line 267
Quoted 5 lines
drivers/gpio/lpc32xx_gpio.c new file +5
-0+ .name = "gpio_lpc32xx", + .id = UCLASS_GPIO, + .ops = &gpio_lpc32xx_ops, + .probe = lpc32xx_gpio_probe, + .priv_auto_alloc_size = 0,You can use
sizeof(struct lpc32xx_priv)here and it will automatically allocate your structure when the device is probed.
Yep, that'll get in along with moving the base address and intenal gpio state array.
Quoted 7 lines
Quoted 4 lines
drivers/gpio/lpc32xx_gpio.c new file +1
-1+}; --2.1.0
Regards,
Simon
Thanks for your review!
Cordialement,
Albert ARIBAUD
3ADEV
PATCH v2 4/8 lpc32xx: add GPIO support
Hi Albert,
Quoted 16 lines · Albert ARIBAUD
Hi Simon,
Le Thu, 12 Feb 2015 22:06:51 -0700, Simon Glass <[email protected]> a ?crit :
Quoted 11 lines
Hi Albert,
Quoted 7 lines · On 12 February 2015 at 10:37, Albert ARIBAUD (3ADEV) <[email protected]>…
This driver only supports Driver Model, not legacy model.
Signed-off-by Albert ARIBAUD (3ADEV) <[email protected]>---
Changes in v2:
- move from legacy to Driver Model support
[snip]
Quoted 29 lines
Quoted 20 lines
Quoted 20 lines
drivers/gpio/lpc32xx_gpio.c new file +20
-0+static int lpc32xx_gpio_direction_input (struct udevice *dev,unsigned offset) +{ +int port, mask; + + port =GPIO_TO_PORT (offset); + mask =GPIO_TO_MASK (offset); + +switch (port) { +case 0 : +writel (mask, ®s->p0_dir_clr); +break ; +case 1 : +writel (mask, ®s->p1_dir_clr); +break ; +case 2 : +/* ports 2 and 3 share a common direction */ +case 3 : +writel (mask, ®s->p2_p3_dir_clr); +break ; +default :Quoted 8 lines
drivers/gpio/lpc32xx_gpio.c line 90
Quoted 4 lines
drivers/gpio/lpc32xx_gpio.c new file +4
-0+return -1 ; + } + + lpc32xx_function[offset] =GPIOF_INPUT ;Another way of doing this is to read the status from the hardware. This might allow you to support
GPIOF_FUNCTION- i.e. the GPIO is currently used by a function.
Quoted 5 lines
Even under the simplified model I used for LPC32XX GPIOs, finding out the state of an individual gpio would be quite complicated and would incur much work for a feature which is actually only useful for the 'gpio' command -- a commodity but not a necessity as far a the actual board user is concerned.
Yes it's only a nicety and can easily be added later if someone wants it. But it might be worth adding a comment to that effect - someone using this driver for inspiration might get the wrong idea.
Regards,
Simon
PATCH v2 3/8 lpc32xx: i2c: add LPC32xx I2C interface support
In reply to Albert ARIBAUD (3ADEV)Hello Albert,
Am 12.02.2015 18:37, schrieb Albert ARIBAUD (3ADEV):
Quoted 5 lines
Signed-off-by Albert ARIBAUD (3ADEV) <[email protected]>---
Changes in v2: None
Quoted 8 lines
arch/arm/cpu/arm926ejs/lpc32xx/devices.c | 11 ++ arch/arm/include/asm/arch-lpc32xx/clk.h | 4 + arch/arm/include/asm/arch-lpc32xx/cpu.h | 2 + arch/arm/include/asm/arch-lpc32xx/sys_proto.h | 1 + drivers/i2c/Makefile | 1 + drivers/i2c/lpc32xx_i2c.c | 249 ++++++++++++++++++++++++++ 6 files changed, 268 insertions(+)create mode 100644
drivers/i2c/lpc32xx_i2c.c
Do you have a chance to use DM on this HW?
bye,
Heiko
Quoted 327 lines
arch/arm/cpu/arm926ejs/lpc32xx/devices.c +11
-0@@ -50,3 +50,14 @@ void lpc32xx_mlc_nand_init(void)/* Enable NAND interface */ writel (CLK_NAND_MLC |CLK_NAND_MLC_INT , &clk->flashclk_ctrl); } + +void lpc32xx_i2c_init (unsigned int devnum) +{ +/* Enable I2C interface */ +uint32_t ctrl =readl (&clk->i2cclk_ctrl); +if (devnum ==1 ) + ctrl |=CLK_I2C1_ENABLE ; +if (devnum ==2 ) + ctrl |=CLK_I2C2_ENABLE ; +writel (ctrl, &clk->i2cclk_ctrl); +}arch/arm/include/asm/arch-lpc32xx/clk.h +4
-0@@ -123,6 +123,10 @@ struct clk_pm_regs {#define CLK_MAC_SLAVE (1 << 1)#define CLK_MAC_REG (1 << 0) +/* I2C Clock Control Register bits */ +#define CLK_I2C2_ENABLE (1 << 1) +#define CLK_I2C1_ENABLE (1 << 0) +/* Timer Clock Control1 Register bits */ #define CLK_TIMCLK_MOTOR (1 << 6)#define CLK_TIMCLK_TIMER3 (1 << 5)arch/arm/include/asm/arch-lpc32xx/cpu.h +2
-0@@ -37,6 +37,8 @@#define UART4_BASE 0x40088000/* UART 4 registers base */ #define UART5_BASE 0x40090000/* UART 5 registers base */ #define UART6_BASE 0x40098000/* UART 6 registers base */ +#define I2C1_BASE 0x400A0000/* I2C 1 registers base */ +#define I2C2_BASE 0x400A8000/* I2C 2 registers base */ /* External SDRAM Memory Bank base addresses */ #define EMC_DYCS0_BASE 0x80000000/* SDRAM DYCS0 base address */ arch/arm/include/asm/arch-lpc32xx/sys_proto.h +1
-0@@ -10,5 +10,6 @@void lpc32xx_uart_init (unsigned int uart_id);void lpc32xx_mac_init (void );void lpc32xx_mlc_nand_init (void ); +void lpc32xx_i2c_init (unsigned int devnum);#endif /* _LPC32XX_SYS_PROTO_H */ drivers/i2c/Makefile +1
-0@@ -20,6 +20,7 @@ obj-$(CONFIG_SYS_I2C_FSL) += fsl_i2c.o obj-$(CONFIG_SYS_I2C_FTI2C010) += fti2c010.o obj-$(CONFIG_SYS_I2C_IHS) += ihs_i2c.o obj-$(CONFIG_SYS_I2C_KONA) += kona_i2c.o +obj-$(CONFIG_SYS_I2C_LPC32XX) += lpc32xx_i2c.o obj-$(CONFIG_SYS_I2C_MVTWSI) += mvtwsi.o obj-$(CONFIG_SYS_I2C_MXC) += mxc_i2c.o obj-$(CONFIG_SYS_I2C_MXS) += mxs_i2c.odrivers/i2c/lpc32xx_i2c.c new file +249
-0@@ -0,0 +1,249 @@ +/* +* LPC32xx I2C interface driver +* +* (C) Copyright 2014 DENX Software Engineering GmbH +* Written-by: Albert ARIBAUD - 3ADEV <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <asm/io.h> +#include <i2c.h> +#include <asm/errno.h> +#include <asm/arch/clk.h> + +/* +* Provide default speed and slave if target did not +*/ + +#if !defined(CONFIG_SYS_I2C_LPC32XX_SPEED ) +#define CONFIG_SYS_I2C_LPC32XX_SPEED 350000 +#endif + +#if !defined(CONFIG_SYS_I2C_LPC32XX_SLAVE ) +#define CONFIG_SYS_I2C_LPC32XX_SLAVE 0 +#endif + +/* i2c register set */ +struct lpc32xx_i2c_registers { +union { +u32 rx; +u32 tx; + }; +u32 stat; +u32 ctrl; +u32 clk_hi; +u32 clk_lo; +u32 adr; +u32 rxfl; +u32 txfl; +u32 rxb; +u32 txb; +u32 stx; +u32 stxfl; +}; + +/* TX register fields */ +#define LPC32XX_I2C_TX_START 0x00000100 +#define LPC32XX_I2C_TX_STOP 0x00000200 + +/* Control register values */ +#define LPC32XX_I2C_SOFT_RESET 0x00000100 + +/* 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 + +static struct lpc32xx_i2c_registers *lpc32xx_i2c[] = { + (struct lpc32xx_i2c_registers *)I2C1_BASE , + (struct lpc32xx_i2c_registers *)I2C2_BASE +}; + +/* Set I2C bus speed */ +static unsigned int lpc32xx_i2c_set_bus_speed (struct i2c_adapter *adap, +unsigned int speed) +{ +int half_period; + +if (speed ==0 ) +return -EINVAL ; + + half_period = (105000000 / speed) /2 ; + +if ((half_period >255 ) || (half_period <0 )) +return -EINVAL ; + +writel (half_period, &lpc32xx_i2c[adap->hwadapnr]->clk_hi); +writel (half_period, &lpc32xx_i2c[adap->hwadapnr]->clk_lo); +return 0 ; +} + +/* I2C init called by cmd_i2c when doing 'i2c reset'. */ +static void _i2c_init (struct i2c_adapter *adap, +int requested_speed,int slaveadd) +{ +struct lpc32xx_i2c_registers *i2c = lpc32xx_i2c[adap->hwadapnr]; + +/* soft reset (auto-clears) */ +writel (LPC32XX_I2C_SOFT_RESET , &i2c->ctrl); +/* set HI and LO periods for about 350 kHz */ +lpc32xx_i2c_set_bus_speed (adap, requested_speed); +} + +/* I2C probe called by cmd_i2c when doing 'i2c probe'. */ +static int lpc32xx_i2c_probe (struct i2c_adapter *adap,u8 dev) +{ +struct lpc32xx_i2c_registers *i2c = lpc32xx_i2c[adap->hwadapnr]; +int stat; + +/* Soft-reset the controller */ +writel (LPC32XX_I2C_SOFT_RESET , &i2c->ctrl); +while (readl (&i2c->ctrl) &LPC32XX_I2C_SOFT_RESET ) + ; +/* Addre slave for write with start before and stop after */ +writel ((dev<<1 ) |LPC32XX_I2C_TX_START |LPC32XX_I2C_TX_STOP , + &i2c->tx); +/* wait for end of transation */ +while (!((stat =readl (&i2c->stat)) &LPC32XX_I2C_STAT_TDI )) + ; +/* was there no acknowledge? */ +return (stat &LPC32XX_I2C_STAT_NAI ) ?-1 :0 ; +} + +/* +* I2C read called by cmd_i2c when doing 'i2c read' and by cmd_eeprom.c +* Begin write, send address byte(s), begin read, receive data bytes, end. +*/ +static int lpc32xx_i2c_read (struct i2c_adapter *adap,u8 dev,uint addr, +int alen,u8 *data,int length) +{ +struct lpc32xx_i2c_registers *i2c = lpc32xx_i2c[adap->hwadapnr]; +int stat, wlen; + +/* Soft-reset the controller */ +writel (LPC32XX_I2C_SOFT_RESET , &i2c->ctrl); +while (readl (&i2c->ctrl) &LPC32XX_I2C_SOFT_RESET ) + ; +/* do we need to write an address at all? */ +if (alen) { +/* Address slave in write mode */ +writel ((dev<<1 ) |LPC32XX_I2C_TX_START , &i2c->tx); +/* write address bytes */ +while (alen--) { +/* compute address byte + stop for the last one */ +int a = (addr >> (8 * alen)) &0xff ; +if (!alen) + a |=LPC32XX_I2C_TX_STOP ; +/* Send address byte */ +writel (a, &i2c->tx); + } +/* wait for end of transation */ +while (!((stat =readl (&i2c->stat)) &LPC32XX_I2C_STAT_TDI )) + ; +/* clear end-of-transaction flag */ +writel (1 , &i2c->stat); + } +/* do we have to read data at all? */ +if (length) { +/* Address slave in read mode */ +writel (1 | (dev<<1 ) |LPC32XX_I2C_TX_START , &i2c->tx); + wlen = length; +/* get data */ +while (length | wlen) { +/* read status for TFF and RFE */ + stat =readl (&i2c->stat); +/* must we, can we write a trigger byte? */ +if ((wlen >0 ) + & (!(stat &LPC32XX_I2C_STAT_TFF ))) { + wlen--; +/* write trigger byte + stop if last */ +writel (wlen ?0 : +LPC32XX_I2C_TX_STOP , &i2c->tx); + } +/* must we, can we read a data byte? */ +if ((length >0 ) + & (!(stat &LPC32XX_I2C_STAT_RFE ))) { + length--; +/* read byte */ + *(data++) =readl (&i2c->rx); + } + } + } +/* wait for end of transation */ +while (!((stat =readl (&i2c->stat)) &LPC32XX_I2C_STAT_TDI )) + ; +/* clear end-of-transaction flag */ +writel (1 , &i2c->stat); +/* success */ +return 0 ; +} + +/* +* I2C write called by cmd_i2c when doing 'i2c write' and by cmd_eeprom.c +* Begin write, send address byte(s), send data bytes, end. +*/ +static int lpc32xx_i2c_write (struct i2c_adapter *adap,u8 dev,uint addr, +int alen,u8 *data,int length) +{ +struct lpc32xx_i2c_registers *i2c = lpc32xx_i2c[adap->hwadapnr]; +int stat; + +/* Soft-reset the controller */ +writel (LPC32XX_I2C_SOFT_RESET , &i2c->ctrl); +while (readl (&i2c->ctrl) &LPC32XX_I2C_SOFT_RESET ) + ; +/* do we need to write anything at all? */ +if (alen | length) +/* Address slave in write mode */ +writel ((dev<<1 ) |LPC32XX_I2C_TX_START , &i2c->tx); +/* write address bytes */ +while (alen) { +/* wait for transmit fifo not full */ + stat =readl (&i2c->stat); +if (!(stat &LPC32XX_I2C_STAT_TFF )) { + alen--; +int a = (addr >> (8 * alen)) &0xff ; +if (!(alen | length)) + a |=LPC32XX_I2C_TX_STOP ; +/* Send address byte */ +writel (a, &i2c->tx); + } + } +while (length) { +/* wait for transmit fifo not full */ + stat =readl (&i2c->stat); +if (!(stat &LPC32XX_I2C_STAT_TFF )) { +/* compute data byte, add stop if length==0 */ + length--; +int d = *(data++); +if (!length) + d |=LPC32XX_I2C_TX_STOP ; +/* Send data byte */ +writel (d, &i2c->tx); + } + } +/* wait for end of transation */ +while (!((stat =readl (&i2c->stat)) &LPC32XX_I2C_STAT_TDI )) + ; +/* clear end-of-transaction flag */ +writel (1 , &i2c->stat); +return 0 ; +} + +U_BOOT_I2C_ADAP_COMPLETE (lpc32xx_0, _i2c_init, lpc32xx_i2c_probe, + lpc32xx_i2c_read, lpc32xx_i2c_write, + lpc32xx_i2c_set_bus_speed, +CONFIG_SYS_I2C_LPC32XX_SPEED , +CONFIG_SYS_I2C_LPC32XX_SLAVE , + 0) + +U_BOOT_I2C_ADAP_COMPLETE (lpc32xx_1, _i2c_init, lpc32xx_i2c_probe, + lpc32xx_i2c_read, lpc32xx_i2c_write, + lpc32xx_i2c_set_bus_speed, +CONFIG_SYS_I2C_LPC32XX_SPEED , +CONFIG_SYS_I2C_LPC32XX_SLAVE , +1 )
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
PATCH v2 3/8 lpc32xx: i2c: add LPC32xx I2C interface support
Hi Heiko,
Le Fri, 13 Feb 2015 11:48:26 +0100, Heiko Schocher <[email protected]> a ?crit :
Quoted 17 lines
Hello Albert,
Am 12.02.2015 18:37, schrieb Albert ARIBAUD (3ADEV):
Quoted 5 lines
Signed-off-by Albert ARIBAUD (3ADEV) <[email protected]>---
Changes in v2: None
Quoted 8 lines
arch/arm/cpu/arm926ejs/lpc32xx/devices.c | 11 ++ arch/arm/include/asm/arch-lpc32xx/clk.h | 4 + arch/arm/include/asm/arch-lpc32xx/cpu.h | 2 + arch/arm/include/asm/arch-lpc32xx/sys_proto.h | 1 + drivers/i2c/Makefile | 1 + drivers/i2c/lpc32xx_i2c.c | 249 ++++++++++++++++++++++++++ 6 files changed, 268 insertions(+)create mode 100644
drivers/i2c/lpc32xx_i2c.c
Quoted 3 lines
Acked-by Heiko Schocher <[email protected]>Do you have a chance to use DM on this HW?
I am using it for GPIOs already. I guess you would like I2C to use it too?
Quoted 2 lines
bye,
Heiko
Cordialement,
Albert ARIBAUD
3ADEV
PATCH v2 3/8 lpc32xx: i2c: add LPC32xx I2C interface support
Hello Albert,
Am 13.02.2015 12:09, schrieb Albert ARIBAUD:
Quoted 22 lines
Hi Heiko,
Le Fri, 13 Feb 2015 11:48:26 +0100, Heiko Schocher <[email protected]> a ?crit :
Quoted 17 lines
Hello Albert,
Am 12.02.2015 18:37, schrieb Albert ARIBAUD (3ADEV):
Quoted 13 lines
Signed-off-by Albert ARIBAUD (3ADEV) <[email protected]>---
Changes in v2: None
arch/arm/cpu/arm926ejs/lpc32xx/devices.c | 11 ++ arch/arm/include/asm/arch-lpc32xx/clk.h | 4 + arch/arm/include/asm/arch-lpc32xx/cpu.h | 2 + arch/arm/include/asm/arch-lpc32xx/sys_proto.h | 1 + drivers/i2c/Makefile | 1 + drivers/i2c/lpc32xx_i2c.c | 249 ++++++++++++++++++++++++++ 6 files changed, 268 insertions(+)create mode 100644
drivers/i2c/lpc32xx_i2c.c
Quoted 6 lines
Quoted 3 lines
Acked-by Heiko Schocher <[email protected]>Do you have a chance to use DM on this HW?
I am using it for GPIOs already. I guess you would like I2C to use it too?
Yes, if it is possible for you to convert the driver to it, that would be great!
DM is the future ;-)
bye,
Heiko
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
PATCH v2 3/8 lpc32xx: i2c: add LPC32xx I2C interface support
Hi Albert,
Quoted 34 lines · Heiko Schocher
Hello Albert,
Am 13.02.2015 12:09, schrieb Albert ARIBAUD:
Quoted 31 lines
Hi Heiko,
Le Fri, 13 Feb 2015 11:48:26 +0100, Heiko Schocher <[email protected]> a ?crit :
Quoted 23 lines
Hello Albert,
Am 12.02.2015 18:37, schrieb Albert ARIBAUD (3ADEV):
Quoted 14 lines
Signed-off-by Albert ARIBAUD (3ADEV) <[email protected]>---
Changes in v2: None
arch/arm/cpu/arm926ejs/lpc32xx/devices.c | 11 ++ arch/arm/include/asm/arch-lpc32xx/clk.h | 4 + arch/arm/include/asm/arch-lpc32xx/cpu.h | 2 + arch/arm/include/asm/arch-lpc32xx/sys_proto.h | 1 + drivers/i2c/Makefile | 1 + drivers/i2c/lpc32xx_i2c.c | 249 ++++++++++++++++++++++++++ 6 files changed, 268 insertions(+)Quoted 1 line
create mode 100644
drivers/i2c/lpc32xx_i2c.cAcked-by Heiko Schocher <[email protected]>Do you have a chance to use DM on this HW?
Quoted 8 lines
Quoted 2 lines
I am using it for GPIOs already. I guess you would like I2C to use it too?
Yes, if it is possible for you to convert the driver to it, that would be great!
DM is the future ;-)
It is fairly straightforward for I2C now. There is no detailed documentation but i2c.h explains the methods and you can see examples with tegra, sandbox and samsung (s3c24x0.c).
Regards,
Simon
v2 cover Extend LPC32xx functionality and add LPC32xx-based work_92015 board
In reply to Albert ARIBAUD (3ADEV)Quoted 3 lines · On Thu, Feb 12, 2015 at 06:36:59PM +0100, Albert ARIBAUD (3ADEV) wrote:
This series extends functionality for the LPC32xx platform and introduces the WORK Microwave
work_92105board which makes use of the extended functionality.
Along with the work_92105 problem, just dropping that patch results in devkit3250 failing in another way:
+(devkit3250) ../arch/arm/cpu/arm926ejs/lpc32xx/devices.c:11:26: fatal
error: asm/arch/mux.h: No such file or directory +(devkit3250) #include <asm/arch/mux.h>
+(devkit3250) compilation terminated.
+(devkit3250) make[3]: *** [arch/arm/cpu/arm926ejs/lpc32xx/devices.o] Error 1
+(devkit3250) make[2]: *** [arch/arm/cpu/arm926ejs/lpc32xx] Error 2 +(devkit3250) make[1]: *** [arch/arm/cpu/arm926ejs] Error 2
Not that it should matter here but my default toolchain is ELDK 5.5.2
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150217/29197acb/attachment.sig>
v2 cover Extend LPC32xx functionality and add LPC32xx-based work_92015 board
Bonjour Tom,
Le Tue, 17 Feb 2015 08:20:09 -0500, Tom Rini <[email protected]> a ?crit :
Quoted 17 lines · On Thu, Feb 12, 2015 at 06:36:59PM +0100, Albert ARIBAUD (3ADEV) wrote:
Quoted 4 lines
This series extends functionality for the LPC32xx platform and introduces the WORK Microwave
work_92105board which makes use of the extended functionality.Along with the
work_92105problem, just dropping that patch results in devkit3250 failing in another way:
+(devkit3250)../arch/arm/cpu/arm926ejs/lpc32xx/devices.c:11:26: fatal
error:asm/arch/mux.h: No such file or directory(quoted diff) +3
-0+(devkit3250) #include <asm/arch/mux.h> +(devkit3250) compilation terminated. +(devkit3250) make[3]: *** [arch/arm/cpu/arm926ejs/lpc32xx/devices.o]Error 1
(quoted diff) +2
-0+(devkit3250) make[2]: *** [arch/arm/cpu/arm926ejs/lpc32xx] Error 2 +(devkit3250) make[1]: *** [arch/arm/cpu/arm926ejs] Error 2
Quoted 1 line
Not that it should matter here but my default toolchain is ELDK 5.5.2
I've just (re-)tried building devkit3250 and it builds fine (apart from the warning that the board should be converted to generic).
What commit did you apply the patch series over?
[My toolchain is gcc version 4.7.4 (Ubuntu/Linaro 4.7.4-2ubuntu1) but I agree with you that it most probably does not matter.]
Cordialement,
Albert ARIBAUD
3ADEV
v2 cover Extend LPC32xx functionality and add LPC32xx-based work_92015 board
Quoted 21 lines · Albert ARIBAUD
Bonjour Tom,
Le Tue, 17 Feb 2015 08:20:09 -0500, Tom Rini <[email protected]> a ?crit :
Quoted 17 lines · On Thu, Feb 12, 2015 at 06:36:59PM +0100, Albert ARIBAUD (3ADEV) wrote:
Quoted 4 lines
This series extends functionality for the LPC32xx platform and introduces the WORK Microwave
work_92105board which makes use of the extended functionality.Along with the
work_92105problem, just dropping that patch results in devkit3250 failing in another way:
+(devkit3250)../arch/arm/cpu/arm926ejs/lpc32xx/devices.c:11:26: fatal
error:asm/arch/mux.h: No such file or directory(quoted diff) +3
-0+(devkit3250) #include <asm/arch/mux.h> +(devkit3250) compilation terminated. +(devkit3250) make[3]: *** [arch/arm/cpu/arm926ejs/lpc32xx/devices.o]Error 1
(quoted diff) +2
-0+(devkit3250) make[2]: *** [arch/arm/cpu/arm926ejs/lpc32xx] Error 2 +(devkit3250) make[1]: *** [arch/arm/cpu/arm926ejs] Error 2
Quoted 6 lines
Quoted 1 line
Not that it should matter here but my default toolchain is ELDK 5.5.2
I've just (re-)tried building devkit3250 and it builds fine (apart from the warning that the board should be converted to generic).
What commit did you apply the patch series over?
There's a handful of things I'm merging shortly but that shouldn't matter, so this is odd. I see Jagan requested a few changes to the SPI stuff so I'll pick up the series after that? Thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150217/3f35292d/attachment.sig>
v2 cover Extend LPC32xx functionality and add LPC32xx-based work_92015 board
Tom,
Quoted 27 lines · Tom Rini
Quoted 26 lines · Albert ARIBAUD
Bonjour Tom,
Le Tue, 17 Feb 2015 08:20:09 -0500, Tom Rini <[email protected]> a ?crit :
Quoted 17 lines · On Thu, Feb 12, 2015 at 06:36:59PM +0100, Albert ARIBAUD (3ADEV) wrote:
Quoted 4 lines
This series extends functionality for the LPC32xx platform and introduces the WORK Microwave
work_92105board which makes use of the extended functionality.Along with the
work_92105problem, just dropping that patch results in devkit3250 failing in another way:
+(devkit3250)../arch/arm/cpu/arm926ejs/lpc32xx/devices.c:11:26: fatal
error:asm/arch/mux.h: No such file or directory(quoted diff) +3
-0+(devkit3250) #include <asm/arch/mux.h> +(devkit3250) compilation terminated. +(devkit3250) make[3]: *** [arch/arm/cpu/arm926ejs/lpc32xx/devices.o]Error 1
(quoted diff) +2
-0+(devkit3250) make[2]: *** [arch/arm/cpu/arm926ejs/lpc32xx] Error 2 +(devkit3250) make[1]: *** [arch/arm/cpu/arm926ejs] Error 2Quoted 1 line
Not that it should matter here but my default toolchain is ELDK 5.5.2
I've just (re-)tried building devkit3250 and it builds fine (apart from the warning that the board should be converted to generic).
Quoted 5 lines
Quoted 1 line
What commit did you apply the patch series over?
There's a handful of things I'm merging shortly but that shouldn't matter, so this is odd. I see Jagan requested a few changes to the SPI stuff so I'll pick up the series after that? Thanks!
Updated my reviewed-by tag on v6 spi patch along with some typo, pick that when you take the series.
thanks!
Signature · 1 line
Jagan.
v2 cover Extend LPC32xx functionality and add LPC32xx-based work_92015 board
Bonjour Jagan,
Le Mon, 30 Mar 2015 17:37:47 +0530, Jagan Teki
<[email protected]> a ?crit :
Quoted 30 lines
Tom,
Quoted 27 lines · Tom Rini
Quoted 26 lines · Albert ARIBAUD
Bonjour Tom,
Le Tue, 17 Feb 2015 08:20:09 -0500, Tom Rini <[email protected]> a ?crit :
Quoted 17 lines · On Thu, Feb 12, 2015 at 06:36:59PM +0100, Albert ARIBAUD (3ADEV) wrote:
Quoted 4 lines
This series extends functionality for the LPC32xx platform and introduces the WORK Microwave
work_92105board which makes use of the extended functionality.Along with the
work_92105problem, just dropping that patch results in devkit3250 failing in another way:
+(devkit3250)../arch/arm/cpu/arm926ejs/lpc32xx/devices.c:11:26: fatal
error:asm/arch/mux.h: No such file or directory(quoted diff) +3
-0+(devkit3250) #include <asm/arch/mux.h> +(devkit3250) compilation terminated. +(devkit3250) make[3]: *** [arch/arm/cpu/arm926ejs/lpc32xx/devices.o]Error 1
(quoted diff) +2
-0+(devkit3250) make[2]: *** [arch/arm/cpu/arm926ejs/lpc32xx] Error 2 +(devkit3250) make[1]: *** [arch/arm/cpu/arm926ejs] Error 2Quoted 1 line
Not that it should matter here but my default toolchain is ELDK 5.5.2
I've just (re-)tried building devkit3250 and it builds fine (apart from the warning that the board should be converted to generic).
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
What commit did you apply the patch series over?
There's a handful of things I'm merging shortly but that shouldn't matter, so this is odd. I see Jagan requested a few changes to the SPI stuff so I'll pick up the series after that? Thanks!
Updated my reviewed-by tag on v6 spi patch along with some typo, pick that when you take the series.
Actually there's a (normally final!) v7 coming in the next hours, but there was no change on the SSP/SPI code. With your permission, I'll 'port over' your Reviewed-by from v6 5/8 to v7 5/9.
Quoted 1 line
thanks!
Thanks to you for reviewing.
Cordialement,
Albert ARIBAUD
3ADEV
v2 cover Extend LPC32xx functionality and add LPC32xx-based work_92015 board
Quoted 41 lines · Albert ARIBAUD
Bonjour Jagan,
Le Mon, 30 Mar 2015 17:37:47 +0530, Jagan Teki
<[email protected]> a ?crit :Quoted 36 lines
Tom,
Quoted 32 lines · Tom Rini
Quoted 21 lines · Albert ARIBAUD
Bonjour Tom,
Le Tue, 17 Feb 2015 08:20:09 -0500, Tom Rini <[email protected]> a ?crit :
Quoted 17 lines · On Thu, Feb 12, 2015 at 06:36:59PM +0100, Albert ARIBAUD (3ADEV) wrote:
Quoted 4 lines
This series extends functionality for the LPC32xx platform and introduces the WORK Microwave
work_92105board which makes use of the extended functionality.Along with the
work_92105problem, just dropping that patch results in devkit3250 failing in another way:
+(devkit3250)../arch/arm/cpu/arm926ejs/lpc32xx/devices.c:11:26: fatal
error:asm/arch/mux.h: No such file or directory(quoted diff) +3
-0+(devkit3250) #include <asm/arch/mux.h> +(devkit3250) compilation terminated. +(devkit3250) make[3]: *** [arch/arm/cpu/arm926ejs/lpc32xx/devices.o]Error 1
(quoted diff) +2
-0+(devkit3250) make[2]: *** [arch/arm/cpu/arm926ejs/lpc32xx] Error 2 +(devkit3250) make[1]: *** [arch/arm/cpu/arm926ejs] Error 2Quoted 6 lines
Quoted 1 line
Not that it should matter here but my default toolchain is ELDK 5.5.2
I've just (re-)tried building devkit3250 and it builds fine (apart from the warning that the board should be converted to generic).
What commit did you apply the patch series over?
There's a handful of things I'm merging shortly but that shouldn't matter, so this is odd. I see Jagan requested a few changes to the SPI stuff so I'll pick up the series after that? Thanks!
Quoted 6 lines
Quoted 2 lines
Updated my reviewed-by tag on v6 spi patch along with some typo, pick that when you take the series.
Actually there's a (normally final!) v7 coming in the next hours, but there was no change on the SSP/SPI code. With your permission, I'll 'port over' your Reviewed-by from v6 5/8 to v7 5/9.
Sure, please fix a typo which I pointed in v6
Quoted 4 lines
Quoted 2 lines
thanks!
Thanks to you for reviewing.
thanks!
Signature · 1 line
Jagan.
v2 cover Extend LPC32xx functionality and add LPC32xx-based work_92015 board
Hi Jagan,
Le Tue, 31 Mar 2015 12:30:51 +0530, Jagan Teki
<[email protected]> a ?crit :
Quoted 5 lines
Quoted 3 lines
Actually there's a (normally final!) v7 coming in the next hours, but there was no change on the SSP/SPI code. With your permission, I'll 'port over' your Reviewed-by from v6 5/8 to v7 5/9.
Sure, please fix a typo which I pointed in v6
Fixed, thanks.
Cordialement,
Albert ARIBAUD
3ADEV