WIP Add support for i.MXRT family
Subsystems (12)
v2 cover WIP Add support for i.MXRT family
Hello everybody,
following:
https://lists.denx.de/pipermail/u-boot/2019-October/388853.html
I send a new patchset where WIP means that patch is still not finished but if possible I would like to have a feedback.
This patchset provides:
- soc family entry
- pinctrl driver
- serial driver tweaking
- sdram controller driver
- imxrt1050-evk board basic support
- clock setup using CCF
- addings to pllv3 driver
- some little improvement for DM_CLK in drivers
I still can't have usdhc completely working since it reads zeroes starting from sector 256(0x100).
While LCDIF is in WIP but almost ready.
Thanks in advance for eventually reviewing these patches.
Best regards
Giulio Benetti (18):
imx: Add basic support for the NXP IMXRT10xx SoC family
clk: imx: pllv3: register PLLV3 GENERIC and USB as 2 different clocks
clk: imx: pllv3: set div_mask differently if PLLV3 is GENERIC or USB
clk: imx: pllv3: add enable() support
clk: imx: pllv3: add disable() support
clk: imx: pllv3: add set_rate() support
clk: imx: pllv3: add PLLV3_SYS support
clk: imx: add i.IMXRT clk driver
pinctrl: add i.MXRT driver
serial_lpuart: add clock enable if CONFIG_CLK is defined
serial_lpuart: add support for i.MXRT
ram: add SDRAM driver for i.MXRT SoCs
mmc: fsl_esdhc: make if(CONFIG_IS_ENABLED(CLK)) an #if statement
mmc: fsl_esdhc: add compatible for fsl, imxrt-usdhc WIP
armv7m: cache: add mmu_set_region_dcache_behaviour() stub for
compatibility
video: mxsfb: add support for DM CLK
video: mxsfb: add support for i.MXRT WIP
imx: imxrt1050-evk: Add support for the NXP i.MXRT1050-EVK
arch/arm/Kconfig | 10 + arch/arm/Makefile | 4 +- arch/arm/cpu/armv7m/cache.c | 6 + arch/arm/dts/Makefile | 2 + arch/arm/dts/imxrt1050-evk.dts | 228 ++++ arch/arm/dts/imxrt1050.dtsi | 167 +++ arch/arm/include/asm/arch-imxrt/clock.h | 10 + arch/arm/include/asm/arch-imxrt/gpio.h | 19 + arch/arm/include/asm/arch-imxrt/imx-regs.h | 20 + arch/arm/include/asm/arch-imxrt/imxrt.h | 11 + arch/arm/include/asm/arch-imxrt/sys_proto.h | 11 + arch/arm/include/asm/mach-imx/regs-lcdif.h | 6 +- arch/arm/mach-imx/Makefile | 3 +- arch/arm/mach-imx/imxrt/Kconfig | 17 + arch/arm/mach-imx/imxrt/Makefile | 7 + arch/arm/mach-imx/imxrt/soc.c | 35 + board/freescale/imxrt1050-evk/Kconfig | 22 + board/freescale/imxrt1050-evk/MAINTAINERS | 6 + board/freescale/imxrt1050-evk/Makefile | 6 + board/freescale/imxrt1050-evk/README | 31 + board/freescale/imxrt1050-evk/imximage.cfg | 36 + board/freescale/imxrt1050-evk/imxrt1050-evk.c | 81 ++ configs/imxrt1050-evk_defconfig | 71 ++ drivers/clk/imx/Kconfig | 16 + drivers/clk/imx/Makefile | 2 + drivers/clk/imx/clk-imxrt.c | 254 +++++ drivers/clk/imx/clk-pllv3.c | 135 ++- drivers/mmc/Kconfig | 2 +- drivers/mmc/fsl_esdhc_imx.c | 53 +- drivers/pinctrl/nxp/Kconfig | 14 + drivers/pinctrl/nxp/Makefile | 1 + drivers/pinctrl/nxp/pinctrl-imxrt.c | 40 + drivers/ram/Kconfig | 8 + drivers/ram/Makefile | 2 + drivers/ram/imxrt_sdram.c | 439 ++++++++ drivers/serial/serial_lpuart.c | 28 +- drivers/video/mxsfb.c | 31 +- include/configs/imxrt1050-evk.h | 59 ++ include/dt-bindings/clock/imxrt-clock.h | 65 ++ include/dt-bindings/memory/imxrt-sdram.h | 100 ++ include/dt-bindings/pinctrl/pins-imxrt1050.h | 993 ++++++++++++++++++ include/fsl_lpuart.h | 3 +- 42 files changed, 3008 insertions(+), 46 deletions(-) create mode 100644 arch/arm/dts/imxrt1050-evk.dts create mode 100644 arch/arm/dts/imxrt1050.dtsi create mode 100644 arch/arm/include/asm/arch-imxrt/clock.h create mode 100644 arch/arm/include/asm/arch-imxrt/gpio.h create mode 100644 arch/arm/include/asm/arch-imxrt/imx-regs.h create mode 100644 arch/arm/include/asm/arch-imxrt/imxrt.h create mode 100644 arch/arm/include/asm/arch-imxrt/sys_proto.h create mode 100644 arch/arm/mach-imx/imxrt/Kconfig create mode 100644 arch/arm/mach-imx/imxrt/Makefile create mode 100644 arch/arm/mach-imx/imxrt/soc.c create mode 100644 board/freescale/imxrt1050-evk/Kconfig create mode 100644 board/freescale/imxrt1050-evk/MAINTAINERS create mode 100644 board/freescale/imxrt1050-evk/Makefile create mode 100644 board/freescale/imxrt1050-evk/README create mode 100644 board/freescale/imxrt1050-evk/imximage.cfg create mode 100644 board/freescale/imxrt1050-evk/imxrt1050-evk.c create mode 100644 configs/imxrt1050-evk_defconfig create mode 100644 drivers/clk/imx/clk-imxrt.c create mode 100644 drivers/pinctrl/nxp/pinctrl-imxrt.c create mode 100644 drivers/ram/imxrt_sdram.c create mode 100644 include/configs/imxrt1050-evk.h create mode 100644 include/dt-bindings/clock/imxrt-clock.h create mode 100644 include/dt-bindings/memory/imxrt-sdram.h create mode 100644 include/dt-bindings/pinctrl/pins-imxrt1050.h
Signature · 1 line
2.20.1
RFC PATCH v2 1/18 imx: Add basic support for the NXP IMXRT10xx SoC family
Add i.IMXRT family basic support.
--- arch/arm/Kconfig | 10 ++ arch/arm/Makefile | 4 +- arch/arm/dts/imxrt1050.dtsi | 167 ++++++++++++++++++++ arch/arm/include/asm/arch-imxrt/clock.h | 10 ++ arch/arm/include/asm/arch-imxrt/gpio.h | 19 +++ arch/arm/include/asm/arch-imxrt/imx-regs.h | 20 +++ arch/arm/include/asm/arch-imxrt/imxrt.h | 11 ++ arch/arm/include/asm/arch-imxrt/sys_proto.h | 11 ++ arch/arm/mach-imx/Makefile | 3 +- arch/arm/mach-imx/imxrt/Kconfig | 6 + arch/arm/mach-imx/imxrt/Makefile | 7 + arch/arm/mach-imx/imxrt/soc.c | 35 ++++ 12 files changed, 300 insertions(+), 3 deletions(-) create mode 100644 arch/arm/dts/imxrt1050.dtsi create mode 100644 arch/arm/include/asm/arch-imxrt/clock.h create mode 100644 arch/arm/include/asm/arch-imxrt/gpio.h create mode 100644 arch/arm/include/asm/arch-imxrt/imx-regs.h create mode 100644 arch/arm/include/asm/arch-imxrt/imxrt.h create mode 100644 arch/arm/include/asm/arch-imxrt/sys_proto.h create mode 100644 arch/arm/mach-imx/imxrt/Kconfig create mode 100644 arch/arm/mach-imx/imxrt/Makefile create mode 100644 arch/arm/mach-imx/imxrt/soc.c
arch/arm/Kconfig +10 -0
@@ -797,6 +797,14 @@ config ARCH_IMX8M select SUPPORT_SPL imply CMD_DM +config ARCH_IMXRT + bool "NXP i.MXRT platform" + select CPU_V7M + select DM + select DM_SERIAL + select SUPPORT_SPL + imply CMD_DM + config ARCH_MX23 bool "NXP i.MX23 family" select CPU_ARM926EJS
@@ -1720,6 +1728,8 @@ source "arch/arm/mach-imx/imx8/Kconfig" source "arch/arm/mach-imx/imx8m/Kconfig" +source "arch/arm/mach-imx/imxrt/Kconfig" + source "arch/arm/mach-imx/mxs/Kconfig" source "arch/arm/mach-omap2/Kconfig"
arch/arm/Makefile +2 -2
@@ -104,11 +104,11 @@ libs-y += arch/arm/cpu/ libs-y += arch/arm/lib/ ifeq ($(CONFIG_SPL_BUILD),y) -ifneq (,$(CONFIG_MX23)$(CONFIG_MX28)$(CONFIG_MX35)$(filter $(SOC), mx25 mx5 mx6 mx7 mx35 imx8m imx8)) +ifneq (,$(CONFIG_MX23)$(CONFIG_MX28)$(CONFIG_MX35)$(filter $(SOC), mx25 mx5 mx6 mx7 mx35 imx8m imx8 imxrt)) libs-y += arch/arm/mach-imx/ endif else -ifneq (,$(filter $(SOC), mx25 mx27 mx5 mx6 mx7 mx7ulp mx31 mx35 mxs imx8m imx8 vf610)) +ifneq (,$(filter $(SOC), mx25 mx27 mx5 mx6 mx7 mx7ulp mx31 mx35 mxs imx8m imx8 imxrt vf610)) libs-y += arch/arm/mach-imx/ endif endif
arch/arm/dts/imxrt1050.dtsi new file +167 -0
167 lines not on this page · raw message
arch/arm/include/asm/arch-imxrt/clock.h new file +10 -0
@@ -0,0 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright (C) 2019 +* Author(s): Giulio Benetti <[email protected]> +*/ + +#ifndef __ASM_ARCH_CLOCK_H +#define __ASM_ARCH_CLOCK_H + +#endif /* __ASM_ARCH_CLOCK_H */
arch/arm/include/asm/arch-imxrt/gpio.h new file +19 -0
@@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright (C) 2019 +* Author(s): Giulio Benetti <[email protected]> +*/ + +#ifndef __ASM_ARCH_GPIO_H__ +#define __ASM_ARCH_GPIO_H__ + +#if !(defined(__KERNEL_STRICT_NAMES) || defined(__ASSEMBLY__)) +/* GPIO registers */ +struct gpio_regs { +u32 gpio_dr;/* data */ +u32 gpio_dir;/* direction */ +u32 gpio_psr;/* pad satus */ +}; +#endif + +#endif /* __ASM_ARCH_GPIO_H__ */
arch/arm/include/asm/arch-imxrt/imx-regs.h new file +20 -0
@@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright(C) 2019 +* Author(s): Giulio Benetti <[email protected]> +*/ + +#ifndef __ASM_ARCH_IMX_REGS_H__ +#define __ASM_ARCH_IMX_REGS_H__ + +#define ARCH_MXC + +#define ANATOP_BASE_ADDR 0x400d8000 + +#define MXS_LCDIF_BASE 0x402b8000 + +#if !(defined(__KERNEL_STRICT_NAMES) || defined(__ASSEMBLY__)) +#include <asm/mach-imx/regs-lcdif.h> +#endif + +#endif /* __ASM_ARCH_IMX_REGS_H__ */
arch/arm/include/asm/arch-imxrt/imxrt.h new file +11 -0
@@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright (C) 2019 +* Author(s): Giulio Benetti <[email protected]> +*/ + +#ifndef _ASM_ARCH_IMXRT_H +#define _ASM_ARCH_IMXRT_H + +#endif /* _ASM_ARCH_IMXRT_H */ +
arch/arm/include/asm/arch-imxrt/sys_proto.h new file +11 -0
@@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright (C) 2017 NXP +*/ + +#ifndef _ASM_ARCH_SYS_PROTO_H +#define _ASM_ARCH_SYS_PROTO_H + +#include <asm/mach-imx/sys_proto.h> + +#endif /* _ASM_ARCH_SYS_PROTO_H */
arch/arm/mach-imx/Makefile +2 -1
@@ -27,7 +27,7 @@ endif obj-$(CONFIG_GPT_TIMER) += timer.o obj-$(CONFIG_SYS_I2C_MXC) += i2c-mxv7.o endif -ifeq ($(SOC),$(filter $(SOC),mx7 mx6 mxs imx8m imx8)) +ifeq ($(SOC),$(filter $(SOC),mx7 mx6 mxs imx8m imx8 imxrt)) obj-y += misc.o obj-$(CONFIG_SPL_BUILD) += spl.o endif
@@ -226,5 +226,6 @@ obj-$(CONFIG_MX7) += mx7/ obj-$(CONFIG_ARCH_MX7ULP) += mx7ulp/ obj-$(CONFIG_IMX8M) += imx8m/ obj-$(CONFIG_ARCH_IMX8) += imx8/ +obj-$(CONFIG_ARCH_IMXRT) += imxrt/ obj-$(CONFIG_SPL_BOOTROM_SUPPORT) += spl_imx_romapi.o
arch/arm/mach-imx/imxrt/Kconfig new file +6 -0
@@ -0,0 +1,6 @@ +if ARCH_IMXRT + +config SYS_SOC + default "imxrt" + +endif
arch/arm/mach-imx/imxrt/Makefile new file +7 -0
@@ -0,0 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# (C) Copyright 2019 +# Author(s): Giulio Benetti <[email protected]> +# + +obj-y := soc.o
arch/arm/mach-imx/imxrt/soc.c new file +35 -0
@@ -0,0 +1,35 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Copyright (C) 2019 +* Author(s): Giulio Benetti <[email protected]> +*/ + +#include <common.h> +#include <asm/io.h> +#include <asm/armv7_mpu.h> + +int arch_cpu_init (void ) +{ +int i; + +struct mpu_region_config imxrt1050_region_config[] = { + {0x00000000 ,REGION_0 ,XN_DIS ,PRIV_RW_USR_RW , +STRONG_ORDER ,REGION_4GB }, + {PHYS_SDRAM ,REGION_1 ,XN_DIS ,PRIV_RW_USR_RW , +O_I_WB_RD_WR_ALLOC , (ffs (PHYS_SDRAM_SIZE ) -2 ) }, + {DMAMEM_BASE , +REGION_2 ,XN_DIS ,PRIV_RW_USR_RW , +STRONG_ORDER , (ffs (DMAMEM_SZ_ALL ) -2 ) }, + }; + +/* +* Configure the memory protection unit (MPU) to allow full access to +* the whole 4GB address space. +*/ +disable_mpu (); +for (i =0 ; i <ARRAY_SIZE (imxrt1050_region_config); i++) +mpu_config (&imxrt1050_region_config[i]); +enable_mpu (); + +return 0 ; +}
Signature · 1 line
2.20.1
RFC PATCH v2 2/18 clk: imx: pllv3: register PLLV3 GENERIC and USB as 2 different clocks
In reply to Giulio BenettiBetter to register the 2 clock as different because they work slightly differently depending on power_bit and powerup_set bits coming on next patches.
--- drivers/clk/imx/clk-pllv3.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/clk/imx/clk-pllv3.c +8 -5
@@ -13,7 +13,8 @@#include <clk.h> #include "clk.h" -#define UBOOT_DM_CLK_IMX_PLLV3 "imx_clk_pllv3" +#define UBOOT_DM_CLK_IMX_PLLV3_GENERIC "imx_clk_pllv3_generic" +#define UBOOT_DM_CLK_IMX_PLLV3_USB "imx_clk_pllv3_usb"struct clk_pllv3 {struct clk clk;
@@ -24,7 +25,7 @@ struct clk_pllv3 {#define to_clk_pllv3 (_clk) container_of(_clk, struct clk_pllv3, clk) -static ulong clk_pllv3_get_rate (struct clk *clk) +static ulong clk_pllv3_generic_get_rate (struct clk *clk) {struct clk_pllv3 *pll =to_clk_pllv3 (dev_get_clk_ptr (clk->dev));unsigned long parent_rate =clk_get_parent_rate (clk);
@@ -35,7 +36,7 @@ static ulong clk_pllv3_get_rate(struct clk *clk) }static const struct clk_ops clk_pllv3_generic_ops = { - .get_rate = clk_pllv3_get_rate, + .get_rate = clk_pllv3_generic_get_rate, }; struct clk *imx_clk_pllv3(enum imx_pllv3_type type, const char *name,
@@ -53,8 +54,10 @@ struct clk *imx_clk_pllv3(enum imx_pllv3_type type, const char *name,switch (type) {case IMX_PLLV3_GENERIC : + drv_name =UBOOT_DM_CLK_IMX_PLLV3_GENERIC ; +break ;case IMX_PLLV3_USB : - drv_name =UBOOT_DM_CLK_IMX_PLLV3 ; + drv_name =UBOOT_DM_CLK_IMX_PLLV3_USB ;break ;default :kfree (pll);
@@ -75,7 +78,7 @@ struct clk *imx_clk_pllv3(enum imx_pllv3_type type, const char *name, }U_BOOT_DRIVER (clk_pllv3_generic) = { - .name =UBOOT_DM_CLK_IMX_PLLV3 , + .name =UBOOT_DM_CLK_IMX_PLLV3_GENERIC , .id =UCLASS_CLK , .ops = &clk_pllv3_generic_ops, .flags =DM_FLAG_PRE_RELOC ,
Signature · 1 line
2.20.1
RFC PATCH v2 3/18 clk: imx: pllv3: set div_mask differently if PLLV3 is GENERIC or USB
In reply to Giulio Benettidiv_mask is different for GENERIC and USB pll, so set it according.
--- drivers/clk/imx/clk-pllv3.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/clk/imx/clk-pllv3.c +2 -0
@@ -55,9 +55,11 @@ struct clk *imx_clk_pllv3(enum imx_pllv3_type type, const char *name,switch (type) {case IMX_PLLV3_GENERIC : drv_name =UBOOT_DM_CLK_IMX_PLLV3_GENERIC ; + pll->div_shift =0 ;break ;case IMX_PLLV3_USB : drv_name =UBOOT_DM_CLK_IMX_PLLV3_USB ; + pll->div_shift =1 ;break ;default :kfree (pll);
Signature · 1 line
2.20.1
RFC PATCH v2 4/18 clk: imx: pllv3: add enable() support
In reply to Giulio BenettiBefore set_rate() pllv3 needs enable() to power the pll up. Add enable() taking into account different power_bit and different powerup_set, because some pll needs its power_bit to be set or reset to be powered on.
--- drivers/clk/imx/clk-pllv3.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
drivers/clk/imx/clk-pllv3.c +24 -0
@@ -16,9 +16,13 @@#define UBOOT_DM_CLK_IMX_PLLV3_GENERIC "imx_clk_pllv3_generic"#define UBOOT_DM_CLK_IMX_PLLV3_USB "imx_clk_pllv3_usb" +#define BM_PLL_POWER (0x1 << 12) +struct clk_pllv3 {struct clk clk;void __iomem *base; +u32 power_bit; +bool powerup_set;u32 div_mask;u32 div_shift; };
@@ -35,7 +39,23 @@ static ulong clk_pllv3_generic_get_rate(struct clk *clk)return (div ==1 ) ? parent_rate *22 : parent_rate *20 ; } +static int clk_pllv3_generic_enable (struct clk *clk) +{ +struct clk_pllv3 *pll =to_clk_pllv3 (clk); +u32 val; + + val =readl (pll->base); +if (pll->powerup_set) + val |= pll->power_bit; +else + val &= ~pll->power_bit; +writel (val, pll->base); + +return 0 ; +} +static const struct clk_ops clk_pllv3_generic_ops = { + .enable = clk_pllv3_generic_enable, .get_rate = clk_pllv3_generic_get_rate, };
@@ -52,14 +72,18 @@ struct clk *imx_clk_pllv3(enum imx_pllv3_type type, const char *name,if (!pll)return ERR_PTR (-ENOMEM ); + pll->power_bit =BM_PLL_POWER ; +switch (type) {case IMX_PLLV3_GENERIC : drv_name =UBOOT_DM_CLK_IMX_PLLV3_GENERIC ; pll->div_shift =0 ; + pll->powerup_set = false;break ;case IMX_PLLV3_USB : drv_name =UBOOT_DM_CLK_IMX_PLLV3_USB ; pll->div_shift =1 ; + pll->powerup_set = true;break ;default :kfree (pll);
Signature · 1 line
2.20.1
RFC PATCH v2 5/18 clk: imx: pllv3: add disable() support
In reply to Giulio BenettiAdd disable() support.
--- drivers/clk/imx/clk-pllv3.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
drivers/clk/imx/clk-pllv3.c +16 -0
@@ -54,8 +54,24 @@ static int clk_pllv3_generic_enable(struct clk *clk)return 0 ; } +static int clk_pllv3_generic_disable (struct clk *clk) +{ +struct clk_pllv3 *pll =to_clk_pllv3 (clk); +u32 val; + + val =readl (pll->base); +if (pll->powerup_set) + val &= ~pll->power_bit; +else + val |= pll->power_bit; +writel (val, pll->base); + +return 0 ; +} +static const struct clk_ops clk_pllv3_generic_ops = { .enable = clk_pllv3_generic_enable, + .disable = clk_pllv3_generic_disable, .get_rate = clk_pllv3_generic_get_rate, };
Signature · 1 line
2.20.1
RFC PATCH v2 6/18 clk: imx: pllv3: add set_rate() support
In reply to Giulio BenettiAdd generic set_rate() support.
--- drivers/clk/imx/clk-pllv3.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
drivers/clk/imx/clk-pllv3.c +27 -0
@@ -17,6 +17,7 @@#define UBOOT_DM_CLK_IMX_PLLV3_USB "imx_clk_pllv3_usb"#define BM_PLL_POWER (0x1 << 12) +#define BM_PLL_LOCK (0x1 << 31)struct clk_pllv3 {struct clk clk;
@@ -39,6 +40,31 @@ static ulong clk_pllv3_generic_get_rate(struct clk *clk)return (div ==1 ) ? parent_rate *22 : parent_rate *20 ; } +static ulong clk_pllv3_generic_set_rate (struct clk *clk,ulong rate) +{ +struct clk_pllv3 *pll =to_clk_pllv3 (clk); +unsigned long parent_rate =clk_get_parent_rate (clk); +u32 val, div; + +if (rate == parent_rate *22 ) + div =1 ; +else if (rate == parent_rate *20 ) + div =0 ; +else +return -EINVAL ; + + val =readl (pll->base); + val &= ~(pll->div_mask << pll->div_shift); + val |= (div << pll->div_shift); +writel (val, pll->base); + +/* Wait for PLL to lock */ +while (!(readl (pll->base) &BM_PLL_LOCK )) + ; + +return 0 ; +} +static int clk_pllv3_generic_enable (struct clk *clk) {struct clk_pllv3 *pll =to_clk_pllv3 (clk);
@@ -73,6 +99,7 @@ static const struct clk_ops clk_pllv3_generic_ops = { .enable = clk_pllv3_generic_enable, .disable = clk_pllv3_generic_disable, .get_rate = clk_pllv3_generic_get_rate, + .set_rate = clk_pllv3_generic_set_rate, }; struct clk *imx_clk_pllv3(enum imx_pllv3_type type, const char *name,
Signature · 1 line
2.20.1
RFC PATCH v2 7/18 clk: imx: pllv3: add PLLV3_SYS support
In reply to Giulio BenettiAdd PLLV3_SYS support by adding set/get_rate() for PLLV3_SYS but keeping generic enable()/disable(). Add a different driver because ops are different respect to GENERIC/USB.
--- drivers/clk/imx/clk-pllv3.c | 53 +++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+)
drivers/clk/imx/clk-pllv3.c +53 -0
@@ -14,6 +14,7 @@#include "clk.h" #define UBOOT_DM_CLK_IMX_PLLV3_GENERIC "imx_clk_pllv3_generic" +#define UBOOT_DM_CLK_IMX_PLLV3_SYS "imx_clk_pllv3_sys"#define UBOOT_DM_CLK_IMX_PLLV3_USB "imx_clk_pllv3_usb"#define BM_PLL_POWER (0x1 << 12)
@@ -102,6 +103,46 @@ static const struct clk_ops clk_pllv3_generic_ops = { .set_rate = clk_pllv3_generic_set_rate, }; +static ulong clk_pllv3_sys_get_rate (struct clk *clk) +{ +struct clk_pllv3 *pll =to_clk_pllv3 (clk); +unsigned long parent_rate =clk_get_parent_rate (clk); +u32 div =readl (pll->base) & pll->div_mask; + +return parent_rate * div /2 ; +} + +static ulong clk_pllv3_sys_set_rate (struct clk *clk,unsigned long rate) +{ +struct clk_pllv3 *pll =to_clk_pllv3 (clk); +unsigned long parent_rate =clk_get_parent_rate (clk); +unsigned long min_rate = parent_rate *54 /2 ; +unsigned long max_rate = parent_rate *108 /2 ; +u32 val, div; + +if (rate < min_rate || rate > max_rate) +return -EINVAL ; + + div = rate *2 / parent_rate; + val =readl (pll->base); + val &= ~pll->div_mask; + val |= div; +writel (val, pll->base); + +/* Wait for PLL to lock */ +while (!(readl (pll->base) &BM_PLL_LOCK )) + ; + +return 0 ; +} + +static const struct clk_ops clk_pllv3_sys_ops = { + .enable = clk_pllv3_generic_enable, + .disable = clk_pllv3_generic_disable, + .get_rate = clk_pllv3_sys_get_rate, + .set_rate = clk_pllv3_sys_set_rate, +}; +struct clk *imx_clk_pllv3 (enum imx_pllv3_type type,const char *name,const char *parent_name,void __iomem *base,u32 div_mask)
@@ -123,6 +164,11 @@ struct clk *imx_clk_pllv3(enum imx_pllv3_type type, const char *name, pll->div_shift =0 ; pll->powerup_set = false;break ; +case IMX_PLLV3_SYS : + drv_name =UBOOT_DM_CLK_IMX_PLLV3_SYS ; + pll->div_shift =0 ; + pll->powerup_set = false; +break ;case IMX_PLLV3_USB : drv_name =UBOOT_DM_CLK_IMX_PLLV3_USB ; pll->div_shift =1 ;
@@ -152,3 +198,10 @@ U_BOOT_DRIVER(clk_pllv3_generic) = { .ops = &clk_pllv3_generic_ops, .flags = DM_FLAG_PRE_RELOC, }; + +U_BOOT_DRIVER (clk_pllv3_sys) = { + .name =UBOOT_DM_CLK_IMX_PLLV3_SYS , + .id =UCLASS_CLK , + .ops = &clk_pllv3_sys_ops, + .flags =DM_FLAG_PRE_RELOC , +};
Signature · 1 line
2.20.1
RFC PATCH v2 8/18 clk: imx: add i.IMXRT clk driver
In reply to Giulio BenettiAdd i.MXRT clk driver support.
--- drivers/clk/imx/Kconfig | 16 ++ drivers/clk/imx/Makefile | 2 + drivers/clk/imx/clk-imxrt.c | 254 ++++++++++++++++++++++++ include/dt-bindings/clock/imxrt-clock.h | 65 ++++++ 4 files changed, 337 insertions(+) create mode 100644 drivers/clk/imx/clk-imxrt.c create mode 100644 include/dt-bindings/clock/imxrt-clock.h
drivers/clk/imx/Kconfig +16 -0
@@ -52,3 +52,19 @@ config CLK_IMX8MN select CLK_CCF help This enables support clock driver for i.MX8MN platforms. + +config SPL_CLK_IMXRT + bool "SPL clock support for i.MXRT" + depends on ARCH_IMXRT && SPL + select SPL_CLK + select SPL_CLK_CCF + help + This enables SPL DM/DTS support for clock driver in i.MXRT + +config CLK_IMXRT + bool "Clock support for i.MXRT" + depends on ARCH_IMXRT + select CLK + select CLK_CCF + help + This enables support clock driver for i.MXRT platforms.
drivers/clk/imx/Makefile +2 -0
@@ -14,3 +14,5 @@ obj-$(CONFIG_$(SPL_TPL_)CLK_IMX8MM) += clk-imx8mm.o clk-pll14xx.o \ clk-composite-8m.o obj-$(CONFIG_$(SPL_TPL_)CLK_IMX8MN) += clk-imx8mn.o clk-pll14xx.o \ clk-composite-8m.o + +obj-$(CONFIG_$(SPL_TPL_)CLK_IMXRT) += clk-imxrt.o
drivers/clk/imx/clk-imxrt.c new file +254 -0
254 lines not on this page · raw message
include/dt-bindings/clock/imxrt-clock.h new file +65 -0
65 lines not on this page · raw message
Signature · 1 line
2.20.1
RFC PATCH v2 9/18 pinctrl: add i.MXRT driver
In reply to Giulio BenettiAdd i.MXRT pinctrl driver.
--- drivers/pinctrl/nxp/Kconfig | 14 + drivers/pinctrl/nxp/Makefile | 1 + drivers/pinctrl/nxp/pinctrl-imxrt.c | 40 + include/dt-bindings/pinctrl/pins-imxrt1050.h | 993 +++++++++++++++++++ 4 files changed, 1048 insertions(+) create mode 100644 drivers/pinctrl/nxp/pinctrl-imxrt.c create mode 100644 include/dt-bindings/pinctrl/pins-imxrt1050.h
drivers/pinctrl/nxp/Kconfig +14 -0
@@ -99,6 +99,20 @@ config PINCTRL_MXS familiy, e.g. i.MX28. This feature depends on device tree configuration. +config PINCTRL_IMXRT + bool "IMXRT pinctrl driver" + depends on ARCH_IMXRT && PINCTRL_FULL + select DEVRES + select PINCTRL_IMX + help + Say Y here to enable the imxrt pinctrl driver + + This provides a simple pinctrl driver for i.MXRT SoC familiy. + This feature depends on device tree configuration. This driver + is different from the linux one, this is a simple implementation, + only parses the 'fsl,pins' property and configure related + registers. + config PINCTRL_VYBRID bool "Vybrid (vf610) pinctrl driver" depends on ARCH_VF610 && PINCTRL_FULL
drivers/pinctrl/nxp/Makefile +1 -0
@@ -8,3 +8,4 @@ obj-$(CONFIG_PINCTRL_IMX8) += pinctrl-imx8.o obj-$(CONFIG_PINCTRL_IMX8M) += pinctrl-imx8m.o obj-$(CONFIG_PINCTRL_MXS) += pinctrl-mxs.o obj-$(CONFIG_PINCTRL_VYBRID) += pinctrl-vf610.o +obj-$(CONFIG_PINCTRL_IMXRT) += pinctrl-imxrt.o
drivers/pinctrl/nxp/pinctrl-imxrt.c new file +40 -0
@@ -0,0 +1,40 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Copyright (C) 2019 +* Author(s): Giulio Benetti <[email protected]> +*/ + +#include <common.h> +#include <dm.h> +#include <dm/pinctrl.h> + +#include "pinctrl-imx.h" + +static struct imx_pinctrl_soc_info imxrt_pinctrl_soc_info = { + .flags =ZERO_OFFSET_VALID , +}; + +static int imxrt_pinctrl_probe (struct udevice *dev) +{ +struct imx_pinctrl_soc_info *info = + (struct imx_pinctrl_soc_info *)dev_get_driver_data (dev); + +return imx_pinctrl_probe (dev, info); +} + +static const struct udevice_id imxrt_pinctrl_match[] = { + { .compatible ="fsl,imxrt-iomuxc" , + .data = (ulong)&imxrt_pinctrl_soc_info }, + {/* sentinel */ } +}; + +U_BOOT_DRIVER (imxrt_pinctrl) = { + .name ="imxrt-pinctrl" , + .id =UCLASS_PINCTRL , + .of_match =of_match_ptr (imxrt_pinctrl_match), + .probe = imxrt_pinctrl_probe, + .remove = imx_pinctrl_remove, + .priv_auto_alloc_size =sizeof (struct imx_pinctrl_priv ), + .ops = &imx_pinctrl_ops, + .flags =DM_FLAG_PRE_RELOC , +};
include/dt-bindings/pinctrl/pins-imxrt1050.h new file +993 -0
993 lines not on this page · raw message
Signature · 1 line
2.20.1
RFC PATCH v2 10/18 serial_lpuart: add clock enable if CONFIG_CLK is defined
In reply to Giulio BenettiThis driver assumes that lpuart clock is already enabled before probing but using DM only lpuart won't be automatically enabled so add clk_enable() when probing if CONFIG_CLK is defined.
--- drivers/serial/serial_lpuart.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/serial/serial_lpuart.c +13 -0
@@ -483,6 +483,19 @@ static int lpuart_serial_pending(struct udevice *dev, bool input)static int lpuart_serial_probe (struct udevice *dev) { +#if CONFIG_IS_ENABLED (CLK ) +struct clk per_clk; +int ret; + + ret =clk_get_by_name (dev,"per" , &per_clk); +if (ret) { +dev_err (dev,"Failed to get per clk: %d\n" , ret); +return ret; + } + +clk_enable (&per_clk); +#endif +if (is_lpuart32 (dev))return _lpuart32_serial_init (dev);else
Signature · 1 line
2.20.1
RFC PATCH v2 11/18 serial_lpuart: add support for i.MXRT
In reply to Giulio BenettiAdd i.MXRT compatible string and cpu type support to lpuart driver, to use little endian 32 bits configurations.
Also according to RM, the Receive RX FIFO Enable (RXFE) field in LPUART FIFO register is bit 3, so this definition should change to 0x08 as done for i.MX8. It needs also to set baudrate the same way as i.MX8 does.
--- drivers/serial/serial_lpuart.c | 15 +++++++++++---- include/fsl_lpuart.h | 3 ++- 2 files changed, 13 insertions(+), 5 deletions(-)
drivers/serial/serial_lpuart.c +11 -4
@@ -49,7 +49,7 @@#define FIFO_RXSIZE_MASK 0x7#define FIFO_RXSIZE_OFF 0#define FIFO_TXFE 0x80 -#ifdef CONFIG_ARCH_IMX8 +#if defined(CONFIG_ARCH_IMX8 ) || defined(CONFIG_ARCH_IMXRT )#define FIFO_RXFE 0x08#else #define FIFO_RXFE 0x40
@@ -67,7 +67,8 @@ enum lpuart_devtype {DEV_VF610 =1 ,DEV_LS1021A ,DEV_MX7ULP , -DEV_IMX8 +DEV_IMX8 , + DEV_IMXRT, }; struct lpuart_serial_platdata {
@@ -409,7 +410,8 @@ static int _lpuart32_serial_init(struct udevice *dev)lpuart_write32 (plat->flags, &base->match,0 ); -if (plat->devtype ==DEV_MX7ULP || plat->devtype ==DEV_IMX8 ) { +if (plat->devtype ==DEV_MX7ULP || plat->devtype ==DEV_IMX8 || + plat->devtype ==DEV_IMXRT ) {_lpuart32_serial_setbrg_7ulp (dev, gd->baudrate); }else {/* provide data bits, parity, stop bit, etc */
@@ -426,7 +428,8 @@ static int lpuart_serial_setbrg(struct udevice *dev, int baudrate)struct lpuart_serial_platdata *plat =dev_get_platdata (dev);if (is_lpuart32 (dev)) { -if (plat->devtype ==DEV_MX7ULP || plat->devtype ==DEV_IMX8 ) +if (plat->devtype ==DEV_MX7ULP || plat->devtype ==DEV_IMX8 || + plat->devtype ==DEV_IMXRT )_lpuart32_serial_setbrg_7ulp (dev, baudrate);else _lpuart32_serial_setbrg (dev, baudrate);
@@ -527,6 +530,8 @@ static int lpuart_serial_ofdata_to_platdata(struct udevice *dev) plat->devtype =DEV_VF610 ; else if (!fdt_node_check_compatible(blob, node, "fsl,imx8qm-lpuart")) plat->devtype = DEV_IMX8; + else if (!fdt_node_check_compatible(blob, node, "fsl,imxrt-lpuart")) + plat->devtype = DEV_IMXRT;return 0 ; }
@@ -546,6 +551,8 @@ static const struct udevice_id lpuart_serial_ids[] = { { .compatible = "fsl,vf610-lpuart"}, { .compatible = "fsl,imx8qm-lpuart", .data = LPUART_FLAG_REGMAP_32BIT_REG }, + { .compatible = "fsl,imxrt-lpuart", + .data = LPUART_FLAG_REGMAP_32BIT_REG }, { } };
include/fsl_lpuart.h +2 -1
@@ -4,7 +4,8 @@* */ -#if defined(CONFIG_ARCH_MX7ULP) || defined(CONFIG_ARCH_IMX8) +#if defined(CONFIG_ARCH_MX7ULP) || defined(CONFIG_ARCH_IMX8) || \ + defined(CONFIG_ARCH_IMXRT) struct lpuart_fsl_reg32 { u32 verid; u32 param;
Signature · 1 line
2.20.1
RFC PATCH v2 12/18 ram: add SDRAM driver for i.MXRT SoCs
In reply to Giulio Benetti--- drivers/ram/Kconfig | 8 + drivers/ram/Makefile | 2 + drivers/ram/imxrt_sdram.c | 439 +++++++++++++++++++++++ include/dt-bindings/clock/imxrt-clock.h | 2 +- include/dt-bindings/memory/imxrt-sdram.h | 100 ++++++ 5 files changed, 550 insertions(+), 1 deletion(-) create mode 100644 drivers/ram/imxrt_sdram.c create mode 100644 include/dt-bindings/memory/imxrt-sdram.h
drivers/ram/Kconfig +8 -0
@@ -65,5 +65,13 @@ config K3_J721E_DDRSS Enabling this config adds support for the DDR memory controller on J721E family of SoCs. +config IMXRT_SDRAM + bool "Enable i.MXRT SDRAM support" + depends on RAM + help + i.MXRT family devices support smart external memory controller(SEMC) + to support external memories like sdram, psram & nand. + This driver is for the sdram memory interface with the SEMC. + source "drivers/ram/rockchip/Kconfig" source "drivers/ram/stm32mp1/Kconfig"
drivers/ram/Makefile +2 -0
@@ -15,3 +15,5 @@ obj-$(CONFIG_ARCH_ROCKCHIP) += rockchip/ obj-$(CONFIG_K3_AM654_DDRSS) += k3-am654-ddrss.o obj-$(CONFIG_ARCH_MEDIATEK) += mediatek/ obj-$(CONFIG_K3_J721E_DDRSS) += k3-j721e/ + +obj-$(CONFIG_IMXRT_SDRAM) += imxrt_sdram.o
drivers/ram/imxrt_sdram.c new file +439 -0
439 lines not on this page · raw message
include/dt-bindings/clock/imxrt-clock.h +1 -1
@@ -44,7 +44,7 @@#define IMXRT_CLK_USDHC1 163#define IMXRT_CLK_USDHC2 164#define IMXRT_CLK_LPUART1 165 -#define IMXRT_CLK_SEMC 166 +#define IMXRT_CLK_SEMC 166#define IMXRT_CLK_LCDIF 167#define IMXRT_CLK_PLL1_SYS 170#define IMXRT_CLK_PLL2_BUS 171
include/dt-bindings/memory/imxrt-sdram.h new file +100 -0
100 lines not on this page · raw message
Signature · 1 line
2.20.1
RFC PATCH v2 13/18 mmc: fsl_esdhc: make if(CONFIG_IS_ENABLED(CLK)) an #if statement
In reply to Giulio BenettiNot all architectures(i.e. i.MXRT) support mxc_get_clock() and use DM_CLK instead. So building could result in failure due to missing mxc_get_clock().
Make if(CONFIG_IS_ENABLED(CLK)) an #if statement.
--- drivers/mmc/fsl_esdhc_imx.c | 38 ++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-)
drivers/mmc/fsl_esdhc_imx.c +19 -19
@@ -1513,27 +1513,27 @@ static int fsl_esdhc_probe(struct udevice *dev)init_clk_usdhc (dev->seq); -if (CONFIG_IS_ENABLED (CLK )) { -/* Assigned clock already set clock */ - ret =clk_get_by_name (dev,"per" , &priv->per_clk); -if (ret) { -printf ("Failed to get per_clk\n" ); -return ret; - } - ret =clk_enable (&priv->per_clk); -if (ret) { -printf ("Failed to enable per_clk\n" ); -return ret; - } +#if CONFIG_IS_ENABLED (CLK ) +/* Assigned clock already set clock */ + ret =clk_get_by_name (dev,"per" , &priv->per_clk); +if (ret) { +printf ("Failed to get per_clk\n" ); +return ret; + } + ret =clk_enable (&priv->per_clk); +if (ret) { +printf ("Failed to enable per_clk\n" ); +return ret; + } - priv->sdhc_clk =clk_get_rate (&priv->per_clk); - }else { - priv->sdhc_clk =mxc_get_clock (MXC_ESDHC_CLK + dev->seq); -if (priv->sdhc_clk <=0 ) { -dev_err (dev,"Unable to get clk for %s\n" , dev->name); -return -EINVAL ; - } + priv->sdhc_clk =clk_get_rate (&priv->per_clk); +#else + priv->sdhc_clk =mxc_get_clock (MXC_ESDHC_CLK + dev->seq); +if (priv->sdhc_clk <=0 ) { +dev_err (dev,"Unable to get clk for %s\n" , dev->name); +return -EINVAL ; } +#endif ret =fsl_esdhc_init (priv, plat);if (ret) {
Signature · 1 line
2.20.1
RFC PATCH v2 14/18 mmc: fsl_esdhc: add compatible for fsl, imxrt-usdhc WIP
In reply to Giulio BenettiAdd compatible "fsl,imxrt-usdhc" to make mmc working on i.MXRT platforms with CONFIG_DM_MMC=y
--- drivers/mmc/Kconfig | 2 +- drivers/mmc/fsl_esdhc_imx.c | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-)
drivers/mmc/Kconfig +1 -1
@@ -732,7 +732,7 @@ config FSL_ESDHC_IMX config FSL_USDHC bool "Freescale/NXP i.MX uSDHC controller support" - depends on MX6 || MX7 ||ARCH_MX7ULP || IMX8 || IMX8M || TARGET_S32V234EVB + depends on MX6 || MX7 ||ARCH_MX7ULP || IMX8 || IMX8M || TARGET_S32V234EVB || ARCH_IMXRT select FSL_ESDHC_IMX help This enables the Ultra Secured Digital Host Controller enhancements
drivers/mmc/fsl_esdhc_imx.c +10 -5
@@ -77,7 +77,7 @@ struct fsl_esdhc {uint vendorspec;uint mmcboot;uint vendorspec2; -uint tuning_ctrl;/* on i.MX6/7/8 */ +uint tuning_ctrl;/* on i.MX6/7/8/RT */ char reserved5[44 ];uint hostver;/* Host controller version register */ char reserved6[4 ];/* reserved */
@@ -264,7 +264,8 @@ static int esdhc_setup_data(struct fsl_esdhc_priv *priv, struct mmc *mmc, {int timeout;struct fsl_esdhc *regs = priv->esdhc_regs; -#if defined(CONFIG_S32V234 ) || defined(CONFIG_IMX8 ) || defined(CONFIG_IMX8M ) +#if defined(CONFIG_S32V234 ) || defined(CONFIG_IMX8 ) || \ + defined(CONFIG_IMX8M ) || defined(CONFIG_ARCH_IMXRT )dma_addr_t addr;#endif uint wml_value;
@@ -277,7 +278,8 @@ static int esdhc_setup_data(struct fsl_esdhc_priv *priv, struct mmc *mmc,esdhc_clrsetbits32 (®s->wml,WML_RD_WML_MASK , wml_value);#ifndef CONFIG_SYS_FSL_ESDHC_USE_PIO -#if defined(CONFIG_S32V234 ) || defined(CONFIG_IMX8 ) || defined(CONFIG_IMX8M ) +#if defined(CONFIG_S32V234 ) || defined(CONFIG_IMX8 ) || \ + defined(CONFIG_IMX8M ) || defined(CONFIG_ARCH_IMXRT ) addr =virt_to_phys ((void *)(data->dest));if (upper_32_bits (addr))printf ("Error found for upper 32 bits\n" );
@@ -313,7 +315,8 @@ static int esdhc_setup_data(struct fsl_esdhc_priv *priv, struct mmc *mmc,esdhc_clrsetbits32 (®s->wml,WML_WR_WML_MASK , wml_value <<16 );#ifndef CONFIG_SYS_FSL_ESDHC_USE_PIO -#if defined(CONFIG_S32V234 ) || defined(CONFIG_IMX8 ) || defined(CONFIG_IMX8M ) +#if defined(CONFIG_S32V234 ) || defined(CONFIG_IMX8 ) || \ + defined(CONFIG_IMX8M ) || defined(CONFIG_ARCH_IMXRT ) addr =virt_to_phys ((void *)(data->src));if (upper_32_bits (addr))printf ("Error found for upper 32 bits\n" );
@@ -378,7 +381,8 @@ static void check_and_invalidate_dcache_rangeunsigned end =0 ;unsigned size =roundup (ARCH_DMA_MINALIGN , data->blocks*data->blocksize); -#if defined(CONFIG_S32V234 ) || defined(CONFIG_IMX8 ) || defined(CONFIG_IMX8M ) +#if defined(CONFIG_S32V234 ) || defined(CONFIG_IMX8 ) || \ + defined(CONFIG_IMX8M ) || defined(CONFIG_ARCH_IMXRT )dma_addr_t addr; addr =virt_to_phys ((void *)(data->dest));
@@ -1650,6 +1654,7 @@ static const struct udevice_id fsl_esdhc_ids[] = { { .compatible = "fsl,imx8mm-usdhc", .data = (ulong)&usdhc_imx8qm_data,}, { .compatible = "fsl,imx8mn-usdhc", .data = (ulong)&usdhc_imx8qm_data,}, { .compatible = "fsl,imx8mq-usdhc", .data = (ulong)&usdhc_imx8qm_data,}, + { .compatible = "fsl,imxrt-usdhc", }, { .compatible = "fsl,esdhc", }, { /* sentinel */ } };
Signature · 1 line
2.20.1
RFC PATCH v2 15/18 armv7m: cache: add mmu_set_region_dcache_behaviour() stub for compatibility
In reply to Giulio BenettiSince some driver requires this function add it as an empty stub when DCACHE is OFF.
--- arch/arm/cpu/armv7m/cache.c | 6 ++++++ 1 file changed, 6 insertions(+)
arch/arm/cpu/armv7m/cache.c +6 -0
@@ -290,6 +290,12 @@ void flush_dcache_all(void)void invalidate_dcache_all (void ) { } + +void mmu_set_region_dcache_behaviour (phys_addr_t start,size_t size, +enum dcache_option option) +{ +} +#endif #if !CONFIG_IS_ENABLED (SYS_ICACHE_OFF )
Signature · 1 line
2.20.1
RFC PATCH v2 16/18 video: mxsfb: add support for DM CLK
In reply to Giulio Benetti--- drivers/video/mxsfb.c | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-)
drivers/video/mxsfb.c +25 -5
@@ -5,6 +5,7 @@* Copyright (C) 2011-2013 Marek Vasut <[email protected]> */ #include <common.h> +#include <clk.h> #include <dm.h> #include <env.h> #include <linux/errno.h>
@@ -51,7 +52,8 @@ __weak void mxsfb_system_setup(void)* le:89,ri:164,up:23,lo:10,hs:10,vs:10,sync:0,vmode:0 */ -static void mxs_lcd_init (u32 fb_addr,struct ctfb_res_modes *mode,int bpp) +static void mxs_lcd_init (struct udevice *dev,u32 fb_addr, +struct ctfb_res_modes *mode,int bpp) {struct mxs_lcdif_regs *regs = (struct mxs_lcdif_regs *)MXS_LCDIF_BASE ;uint32_t word_len =0 , bus_width =0 ;
@@ -127,17 +129,35 @@ static void mxs_lcd_init(u32 fb_addr, struct ctfb_res_modes *mode, int bpp)/* FIFO cleared */ writel (LCDIF_CTRL1_FIFO_CLEAR , ®s->hw_lcdif_ctrl1_clr); +#if CONFIG_IS_ENABLED (CLK ) +struct clk per_clk; +int ret; + + ret =clk_get_by_name (dev,"per" , &per_clk); +if (ret) { +dev_err (dev,"Failed to get mxs clk: %d\n" , ret); +return ; + } + +clk_set_rate (&per_clk,PS2KHZ (mode->pixclock) *1000 ); +if (ret) { +dev_err (dev,"Failed to set mxs clk: %d\n" , ret); +return ; + } +#else /* Kick in the LCDIF clock */ mxs_set_lcdclk (MXS_LCDIF_BASE ,PS2KHZ (mode->pixclock)); +#endif /* RUN! */ writel (LCDIF_CTRL_RUN , ®s->hw_lcdif_ctrl_set); } -static int mxs_probe_common (struct ctfb_res_modes *mode,int bpp,u32 fb) +static int mxs_probe_common (struct udevice *dev,struct ctfb_res_modes *mode, +int bpp,u32 fb) {/* Start framebuffer */ -mxs_lcd_init (fb, mode, bpp); +mxs_lcd_init (dev, fb, mode, bpp);#ifdef CONFIG_VIDEO_MXS_MODE_SYSTEM /*
@@ -259,7 +279,7 @@ void *video_hw_init(void)printf ("%s\n" , panel.modeIdent); - ret =mxs_probe_common (&mode, bpp, (u32 )fb); + ret =mxs_probe_common (NULL , &mode, bpp, (u32 )fb);if (ret) goto dealloc_fb;
@@ -336,7 +356,7 @@ static int mxs_video_probe(struct udevice *dev) mode.vsync_len = timings.vsync_len.typ; mode.pixclock =HZ2PS (timings.pixelclock.typ); - ret =mxs_probe_common (&mode, bpp, plat->base); + ret =mxs_probe_common (dev, &mode, bpp, plat->base);if (ret)return ret;
Signature · 1 line
2.20.1
RFC PATCH v2 17/18 video: mxsfb: add support for i.MXRT WIP
In reply to Giulio Benetti--- arch/arm/include/asm/mach-imx/regs-lcdif.h | 6 +++--- drivers/video/mxsfb.c | 1 + 2 files changed, 4 insertions(+), 3 deletions(-)
arch/arm/include/asm/mach-imx/regs-lcdif.h +3 -3
@@ -22,7 +22,7 @@ struct mxs_lcdif_regs {defined (CONFIG_MX6SL ) ||defined (CONFIG_MX6SLL ) || \defined (CONFIG_MX6UL ) ||defined (CONFIG_MX6ULL ) || \defined (CONFIG_MX7 ) ||defined (CONFIG_MX7ULP ) || \ - defined(CONFIG_IMX8M) + defined(CONFIG_IMX8M) || defined(CONFIG_ARCH_IMXRT) mxs_reg_32(hw_lcdif_ctrl2) /* 0x20 */#endif mxs_reg_32 (hw_lcdif_transfer_count)/* 0x20/0x30 */
@@ -49,7 +49,7 @@ struct mxs_lcdif_regs { mxs_reg_32(hw_lcdif_csc_coeffctrl2) /* 0x130 */ mxs_reg_32(hw_lcdif_csc_coeffctrl3) /* 0x140 */ mxs_reg_32(hw_lcdif_csc_coeffctrl4) /* 0x150 */ - mxs_reg_32(hw_lcdif_csc_offset) /* 0x160 */ + mxs_reg_32(hw_lcdif_csc_offset) /* 0x160 */ mxs_reg_32(hw_lcdif_csc_limit) /* 0x170 */ #if defined(CONFIG_MX23)
@@ -61,7 +61,7 @@ struct mxs_lcdif_regs {defined (CONFIG_MX6SL ) ||defined (CONFIG_MX6SLL ) || \defined (CONFIG_MX6UL ) ||defined (CONFIG_MX6ULL ) || \defined (CONFIG_MX7 ) ||defined (CONFIG_MX7ULP ) || \ - defined(CONFIG_IMX8M) + defined(CONFIG_IMX8M) || defined(CONFIG_ARCH_IMXRT) mxs_reg_32(hw_lcdif_crc_stat) /* 0x1a0 */#endif mxs_reg_32 (hw_lcdif_lcdif_stat)/* 0x1d0/0x1b0 */
drivers/video/mxsfb.c +1 -0
@@ -439,6 +439,7 @@ static const struct udevice_id mxs_video_ids[] = { { .compatible = "fsl,imx23-lcdif" }, { .compatible = "fsl,imx28-lcdif" }, { .compatible = "fsl,imx7ulp-lcdif" }, + { .compatible = "fsl,imxrt-lcdif" }, {/* sentinel */ } };
Signature · 1 line
2.20.1
RFC PATCH v2 18/18 imx: imxrt1050-evk: Add support for the NXP i.MXRT1050-EVK
In reply to Giulio BenettiThis commit adds board support for i.MXRT1050-EVK from NXP. This board is an evaluation kit provided by NXP for i.MXRT105x processor family.
More information about this board can be found here:
https://www.nxp.com/design/development-boards/i.mx-evaluation-and-development-boards/i.mx-rt1050-evaluation-kit:MIMXRT1050-EVK
The initial supported/tested devices include:
- Debug serial
- SD
--- arch/arm/dts/Makefile | 2 + arch/arm/dts/imxrt1050-evk.dts | 228 ++++++++++++++++++ arch/arm/mach-imx/imxrt/Kconfig | 11 + board/freescale/imxrt1050-evk/Kconfig | 22 ++ board/freescale/imxrt1050-evk/MAINTAINERS | 6 + board/freescale/imxrt1050-evk/Makefile | 6 + board/freescale/imxrt1050-evk/README | 31 +++ board/freescale/imxrt1050-evk/imximage.cfg | 36 +++ board/freescale/imxrt1050-evk/imxrt1050-evk.c | 81 +++++++ configs/imxrt1050-evk_defconfig | 71 ++++++ include/configs/imxrt1050-evk.h | 59 +++++ 11 files changed, 553 insertions(+) create mode 100644 arch/arm/dts/imxrt1050-evk.dts create mode 100644 board/freescale/imxrt1050-evk/Kconfig create mode 100644 board/freescale/imxrt1050-evk/MAINTAINERS create mode 100644 board/freescale/imxrt1050-evk/Makefile create mode 100644 board/freescale/imxrt1050-evk/README create mode 100644 board/freescale/imxrt1050-evk/imximage.cfg create mode 100644 board/freescale/imxrt1050-evk/imxrt1050-evk.c create mode 100644 configs/imxrt1050-evk_defconfig create mode 100644 include/configs/imxrt1050-evk.h
arch/arm/dts/Makefile +2 -0
@@ -672,6 +672,8 @@ dtb-$(CONFIG_ARCH_IMX8M) += \ imx8mn-ddr4-evk.dtb \ imx8mq-evk.dtb +dtb-$(CONFIG_ARCH_IMXRT) += imxrt1050-evk.dtb + dtb-$(CONFIG_RCAR_GEN2) += \ r8a7790-lager-u-boot.dtb \ r8a7790-stout-u-boot.dtb \
arch/arm/dts/imxrt1050-evk.dts new file +228 -0
228 lines not on this page · raw message
arch/arm/mach-imx/imxrt/Kconfig +11 -0
@@ -3,4 +3,15 @@ if ARCH_IMXRT config SYS_SOC default "imxrt" +choice + prompt "IMXRT board select" + optional + +config TARGET_IMXRT1050_EVK + bool "Support imxrt1050 EVK board" + +endchoice + +source "board/freescale/imxrt1050-evk/Kconfig" + endif
board/freescale/imxrt1050-evk/Kconfig new file +22 -0
@@ -0,0 +1,22 @@ +if TARGET_IMXRT1050_EVK + +config SYS_BOARD + string + default "imxrt1050-evk" + +config SYS_VENDOR + string + default "freescale" + +config SYS_SOC + string + default "imxrt" + +config SYS_CONFIG_NAME + string + default "imxrt1050-evk" + +config IMX_CONFIG + default "board/freescale/imxrt1050-evk/imximage.cfg" + +endif
board/freescale/imxrt1050-evk/MAINTAINERS new file +6 -0
@@ -0,0 +1,6 @@ +IMXRT1050 EVALUATION KIT +M: Giulio Benetti <[email protected]> +S: Maintained +F: board/freescale/imxrt1050-evk +F: include/configs/imxrt1050-evk.h +F: configs/imxrt1050-evk_defconfig
board/freescale/imxrt1050-evk/Makefile new file +6 -0
@@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright (C) 2019 +# Author(s): Giulio Benetti <[email protected]> + +obj-y := imxrt1050-evk.o
board/freescale/imxrt1050-evk/README new file +31 -0
@@ -0,0 +1,31 @@ +How to use U-Boot on NXP i.MXRT1050 EVK +----------------------------------------------- + +- Build U-Boot for i.MXRT1050 EVK: + +$ make mrproper +$ make imxrt1050-evk_defconfig +$ make + +This will generate the SPL image called SPL and the u-boot.img. + +- Flash the SPL image into the micro SD card: + +sudo dd if=SPL of=/dev/mmcblk0 bs=1k seek=1; sync + +- Flash the u-boot.img image into the micro SD card: + +sudo dd if=u-boot.img of=/dev/sdb bs=1k seek=128; sync + +- Jumper settings: + +SW7: 1 0 1 0 + +where 0 means bottom position and 1 means top position (from the +switch label numbers reference). + +- Connect the USB cable between the EVK and the PC for the console. +(The USB console connector is the one close the ethernet connector) + +- Insert the micro SD card in the board, power it up and U-Boot messages should +come up.
board/freescale/imxrt1050-evk/imximage.cfg new file +36 -0
@@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright (C) 2019 + * Author(s): Giulio Benetti <[email protected]> + */ + +#define __ASSEMBLY__ +#include <config.h> + +/* image version */ + +IMAGE_VERSION 2 + +/* + * Boot Device : one of + * spi/sd/nand/onenand, qspi/nor + */ + +BOOT_FROM sd + +/* + * Device Configuration Data (DCD) + * + * Each entry must have the format: + * Addr-type Address Value + * + * where: + * Addr-type register length (1,2 or 4 bytes) + * Address absolute address of the register + * value value to be stored in the register + */ + +/* Set all FlexRAM as OCRAM(01b) */ +DATA 4 0x400AC044 0x55555555 +/* Use FLEXRAM_BANK_CFG to config FlexRAM */ +SET_BIT 4 0x400AC040 0x4
board/freescale/imxrt1050-evk/imxrt1050-evk.c new file +81 -0
81 lines not on this page · raw message
configs/imxrt1050-evk_defconfig new file +71 -0
71 lines not on this page · raw message
include/configs/imxrt1050-evk.h new file +59 -0
59 lines not on this page · raw message
Signature · 1 line
2.20.1