* i.MX7 support @ 2017-01-16 10:50 Sascha Hauer 2017-01-16 10:50 ` [PATCH 01/23] imx-usb-loader: let constant data be const Sascha Hauer ` (24 more replies) 0 siblings, 25 replies; 38+ messages in thread From: Sascha Hauer @ 2017-01-16 10:50 UTC (permalink / raw) To: Barebox List The following series adds i.MX7 support to barebox. The port was done on the WaRP7 board. The board starts, eMMC, USB and serial work. This board does not have ethernet or NAND, so supporting this is left for a later exercise. It will be some additional fun to support the 2nd CPU for i.MX7d as we'll need PSCI support then. So far we are limited to a single core, but the only currently supported board is single core anyway. One issue remaining is that I am currently unable to reset the board using the watchdog or the barebox reset command. Out of ideas, will fix later. Sascha ---------------------------------------------------------------- Juergen Borleis (10): imx-usb-loader: let constant data be const imx-usb-loader: this table is used internally only, so keep it static imx-usb-loader: add i.MX7S support ARM: Makefile: format fix ARM: i.MX: Add i.MX7 base architecture support clk: i.MX: Add clock support for i.MX7 ARM: i.MX: gpt: Add i.MX7 support pinmmux: i.MX: add pin mux support for i.MX7 serial: i.MX: add i.MX7 support ARM: i.MX: Add WaRP7 board support Sascha Hauer (13): i2c: i.MX: Enable clock mci: imx-esdhc: Enable clock serial: i.MX: Enable clock usb: imx: Make usb-misc multi instance safe usb: imx: Add usbmisc support for i.MX7 usb: imx: Add clock support phy: usb-nop-xceiv: Add clock support of: partitions: force "partitions" subnode mci: Allow to partition eMMC boot partitions mci: imx-esdhci: remove wrong write protection test clk: i.MX: pllv3: Add support for the i.MX7 enet pll clk: imx: Add clk-cpu support clk: i.MX7: Add missing USB clocks Documentation/boards/imx.rst | 1 + Documentation/boards/imx/Element14-WaRP7.rst | 54 ++ arch/arm/Makefile | 2 +- arch/arm/boards/Makefile | 1 + arch/arm/boards/element14-warp7/Makefile | 2 + arch/arm/boards/element14-warp7/board.c | 35 + .../element14-warp7/flash-header-mx7-warp.imxcfg | 81 ++ arch/arm/boards/element14-warp7/lowlevel.c | 48 ++ arch/arm/dts/Makefile | 1 + arch/arm/dts/imx7s-warp.dts | 45 ++ arch/arm/mach-imx/Kconfig | 9 + arch/arm/mach-imx/Makefile | 1 + arch/arm/mach-imx/boot.c | 70 ++ arch/arm/mach-imx/clocksource.c | 6 +- arch/arm/mach-imx/cpu_init.c | 5 + arch/arm/mach-imx/imx.c | 6 + arch/arm/mach-imx/imx7.c | 75 ++ arch/arm/mach-imx/include/mach/debug_ll.h | 3 + arch/arm/mach-imx/include/mach/generic.h | 16 + arch/arm/mach-imx/include/mach/imx7-regs.h | 23 + arch/arm/mach-imx/include/mach/imx7.h | 59 ++ arch/arm/mach-imx/include/mach/imx_cpu_types.h | 1 + common/Kconfig | 8 + drivers/clk/imx/Makefile | 2 + drivers/clk/imx/clk-cpu.c | 110 +++ drivers/clk/imx/clk-imx7.c | 881 +++++++++++++++++++++ drivers/clk/imx/clk-pllv3.c | 23 +- drivers/clk/imx/clk.h | 33 + drivers/i2c/busses/i2c-imx.c | 1 + drivers/mci/imx-esdhc.c | 15 +- drivers/mci/mci-core.c | 78 +- drivers/of/partition.c | 12 +- drivers/phy/usb-nop-xceiv.c | 18 +- drivers/pinctrl/imx-iomux-v3.c | 5 +- drivers/serial/serial_imx.c | 4 + drivers/usb/imx/chipidea-imx.c | 22 +- drivers/usb/imx/imx-usb-misc.c | 87 +- images/Makefile.imx | 5 + include/mci.h | 1 + include/serial/imx-uart.h | 5 + include/usb/chipidea-imx.h | 4 +- scripts/imx/imx-usb-loader.c | 21 +- scripts/imx/imx.c | 1 + 43 files changed, 1803 insertions(+), 77 deletions(-) create mode 100644 Documentation/boards/imx/Element14-WaRP7.rst create mode 100644 arch/arm/boards/element14-warp7/Makefile create mode 100644 arch/arm/boards/element14-warp7/board.c create mode 100644 arch/arm/boards/element14-warp7/flash-header-mx7-warp.imxcfg create mode 100644 arch/arm/boards/element14-warp7/lowlevel.c create mode 100644 arch/arm/dts/imx7s-warp.dts create mode 100644 arch/arm/mach-imx/imx7.c create mode 100644 arch/arm/mach-imx/include/mach/imx7-regs.h create mode 100644 arch/arm/mach-imx/include/mach/imx7.h create mode 100644 drivers/clk/imx/clk-cpu.c create mode 100644 drivers/clk/imx/clk-imx7.c _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 01/23] imx-usb-loader: let constant data be const 2017-01-16 10:50 i.MX7 support Sascha Hauer @ 2017-01-16 10:50 ` Sascha Hauer 2017-01-16 10:50 ` [PATCH 02/23] imx-usb-loader: this table is used internally only, so keep it static Sascha Hauer ` (23 subsequent siblings) 24 siblings, 0 replies; 38+ messages in thread From: Sascha Hauer @ 2017-01-16 10:50 UTC (permalink / raw) To: Barebox List; +Cc: Juergen Borleis From: Juergen Borleis <jbe@pengutronix.de> Signed-off-by: Juergen Borleis <jbe@pengutronix.de> --- scripts/imx/imx-usb-loader.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/imx/imx-usb-loader.c b/scripts/imx/imx-usb-loader.c index be0894fa6..dfeef9e2c 100644 --- a/scripts/imx/imx-usb-loader.c +++ b/scripts/imx/imx-usb-loader.c @@ -72,11 +72,11 @@ struct usb_work { }; struct usb_id { - struct mach_id *mach_id; + const struct mach_id *mach_id; struct usb_work *work; }; -struct mach_id imx_ids[] = { +const struct mach_id imx_ids[] = { { .vid = 0x066f, .pid = 0x3780, @@ -174,12 +174,12 @@ struct sdp_command { uint8_t rsvd; } __attribute__((packed)); -static struct mach_id *imx_device(unsigned short vid, unsigned short pid) +static const struct mach_id *imx_device(unsigned short vid, unsigned short pid) { int i; for (i = 0; i < ARRAY_SIZE(imx_ids); i++) { - struct mach_id *id = &imx_ids[i]; + const struct mach_id *id = &imx_ids[i]; if (id->vid == vid && id->pid == pid) { fprintf(stderr, "found %s USB device [%04x:%04x]\n", id->name, vid, pid); @@ -190,10 +190,10 @@ static struct mach_id *imx_device(unsigned short vid, unsigned short pid) return NULL; } -static libusb_device *find_imx_dev(libusb_device **devs, struct mach_id **pp_id) +static libusb_device *find_imx_dev(libusb_device **devs, const struct mach_id **pp_id) { int i = 0; - struct mach_id *p; + const struct mach_id *p; for (;;) { struct libusb_device_descriptor desc; @@ -1288,7 +1288,7 @@ static void usage(const char *prgname) int main(int argc, char *argv[]) { - struct mach_id *mach; + const struct mach_id *mach; libusb_device **devs; libusb_device *dev; int r; -- 2.11.0 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 02/23] imx-usb-loader: this table is used internally only, so keep it static 2017-01-16 10:50 i.MX7 support Sascha Hauer 2017-01-16 10:50 ` [PATCH 01/23] imx-usb-loader: let constant data be const Sascha Hauer @ 2017-01-16 10:50 ` Sascha Hauer 2017-01-16 11:29 ` Juergen Borleis 2017-01-16 10:50 ` [PATCH 03/23] imx-usb-loader: add i.MX7S support Sascha Hauer ` (22 subsequent siblings) 24 siblings, 1 reply; 38+ messages in thread From: Sascha Hauer @ 2017-01-16 10:50 UTC (permalink / raw) To: Barebox List; +Cc: Juergen Borleis From: Juergen Borleis <jbe@pengutronix.de> --- scripts/imx/imx-usb-loader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/imx/imx-usb-loader.c b/scripts/imx/imx-usb-loader.c index dfeef9e2c..ebffeddae 100644 --- a/scripts/imx/imx-usb-loader.c +++ b/scripts/imx/imx-usb-loader.c @@ -76,7 +76,7 @@ struct usb_id { struct usb_work *work; }; -const struct mach_id imx_ids[] = { +static const struct mach_id imx_ids[] = { { .vid = 0x066f, .pid = 0x3780, -- 2.11.0 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH 02/23] imx-usb-loader: this table is used internally only, so keep it static 2017-01-16 10:50 ` [PATCH 02/23] imx-usb-loader: this table is used internally only, so keep it static Sascha Hauer @ 2017-01-16 11:29 ` Juergen Borleis 0 siblings, 0 replies; 38+ messages in thread From: Juergen Borleis @ 2017-01-16 11:29 UTC (permalink / raw) To: barebox On Monday 16 January 2017 11:50:47 Sascha Hauer wrote: > From: Juergen Borleis <jbe@pengutronix.de> > > --- > scripts/imx/imx-usb-loader.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/scripts/imx/imx-usb-loader.c b/scripts/imx/imx-usb-loader.c You can add here my Signed-off as well. Cheers, Juergen -- Pengutronix e.K. | Juergen Borleis | Industrial Linux Solutions | http://www.pengutronix.de/ | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 03/23] imx-usb-loader: add i.MX7S support 2017-01-16 10:50 i.MX7 support Sascha Hauer 2017-01-16 10:50 ` [PATCH 01/23] imx-usb-loader: let constant data be const Sascha Hauer 2017-01-16 10:50 ` [PATCH 02/23] imx-usb-loader: this table is used internally only, so keep it static Sascha Hauer @ 2017-01-16 10:50 ` Sascha Hauer 2017-01-16 10:50 ` [PATCH 04/23] ARM: Makefile: format fix Sascha Hauer ` (21 subsequent siblings) 24 siblings, 0 replies; 38+ messages in thread From: Sascha Hauer @ 2017-01-16 10:50 UTC (permalink / raw) To: Barebox List; +Cc: Juergen Borleis From: Juergen Borleis <jbe@pengutronix.de> Signed-off-by: Juergen Borleis <jbe@pengutronix.de> --- scripts/imx/imx-usb-loader.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/imx/imx-usb-loader.c b/scripts/imx/imx-usb-loader.c index ebffeddae..9de7bb3a8 100644 --- a/scripts/imx/imx-usb-loader.c +++ b/scripts/imx/imx-usb-loader.c @@ -156,6 +156,13 @@ static const struct mach_id imx_ids[] = { .header_type = HDR_MX53, .mode = MODE_HID, .max_transfer = 1024, + }, { + .vid = 0x15a2, + .pid = 0x0076, + .name = "i.MX7S", + .header_type = HDR_MX53, + .mode = MODE_HID, + .max_transfer = 1024, }, }; -- 2.11.0 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 04/23] ARM: Makefile: format fix 2017-01-16 10:50 i.MX7 support Sascha Hauer ` (2 preceding siblings ...) 2017-01-16 10:50 ` [PATCH 03/23] imx-usb-loader: add i.MX7S support Sascha Hauer @ 2017-01-16 10:50 ` Sascha Hauer 2017-01-16 10:50 ` [PATCH 05/23] i2c: i.MX: Enable clock Sascha Hauer ` (20 subsequent siblings) 24 siblings, 0 replies; 38+ messages in thread From: Sascha Hauer @ 2017-01-16 10:50 UTC (permalink / raw) To: Barebox List; +Cc: Juergen Borleis From: Juergen Borleis <jbe@pengutronix.de> Signed-off-by: Juergen Borleis <jbe@pengutronix.de> --- arch/arm/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/Makefile b/arch/arm/Makefile index 96ec588da..620a3ccb0 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile @@ -32,7 +32,7 @@ endif # testing for a specific architecture or later rather impossible. arch-$(CONFIG_CPU_64v8) := -D__LINUX_ARM_ARCH__=8 $(call cc-option,-march=armv8-a) arch-$(CONFIG_CPU_32v7) :=-D__LINUX_ARM_ARCH__=7 $(call cc-option,-march=armv7-a,-march=armv5t -Wa$(comma)-march=armv7-a) -arch-$(CONFIG_CPU_32v6) :=-D__LINUX_ARM_ARCH__=6 $(call cc-option,-march=armv6,-march=armv5t -Wa$(comma)-march=armv6) +arch-$(CONFIG_CPU_32v6) :=-D__LINUX_ARM_ARCH__=6 $(call cc-option,-march=armv6,-march=armv5t -Wa$(comma)-march=armv6) arch-$(CONFIG_CPU_32v5) :=-D__LINUX_ARM_ARCH__=5 $(call cc-option,-march=armv5te,-march=armv4t) arch-$(CONFIG_CPU_32v4T) :=-D__LINUX_ARM_ARCH__=4 -march=armv4t -- 2.11.0 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 05/23] i2c: i.MX: Enable clock 2017-01-16 10:50 i.MX7 support Sascha Hauer ` (3 preceding siblings ...) 2017-01-16 10:50 ` [PATCH 04/23] ARM: Makefile: format fix Sascha Hauer @ 2017-01-16 10:50 ` Sascha Hauer 2017-01-16 10:50 ` [PATCH 06/23] mci: imx-esdhc: " Sascha Hauer ` (19 subsequent siblings) 24 siblings, 0 replies; 38+ messages in thread From: Sascha Hauer @ 2017-01-16 10:50 UTC (permalink / raw) To: Barebox List For architectures which do not enable all clocks during initialization. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- drivers/i2c/busses/i2c-imx.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c index 74f046d00..5677443a1 100644 --- a/drivers/i2c/busses/i2c-imx.c +++ b/drivers/i2c/busses/i2c-imx.c @@ -673,6 +673,7 @@ static int __init i2c_fsl_probe(struct device_d *pdev) ret = PTR_ERR(i2c_fsl->clk); goto fail; } + clk_enable(i2c_fsl->clk); #endif i2c_fsl->hwdata = of_device_get_match_data(pdev); -- 2.11.0 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 06/23] mci: imx-esdhc: Enable clock 2017-01-16 10:50 i.MX7 support Sascha Hauer ` (4 preceding siblings ...) 2017-01-16 10:50 ` [PATCH 05/23] i2c: i.MX: Enable clock Sascha Hauer @ 2017-01-16 10:50 ` Sascha Hauer 2017-01-16 10:50 ` [PATCH 07/23] serial: i.MX: " Sascha Hauer ` (18 subsequent siblings) 24 siblings, 0 replies; 38+ messages in thread From: Sascha Hauer @ 2017-01-16 10:50 UTC (permalink / raw) To: Barebox List For architectures which do not enable all clocks during initialization. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- drivers/mci/imx-esdhc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mci/imx-esdhc.c b/drivers/mci/imx-esdhc.c index 951ac4501..c845187a5 100644 --- a/drivers/mci/imx-esdhc.c +++ b/drivers/mci/imx-esdhc.c @@ -630,6 +630,7 @@ static int fsl_esdhc_probe(struct device_d *dev) host->clk = clk_get(dev, "per"); if (IS_ERR(host->clk)) return PTR_ERR(host->clk); + clk_enable(host->clk); host->dev = dev; iores = dev_request_mem_resource(dev, 0); -- 2.11.0 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 07/23] serial: i.MX: Enable clock 2017-01-16 10:50 i.MX7 support Sascha Hauer ` (5 preceding siblings ...) 2017-01-16 10:50 ` [PATCH 06/23] mci: imx-esdhc: " Sascha Hauer @ 2017-01-16 10:50 ` Sascha Hauer 2017-01-16 10:50 ` [PATCH 08/23] usb: imx: Make usb-misc multi instance safe Sascha Hauer ` (17 subsequent siblings) 24 siblings, 0 replies; 38+ messages in thread From: Sascha Hauer @ 2017-01-16 10:50 UTC (permalink / raw) To: Barebox List For architectures which do not enable all clocks during initialization. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- drivers/serial/serial_imx.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/serial/serial_imx.c b/drivers/serial/serial_imx.c index 2b1e5e07a..c15ab8630 100644 --- a/drivers/serial/serial_imx.c +++ b/drivers/serial/serial_imx.c @@ -228,6 +228,7 @@ static int imx_serial_probe(struct device_d *dev) ret = PTR_ERR(priv->clk); goto err_free; } + clk_enable(priv->clk); iores = dev_request_mem_resource(dev, 0); if (IS_ERR(iores)) -- 2.11.0 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 08/23] usb: imx: Make usb-misc multi instance safe 2017-01-16 10:50 i.MX7 support Sascha Hauer ` (6 preceding siblings ...) 2017-01-16 10:50 ` [PATCH 07/23] serial: i.MX: " Sascha Hauer @ 2017-01-16 10:50 ` Sascha Hauer 2017-01-16 10:50 ` [PATCH 09/23] usb: imx: Add usbmisc support for i.MX7 Sascha Hauer ` (16 subsequent siblings) 24 siblings, 0 replies; 38+ messages in thread From: Sascha Hauer @ 2017-01-16 10:50 UTC (permalink / raw) To: Barebox List i.MX7 has two usbmisc devices, so we cannot use global instance variables anymore. Create a driver private data struct for it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- drivers/usb/imx/chipidea-imx.c | 9 +++++++-- drivers/usb/imx/imx-usb-misc.c | 34 +++++++++++++++++++++------------- include/usb/chipidea-imx.h | 4 ++-- 3 files changed, 30 insertions(+), 17 deletions(-) diff --git a/drivers/usb/imx/chipidea-imx.c b/drivers/usb/imx/chipidea-imx.c index ed00ff4a1..f4354876c 100644 --- a/drivers/usb/imx/chipidea-imx.c +++ b/drivers/usb/imx/chipidea-imx.c @@ -37,6 +37,7 @@ struct imx_chipidea { unsigned long flags; uint32_t mode; int portno; + struct device_d *usbmisc; enum usb_phy_interface phymode; struct param_d *param_mode; int role_registered; @@ -67,7 +68,7 @@ static int imx_chipidea_port_init(void *drvdata) return ret; } - ret = imx_usbmisc_port_init(ci->portno, ci->flags); + ret = imx_usbmisc_port_init(ci->usbmisc, ci->portno, ci->flags); if (ret) dev_err(ci->dev, "misc init failed: %s\n", strerror(-ret)); @@ -79,7 +80,7 @@ static int imx_chipidea_port_post_init(void *drvdata) struct imx_chipidea *ci = drvdata; int ret; - ret = imx_usbmisc_port_post_init(ci->portno, ci->flags); + ret = imx_usbmisc_port_post_init(ci->usbmisc, ci->portno, ci->flags); if (ret) dev_err(ci->dev, "post misc init failed: %s\n", strerror(-ret)); @@ -95,6 +96,10 @@ static int imx_chipidea_probe_dt(struct imx_chipidea *ci) "#index-cells", 0, &out_args)) return -ENODEV; + ci->usbmisc = of_find_device_by_node(out_args.np); + if (!ci->usbmisc) + return -ENODEV; + ci->portno = out_args.args[0]; ci->flags = MXC_EHCI_MODE_UTMI_8BIT; diff --git a/drivers/usb/imx/imx-usb-misc.c b/drivers/usb/imx/imx-usb-misc.c index 7c18ca2a1..16fb38018 100644 --- a/drivers/usb/imx/imx-usb-misc.c +++ b/drivers/usb/imx/imx-usb-misc.c @@ -43,6 +43,11 @@ struct imx_usb_misc_data { int (*post_init)(void __iomem *base, int port, unsigned int flags); }; +struct imx_usb_misc_priv { + struct imx_usb_misc_data *data; + void __iomem *base; +}; + static __maybe_unused int mx25_initialize_usb_hw(void __iomem *base, int port, unsigned int flags) { unsigned int v; @@ -524,35 +529,37 @@ static __maybe_unused struct of_device_id imx_usbmisc_dt_ids[] = { }, }; -static struct imx_usb_misc_data *imxusbmisc_data; -static void __iomem *usbmisc_base; - -int imx_usbmisc_port_init(int port, unsigned flags) +int imx_usbmisc_port_init(struct device_d *dev, int port, unsigned flags) { - if (!imxusbmisc_data) + struct imx_usb_misc_priv *usbmisc = dev->priv; + + if (!usbmisc) return -ENODEV; - if (!imxusbmisc_data->init) + if (!usbmisc->data->init) return 0; - return imxusbmisc_data->init(usbmisc_base, port, flags); + return usbmisc->data->init(usbmisc->base, port, flags); } -int imx_usbmisc_port_post_init(int port, unsigned flags) +int imx_usbmisc_port_post_init(struct device_d *dev, int port, unsigned flags) { - if (!imxusbmisc_data) + struct imx_usb_misc_priv *usbmisc = dev->priv; + + if (!usbmisc) return -ENODEV; - if (!imxusbmisc_data->post_init) + if (!usbmisc->data->post_init) return 0; - return imxusbmisc_data->post_init(usbmisc_base, port, flags); + return usbmisc->data->post_init(usbmisc->base, port, flags); } static int imx_usbmisc_probe(struct device_d *dev) { struct resource *iores; struct imx_usb_misc_data *devtype; + struct imx_usb_misc_priv *usbmisc = dev->priv; int ret; ret = dev_get_drvdata(dev, (const void **)&devtype); @@ -562,9 +569,10 @@ static int imx_usbmisc_probe(struct device_d *dev) iores = dev_request_mem_resource(dev, 0); if (IS_ERR(iores)) return PTR_ERR(iores); - usbmisc_base = IOMEM(iores->start); - imxusbmisc_data = devtype; + usbmisc = xzalloc(sizeof(*usbmisc)); + usbmisc->base = IOMEM(iores->start); + usbmisc->data = devtype; return 0; } diff --git a/include/usb/chipidea-imx.h b/include/usb/chipidea-imx.h index 64f086af6..640ae0694 100644 --- a/include/usb/chipidea-imx.h +++ b/include/usb/chipidea-imx.h @@ -48,7 +48,7 @@ struct imxusb_platformdata { enum imx_usb_mode mode; }; -int imx_usbmisc_port_init(int port, unsigned flags); -int imx_usbmisc_port_post_init(int port, unsigned flags); +int imx_usbmisc_port_init(struct device_d *dev, int port, unsigned flags); +int imx_usbmisc_port_post_init(struct device_d *dev, int port, unsigned flags); #endif /* __USB_CHIPIDEA_IMX_H */ -- 2.11.0 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 09/23] usb: imx: Add usbmisc support for i.MX7 2017-01-16 10:50 i.MX7 support Sascha Hauer ` (7 preceding siblings ...) 2017-01-16 10:50 ` [PATCH 08/23] usb: imx: Make usb-misc multi instance safe Sascha Hauer @ 2017-01-16 10:50 ` Sascha Hauer 2017-01-16 10:50 ` [PATCH 10/23] usb: imx: Add clock support Sascha Hauer ` (15 subsequent siblings) 24 siblings, 0 replies; 38+ messages in thread From: Sascha Hauer @ 2017-01-16 10:50 UTC (permalink / raw) To: Barebox List Taken directly from Linux-4.10-rc3 Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- drivers/usb/imx/imx-usb-misc.c | 53 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/drivers/usb/imx/imx-usb-misc.c b/drivers/usb/imx/imx-usb-misc.c index 16fb38018..55dc0492b 100644 --- a/drivers/usb/imx/imx-usb-misc.c +++ b/drivers/usb/imx/imx-usb-misc.c @@ -353,6 +353,7 @@ static __maybe_unused struct imx_usb_misc_data mx5_data = { #define MX6_USB_CTRL(n) ((n) * 4) #define MX6_USB_CTRL_OVER_CUR_DIS (1 << 7) +#define MX6_USB_CTRL_OVER_CUR_ACT_HIGH (1 << 8) static void mx6_hsic_pullup(unsigned long reg, int on) { @@ -427,6 +428,46 @@ static __maybe_unused struct imx_usb_misc_data mx6_data = { .post_init = mx6_post_init, }; +#define MX7D_USBNC_USB_CTRL2 0x4 +#define MX7D_USB_VBUS_WAKEUP_SOURCE_MASK 0x3 +#define MX7D_USB_VBUS_WAKEUP_SOURCE(v) (v << 0) +#define MX7D_USB_VBUS_WAKEUP_SOURCE_VBUS MX7D_USB_VBUS_WAKEUP_SOURCE(0) +#define MX7D_USB_VBUS_WAKEUP_SOURCE_AVALID MX7D_USB_VBUS_WAKEUP_SOURCE(1) +#define MX7D_USB_VBUS_WAKEUP_SOURCE_BVALID MX7D_USB_VBUS_WAKEUP_SOURCE(2) +#define MX7D_USB_VBUS_WAKEUP_SOURCE_SESS_END MX7D_USB_VBUS_WAKEUP_SOURCE(3) + +static int usbmisc_imx7d_init(void __iomem *base, int port, + unsigned int flags) +{ + u32 reg; + + if (port >= 1) + return -EINVAL; + + reg = readl(base); + if (flags & MXC_EHCI_DISABLE_OVERCURRENT) { + reg |= MX6_USB_CTRL_OVER_CUR_DIS; + } else { + reg &= ~MX6_USB_CTRL_OVER_CUR_DIS; + if (flags & MXC_EHCI_OC_PIN_ACTIVE_LOW) + reg &= ~MX6_USB_CTRL_OVER_CUR_ACT_HIGH; + else + reg |= MX6_USB_CTRL_OVER_CUR_ACT_HIGH; + } + writel(reg, base); + + reg = readl(base + MX7D_USBNC_USB_CTRL2); + reg &= ~MX7D_USB_VBUS_WAKEUP_SOURCE_MASK; + writel(reg | MX7D_USB_VBUS_WAKEUP_SOURCE_BVALID, + base + MX7D_USBNC_USB_CTRL2); + + return 0; +} + +static __maybe_unused struct imx_usb_misc_data mx7_data = { + .init = usbmisc_imx7d_init, +}; + static struct platform_device_id imx_usbmisc_ids[] = { #ifdef CONFIG_ARCH_IMX25 { @@ -476,6 +517,12 @@ static struct platform_device_id imx_usbmisc_ids[] = { .driver_data = (unsigned long)&mx6_data, }, #endif +#ifdef CONFIG_ARCH_IMX7 + { + .name = "imx7d-usb-misc", + .driver_data = (unsigned long)&mx7_data, + }, +#endif { /* sentinel */ }, @@ -518,6 +565,12 @@ static __maybe_unused struct of_device_id imx_usbmisc_dt_ids[] = { .data = &mx5_data, }, #endif +#ifdef CONFIG_ARCH_IMX7 + { + .compatible = "fsl,imx7d-usbmisc", + .data = &mx7_data, + }, +#endif #ifdef CONFIG_ARCH_IMX6 { .compatible = "fsl,imx6q-usbmisc", -- 2.11.0 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 10/23] usb: imx: Add clock support 2017-01-16 10:50 i.MX7 support Sascha Hauer ` (8 preceding siblings ...) 2017-01-16 10:50 ` [PATCH 09/23] usb: imx: Add usbmisc support for i.MX7 Sascha Hauer @ 2017-01-16 10:50 ` Sascha Hauer 2017-01-16 10:50 ` [PATCH 11/23] phy: usb-nop-xceiv: " Sascha Hauer ` (14 subsequent siblings) 24 siblings, 0 replies; 38+ messages in thread From: Sascha Hauer @ 2017-01-16 10:50 UTC (permalink / raw) To: Barebox List Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- drivers/usb/imx/chipidea-imx.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/usb/imx/chipidea-imx.c b/drivers/usb/imx/chipidea-imx.c index f4354876c..ccd534613 100644 --- a/drivers/usb/imx/chipidea-imx.c +++ b/drivers/usb/imx/chipidea-imx.c @@ -27,6 +27,7 @@ #include <usb/fsl_usb2.h> #include <linux/err.h> #include <linux/phy/phy.h> +#include <linux/clk.h> #define MXC_EHCI_PORTSC_MASK ((0xf << 28) | (1 << 25)) @@ -44,6 +45,7 @@ struct imx_chipidea { struct regulator *vbus; struct phy *phy; struct usb_phy *usbphy; + struct clk *clk; }; static int imx_chipidea_port_init(void *drvdata) @@ -268,6 +270,17 @@ static int imx_chipidea_probe(struct device_d *dev) if (IS_ERR(ci->vbus)) ci->vbus = NULL; + /* + * Some devices have more than one clock, in this case they are enabled + * by default in the clock driver. At least enable the main clock for + * devices which have only one. + */ + ci->clk = clk_get(dev, NULL); + if (IS_ERR(ci->clk)) + return PTR_ERR(ci->clk); + + clk_enable(ci->clk); + if (of_property_read_bool(dev->device_node, "fsl,usbphy")) { ci->phy = of_phy_get_by_phandle(dev, "fsl,usbphy", 0); if (IS_ERR(ci->phy)) { -- 2.11.0 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 11/23] phy: usb-nop-xceiv: Add clock support 2017-01-16 10:50 i.MX7 support Sascha Hauer ` (9 preceding siblings ...) 2017-01-16 10:50 ` [PATCH 10/23] usb: imx: Add clock support Sascha Hauer @ 2017-01-16 10:50 ` Sascha Hauer 2017-01-16 10:50 ` [PATCH 12/23] of: partitions: force "partitions" subnode Sascha Hauer ` (13 subsequent siblings) 24 siblings, 0 replies; 38+ messages in thread From: Sascha Hauer @ 2017-01-16 10:50 UTC (permalink / raw) To: Barebox List As stated in the FIXME comment this is needed. Get and enable a "main_clk" just like the kernel does. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- drivers/phy/usb-nop-xceiv.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/phy/usb-nop-xceiv.c b/drivers/phy/usb-nop-xceiv.c index 606e09822..d403fe4d6 100644 --- a/drivers/phy/usb-nop-xceiv.c +++ b/drivers/phy/usb-nop-xceiv.c @@ -27,6 +27,7 @@ struct nop_usbphy { struct usb_phy usb_phy; struct phy *phy; struct phy_provider *provider; + struct clk *clk; }; static struct phy *nop_usbphy_xlate(struct device_d *dev, @@ -37,6 +38,13 @@ static struct phy *nop_usbphy_xlate(struct device_d *dev, return nopphy->phy; } +static int nop_usbphy_init(struct phy *phy) +{ + struct nop_usbphy *nopphy = phy_get_drvdata(phy); + + return clk_enable(nopphy->clk); +} + static struct usb_phy *nop_usbphy_to_usbphy(struct phy *phy) { struct nop_usbphy *nopphy = phy_get_drvdata(phy); @@ -46,6 +54,7 @@ static struct usb_phy *nop_usbphy_to_usbphy(struct phy *phy) static const struct phy_ops nop_phy_ops = { .to_usbphy = nop_usbphy_to_usbphy, + .init = nop_usbphy_init, }; static int nop_usbphy_probe(struct device_d *dev) @@ -57,7 +66,10 @@ static int nop_usbphy_probe(struct device_d *dev) dev->priv = nopphy; - /* FIXME: Add clk support */ + nopphy->clk = clk_get(dev, "main_clk"); + if (IS_ERR(nopphy->clk)) + nopphy->clk = NULL; + /* FIXME: Add vbus regulator support */ /* FIXME: Add vbus-detect-gpio support */ @@ -97,8 +109,8 @@ static struct driver_d nop_usbphy_driver = { .of_compatible = DRV_OF_COMPAT(nop_usbphy_dt_ids), }; -static int nop_usbphy_init(void) +static int nop_usbphy_driver_init(void) { return platform_driver_register(&nop_usbphy_driver); } -fs_initcall(nop_usbphy_init); +fs_initcall(nop_usbphy_driver_init); -- 2.11.0 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 12/23] of: partitions: force "partitions" subnode 2017-01-16 10:50 i.MX7 support Sascha Hauer ` (10 preceding siblings ...) 2017-01-16 10:50 ` [PATCH 11/23] phy: usb-nop-xceiv: " Sascha Hauer @ 2017-01-16 10:50 ` Sascha Hauer 2017-01-16 10:50 ` [PATCH 13/23] mci: Allow to partition eMMC boot partitions Sascha Hauer ` (12 subsequent siblings) 24 siblings, 0 replies; 38+ messages in thread From: Sascha Hauer @ 2017-01-16 10:50 UTC (permalink / raw) To: Barebox List The binding states that a subnode containing partition subnodes should have the name "partitions". Enforce this so that we do not parse nodes with other names which may have partition descriptions for other disks. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- drivers/of/partition.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/of/partition.c b/drivers/of/partition.c index bdf594562..8c2aef232 100644 --- a/drivers/of/partition.c +++ b/drivers/of/partition.c @@ -74,16 +74,16 @@ struct cdev *of_parse_partition(struct cdev *cdev, struct device_node *node) int of_parse_partitions(struct cdev *cdev, struct device_node *node) { - struct device_node *n; + struct device_node *n, *subnode; if (!node) return -EINVAL; - for_each_child_of_node(node, n) { - if (of_device_is_compatible(n, "fixed-partitions")) { - node = n; - break; - } + subnode = of_get_child_by_name(node, "partitions"); + if (subnode) { + if (!of_device_is_compatible(subnode, "fixed-partitions")) + return -EINVAL; + node = subnode; } for_each_child_of_node(node, n) { -- 2.11.0 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 13/23] mci: Allow to partition eMMC boot partitions 2017-01-16 10:50 i.MX7 support Sascha Hauer ` (11 preceding siblings ...) 2017-01-16 10:50 ` [PATCH 12/23] of: partitions: force "partitions" subnode Sascha Hauer @ 2017-01-16 10:50 ` Sascha Hauer 2017-01-16 10:50 ` [PATCH 14/23] mci: imx-esdhci: remove wrong write protection test Sascha Hauer ` (11 subsequent siblings) 24 siblings, 0 replies; 38+ messages in thread From: Sascha Hauer @ 2017-01-16 10:50 UTC (permalink / raw) To: Barebox List So far the eMMC boot partitions cannot be partitioned from the device tree. Since they are often 4MiB in size they are big enough to hold a barebox image and the environment. Add partition parsing to the boot partitions to allow this usecase. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- drivers/mci/mci-core.c | 78 +++++++++++++++++++++++++++++++++++--------------- include/mci.h | 1 + 2 files changed, 56 insertions(+), 23 deletions(-) diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c index 4e176f7b3..055a5e2b0 100644 --- a/drivers/mci/mci-core.c +++ b/drivers/mci/mci-core.c @@ -436,6 +436,7 @@ static void mci_part_add(struct mci *mci, uint64_t size, part->blk.num_blocks = mci_calc_blk_cnt(size, part->blk.blockbits); part->area_type = area_type; part->part_cfg = part_cfg; + part->idx = idx; if (area_type == MMC_BLK_DATA_AREA_MAIN) part->blk.cdev.device_node = mci->host->hw_dev->device_node; @@ -1573,6 +1574,59 @@ static const char *mci_boot_names[] = { "user", }; +static int mci_register_partition(struct mci_part *part) +{ + struct mci *mci = part->mci; + struct mci_host *host = mci->host; + const char *partnodename = NULL; + struct device_node *np; + int rc; + + /* + * An MMC/SD card acts like an ordinary disk. + * So, re-use the disk driver to gain access to this media + */ + part->blk.dev = &mci->dev; + part->blk.ops = &mci_ops; + + rc = blockdevice_register(&part->blk); + if (rc != 0) { + dev_err(&mci->dev, "Failed to register MCI/SD blockdevice\n"); + return rc; + } + dev_info(&mci->dev, "registered %s\n", part->blk.cdev.name); + + np = host->hw_dev->device_node; + + /* create partitions on demand */ + switch (part->area_type) { + case MMC_BLK_DATA_AREA_BOOT: + if (part->idx == 0) + partnodename = "boot0-partitions"; + else + partnodename = "boot1-partitions"; + + np = of_get_child_by_name(host->hw_dev->device_node, + partnodename); + break; + case MMC_BLK_DATA_AREA_MAIN: + break; + default: + return 0; + } + + rc = parse_partition_table(&part->blk); + if (rc != 0) { + dev_warn(&mci->dev, "No partition table found\n"); + rc = 0; /* it's not a failure */ + } + + if (np) + of_parse_partitions(&part->blk.cdev, np); + + return 0; +} + /** * Probe an MCI card at the given host interface * @param mci MCI device instance @@ -1647,29 +1701,7 @@ static int mci_card_probe(struct mci *mci) for (i = 0; i < mci->nr_parts; i++) { struct mci_part *part = &mci->part[i]; - /* - * An MMC/SD card acts like an ordinary disk. - * So, re-use the disk driver to gain access to this media - */ - part->blk.dev = &mci->dev; - part->blk.ops = &mci_ops; - - rc = blockdevice_register(&part->blk); - if (rc != 0) { - dev_err(&mci->dev, "Failed to register MCI/SD blockdevice\n"); - goto on_error; - } - dev_info(&mci->dev, "registered %s\n", part->blk.cdev.name); - - /* create partitions on demand */ - if (part->area_type == MMC_BLK_DATA_AREA_MAIN) { - rc = parse_partition_table(&part->blk); - if (rc != 0) { - dev_warn(&mci->dev, "No partition table found\n"); - rc = 0; /* it's not a failure */ - } - of_parse_partitions(&part->blk.cdev, host->hw_dev->device_node); - } + rc = mci_register_partition(part); if (IS_ENABLED(CONFIG_MCI_MMC_BOOT_PARTITIONS) && part->area_type == MMC_BLK_DATA_AREA_BOOT && diff --git a/include/mci.h b/include/mci.h index 0370547b0..cc4712cfa 100644 --- a/include/mci.h +++ b/include/mci.h @@ -433,6 +433,7 @@ struct mci_part { uint64_t size; /* partition size (in bytes) */ unsigned int part_cfg; /* partition type */ char *name; + int idx; unsigned int area_type; #define MMC_BLK_DATA_AREA_MAIN (1<<0) #define MMC_BLK_DATA_AREA_BOOT (1<<1) -- 2.11.0 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 14/23] mci: imx-esdhci: remove wrong write protection test 2017-01-16 10:50 i.MX7 support Sascha Hauer ` (12 preceding siblings ...) 2017-01-16 10:50 ` [PATCH 13/23] mci: Allow to partition eMMC boot partitions Sascha Hauer @ 2017-01-16 10:50 ` Sascha Hauer 2017-01-16 10:51 ` [PATCH 15/23] ARM: i.MX: Add i.MX7 base architecture support Sascha Hauer ` (10 subsequent siblings) 24 siblings, 0 replies; 38+ messages in thread From: Sascha Hauer @ 2017-01-16 10:50 UTC (permalink / raw) To: Barebox List Testing for the write protection bit to determine if a card is write protected or not is wrong. The bit may have the wrong value for permanently plugged cards (eMMC) or for boards using a GPIO for write protection detection. Since the core will test for write protection before actually calling into the driver this test can just be removed. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- drivers/mci/imx-esdhc.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/drivers/mci/imx-esdhc.c b/drivers/mci/imx-esdhc.c index c845187a5..f4d57348e 100644 --- a/drivers/mci/imx-esdhc.c +++ b/drivers/mci/imx-esdhc.c @@ -218,13 +218,10 @@ static int esdhc_setup_data(struct mci_host *mci, struct mci_data *data) u32 wml_value; if (IS_ENABLED(CONFIG_MCI_IMX_ESDHC_PIO)) { - if (!(data->flags & MMC_DATA_READ)) { - if ((esdhc_read32(regs + SDHCI_PRESENT_STATE) & PRSSTAT_WPSPL) == 0) - goto err_locked; + if (!(data->flags & MMC_DATA_READ)) esdhc_write32(regs + SDHCI_DMA_ADDRESS, (u32)data->src); - } else { + else esdhc_write32(regs + SDHCI_DMA_ADDRESS, (u32)data->dest); - } } else { wml_value = data->blocksize/4; @@ -237,8 +234,6 @@ static int esdhc_setup_data(struct mci_host *mci, struct mci_data *data) } else { if (wml_value > 0x80) wml_value = 0x80; - if ((esdhc_read32(regs + SDHCI_PRESENT_STATE) & PRSSTAT_WPSPL) == 0) - goto err_locked; esdhc_clrsetbits32(regs + IMX_SDHCI_WML, WML_WR_WML_MASK, wml_value << 16); @@ -249,11 +244,6 @@ static int esdhc_setup_data(struct mci_host *mci, struct mci_data *data) esdhc_write32(regs + SDHCI_BLOCK_SIZE__BLOCK_COUNT, data->blocks << 16 | data->blocksize); return 0; - -err_locked: - dev_err(host->dev, "Can not write to locked card.\n\n"); - - return -ETIMEDOUT; } static int esdhc_do_data(struct mci_host *mci, struct mci_data *data) -- 2.11.0 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 15/23] ARM: i.MX: Add i.MX7 base architecture support 2017-01-16 10:50 i.MX7 support Sascha Hauer ` (13 preceding siblings ...) 2017-01-16 10:50 ` [PATCH 14/23] mci: imx-esdhci: remove wrong write protection test Sascha Hauer @ 2017-01-16 10:51 ` Sascha Hauer 2017-01-16 10:51 ` [PATCH 16/23] clk: i.MX: pllv3: Add support for the i.MX7 enet pll Sascha Hauer ` (9 subsequent siblings) 24 siblings, 0 replies; 38+ messages in thread From: Sascha Hauer @ 2017-01-16 10:51 UTC (permalink / raw) To: Barebox List; +Cc: Juergen Borleis From: Juergen Borleis <jbe@pengutronix.de> Signed-off-by Juergen Borleis <jbe@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- Documentation/boards/imx.rst | 1 + arch/arm/mach-imx/Kconfig | 4 ++ arch/arm/mach-imx/Makefile | 1 + arch/arm/mach-imx/boot.c | 70 ++++++++++++++++++++++++ arch/arm/mach-imx/cpu_init.c | 5 ++ arch/arm/mach-imx/imx.c | 6 +++ arch/arm/mach-imx/imx7.c | 75 ++++++++++++++++++++++++++ arch/arm/mach-imx/include/mach/debug_ll.h | 3 ++ arch/arm/mach-imx/include/mach/generic.h | 16 ++++++ arch/arm/mach-imx/include/mach/imx7-regs.h | 23 ++++++++ arch/arm/mach-imx/include/mach/imx7.h | 59 ++++++++++++++++++++ arch/arm/mach-imx/include/mach/imx_cpu_types.h | 1 + common/Kconfig | 8 +++ include/serial/imx-uart.h | 5 ++ scripts/imx/imx.c | 1 + 15 files changed, 278 insertions(+) create mode 100644 arch/arm/mach-imx/imx7.c create mode 100644 arch/arm/mach-imx/include/mach/imx7-regs.h create mode 100644 arch/arm/mach-imx/include/mach/imx7.h diff --git a/Documentation/boards/imx.rst b/Documentation/boards/imx.rst index 60cdcf072..b6e65060c 100644 --- a/Documentation/boards/imx.rst +++ b/Documentation/boards/imx.rst @@ -20,6 +20,7 @@ The Internal Boot Mode is supported on: * i.MX51 * i.MX53 * i.MX6 +* i.MX7 With the Internal Boot Mode, the images contain a header which describes where the binary shall be loaded and started. These headers also contain diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig index 9dbe31c4b..fd1ecb6bb 100644 --- a/arch/arm/mach-imx/Kconfig +++ b/arch/arm/mach-imx/Kconfig @@ -157,6 +157,10 @@ config ARCH_IMX6UL bool select ARCH_IMX6 +config ARCH_IMX7 + bool + select CPU_V7 + config ARCH_VF610 bool select ARCH_HAS_L2X0 diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile index d0fe7abc0..fc5305f05 100644 --- a/arch/arm/mach-imx/Makefile +++ b/arch/arm/mach-imx/Makefile @@ -13,6 +13,7 @@ obj-$(CONFIG_ARCH_IMX53) += imx53.o imx5.o esdctl-v4.o pbl-$(CONFIG_ARCH_IMX53) += imx53.o imx5.o esdctl-v4.o obj-$(CONFIG_ARCH_IMX6) += imx6.o usb-imx6.o lwl-$(CONFIG_ARCH_IMX6) += imx6-mmdc.o +obj-$(CONFIG_ARCH_IMX7) += imx7.o obj-$(CONFIG_ARCH_IMX_XLOAD) += xload.o obj-$(CONFIG_IMX_IIM) += iim.o obj-$(CONFIG_IMX_OCOTP) += ocotp.o diff --git a/arch/arm/mach-imx/boot.c b/arch/arm/mach-imx/boot.c index 489306072..72597f5e2 100644 --- a/arch/arm/mach-imx/boot.c +++ b/arch/arm/mach-imx/boot.c @@ -25,6 +25,7 @@ #include <mach/imx51-regs.h> #include <mach/imx53-regs.h> #include <mach/imx6-regs.h> +#include <mach/imx7-regs.h> /* [CTRL][TYPE] */ static const enum bootsource locations[4][4] = { @@ -346,3 +347,72 @@ void imx6_boot_save_loc(void) bootsource_set(src); bootsource_set_instance(instance); } + +#define IMX7_SRC_SBMR1 0x58 +#define IMX7_SRC_SBMR2 0x70 + +void imx7_get_boot_source(enum bootsource *src, int *instance) +{ + void __iomem *src_base = IOMEM(MX7_SRC_BASE_ADDR); + uint32_t sbmr1 = readl(src_base + IMX7_SRC_SBMR1); + uint32_t sbmr2 = readl(src_base + IMX7_SRC_SBMR2); + int boot_mode; + + /* BMOD[1:0] */ + boot_mode = (sbmr2 >> 24) & 0x3; + + switch (boot_mode) { + case 0: /* Fuses, fall through */ + case 2: /* internal boot */ + goto internal_boot; + case 1: /* Serial Downloader */ + *src = BOOTSOURCE_SERIAL; + break; + case 3: /* reserved */ + break; + }; + + return; + +internal_boot: + + switch ((sbmr1 >> 12) & 0xf) { + case 1: + case 2: + *src = BOOTSOURCE_MMC; + *instance = (sbmr1 >> 10 & 0x3); + break; + case 3: + *src = BOOTSOURCE_NAND; + break; + case 4: + *src = BOOTSOURCE_SPI_NOR, + *instance = (sbmr1 >> 9 & 0x7); + break; + case 6: + *src = BOOTSOURCE_SPI; /* Really: qspi */ + break; + case 5: + *src = BOOTSOURCE_NOR; + break; + default: + break; + } + + /* BOOT_CFG1[7:0] */ + if (sbmr1 & (1 << 7)) + *src = BOOTSOURCE_NAND; + + return; +} + +void imx7_boot_save_loc(void) +{ + enum bootsource src = BOOTSOURCE_UNKNOWN; + int instance = BOOTSOURCE_INSTANCE_UNKNOWN; + + imx7_get_boot_source(&src, &instance); + + bootsource_set(src); + bootsource_set_instance(instance); +} diff --git a/arch/arm/mach-imx/cpu_init.c b/arch/arm/mach-imx/cpu_init.c index 6971d89d9..2b388cad8 100644 --- a/arch/arm/mach-imx/cpu_init.c +++ b/arch/arm/mach-imx/cpu_init.c @@ -34,6 +34,11 @@ void imx6_cpu_lowlevel_init(void) enable_arm_errata_845369_war(); } +void imx7_cpu_lowlevel_init(void) +{ + arm_cpu_lowlevel_init(); +} + void vf610_cpu_lowlevel_init(void) { arm_cpu_lowlevel_init(); diff --git a/arch/arm/mach-imx/imx.c b/arch/arm/mach-imx/imx.c index 952db007d..907340fc5 100644 --- a/arch/arm/mach-imx/imx.c +++ b/arch/arm/mach-imx/imx.c @@ -65,6 +65,10 @@ static int imx_soc_from_dt(void) return IMX_CPU_IMX6; if (of_machine_is_compatible("fsl,imx6ul")) return IMX_CPU_IMX6; + if (of_machine_is_compatible("fsl,imx7s")) + return IMX_CPU_IMX7; + if (of_machine_is_compatible("fsl,imx7d")) + return IMX_CPU_IMX7; if (of_machine_is_compatible("fsl,vf610")) return IMX_CPU_VF610; @@ -103,6 +107,8 @@ static int imx_init(void) ret = imx53_init(); else if (cpu_is_mx6()) ret = imx6_init(); + else if (cpu_is_mx7()) + ret = imx7_init(); else if (cpu_is_vf610()) ret = 0; else diff --git a/arch/arm/mach-imx/imx7.c b/arch/arm/mach-imx/imx7.c new file mode 100644 index 000000000..fde66d838 --- /dev/null +++ b/arch/arm/mach-imx/imx7.c @@ -0,0 +1,75 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include <init.h> +#include <common.h> +#include <io.h> +#include <linux/sizes.h> +#include <mach/imx7.h> +#include <mach/generic.h> +#include <mach/revision.h> +#include <mach/imx7-regs.h> + +void imx7_init_lowlevel(void) +{ + void __iomem *aips1 = IOMEM(MX7_AIPS1_CONFIG_BASE_ADDR); + void __iomem *aips2 = IOMEM(MX7_AIPS2_CONFIG_BASE_ADDR); + + /* + * Set all MPROTx to be non-bufferable, trusted for R/W, + * not forced to user-mode. + */ + writel(0x77777777, aips1); + writel(0x77777777, aips1 + 0x4); + writel(0, aips1 + 0x40); + writel(0, aips1 + 0x44); + writel(0, aips1 + 0x48); + writel(0, aips1 + 0x4c); + writel(0, aips1 + 0x50); + + writel(0x77777777, aips2); + writel(0x77777777, aips2 + 0x4); + writel(0, aips2 + 0x40); + writel(0, aips2 + 0x44); + writel(0, aips2 + 0x48); + writel(0, aips2 + 0x4c); + writel(0, aips2 + 0x50); +} + +int imx7_init(void) +{ + const char *cputypestr; + u32 imx7_silicon_revision; + + imx7_init_lowlevel(); + + imx7_boot_save_loc(); + + imx7_silicon_revision = imx7_cpu_revision(); + + switch (imx7_cpu_type()) { + case IMX7_CPUTYPE_IMX7D: + cputypestr = "i.MX7d"; + break; + case IMX7_CPUTYPE_IMX7S: + cputypestr = "i.MX7s"; + break; + default: + cputypestr = "unknown i.MX7"; + break; + } + + imx_set_silicon_revision(cputypestr, imx7_silicon_revision); + + return 0; +} diff --git a/arch/arm/mach-imx/include/mach/debug_ll.h b/arch/arm/mach-imx/include/mach/debug_ll.h index a132f3c16..39d710f7d 100644 --- a/arch/arm/mach-imx/include/mach/debug_ll.h +++ b/arch/arm/mach-imx/include/mach/debug_ll.h @@ -14,6 +14,7 @@ #include <mach/imx51-regs.h> #include <mach/imx53-regs.h> #include <mach/imx6-regs.h> +#include <mach/imx7-regs.h> #include <mach/vf610-regs.h> #include <serial/imx-uart.h> @@ -44,6 +45,8 @@ #define IMX_DEBUG_SOC MX53 #elif defined CONFIG_DEBUG_IMX6Q_UART #define IMX_DEBUG_SOC MX6 +#elif defined CONFIG_DEBUG_IMX7D_UART +#define IMX_DEBUG_SOC MX7 #elif defined CONFIG_DEBUG_VF610_UART #define IMX_DEBUG_SOC VF610 #else diff --git a/arch/arm/mach-imx/include/mach/generic.h b/arch/arm/mach-imx/include/mach/generic.h index 34194509e..73be9ceb5 100644 --- a/arch/arm/mach-imx/include/mach/generic.h +++ b/arch/arm/mach-imx/include/mach/generic.h @@ -14,12 +14,14 @@ void imx27_boot_save_loc(void); void imx51_boot_save_loc(void); void imx53_boot_save_loc(void); void imx6_boot_save_loc(void); +void imx7_boot_save_loc(void); void imx25_get_boot_source(enum bootsource *src, int *instance); void imx35_get_boot_source(enum bootsource *src, int *instance); void imx51_get_boot_source(enum bootsource *src, int *instance); void imx53_get_boot_source(enum bootsource *src, int *instance); void imx6_get_boot_source(enum bootsource *src, int *instance); +void imx7_get_boot_source(enum bootsource *src, int *instance); int imx1_init(void); int imx21_init(void); @@ -31,6 +33,7 @@ int imx50_init(void); int imx51_init(void); int imx53_init(void); int imx6_init(void); +int imx7_init(void); int imx1_devices_init(void); int imx21_devices_init(void); @@ -45,6 +48,7 @@ int imx6_devices_init(void); void imx5_cpu_lowlevel_init(void); void imx6_cpu_lowlevel_init(void); +void imx7_cpu_lowlevel_init(void); void vf610_cpu_lowlevel_init(void); /* There's a off-by-one betweem the gpio bank number and the gpiochip */ @@ -174,6 +178,18 @@ extern unsigned int __imx_cpu_type; # define cpu_is_mx6() (0) #endif +#ifdef CONFIG_ARCH_IMX7 +# ifdef imx_cpu_type +# undef imx_cpu_type +# define imx_cpu_type __imx_cpu_type +# else +# define imx_cpu_type IMX_CPU_IMX7 +# endif +# define cpu_is_mx7() (imx_cpu_type == IMX_CPU_IMX7) +#else +# define cpu_is_mx7() (0) +#endif + #ifdef CONFIG_ARCH_VF610 # ifdef imx_cpu_type # undef imx_cpu_type diff --git a/arch/arm/mach-imx/include/mach/imx7-regs.h b/arch/arm/mach-imx/include/mach/imx7-regs.h new file mode 100644 index 000000000..7808a2a0a --- /dev/null +++ b/arch/arm/mach-imx/include/mach/imx7-regs.h @@ -0,0 +1,23 @@ +#ifndef __MACH_IMX7_REGS_H +#define __MACH_IMX7_REGS_H + +#define MX7_AIPS1_BASE_ADDR 0x30000000 +#define MX7_AIPS2_BASE_ADDR 0x30400000 +#define MX7_AIPS3_BASE_ADDR 0x30800000 + +#define MX7_AIPS1_CONFIG_BASE_ADDR 0x301f0000 +#define MX7_IOMUX_BASE_ADDR 0x30330000 +#define MX7_OCOTP_BASE_ADDR 0x30350000 +#define MX7_ANATOP_BASE_ADDR 0x30360000 +#define MX7_CCM_BASE_ADDR 0x30380000 +#define MX7_SRC_BASE_ADDR 0x30390000 +#define MX7_UART1_BASE_ADDR 0x30860000 +#define MX7_UART2_BASE_ADDR 0x30870000 +#define MX7_UART3_BASE_ADDR 0x30880000 +#define MX7_UART4_BASE_ADDR 0x30a60000 +#define MX7_UART5_BASE_ADDR 0x30a70000 +#define MX7_UART6_BASE_ADDR 0x30a80000 +#define MX7_UART7_BASE_ADDR 0x30a90000 +#define MX7_AIPS2_CONFIG_BASE_ADDR 0x305f0000 + +#endif /* __MACH_IMX7_REGS_H */ diff --git a/arch/arm/mach-imx/include/mach/imx7.h b/arch/arm/mach-imx/include/mach/imx7.h new file mode 100644 index 000000000..851893546 --- /dev/null +++ b/arch/arm/mach-imx/include/mach/imx7.h @@ -0,0 +1,59 @@ +#ifndef __MACH_IMX7_H +#define __MACH_IMX7_H + +#include <io.h> +#include <mach/generic.h> +#include <mach/imx7-regs.h> +#include <mach/revision.h> + +void imx7_init_lowlevel(void); + +#define ANADIG_DIGPROG_IMX7 0x800 + +#define IMX7_CPUTYPE_IMX7S 0x71 +#define IMX7_CPUTYPE_IMX7D 0x72 + +static inline int __imx7_cpu_type(void) +{ + void __iomem *ocotp = IOMEM(MX7_OCOTP_BASE_ADDR); + + if (readl(ocotp + 0x450) & 1) + return IMX7_CPUTYPE_IMX7S; + else + return IMX7_CPUTYPE_IMX7D; +} + +static inline int imx7_cpu_type(void) +{ + if (!cpu_is_mx7()) + return 0; + + return __imx7_cpu_type(); +} + +static inline int imx7_cpu_revision(void) +{ + if (!cpu_is_mx7()) + return IMX_CHIP_REV_UNKNOWN; + + /* register value has the format of the IMX_CHIP_REV_* macros */ + return readl(MX7_ANATOP_BASE_ADDR + ANADIG_DIGPROG_IMX7) & 0xff; +} + +#define DEFINE_MX7_CPU_TYPE(str, type) \ + static inline int cpu_mx7_is_##str(void) \ + { \ + return __imx7_cpu_type() == type; \ + } \ + \ + static inline int cpu_is_##str(void) \ + { \ + if (!cpu_is_mx7()) \ + return 0; \ + return cpu_mx7_is_##str(); \ + } + +DEFINE_MX7_CPU_TYPE(mx7s, IMX7_CPUTYPE_IMX7S); +DEFINE_MX7_CPU_TYPE(mx7d, IMX7_CPUTYPE_IMX7D); + +#endif /* __MACH_IMX7_H */ \ No newline at end of file diff --git a/arch/arm/mach-imx/include/mach/imx_cpu_types.h b/arch/arm/mach-imx/include/mach/imx_cpu_types.h index 50be0b6b5..f95ef6f13 100644 --- a/arch/arm/mach-imx/include/mach/imx_cpu_types.h +++ b/arch/arm/mach-imx/include/mach/imx_cpu_types.h @@ -11,6 +11,7 @@ #define IMX_CPU_IMX51 51 #define IMX_CPU_IMX53 53 #define IMX_CPU_IMX6 6 +#define IMX_CPU_IMX7 7 #define IMX_CPU_VF610 610 #endif /* __MACH_IMX_CPU_TYPES_H */ diff --git a/common/Kconfig b/common/Kconfig index 462c104fd..350e3d49d 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -1072,6 +1072,13 @@ config DEBUG_IMX6Q_UART Say Y here if you want kernel low-level debugging support on i.MX6Q. +config DEBUG_IMX7D_UART + bool "i.MX7D Debug UART" + depends on ARCH_IMX7 + help + Say Y here if you want barebox low-level debugging support + on i.MX7D. + config DEBUG_VF610_UART bool "VF610 Debug UART" depends on ARCH_VF610 @@ -1120,6 +1127,7 @@ config DEBUG_IMX_UART_PORT DEBUG_IMX53_UART || \ DEBUG_IMX6Q_UART || \ DEBUG_IMX6SL_UART || \ + DEBUG_IMX7D_UART || \ DEBUG_VF610_UART default 1 depends on ARCH_IMX diff --git a/include/serial/imx-uart.h b/include/serial/imx-uart.h index b40044ea4..9cab32f35 100644 --- a/include/serial/imx-uart.h +++ b/include/serial/imx-uart.h @@ -175,6 +175,11 @@ static inline void imx6_uart_setup(void __iomem *uartbase) imx_uart_setup(uartbase, 80000000); } +static inline void imx7_uart_setup(void __iomem *uartbase) +{ + imx_uart_setup(uartbase, 24000000); +} + static inline void imx_uart_putc(void *base, int c) { if (!(readl(base + UCR1) & UCR1_UARTEN)) diff --git a/scripts/imx/imx.c b/scripts/imx/imx.c index bf3a42fb2..809d8a7f7 100644 --- a/scripts/imx/imx.c +++ b/scripts/imx/imx.c @@ -231,6 +231,7 @@ static struct soc_type socs[] = { { .name = "imx51", .header_version = 1, .cpu_type = IMX_CPU_IMX51 }, { .name = "imx53", .header_version = 2, .cpu_type = IMX_CPU_IMX53 }, { .name = "imx6", .header_version = 2, .cpu_type = IMX_CPU_IMX6 }, + { .name = "imx7", .header_version = 2, .cpu_type = IMX_CPU_IMX7 }, { .name = "vf610", .header_version = 2, .cpu_type = IMX_CPU_VF610 }, }; -- 2.11.0 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 16/23] clk: i.MX: pllv3: Add support for the i.MX7 enet pll 2017-01-16 10:50 i.MX7 support Sascha Hauer ` (14 preceding siblings ...) 2017-01-16 10:51 ` [PATCH 15/23] ARM: i.MX: Add i.MX7 base architecture support Sascha Hauer @ 2017-01-16 10:51 ` Sascha Hauer 2017-01-16 10:51 ` [PATCH 17/23] clk: imx: Add clk-cpu support Sascha Hauer ` (8 subsequent siblings) 24 siblings, 0 replies; 38+ messages in thread From: Sascha Hauer @ 2017-01-16 10:51 UTC (permalink / raw) To: Barebox List Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- drivers/clk/imx/clk-pllv3.c | 23 ++++++++++++++++++----- drivers/clk/imx/clk.h | 1 + 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/drivers/clk/imx/clk-pllv3.c b/drivers/clk/imx/clk-pllv3.c index 29c0f1c70..2a08996a6 100644 --- a/drivers/clk/imx/clk-pllv3.c +++ b/drivers/clk/imx/clk-pllv3.c @@ -30,6 +30,7 @@ #define BM_PLL_ENABLE (0x1 << 13) #define BM_PLL_BYPASS (0x1 << 16) #define BM_PLL_LOCK (0x1 << 31) +#define IMX7_ENET_PLL_POWER (0x1 << 5) struct clk_pllv3 { struct clk clk; @@ -38,6 +39,8 @@ struct clk_pllv3 { u32 div_mask; u32 div_shift; const char *parent; + u32 ref_clock; + u32 power_bit; }; #define to_clk_pllv3(_clk) container_of(_clk, struct clk_pllv3, clk) @@ -51,9 +54,9 @@ static int clk_pllv3_enable(struct clk *clk) val = readl(pll->base); val &= ~BM_PLL_BYPASS; if (pll->powerup_set) - val |= BM_PLL_POWER; + val |= pll->power_bit; else - val &= ~BM_PLL_POWER; + val &= ~pll->power_bit; writel(val, pll->base); /* Wait for PLL to lock */ @@ -83,9 +86,9 @@ static void clk_pllv3_disable(struct clk *clk) val |= BM_PLL_BYPASS; if (pll->powerup_set) - val &= ~BM_PLL_POWER; + val &= ~pll->power_bit; else - val |= BM_PLL_POWER; + val |= pll->power_bit; writel(val, pll->base); } @@ -265,7 +268,9 @@ static const struct clk_ops clk_pllv3_av_ops = { static unsigned long clk_pllv3_enet_recalc_rate(struct clk *clk, unsigned long parent_rate) { - return 500000000; + struct clk_pllv3 *pll = to_clk_pllv3(clk); + + return pll->ref_clock; } static const struct clk_ops clk_pllv3_enet_ops = { @@ -289,6 +294,8 @@ struct clk *imx_clk_pllv3(enum imx_pllv3_type type, const char *name, pll = xzalloc(sizeof(*pll)); + pll->power_bit = BM_PLL_POWER; + switch (type) { case IMX_PLLV3_SYS: ops = &clk_pllv3_sys_ops; @@ -302,7 +309,13 @@ struct clk *imx_clk_pllv3(enum imx_pllv3_type type, const char *name, case IMX_PLLV3_AV: ops = &clk_pllv3_av_ops; break; + case IMX_PLLV3_ENET_IMX7: + pll->power_bit = IMX7_ENET_PLL_POWER; + pll->ref_clock = 1000000000; + ops = &clk_pllv3_enet_ops; + break; case IMX_PLLV3_ENET: + pll->ref_clock = 500000000; ops = &clk_pllv3_enet_ops; break; case IMX_PLLV3_MLB: diff --git a/drivers/clk/imx/clk.h b/drivers/clk/imx/clk.h index 970f65c7d..7ecb14654 100644 --- a/drivers/clk/imx/clk.h +++ b/drivers/clk/imx/clk.h @@ -82,6 +82,7 @@ enum imx_pllv3_type { IMX_PLLV3_USB_VF610, IMX_PLLV3_AV, IMX_PLLV3_ENET, + IMX_PLLV3_ENET_IMX7, IMX_PLLV3_MLB, }; -- 2.11.0 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 17/23] clk: imx: Add clk-cpu support 2017-01-16 10:50 i.MX7 support Sascha Hauer ` (15 preceding siblings ...) 2017-01-16 10:51 ` [PATCH 16/23] clk: i.MX: pllv3: Add support for the i.MX7 enet pll Sascha Hauer @ 2017-01-16 10:51 ` Sascha Hauer 2017-01-16 10:51 ` [PATCH 18/23] clk: i.MX: Add clock support for i.MX7 Sascha Hauer ` (7 subsequent siblings) 24 siblings, 0 replies; 38+ messages in thread From: Sascha Hauer @ 2017-01-16 10:51 UTC (permalink / raw) To: Barebox List Taken from the kernel as of 4.10-rc3. Needed for i.MX7 Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- drivers/clk/imx/Makefile | 1 + drivers/clk/imx/clk-cpu.c | 110 ++++++++++++++++++++++++++++++++++++++++++++++ drivers/clk/imx/clk.h | 3 ++ 3 files changed, 114 insertions(+) create mode 100644 drivers/clk/imx/clk-cpu.c diff --git a/drivers/clk/imx/Makefile b/drivers/clk/imx/Makefile index 65d7859ed..636bfdc2e 100644 --- a/drivers/clk/imx/Makefile +++ b/drivers/clk/imx/Makefile @@ -5,6 +5,7 @@ obj-$(CONFIG_COMMON_CLK) += \ clk-pfd.o \ clk-gate2.o \ clk-gate-exclusive.o \ + clk-cpu.o \ clk.o obj-$(CONFIG_ARCH_IMX1) += clk-imx1.o diff --git a/drivers/clk/imx/clk-cpu.c b/drivers/clk/imx/clk-cpu.c new file mode 100644 index 000000000..bd1749fd8 --- /dev/null +++ b/drivers/clk/imx/clk-cpu.c @@ -0,0 +1,110 @@ +/* + * Copyright (c) 2014 Lucas Stach <l.stach@pengutronix.de>, Pengutronix + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * http://www.opensource.org/licenses/gpl-license.html + * http://www.gnu.org/copyleft/gpl.html + */ + +#include <common.h> +#include <init.h> +#include <driver.h> +#include <linux/clk.h> +#include <io.h> +#include <linux/clkdev.h> +#include <linux/err.h> +#include <malloc.h> +#include <clock.h> + +#include "clk.h" + +struct clk_cpu { + struct clk clk; + struct clk *div; + struct clk *mux; + struct clk *pll; + struct clk *step; +}; + +static inline struct clk_cpu *to_clk_cpu(struct clk *clk) +{ + return container_of(clk, struct clk_cpu, clk); +} + +static unsigned long clk_cpu_recalc_rate(struct clk *clk, + unsigned long parent_rate) +{ + struct clk_cpu *cpu = to_clk_cpu(clk); + + return clk_get_rate(cpu->div); +} + +static long clk_cpu_round_rate(struct clk *clk, unsigned long rate, + unsigned long *prate) +{ + struct clk_cpu *cpu = to_clk_cpu(clk); + + return clk_round_rate(cpu->pll, rate); +} + +static int clk_cpu_set_rate(struct clk *clk, unsigned long rate, + unsigned long parent_rate) +{ + struct clk_cpu *cpu = to_clk_cpu(clk); + int ret; + + /* switch to PLL bypass clock */ + ret = clk_set_parent(cpu->mux, cpu->step); + if (ret) + return ret; + + /* reprogram PLL */ + ret = clk_set_rate(cpu->pll, rate); + if (ret) { + clk_set_parent(cpu->mux, cpu->pll); + return ret; + } + /* switch back to PLL clock */ + clk_set_parent(cpu->mux, cpu->pll); + + /* Ensure the divider is what we expect */ + clk_set_rate(cpu->div, rate); + + return 0; +} + +static const struct clk_ops clk_cpu_ops = { + .recalc_rate = clk_cpu_recalc_rate, + .round_rate = clk_cpu_round_rate, + .set_rate = clk_cpu_set_rate, +}; + +struct clk *imx_clk_cpu(const char *name, const char *parent_name, + struct clk *div, struct clk *mux, struct clk *pll, + struct clk *step) +{ + struct clk_cpu *cpu; + int ret; + + cpu = xzalloc(sizeof(*cpu)); + + cpu->div = div; + cpu->mux = mux; + cpu->pll = pll; + cpu->step = step; + + cpu->clk.name = name; + cpu->clk.ops = &clk_cpu_ops; + cpu->clk.flags = 0; + cpu->clk.parent_names = &parent_name; + cpu->clk.num_parents = 1; + + ret = clk_register(&cpu->clk); + if (ret) + free(cpu); + + return &cpu->clk; +} diff --git a/drivers/clk/imx/clk.h b/drivers/clk/imx/clk.h index 7ecb14654..3240231a7 100644 --- a/drivers/clk/imx/clk.h +++ b/drivers/clk/imx/clk.h @@ -120,5 +120,8 @@ struct clk *imx_clk_gate_exclusive(const char *name, const char *parent, void imx_check_clocks(struct clk *clks[], unsigned int count); +struct clk *imx_clk_cpu(const char *name, const char *parent_name, + struct clk *div, struct clk *mux, struct clk *pll, + struct clk *step); #endif /* __IMX_CLK_H */ -- 2.11.0 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 18/23] clk: i.MX: Add clock support for i.MX7 2017-01-16 10:50 i.MX7 support Sascha Hauer ` (16 preceding siblings ...) 2017-01-16 10:51 ` [PATCH 17/23] clk: imx: Add clk-cpu support Sascha Hauer @ 2017-01-16 10:51 ` Sascha Hauer 2017-01-16 10:51 ` [PATCH 19/23] clk: i.MX7: Add missing USB clocks Sascha Hauer ` (6 subsequent siblings) 24 siblings, 0 replies; 38+ messages in thread From: Sascha Hauer @ 2017-01-16 10:51 UTC (permalink / raw) To: Barebox List; +Cc: Juergen Borleis From: Juergen Borleis <jbe@pengutronix.de> Signed-off-by Juergen Borleis <jbe@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- drivers/clk/imx/Makefile | 1 + drivers/clk/imx/clk-imx7.c | 878 +++++++++++++++++++++++++++++++++++++++++++++ drivers/clk/imx/clk.h | 29 ++ 3 files changed, 908 insertions(+) create mode 100644 drivers/clk/imx/clk-imx7.c diff --git a/drivers/clk/imx/Makefile b/drivers/clk/imx/Makefile index 636bfdc2e..32d503879 100644 --- a/drivers/clk/imx/Makefile +++ b/drivers/clk/imx/Makefile @@ -20,4 +20,5 @@ obj-$(CONFIG_ARCH_IMX53) += clk-imx5.o obj-$(CONFIG_ARCH_IMX6) += clk-imx6.o obj-$(CONFIG_ARCH_IMX6SX) += clk-imx6sx.o obj-$(CONFIG_ARCH_IMX6UL) += clk-imx6ul.o +obj-$(CONFIG_ARCH_IMX7) += clk-imx7.o obj-$(CONFIG_ARCH_VF610) += clk-vf610.o diff --git a/drivers/clk/imx/clk-imx7.c b/drivers/clk/imx/clk-imx7.c new file mode 100644 index 000000000..c8424fe07 --- /dev/null +++ b/drivers/clk/imx/clk-imx7.c @@ -0,0 +1,878 @@ +/* + * Copyright (C) 2014-2015 Freescale Semiconductor, Inc. + * + * The code contained herein is licensed under the GNU General Public + * License. You may obtain a copy of the GNU General Public License + * Version 2 or later at the following locations: + * + * http://www.opensource.org/licenses/gpl-license.html + * http://www.gnu.org/copyleft/gpl.html + */ + +#include <common.h> +#include <init.h> +#include <driver.h> +#include <linux/clk.h> +#include <io.h> +#include <of.h> +#include <linux/clkdev.h> +#include <linux/err.h> +#include <mach/imx7-regs.h> +#include <mach/revision.h> +#include <dt-bindings/clock/imx7d-clock.h> + +#include "clk.h" + +static struct clk *clks[IMX7D_CLK_END]; +static const char *arm_a7_sel[] = { "osc", "pll_arm_main_clk", + "pll_enet_500m_clk", "pll_dram_main_clk", + "pll_sys_main_clk", "pll_sys_pfd0_392m_clk", "pll_audio_post_div", + "pll_usb_main_clk", }; + +static const char *arm_m4_sel[] = { "osc", "pll_sys_main_240m_clk", + "pll_enet_250m_clk", "pll_sys_pfd2_270m_clk", + "pll_dram_533m_clk", "pll_audio_post_div", "pll_video_main_clk", + "pll_usb_main_clk", }; + +static const char *arm_m0_sel[] = { "osc", "pll_sys_main_120m_clk", + "pll_enet_125m_clk", "pll_sys_pfd2_135m_clk", + "pll_dram_533m_clk", "pll_audio_post_div", "pll_video_main_clk", + "pll_usb_main_clk", }; + +static const char *axi_sel[] = { "osc", "pll_sys_pfd1_332m_clk", + "pll_dram_533m_clk", "pll_enet_250m_clk", "pll_sys_pfd5_clk", + "pll_audio_post_div", "pll_video_main_clk", "pll_sys_pfd7_clk", }; + +static const char *disp_axi_sel[] = { "osc", "pll_sys_pfd1_332m_clk", + "pll_dram_533m_clk", "pll_enet_250m_clk", "pll_sys_pfd6_clk", + "pll_sys_pfd7_clk", "pll_audio_post_div", "pll_video_main_clk", }; + +static const char *enet_axi_sel[] = { "osc", "pll_sys_pfd2_270m_clk", + "pll_dram_533m_clk", "pll_enet_250m_clk", + "pll_sys_main_240m_clk", "pll_audio_post_div", "pll_video_main_clk", + "pll_sys_pfd4_clk", }; + +static const char *nand_usdhc_bus_sel[] = { "osc", "pll_sys_pfd2_270m_clk", + "pll_dram_533m_clk", "pll_sys_main_240m_clk", + "pll_sys_pfd2_135m_clk", "pll_sys_pfd6_clk", "pll_enet_250m_clk", + "pll_audio_post_div", }; + +static const char *ahb_channel_sel[] = { "osc", "pll_sys_pfd2_270m_clk", + "pll_dram_533m_clk", "pll_sys_pfd0_392m_clk", + "pll_enet_125m_clk", "pll_usb_main_clk", "pll_audio_post_div", + "pll_video_main_clk", }; + +static const char *dram_phym_sel[] = { "pll_dram_main_clk", + "dram_phym_alt_clk", }; + +static const char *dram_sel[] = { "pll_dram_main_clk", + "dram_alt_root_clk", }; + +static const char *dram_phym_alt_sel[] = { "osc", "pll_dram_533m_clk", + "pll_sys_main_clk", "pll_enet_500m_clk", + "pll_usb_main_clk", "pll_sys_pfd7_clk", "pll_audio_post_div", + "pll_video_main_clk", }; + +static const char *dram_alt_sel[] = { "osc", "pll_dram_533m_clk", + "pll_sys_main_clk", "pll_enet_500m_clk", + "pll_enet_250m_clk", "pll_sys_pfd0_392m_clk", + "pll_audio_post_div", "pll_sys_pfd2_270m_clk", }; + +static const char *usb_hsic_sel[] = { "osc", "pll_sys_main_clk", + "pll_usb_main_clk", "pll_sys_pfd3_clk", "pll_sys_pfd4_clk", + "pll_sys_pfd5_clk", "pll_sys_pfd6_clk", "pll_sys_pfd7_clk", }; + +static const char *pcie_ctrl_sel[] = { "osc", "pll_enet_250m_clk", + "pll_sys_main_240m_clk", "pll_sys_pfd2_270m_clk", + "pll_dram_533m_clk", "pll_enet_500m_clk", + "pll_sys_pfd1_332m_clk", "pll_sys_pfd6_clk", }; + +static const char *pcie_phy_sel[] = { "osc", "pll_enet_100m_clk", + "pll_enet_500m_clk", "ext_clk_1", "ext_clk_2", "ext_clk_3", + "ext_clk_4", "pll_sys_pfd0_392m_clk", }; + +static const char *epdc_pixel_sel[] = { "osc", "pll_sys_pfd1_332m_clk", + "pll_dram_533m_clk", "pll_sys_main_clk", "pll_sys_pfd5_clk", + "pll_sys_pfd6_clk", "pll_sys_pfd7_clk", "pll_video_main_clk", }; + +static const char *lcdif_pixel_sel[] = { "osc", "pll_sys_pfd5_clk", + "pll_dram_533m_clk", "ext_clk_3", "pll_sys_pfd4_clk", + "pll_sys_pfd2_270m_clk", "pll_video_main_clk", + "pll_usb_main_clk", }; + +static const char *mipi_dsi_sel[] = { "osc", "pll_sys_pfd5_clk", + "pll_sys_pfd3_clk", "pll_sys_main_clk", "pll_sys_pfd0_196m_clk", + "pll_dram_533m_clk", "pll_video_main_clk", "pll_audio_post_div", }; + +static const char *mipi_csi_sel[] = { "osc", "pll_sys_pfd4_clk", + "pll_sys_pfd3_clk", "pll_sys_main_clk", "pll_sys_pfd0_196m_clk", + "pll_dram_533m_clk", "pll_video_main_clk", "pll_audio_post_div", }; + +static const char *mipi_dphy_sel[] = { "osc", "pll_sys_main_120m_clk", + "pll_dram_533m_clk", "pll_sys_pfd5_clk", "ref_1m_clk", "ext_clk_2", + "pll_video_main_clk", "ext_clk_3", }; + +static const char *sai1_sel[] = { "osc", "pll_sys_pfd2_135m_clk", + "pll_audio_post_div", "pll_dram_533m_clk", "pll_video_main_clk", + "pll_sys_pfd4_clk", "pll_enet_125m_clk", "ext_clk_2", }; + +static const char *sai2_sel[] = { "osc", "pll_sys_pfd2_135m_clk", + "pll_audio_post_div", "pll_dram_533m_clk", "pll_video_main_clk", + "pll_sys_pfd4_clk", "pll_enet_125m_clk", "ext_clk_2", }; + +static const char *sai3_sel[] = { "osc", "pll_sys_pfd2_135m_clk", + "pll_audio_post_div", "pll_dram_533m_clk", "pll_video_main_clk", + "pll_sys_pfd4_clk", "pll_enet_125m_clk", "ext_clk_3", }; + +static const char *spdif_sel[] = { "osc", "pll_sys_pfd2_135m_clk", + "pll_audio_post_div", "pll_dram_533m_clk", "pll_video_main_clk", + "pll_sys_pfd4_clk", "pll_enet_125m_clk", "ext_3_clk", }; + +static const char *enet1_ref_sel[] = { "osc", "pll_enet_125m_clk", + "pll_enet_50m_clk", "pll_enet_25m_clk", + "pll_sys_main_120m_clk", "pll_audio_post_div", "pll_video_main_clk", + "ext_clk_4", }; + +static const char *enet1_time_sel[] = { "osc", "pll_enet_100m_clk", + "pll_audio_post_div", "ext_clk_1", "ext_clk_2", "ext_clk_3", + "ext_clk_4", "pll_video_main_clk", }; + +static const char *enet2_ref_sel[] = { "osc", "pll_enet_125m_clk", + "pll_enet_50m_clk", "pll_enet_25m_clk", + "pll_sys_main_120m_clk", "pll_audio_post_div", "pll_video_main_clk", + "ext_clk_4", }; + +static const char *enet2_time_sel[] = { "osc", "pll_enet_100m_clk", + "pll_audio_post_div", "ext_clk_1", "ext_clk_2", "ext_clk_3", + "ext_clk_4", "pll_video_main_clk", }; + +static const char *enet_phy_ref_sel[] = { "osc", "pll_enet_25m_clk", + "pll_enet_50m_clk", "pll_enet_125m_clk", + "pll_dram_533m_clk", "pll_audio_post_div", "pll_video_main_clk", + "pll_sys_pfd3_clk", }; + +static const char *eim_sel[] = { "osc", "pll_sys_pfd2_135m_clk", + "pll_sys_main_120m_clk", "pll_dram_533m_clk", + "pll_sys_pfd2_270m_clk", "pll_sys_pfd3_clk", "pll_enet_125m_clk", + "pll_usb_main_clk", }; + +static const char *nand_sel[] = { "osc", "pll_sys_main_clk", + "pll_dram_533m_clk", "pll_sys_pfd0_392m_clk", "pll_sys_pfd3_clk", + "pll_enet_500m_clk", "pll_enet_250m_clk", + "pll_video_main_clk", }; + +static const char *qspi_sel[] = { "osc", "pll_sys_pfd4_clk", + "pll_dram_533m_clk", "pll_enet_500m_clk", "pll_sys_pfd3_clk", + "pll_sys_pfd2_270m_clk", "pll_sys_pfd6_clk", "pll_sys_pfd7_clk", }; + +static const char *usdhc1_sel[] = { "osc", "pll_sys_pfd0_392m_clk", + "pll_dram_533m_clk", "pll_enet_500m_clk", "pll_sys_pfd4_clk", + "pll_sys_pfd2_270m_clk", "pll_sys_pfd6_clk", "pll_sys_pfd7_clk", }; + +static const char *usdhc2_sel[] = { "osc", "pll_sys_pfd0_392m_clk", + "pll_dram_533m_clk", "pll_enet_500m_clk", "pll_sys_pfd4_clk", + "pll_sys_pfd2_270m_clk", "pll_sys_pfd6_clk", "pll_sys_pfd7_clk", }; + +static const char *usdhc3_sel[] = { "osc", "pll_sys_pfd0_392m_clk", + "pll_dram_533m_clk", "pll_enet_500m_clk", "pll_sys_pfd4_clk", + "pll_sys_pfd2_270m_clk", "pll_sys_pfd6_clk", "pll_sys_pfd7_clk", }; + +static const char *can1_sel[] = { "osc", "pll_sys_main_120m_clk", + "pll_dram_533m_clk", "pll_sys_main_clk", + "pll_enet_40m_clk", "pll_usb_main_clk", "ext_clk_1", + "ext_clk_4", }; + +static const char *can2_sel[] = { "osc", "pll_sys_main_120m_clk", + "pll_dram_533m_clk", "pll_sys_main_clk", + "pll_enet_40m_clk", "pll_usb_main_clk", "ext_clk_1", + "ext_clk_3", }; + +static const char *i2c1_sel[] = { "osc", "pll_sys_main_120m_clk", + "pll_enet_50m_clk", "pll_dram_533m_clk", + "pll_audio_post_div", "pll_video_main_clk", "pll_usb_main_clk", + "pll_sys_pfd2_135m_clk", }; + +static const char *i2c2_sel[] = { "osc", "pll_sys_main_120m_clk", + "pll_enet_50m_clk", "pll_dram_533m_clk", + "pll_audio_post_div", "pll_video_main_clk", "pll_usb_main_clk", + "pll_sys_pfd2_135m_clk", }; + +static const char *i2c3_sel[] = { "osc", "pll_sys_main_120m_clk", + "pll_enet_50m_clk", "pll_dram_533m_clk", + "pll_audio_post_div", "pll_video_main_clk", "pll_usb_main_clk", + "pll_sys_pfd2_135m_clk", }; + +static const char *i2c4_sel[] = { "osc", "pll_sys_main_120m_clk", + "pll_enet_50m_clk", "pll_dram_533m_clk", + "pll_audio_post_div", "pll_video_main_clk", "pll_usb_main_clk", + "pll_sys_pfd2_135m_clk", }; + +static const char *uart1_sel[] = { "osc", "pll_sys_main_240m_clk", + "pll_enet_40m_clk", "pll_enet_100m_clk", + "pll_sys_main_clk", "ext_clk_2", "ext_clk_4", + "pll_usb_main_clk", }; + +static const char *uart2_sel[] = { "osc", "pll_sys_main_240m_clk", + "pll_enet_40m_clk", "pll_enet_100m_clk", + "pll_sys_main_clk", "ext_clk_2", "ext_clk_3", + "pll_usb_main_clk", }; + +static const char *uart3_sel[] = { "osc", "pll_sys_main_240m_clk", + "pll_enet_40m_clk", "pll_enet_100m_clk", + "pll_sys_main_clk", "ext_clk_2", "ext_clk_4", + "pll_usb_main_clk", }; + +static const char *uart4_sel[] = { "osc", "pll_sys_main_240m_clk", + "pll_enet_40m_clk", "pll_enet_100m_clk", + "pll_sys_main_clk", "ext_clk_2", "ext_clk_3", + "pll_usb_main_clk", }; + +static const char *uart5_sel[] = { "osc", "pll_sys_main_240m_clk", + "pll_enet_40m_clk", "pll_enet_100m_clk", + "pll_sys_main_clk", "ext_clk_2", "ext_clk_4", + "pll_usb_main_clk", }; + +static const char *uart6_sel[] = { "osc", "pll_sys_main_240m_clk", + "pll_enet_40m_clk", "pll_enet_100m_clk", + "pll_sys_main_clk", "ext_clk_2", "ext_clk_3", + "pll_usb_main_clk", }; + +static const char *uart7_sel[] = { "osc", "pll_sys_main_240m_clk", + "pll_enet_40m_clk", "pll_enet_100m_clk", + "pll_sys_main_clk", "ext_clk_2", "ext_clk_4", + "pll_usb_main_clk", }; + +static const char *ecspi1_sel[] = { "osc", "pll_sys_main_240m_clk", + "pll_enet_40m_clk", "pll_sys_main_120m_clk", + "pll_sys_main_clk", "pll_sys_pfd4_clk", "pll_enet_250m_clk", + "pll_usb_main_clk", }; + +static const char *ecspi2_sel[] = { "osc", "pll_sys_main_240m_clk", + "pll_enet_40m_clk", "pll_sys_main_120m_clk", + "pll_sys_main_clk", "pll_sys_pfd4_clk", "pll_enet_250m_clk", + "pll_usb_main_clk", }; + +static const char *ecspi3_sel[] = { "osc", "pll_sys_main_240m_clk", + "pll_enet_40m_clk", "pll_sys_main_120m_clk", + "pll_sys_main_clk", "pll_sys_pfd4_clk", "pll_enet_250m_clk", + "pll_usb_main_clk", }; + +static const char *ecspi4_sel[] = { "osc", "pll_sys_main_240m_clk", + "pll_enet_40m_clk", "pll_sys_main_120m_clk", + "pll_sys_main_clk", "pll_sys_pfd4_clk", "pll_enet_250m_clk", + "pll_usb_main_clk", }; + +static const char *pwm1_sel[] = { "osc", "pll_enet_100m_clk", + "pll_sys_main_120m_clk", "pll_enet_40m_clk", "pll_audio_post_div", + "ext_clk_1", "ref_1m_clk", "pll_video_main_clk", }; + +static const char *pwm2_sel[] = { "osc", "pll_enet_100m_clk", + "pll_sys_main_120m_clk", "pll_enet_40m_clk", "pll_audio_post_div", + "ext_clk_1", "ref_1m_clk", "pll_video_main_clk", }; + +static const char *pwm3_sel[] = { "osc", "pll_enet_100m_clk", + "pll_sys_main_120m_clk", "pll_enet_40m_clk", "pll_audio_post_div", + "ext_clk_2", "ref_1m_clk", "pll_video_main_clk", }; + +static const char *pwm4_sel[] = { "osc", "pll_enet_100m_clk", + "pll_sys_main_120m_clk", "pll_enet_40m_clk", "pll_audio_post_div", + "ext_clk_2", "ref_1m_clk", "pll_video_main_clk", }; + +static const char *flextimer1_sel[] = { "osc", "pll_enet_100m_clk", + "pll_sys_main_120m_clk", "pll_enet_40m_clk", "pll_audio_post_div", + "ext_clk_3", "ref_1m_clk", "pll_video_main_clk", }; + +static const char *flextimer2_sel[] = { "osc", "pll_enet_100m_clk", + "pll_sys_main_120m_clk", "pll_enet_40m_clk", "pll_audio_post_div", + "ext_clk_3", "ref_1m_clk", "pll_video_main_clk", }; + +static const char *sim1_sel[] = { "osc", "pll_sys_pfd2_135m_clk", + "pll_sys_main_120m_clk", "pll_dram_533m_clk", + "pll_usb_main_clk", "pll_audio_post_div", "pll_enet_125m_clk", + "pll_sys_pfd7_clk", }; + +static const char *sim2_sel[] = { "osc", "pll_sys_pfd2_135m_clk", + "pll_sys_main_120m_clk", "pll_dram_533m_clk", + "pll_usb_main_clk", "pll_video_main_clk", "pll_enet_125m_clk", + "pll_sys_pfd7_clk", }; + +static const char *gpt1_sel[] = { "osc", "pll_enet_100m_clk", + "pll_sys_pfd0_392m_clk", "pll_enet_40m_clk", "pll_video_main_clk", + "ref_1m_clk", "pll_audio_post_div", "ext_clk_1", }; + +static const char *gpt2_sel[] = { "osc", "pll_enet_100m_clk", + "pll_sys_pfd0_392m_clk", "pll_enet_40m_clk", "pll_video_main_clk", + "ref_1m_clk", "pll_audio_post_div", "ext_clk_2", }; + +static const char *gpt3_sel[] = { "osc", "pll_enet_100m_clk", + "pll_sys_pfd0_392m_clk", "pll_enet_40m_clk", "pll_video_main_clk", + "ref_1m_clk", "pll_audio_post_div", "ext_clk_3", }; + +static const char *gpt4_sel[] = { "osc", "pll_enet_100m_clk", + "pll_sys_pfd0_392m_clk", "pll_enet_40m_clk", "pll_video_main_clk", + "ref_1m_clk", "pll_audio_post_div", "ext_clk_4", }; + +static const char *trace_sel[] = { "osc", "pll_sys_pfd2_135m_clk", + "pll_sys_main_120m_clk", "pll_dram_533m_clk", + "pll_enet_125m_clk", "pll_usb_main_clk", "ext_clk_2", + "ext_clk_3", }; + +static const char *wdog_sel[] = { "osc", "pll_sys_pfd2_135m_clk", + "pll_sys_main_120m_clk", "pll_dram_533m_clk", + "pll_enet_125m_clk", "pll_usb_main_clk", "ref_1m_clk", + "pll_sys_pfd1_166m_clk", }; + +static const char *csi_mclk_sel[] = { "osc", "pll_sys_pfd2_135m_clk", + "pll_sys_main_120m_clk", "pll_dram_533m_clk", + "pll_enet_125m_clk", "pll_audio_post_div", "pll_video_main_clk", + "pll_usb_main_clk", }; + +static const char *audio_mclk_sel[] = { "osc", "pll_sys_pfd2_135m_clk", + "pll_sys_main_120m_clk", "pll_dram_533m_clk", + "pll_enet_125m_clk", "pll_audio_post_div", "pll_video_main_clk", + "pll_usb_main_clk", }; + +static const char *wrclk_sel[] = { "osc", "pll_enet_40m_clk", + "pll_dram_533m_clk", "pll_usb_main_clk", + "pll_sys_main_240m_clk", "pll_sys_pfd2_270m_clk", + "pll_enet_500m_clk", "pll_sys_pfd7_clk", }; + +static const char *clko1_sel[] = { "osc", "pll_sys_main_clk", + "pll_sys_main_240m_clk", "pll_sys_pfd0_196m_clk", "pll_sys_pfd3_clk", + "pll_enet_500m_clk", "pll_dram_533m_clk", "ref_1m_clk", }; + +static const char *clko2_sel[] = { "osc", "pll_sys_main_240m_clk", + "pll_sys_pfd0_392m_clk", "pll_sys_pfd1_166m_clk", "pll_sys_pfd4_clk", + "pll_audio_post_div", "pll_video_main_clk", "ckil", }; + +static const char *lvds1_sel[] = { "pll_arm_main_clk", + "pll_sys_main_clk", "pll_sys_pfd0_392m_clk", "pll_sys_pfd1_332m_clk", + "pll_sys_pfd2_270m_clk", "pll_sys_pfd3_clk", "pll_sys_pfd4_clk", + "pll_sys_pfd5_clk", "pll_sys_pfd6_clk", "pll_sys_pfd7_clk", + "pll_audio_post_div", "pll_video_main_clk", "pll_enet_500m_clk", + "pll_enet_250m_clk", "pll_enet_125m_clk", "pll_enet_100m_clk", + "pll_enet_50m_clk", "pll_enet_40m_clk", "pll_enet_25m_clk", + "pll_dram_main_clk", }; + +static const char *pll_bypass_src_sel[] = { "osc", "dummy", }; +static const char *pll_arm_bypass_sel[] = { "pll_arm_main", "pll_arm_main_src", }; +static const char *pll_dram_bypass_sel[] = { "pll_dram_main", "pll_dram_main_src", }; +static const char *pll_sys_bypass_sel[] = { "pll_sys_main", "pll_sys_main_src", }; +static const char *pll_enet_bypass_sel[] = { "pll_enet_main", "pll_enet_main_src", }; +static const char *pll_audio_bypass_sel[] = { "pll_audio_main", "pll_audio_main_src", }; +static const char *pll_video_bypass_sel[] = { "pll_video_main", "pll_video_main_src", }; + +static int const clks_init_on[] __initconst = { + IMX7D_ARM_A7_ROOT_CLK, IMX7D_MAIN_AXI_ROOT_CLK, + IMX7D_PLL_SYS_MAIN_480M_CLK, IMX7D_NAND_USDHC_BUS_ROOT_CLK, + IMX7D_DRAM_PHYM_ROOT_CLK, IMX7D_DRAM_ROOT_CLK, + IMX7D_DRAM_PHYM_ALT_ROOT_CLK, IMX7D_DRAM_ALT_ROOT_CLK, + IMX7D_AHB_CHANNEL_ROOT_CLK, +}; + +static struct clk_onecell_data clk_data; + +static struct clk ** const uart_clks[] __initconst = { + &clks[IMX7D_UART1_ROOT_CLK], + &clks[IMX7D_UART2_ROOT_CLK], + &clks[IMX7D_UART3_ROOT_CLK], + &clks[IMX7D_UART4_ROOT_CLK], + &clks[IMX7D_UART5_ROOT_CLK], + &clks[IMX7D_UART6_ROOT_CLK], + &clks[IMX7D_UART7_ROOT_CLK], + NULL +}; + +static int imx7_ccm_probe(struct device_d *dev) +{ + struct resource *iores; + void __iomem *base, *anatop_base, *ccm_base; + int i; + + anatop_base = IOMEM(MX7_ANATOP_BASE_ADDR); + iores = dev_request_mem_resource(dev, 0); + if (IS_ERR(iores)) + return PTR_ERR(iores); + ccm_base = IOMEM(iores->start); + + base = anatop_base; + + clks[IMX7D_PLL_ARM_MAIN_SRC] = imx_clk_mux("pll_arm_main_src", base + 0x60, 14, 2, pll_bypass_src_sel, ARRAY_SIZE(pll_bypass_src_sel)); + clks[IMX7D_PLL_DRAM_MAIN_SRC] = imx_clk_mux("pll_dram_main_src", base + 0x70, 14, 2, pll_bypass_src_sel, ARRAY_SIZE(pll_bypass_src_sel)); + clks[IMX7D_PLL_SYS_MAIN_SRC] = imx_clk_mux("pll_sys_main_src", base + 0xb0, 14, 2, pll_bypass_src_sel, ARRAY_SIZE(pll_bypass_src_sel)); + clks[IMX7D_PLL_ENET_MAIN_SRC] = imx_clk_mux("pll_enet_main_src", base + 0xe0, 14, 2, pll_bypass_src_sel, ARRAY_SIZE(pll_bypass_src_sel)); + clks[IMX7D_PLL_AUDIO_MAIN_SRC] = imx_clk_mux("pll_audio_main_src", base + 0xf0, 14, 2, pll_bypass_src_sel, ARRAY_SIZE(pll_bypass_src_sel)); + clks[IMX7D_PLL_VIDEO_MAIN_SRC] = imx_clk_mux("pll_video_main_src", base + 0x130, 14, 2, pll_bypass_src_sel, ARRAY_SIZE(pll_bypass_src_sel)); + + clks[IMX7D_PLL_ARM_MAIN] = imx_clk_pllv3(IMX_PLLV3_SYS, "pll_arm_main", "osc", base + 0x60, 0x7f); + clks[IMX7D_PLL_DRAM_MAIN] = imx_clk_pllv3(IMX_PLLV3_AV, "pll_dram_main", "osc", base + 0x70, 0x7f); + clks[IMX7D_PLL_SYS_MAIN] = imx_clk_pllv3(IMX_PLLV3_GENERIC, "pll_sys_main", "osc", base + 0xb0, 0x1); + clks[IMX7D_PLL_ENET_MAIN] = imx_clk_pllv3(IMX_PLLV3_ENET_IMX7, "pll_enet_main", "osc", base + 0xe0, 0x0); + clks[IMX7D_PLL_AUDIO_MAIN] = imx_clk_pllv3(IMX_PLLV3_AV, "pll_audio_main", "osc", base + 0xf0, 0x7f); + clks[IMX7D_PLL_VIDEO_MAIN] = imx_clk_pllv3(IMX_PLLV3_AV, "pll_video_main", "osc", base + 0x130, 0x7f); + + clks[IMX7D_PLL_ARM_MAIN_BYPASS] = imx_clk_mux_p("pll_arm_main_bypass", base + 0x60, 16, 1, pll_arm_bypass_sel, ARRAY_SIZE(pll_arm_bypass_sel)); + clks[IMX7D_PLL_DRAM_MAIN_BYPASS] = imx_clk_mux_p("pll_dram_main_bypass", base + 0x70, 16, 1, pll_dram_bypass_sel, ARRAY_SIZE(pll_dram_bypass_sel)); + clks[IMX7D_PLL_SYS_MAIN_BYPASS] = imx_clk_mux_p("pll_sys_main_bypass", base + 0xb0, 16, 1, pll_sys_bypass_sel, ARRAY_SIZE(pll_sys_bypass_sel)); + clks[IMX7D_PLL_ENET_MAIN_BYPASS] = imx_clk_mux_p("pll_enet_main_bypass", base + 0xe0, 16, 1, pll_enet_bypass_sel, ARRAY_SIZE(pll_enet_bypass_sel)); + clks[IMX7D_PLL_AUDIO_MAIN_BYPASS] = imx_clk_mux_p("pll_audio_main_bypass", base + 0xf0, 16, 1, pll_audio_bypass_sel, ARRAY_SIZE(pll_audio_bypass_sel)); + clks[IMX7D_PLL_VIDEO_MAIN_BYPASS] = imx_clk_mux_p("pll_video_main_bypass", base + 0x130, 16, 1, pll_video_bypass_sel, ARRAY_SIZE(pll_video_bypass_sel)); + + clk_set_parent(clks[IMX7D_PLL_ARM_MAIN_BYPASS], clks[IMX7D_PLL_ARM_MAIN]); + clk_set_parent(clks[IMX7D_PLL_DRAM_MAIN_BYPASS], clks[IMX7D_PLL_DRAM_MAIN]); + clk_set_parent(clks[IMX7D_PLL_SYS_MAIN_BYPASS], clks[IMX7D_PLL_SYS_MAIN]); + clk_set_parent(clks[IMX7D_PLL_ENET_MAIN_BYPASS], clks[IMX7D_PLL_ENET_MAIN]); + clk_set_parent(clks[IMX7D_PLL_AUDIO_MAIN_BYPASS], clks[IMX7D_PLL_AUDIO_MAIN]); + clk_set_parent(clks[IMX7D_PLL_VIDEO_MAIN_BYPASS], clks[IMX7D_PLL_VIDEO_MAIN]); + + clks[IMX7D_PLL_ARM_MAIN_CLK] = imx_clk_gate("pll_arm_main_clk", "pll_arm_main_bypass", base + 0x60, 13); + clks[IMX7D_PLL_DRAM_MAIN_CLK] = imx_clk_gate("pll_dram_main_clk", "pll_dram_main_bypass", base + 0x70, 13); + clks[IMX7D_PLL_SYS_MAIN_CLK] = imx_clk_gate("pll_sys_main_clk", "pll_sys_main_bypass", base + 0xb0, 13); + clks[IMX7D_PLL_AUDIO_MAIN_CLK] = imx_clk_gate("pll_audio_main_clk", "pll_audio_main_bypass", base + 0xf0, 13); + clks[IMX7D_PLL_VIDEO_MAIN_CLK] = imx_clk_gate("pll_video_main_clk", "pll_video_main_bypass", base + 0x130, 13); + + clks[IMX7D_PLL_SYS_PFD0_392M_CLK] = imx_clk_pfd("pll_sys_pfd0_392m_clk", "pll_sys_main_clk", base + 0xc0, 0); + clks[IMX7D_PLL_SYS_PFD1_332M_CLK] = imx_clk_pfd("pll_sys_pfd1_332m_clk", "pll_sys_main_clk", base + 0xc0, 1); + clks[IMX7D_PLL_SYS_PFD2_270M_CLK] = imx_clk_pfd("pll_sys_pfd2_270m_clk", "pll_sys_main_clk", base + 0xc0, 2); + + clks[IMX7D_PLL_SYS_PFD3_CLK] = imx_clk_pfd("pll_sys_pfd3_clk", "pll_sys_main_clk", base + 0xc0, 3); + clks[IMX7D_PLL_SYS_PFD4_CLK] = imx_clk_pfd("pll_sys_pfd4_clk", "pll_sys_main_clk", base + 0xd0, 0); + clks[IMX7D_PLL_SYS_PFD5_CLK] = imx_clk_pfd("pll_sys_pfd5_clk", "pll_sys_main_clk", base + 0xd0, 1); + clks[IMX7D_PLL_SYS_PFD6_CLK] = imx_clk_pfd("pll_sys_pfd6_clk", "pll_sys_main_clk", base + 0xd0, 2); + clks[IMX7D_PLL_SYS_PFD7_CLK] = imx_clk_pfd("pll_sys_pfd7_clk", "pll_sys_main_clk", base + 0xd0, 3); + + clks[IMX7D_PLL_SYS_MAIN_480M] = imx_clk_fixed_factor("pll_sys_main_480m", "pll_sys_main_clk", 1, 1); + clks[IMX7D_PLL_SYS_MAIN_240M] = imx_clk_fixed_factor("pll_sys_main_240m", "pll_sys_main_clk", 1, 2); + clks[IMX7D_PLL_SYS_MAIN_120M] = imx_clk_fixed_factor("pll_sys_main_120m", "pll_sys_main_clk", 1, 4); + clks[IMX7D_PLL_DRAM_MAIN_533M] = imx_clk_fixed_factor("pll_dram_533m", "pll_dram_main_clk", 1, 2); + + clks[IMX7D_PLL_SYS_MAIN_480M_CLK] = imx_clk_gate_dis("pll_sys_main_480m_clk", "pll_sys_main_480m", base + 0xb0, 4); + clks[IMX7D_PLL_SYS_MAIN_240M_CLK] = imx_clk_gate_dis("pll_sys_main_240m_clk", "pll_sys_main_240m", base + 0xb0, 5); + clks[IMX7D_PLL_SYS_MAIN_120M_CLK] = imx_clk_gate_dis("pll_sys_main_120m_clk", "pll_sys_main_120m", base + 0xb0, 6); + clks[IMX7D_PLL_DRAM_MAIN_533M_CLK] = imx_clk_gate("pll_dram_533m_clk", "pll_dram_533m", base + 0x70, 12); + + clks[IMX7D_PLL_SYS_PFD0_196M] = imx_clk_fixed_factor("pll_sys_pfd0_196m", "pll_sys_pfd0_392m_clk", 1, 2); + clks[IMX7D_PLL_SYS_PFD1_166M] = imx_clk_fixed_factor("pll_sys_pfd1_166m", "pll_sys_pfd1_332m_clk", 1, 2); + clks[IMX7D_PLL_SYS_PFD2_135M] = imx_clk_fixed_factor("pll_sys_pfd2_135m", "pll_sys_pfd2_270m_clk", 1, 2); + + clks[IMX7D_PLL_SYS_PFD0_196M_CLK] = imx_clk_gate_dis("pll_sys_pfd0_196m_clk", "pll_sys_pfd0_196m", base + 0xb0, 26); + clks[IMX7D_PLL_SYS_PFD1_166M_CLK] = imx_clk_gate_dis("pll_sys_pfd1_166m_clk", "pll_sys_pfd1_166m", base + 0xb0, 27); + clks[IMX7D_PLL_SYS_PFD2_135M_CLK] = imx_clk_gate_dis("pll_sys_pfd2_135m_clk", "pll_sys_pfd2_135m", base + 0xb0, 28); + + clks[IMX7D_PLL_ENET_MAIN_CLK] = imx_clk_fixed_factor("pll_enet_main_clk", "pll_enet_main_bypass", 1, 1); + clks[IMX7D_PLL_ENET_MAIN_500M] = imx_clk_fixed_factor("pll_enet_500m", "pll_enet_main_clk", 1, 2); + clks[IMX7D_PLL_ENET_MAIN_250M] = imx_clk_fixed_factor("pll_enet_250m", "pll_enet_main_clk", 1, 4); + clks[IMX7D_PLL_ENET_MAIN_125M] = imx_clk_fixed_factor("pll_enet_125m", "pll_enet_main_clk", 1, 8); + clks[IMX7D_PLL_ENET_MAIN_100M] = imx_clk_fixed_factor("pll_enet_100m", "pll_enet_main_clk", 1, 10); + clks[IMX7D_PLL_ENET_MAIN_50M] = imx_clk_fixed_factor("pll_enet_50m", "pll_enet_main_clk", 1, 20); + clks[IMX7D_PLL_ENET_MAIN_40M] = imx_clk_fixed_factor("pll_enet_40m", "pll_enet_main_clk", 1, 25); + clks[IMX7D_PLL_ENET_MAIN_25M] = imx_clk_fixed_factor("pll_enet_25m", "pll_enet_main_clk", 1, 40); + + clks[IMX7D_PLL_ENET_MAIN_500M_CLK] = imx_clk_gate("pll_enet_500m_clk", "pll_enet_500m", base + 0xe0, 12); + clks[IMX7D_PLL_ENET_MAIN_250M_CLK] = imx_clk_gate("pll_enet_250m_clk", "pll_enet_250m", base + 0xe0, 11); + clks[IMX7D_PLL_ENET_MAIN_125M_CLK] = imx_clk_gate("pll_enet_125m_clk", "pll_enet_125m", base + 0xe0, 10); + clks[IMX7D_PLL_ENET_MAIN_100M_CLK] = imx_clk_gate("pll_enet_100m_clk", "pll_enet_100m", base + 0xe0, 9); + clks[IMX7D_PLL_ENET_MAIN_50M_CLK] = imx_clk_gate("pll_enet_50m_clk", "pll_enet_50m", base + 0xe0, 8); + clks[IMX7D_PLL_ENET_MAIN_40M_CLK] = imx_clk_gate("pll_enet_40m_clk", "pll_enet_40m", base + 0xe0, 7); + clks[IMX7D_PLL_ENET_MAIN_25M_CLK] = imx_clk_gate("pll_enet_25m_clk", "pll_enet_25m", base + 0xe0, 6); + + clks[IMX7D_LVDS1_OUT_SEL] = imx_clk_mux("lvds1_sel", base + 0x170, 0, 5, lvds1_sel, ARRAY_SIZE(lvds1_sel)); + clks[IMX7D_LVDS1_OUT_CLK] = imx_clk_gate_exclusive("lvds1_out", "lvds1_sel", base + 0x170, 5, BIT(6)); + + base = ccm_base; + + clks[IMX7D_ARM_A7_ROOT_SRC] = imx_clk_mux2("arm_a7_src", base + 0x8000, 24, 3, arm_a7_sel, ARRAY_SIZE(arm_a7_sel)); + clks[IMX7D_ARM_M4_ROOT_SRC] = imx_clk_mux2("arm_m4_src", base + 0x8080, 24, 3, arm_m4_sel, ARRAY_SIZE(arm_m4_sel)); + clks[IMX7D_ARM_M0_ROOT_SRC] = imx_clk_mux2("arm_m0_src", base + 0x8100, 24, 3, arm_m0_sel, ARRAY_SIZE(arm_m0_sel)); + clks[IMX7D_MAIN_AXI_ROOT_SRC] = imx_clk_mux2("axi_src", base + 0x8800, 24, 3, axi_sel, ARRAY_SIZE(axi_sel)); + clks[IMX7D_DISP_AXI_ROOT_SRC] = imx_clk_mux2("disp_axi_src", base + 0x8880, 24, 3, disp_axi_sel, ARRAY_SIZE(disp_axi_sel)); + clks[IMX7D_ENET_AXI_ROOT_SRC] = imx_clk_mux2("enet_axi_src", base + 0x8900, 24, 3, enet_axi_sel, ARRAY_SIZE(enet_axi_sel)); + clks[IMX7D_NAND_USDHC_BUS_ROOT_SRC] = imx_clk_mux2("nand_usdhc_src", base + 0x8980, 24, 3, nand_usdhc_bus_sel, ARRAY_SIZE(nand_usdhc_bus_sel)); + clks[IMX7D_AHB_CHANNEL_ROOT_SRC] = imx_clk_mux2("ahb_src", base + 0x9000, 24, 3, ahb_channel_sel, ARRAY_SIZE(ahb_channel_sel)); + clks[IMX7D_DRAM_PHYM_ROOT_SRC] = imx_clk_mux2("dram_phym_src", base + 0x9800, 24, 1, dram_phym_sel, ARRAY_SIZE(dram_phym_sel)); + clks[IMX7D_DRAM_ROOT_SRC] = imx_clk_mux2("dram_src", base + 0x9880, 24, 1, dram_sel, ARRAY_SIZE(dram_sel)); + clks[IMX7D_DRAM_PHYM_ALT_ROOT_SRC] = imx_clk_mux2("dram_phym_alt_src", base + 0xa000, 24, 3, dram_phym_alt_sel, ARRAY_SIZE(dram_phym_alt_sel)); + clks[IMX7D_DRAM_ALT_ROOT_SRC] = imx_clk_mux2("dram_alt_src", base + 0xa080, 24, 3, dram_alt_sel, ARRAY_SIZE(dram_alt_sel)); + clks[IMX7D_USB_HSIC_ROOT_SRC] = imx_clk_mux2("usb_hsic_src", base + 0xa100, 24, 3, usb_hsic_sel, ARRAY_SIZE(usb_hsic_sel)); + clks[IMX7D_PCIE_CTRL_ROOT_SRC] = imx_clk_mux2("pcie_ctrl_src", base + 0xa180, 24, 3, pcie_ctrl_sel, ARRAY_SIZE(pcie_ctrl_sel)); + clks[IMX7D_PCIE_PHY_ROOT_SRC] = imx_clk_mux2("pcie_phy_src", base + 0xa200, 24, 3, pcie_phy_sel, ARRAY_SIZE(pcie_phy_sel)); + clks[IMX7D_EPDC_PIXEL_ROOT_SRC] = imx_clk_mux2("epdc_pixel_src", base + 0xa280, 24, 3, epdc_pixel_sel, ARRAY_SIZE(epdc_pixel_sel)); + clks[IMX7D_LCDIF_PIXEL_ROOT_SRC] = imx_clk_mux2("lcdif_pixel_src", base + 0xa300, 24, 3, lcdif_pixel_sel, ARRAY_SIZE(lcdif_pixel_sel)); + clks[IMX7D_MIPI_DSI_ROOT_SRC] = imx_clk_mux2("mipi_dsi_src", base + 0xa380, 24, 3, mipi_dsi_sel, ARRAY_SIZE(mipi_dsi_sel)); + clks[IMX7D_MIPI_CSI_ROOT_SRC] = imx_clk_mux2("mipi_csi_src", base + 0xa400, 24, 3, mipi_csi_sel, ARRAY_SIZE(mipi_csi_sel)); + clks[IMX7D_MIPI_DPHY_ROOT_SRC] = imx_clk_mux2("mipi_dphy_src", base + 0xa480, 24, 3, mipi_dphy_sel, ARRAY_SIZE(mipi_dphy_sel)); + clks[IMX7D_SAI1_ROOT_SRC] = imx_clk_mux2("sai1_src", base + 0xa500, 24, 3, sai1_sel, ARRAY_SIZE(sai1_sel)); + clks[IMX7D_SAI2_ROOT_SRC] = imx_clk_mux2("sai2_src", base + 0xa580, 24, 3, sai2_sel, ARRAY_SIZE(sai2_sel)); + clks[IMX7D_SAI3_ROOT_SRC] = imx_clk_mux2("sai3_src", base + 0xa600, 24, 3, sai3_sel, ARRAY_SIZE(sai3_sel)); + clks[IMX7D_SPDIF_ROOT_SRC] = imx_clk_mux2("spdif_src", base + 0xa680, 24, 3, spdif_sel, ARRAY_SIZE(spdif_sel)); + clks[IMX7D_ENET1_REF_ROOT_SRC] = imx_clk_mux2("enet1_ref_src", base + 0xa700, 24, 3, enet1_ref_sel, ARRAY_SIZE(enet1_ref_sel)); + clks[IMX7D_ENET1_TIME_ROOT_SRC] = imx_clk_mux2("enet1_time_src", base + 0xa780, 24, 3, enet1_time_sel, ARRAY_SIZE(enet1_time_sel)); + clks[IMX7D_ENET2_REF_ROOT_SRC] = imx_clk_mux2("enet2_ref_src", base + 0xa800, 24, 3, enet2_ref_sel, ARRAY_SIZE(enet2_ref_sel)); + clks[IMX7D_ENET2_TIME_ROOT_SRC] = imx_clk_mux2("enet2_time_src", base + 0xa880, 24, 3, enet2_time_sel, ARRAY_SIZE(enet2_time_sel)); + clks[IMX7D_ENET_PHY_REF_ROOT_SRC] = imx_clk_mux2("enet_phy_ref_src", base + 0xa900, 24, 3, enet_phy_ref_sel, ARRAY_SIZE(enet_phy_ref_sel)); + clks[IMX7D_EIM_ROOT_SRC] = imx_clk_mux2("eim_src", base + 0xa980, 24, 3, eim_sel, ARRAY_SIZE(eim_sel)); + clks[IMX7D_NAND_ROOT_SRC] = imx_clk_mux2("nand_src", base + 0xaa00, 24, 3, nand_sel, ARRAY_SIZE(nand_sel)); + clks[IMX7D_QSPI_ROOT_SRC] = imx_clk_mux2("qspi_src", base + 0xaa80, 24, 3, qspi_sel, ARRAY_SIZE(qspi_sel)); + clks[IMX7D_USDHC1_ROOT_SRC] = imx_clk_mux2("usdhc1_src", base + 0xab00, 24, 3, usdhc1_sel, ARRAY_SIZE(usdhc1_sel)); + clks[IMX7D_USDHC2_ROOT_SRC] = imx_clk_mux2("usdhc2_src", base + 0xab80, 24, 3, usdhc2_sel, ARRAY_SIZE(usdhc2_sel)); + clks[IMX7D_USDHC3_ROOT_SRC] = imx_clk_mux2("usdhc3_src", base + 0xac00, 24, 3, usdhc3_sel, ARRAY_SIZE(usdhc3_sel)); + clks[IMX7D_CAN1_ROOT_SRC] = imx_clk_mux2("can1_src", base + 0xac80, 24, 3, can1_sel, ARRAY_SIZE(can1_sel)); + clks[IMX7D_CAN2_ROOT_SRC] = imx_clk_mux2("can2_src", base + 0xad00, 24, 3, can2_sel, ARRAY_SIZE(can2_sel)); + clks[IMX7D_I2C1_ROOT_SRC] = imx_clk_mux2("i2c1_src", base + 0xad80, 24, 3, i2c1_sel, ARRAY_SIZE(i2c1_sel)); + clks[IMX7D_I2C2_ROOT_SRC] = imx_clk_mux2("i2c2_src", base + 0xae00, 24, 3, i2c2_sel, ARRAY_SIZE(i2c2_sel)); + clks[IMX7D_I2C3_ROOT_SRC] = imx_clk_mux2("i2c3_src", base + 0xae80, 24, 3, i2c3_sel, ARRAY_SIZE(i2c3_sel)); + clks[IMX7D_I2C4_ROOT_SRC] = imx_clk_mux2("i2c4_src", base + 0xaf00, 24, 3, i2c4_sel, ARRAY_SIZE(i2c4_sel)); + clks[IMX7D_UART1_ROOT_SRC] = imx_clk_mux2("uart1_src", base + 0xaf80, 24, 3, uart1_sel, ARRAY_SIZE(uart1_sel)); + clks[IMX7D_UART2_ROOT_SRC] = imx_clk_mux2("uart2_src", base + 0xb000, 24, 3, uart2_sel, ARRAY_SIZE(uart2_sel)); + clks[IMX7D_UART3_ROOT_SRC] = imx_clk_mux2("uart3_src", base + 0xb080, 24, 3, uart3_sel, ARRAY_SIZE(uart3_sel)); + clks[IMX7D_UART4_ROOT_SRC] = imx_clk_mux2("uart4_src", base + 0xb100, 24, 3, uart4_sel, ARRAY_SIZE(uart4_sel)); + clks[IMX7D_UART5_ROOT_SRC] = imx_clk_mux2("uart5_src", base + 0xb180, 24, 3, uart5_sel, ARRAY_SIZE(uart5_sel)); + clks[IMX7D_UART6_ROOT_SRC] = imx_clk_mux2("uart6_src", base + 0xb200, 24, 3, uart6_sel, ARRAY_SIZE(uart6_sel)); + clks[IMX7D_UART7_ROOT_SRC] = imx_clk_mux2("uart7_src", base + 0xb280, 24, 3, uart7_sel, ARRAY_SIZE(uart7_sel)); + clks[IMX7D_ECSPI1_ROOT_SRC] = imx_clk_mux2("ecspi1_src", base + 0xb300, 24, 3, ecspi1_sel, ARRAY_SIZE(ecspi1_sel)); + clks[IMX7D_ECSPI2_ROOT_SRC] = imx_clk_mux2("ecspi2_src", base + 0xb380, 24, 3, ecspi2_sel, ARRAY_SIZE(ecspi2_sel)); + clks[IMX7D_ECSPI3_ROOT_SRC] = imx_clk_mux2("ecspi3_src", base + 0xb400, 24, 3, ecspi3_sel, ARRAY_SIZE(ecspi3_sel)); + clks[IMX7D_ECSPI4_ROOT_SRC] = imx_clk_mux2("ecspi4_src", base + 0xb480, 24, 3, ecspi4_sel, ARRAY_SIZE(ecspi4_sel)); + clks[IMX7D_PWM1_ROOT_SRC] = imx_clk_mux2("pwm1_src", base + 0xb500, 24, 3, pwm1_sel, ARRAY_SIZE(pwm1_sel)); + clks[IMX7D_PWM2_ROOT_SRC] = imx_clk_mux2("pwm2_src", base + 0xb580, 24, 3, pwm2_sel, ARRAY_SIZE(pwm2_sel)); + clks[IMX7D_PWM3_ROOT_SRC] = imx_clk_mux2("pwm3_src", base + 0xb600, 24, 3, pwm3_sel, ARRAY_SIZE(pwm3_sel)); + clks[IMX7D_PWM4_ROOT_SRC] = imx_clk_mux2("pwm4_src", base + 0xb680, 24, 3, pwm4_sel, ARRAY_SIZE(pwm4_sel)); + clks[IMX7D_FLEXTIMER1_ROOT_SRC] = imx_clk_mux2("flextimer1_src", base + 0xb700, 24, 3, flextimer1_sel, ARRAY_SIZE(flextimer1_sel)); + clks[IMX7D_FLEXTIMER2_ROOT_SRC] = imx_clk_mux2("flextimer2_src", base + 0xb780, 24, 3, flextimer2_sel, ARRAY_SIZE(flextimer2_sel)); + clks[IMX7D_SIM1_ROOT_SRC] = imx_clk_mux2("sim1_src", base + 0xb800, 24, 3, sim1_sel, ARRAY_SIZE(sim1_sel)); + clks[IMX7D_SIM2_ROOT_SRC] = imx_clk_mux2("sim2_src", base + 0xb880, 24, 3, sim2_sel, ARRAY_SIZE(sim2_sel)); + clks[IMX7D_GPT1_ROOT_SRC] = imx_clk_mux2("gpt1_src", base + 0xb900, 24, 3, gpt1_sel, ARRAY_SIZE(gpt1_sel)); + clks[IMX7D_GPT2_ROOT_SRC] = imx_clk_mux2("gpt2_src", base + 0xb980, 24, 3, gpt2_sel, ARRAY_SIZE(gpt2_sel)); + clks[IMX7D_GPT3_ROOT_SRC] = imx_clk_mux2("gpt3_src", base + 0xba00, 24, 3, gpt3_sel, ARRAY_SIZE(gpt3_sel)); + clks[IMX7D_GPT4_ROOT_SRC] = imx_clk_mux2("gpt4_src", base + 0xba80, 24, 3, gpt4_sel, ARRAY_SIZE(gpt4_sel)); + clks[IMX7D_TRACE_ROOT_SRC] = imx_clk_mux2("trace_src", base + 0xbb00, 24, 3, trace_sel, ARRAY_SIZE(trace_sel)); + clks[IMX7D_WDOG_ROOT_SRC] = imx_clk_mux2("wdog_src", base + 0xbb80, 24, 3, wdog_sel, ARRAY_SIZE(wdog_sel)); + clks[IMX7D_CSI_MCLK_ROOT_SRC] = imx_clk_mux2("csi_mclk_src", base + 0xbc00, 24, 3, csi_mclk_sel, ARRAY_SIZE(csi_mclk_sel)); + clks[IMX7D_AUDIO_MCLK_ROOT_SRC] = imx_clk_mux2("audio_mclk_src", base + 0xbc80, 24, 3, audio_mclk_sel, ARRAY_SIZE(audio_mclk_sel)); + clks[IMX7D_WRCLK_ROOT_SRC] = imx_clk_mux2("wrclk_src", base + 0xbd00, 24, 3, wrclk_sel, ARRAY_SIZE(wrclk_sel)); + clks[IMX7D_CLKO1_ROOT_SRC] = imx_clk_mux2("clko1_src", base + 0xbd80, 24, 3, clko1_sel, ARRAY_SIZE(clko1_sel)); + clks[IMX7D_CLKO2_ROOT_SRC] = imx_clk_mux2("clko2_src", base + 0xbe00, 24, 3, clko2_sel, ARRAY_SIZE(clko2_sel)); + + clks[IMX7D_ARM_A7_ROOT_CG] = imx_clk_gate3("arm_a7_cg", "arm_a7_src", base + 0x8000, 28); + clks[IMX7D_ARM_M4_ROOT_CG] = imx_clk_gate3("arm_m4_cg", "arm_m4_src", base + 0x8080, 28); + clks[IMX7D_ARM_M0_ROOT_CG] = imx_clk_gate3("arm_m0_cg", "arm_m0_src", base + 0x8100, 28); + clks[IMX7D_MAIN_AXI_ROOT_CG] = imx_clk_gate3("axi_cg", "axi_src", base + 0x8800, 28); + clks[IMX7D_DISP_AXI_ROOT_CG] = imx_clk_gate3("disp_axi_cg", "disp_axi_src", base + 0x8880, 28); + clks[IMX7D_ENET_AXI_ROOT_CG] = imx_clk_gate3("enet_axi_cg", "enet_axi_src", base + 0x8900, 28); + clks[IMX7D_NAND_USDHC_BUS_ROOT_CG] = imx_clk_gate3("nand_usdhc_cg", "nand_usdhc_src", base + 0x8980, 28); + clks[IMX7D_AHB_CHANNEL_ROOT_CG] = imx_clk_gate3("ahb_cg", "ahb_src", base + 0x9000, 28); + clks[IMX7D_DRAM_PHYM_ROOT_CG] = imx_clk_gate3("dram_phym_cg", "dram_phym_src", base + 0x9800, 28); + clks[IMX7D_DRAM_ROOT_CG] = imx_clk_gate3("dram_cg", "dram_src", base + 0x9880, 28); + clks[IMX7D_DRAM_PHYM_ALT_ROOT_CG] = imx_clk_gate3("dram_phym_alt_cg", "dram_phym_alt_src", base + 0xa000, 28); + clks[IMX7D_DRAM_ALT_ROOT_CG] = imx_clk_gate3("dram_alt_cg", "dram_alt_src", base + 0xa080, 28); + clks[IMX7D_USB_HSIC_ROOT_CG] = imx_clk_gate3("usb_hsic_cg", "usb_hsic_src", base + 0xa100, 28); + clks[IMX7D_PCIE_CTRL_ROOT_CG] = imx_clk_gate3("pcie_ctrl_cg", "pcie_ctrl_src", base + 0xa180, 28); + clks[IMX7D_PCIE_PHY_ROOT_CG] = imx_clk_gate3("pcie_phy_cg", "pcie_phy_src", base + 0xa200, 28); + clks[IMX7D_EPDC_PIXEL_ROOT_CG] = imx_clk_gate3("epdc_pixel_cg", "epdc_pixel_src", base + 0xa280, 28); + clks[IMX7D_LCDIF_PIXEL_ROOT_CG] = imx_clk_gate3("lcdif_pixel_cg", "lcdif_pixel_src", base + 0xa300, 28); + clks[IMX7D_MIPI_DSI_ROOT_CG] = imx_clk_gate3("mipi_dsi_cg", "mipi_dsi_src", base + 0xa380, 28); + clks[IMX7D_MIPI_CSI_ROOT_CG] = imx_clk_gate3("mipi_csi_cg", "mipi_csi_src", base + 0xa400, 28); + clks[IMX7D_MIPI_DPHY_ROOT_CG] = imx_clk_gate3("mipi_dphy_cg", "mipi_dphy_src", base + 0xa480, 28); + clks[IMX7D_SAI1_ROOT_CG] = imx_clk_gate3("sai1_cg", "sai1_src", base + 0xa500, 28); + clks[IMX7D_SAI2_ROOT_CG] = imx_clk_gate3("sai2_cg", "sai2_src", base + 0xa580, 28); + clks[IMX7D_SAI3_ROOT_CG] = imx_clk_gate3("sai3_cg", "sai3_src", base + 0xa600, 28); + clks[IMX7D_SPDIF_ROOT_CG] = imx_clk_gate3("spdif_cg", "spdif_src", base + 0xa680, 28); + clks[IMX7D_ENET1_REF_ROOT_CG] = imx_clk_gate3("enet1_ref_cg", "enet1_ref_src", base + 0xa700, 28); + clks[IMX7D_ENET1_TIME_ROOT_CG] = imx_clk_gate3("enet1_time_cg", "enet1_time_src", base + 0xa780, 28); + clks[IMX7D_ENET2_REF_ROOT_CG] = imx_clk_gate3("enet2_ref_cg", "enet2_ref_src", base + 0xa800, 28); + clks[IMX7D_ENET2_TIME_ROOT_CG] = imx_clk_gate3("enet2_time_cg", "enet2_time_src", base + 0xa880, 28); + clks[IMX7D_ENET_PHY_REF_ROOT_CG] = imx_clk_gate3("enet_phy_ref_cg", "enet_phy_ref_src", base + 0xa900, 28); + clks[IMX7D_EIM_ROOT_CG] = imx_clk_gate3("eim_cg", "eim_src", base + 0xa980, 28); + clks[IMX7D_NAND_ROOT_CG] = imx_clk_gate3("nand_cg", "nand_src", base + 0xaa00, 28); + clks[IMX7D_QSPI_ROOT_CG] = imx_clk_gate3("qspi_cg", "qspi_src", base + 0xaa80, 28); + clks[IMX7D_USDHC1_ROOT_CG] = imx_clk_gate3("usdhc1_cg", "usdhc1_src", base + 0xab00, 28); + clks[IMX7D_USDHC2_ROOT_CG] = imx_clk_gate3("usdhc2_cg", "usdhc2_src", base + 0xab80, 28); + clks[IMX7D_USDHC3_ROOT_CG] = imx_clk_gate3("usdhc3_cg", "usdhc3_src", base + 0xac00, 28); + clks[IMX7D_CAN1_ROOT_CG] = imx_clk_gate3("can1_cg", "can1_src", base + 0xac80, 28); + clks[IMX7D_CAN2_ROOT_CG] = imx_clk_gate3("can2_cg", "can2_src", base + 0xad00, 28); + clks[IMX7D_I2C1_ROOT_CG] = imx_clk_gate3("i2c1_cg", "i2c1_src", base + 0xad80, 28); + clks[IMX7D_I2C2_ROOT_CG] = imx_clk_gate3("i2c2_cg", "i2c2_src", base + 0xae00, 28); + clks[IMX7D_I2C3_ROOT_CG] = imx_clk_gate3("i2c3_cg", "i2c3_src", base + 0xae80, 28); + clks[IMX7D_I2C4_ROOT_CG] = imx_clk_gate3("i2c4_cg", "i2c4_src", base + 0xaf00, 28); + clks[IMX7D_UART1_ROOT_CG] = imx_clk_gate3("uart1_cg", "uart1_src", base + 0xaf80, 28); + clks[IMX7D_UART2_ROOT_CG] = imx_clk_gate3("uart2_cg", "uart2_src", base + 0xb000, 28); + clks[IMX7D_UART3_ROOT_CG] = imx_clk_gate3("uart3_cg", "uart3_src", base + 0xb080, 28); + clks[IMX7D_UART4_ROOT_CG] = imx_clk_gate3("uart4_cg", "uart4_src", base + 0xb100, 28); + clks[IMX7D_UART5_ROOT_CG] = imx_clk_gate3("uart5_cg", "uart5_src", base + 0xb180, 28); + clks[IMX7D_UART6_ROOT_CG] = imx_clk_gate3("uart6_cg", "uart6_src", base + 0xb200, 28); + clks[IMX7D_UART7_ROOT_CG] = imx_clk_gate3("uart7_cg", "uart7_src", base + 0xb280, 28); + clks[IMX7D_ECSPI1_ROOT_CG] = imx_clk_gate3("ecspi1_cg", "ecspi1_src", base + 0xb300, 28); + clks[IMX7D_ECSPI2_ROOT_CG] = imx_clk_gate3("ecspi2_cg", "ecspi2_src", base + 0xb380, 28); + clks[IMX7D_ECSPI3_ROOT_CG] = imx_clk_gate3("ecspi3_cg", "ecspi3_src", base + 0xb400, 28); + clks[IMX7D_ECSPI4_ROOT_CG] = imx_clk_gate3("ecspi4_cg", "ecspi4_src", base + 0xb480, 28); + clks[IMX7D_PWM1_ROOT_CG] = imx_clk_gate3("pwm1_cg", "pwm1_src", base + 0xb500, 28); + clks[IMX7D_PWM2_ROOT_CG] = imx_clk_gate3("pwm2_cg", "pwm2_src", base + 0xb580, 28); + clks[IMX7D_PWM3_ROOT_CG] = imx_clk_gate3("pwm3_cg", "pwm3_src", base + 0xb600, 28); + clks[IMX7D_PWM4_ROOT_CG] = imx_clk_gate3("pwm4_cg", "pwm4_src", base + 0xb680, 28); + clks[IMX7D_FLEXTIMER1_ROOT_CG] = imx_clk_gate3("flextimer1_cg", "flextimer1_src", base + 0xb700, 28); + clks[IMX7D_FLEXTIMER2_ROOT_CG] = imx_clk_gate3("flextimer2_cg", "flextimer2_src", base + 0xb780, 28); + clks[IMX7D_SIM1_ROOT_CG] = imx_clk_gate3("sim1_cg", "sim1_src", base + 0xb800, 28); + clks[IMX7D_SIM2_ROOT_CG] = imx_clk_gate3("sim2_cg", "sim2_src", base + 0xb880, 28); + clks[IMX7D_GPT1_ROOT_CG] = imx_clk_gate3("gpt1_cg", "gpt1_src", base + 0xb900, 28); + clks[IMX7D_GPT2_ROOT_CG] = imx_clk_gate3("gpt2_cg", "gpt2_src", base + 0xb980, 28); + clks[IMX7D_GPT3_ROOT_CG] = imx_clk_gate3("gpt3_cg", "gpt3_src", base + 0xbA00, 28); + clks[IMX7D_GPT4_ROOT_CG] = imx_clk_gate3("gpt4_cg", "gpt4_src", base + 0xbA80, 28); + clks[IMX7D_TRACE_ROOT_CG] = imx_clk_gate3("trace_cg", "trace_src", base + 0xbb00, 28); + clks[IMX7D_WDOG_ROOT_CG] = imx_clk_gate3("wdog_cg", "wdog_src", base + 0xbb80, 28); + clks[IMX7D_CSI_MCLK_ROOT_CG] = imx_clk_gate3("csi_mclk_cg", "csi_mclk_src", base + 0xbc00, 28); + clks[IMX7D_AUDIO_MCLK_ROOT_CG] = imx_clk_gate3("audio_mclk_cg", "audio_mclk_src", base + 0xbc80, 28); + clks[IMX7D_WRCLK_ROOT_CG] = imx_clk_gate3("wrclk_cg", "wrclk_src", base + 0xbd00, 28); + clks[IMX7D_CLKO1_ROOT_CG] = imx_clk_gate3("clko1_cg", "clko1_src", base + 0xbd80, 28); + clks[IMX7D_CLKO2_ROOT_CG] = imx_clk_gate3("clko2_cg", "clko2_src", base + 0xbe00, 28); + + clks[IMX7D_MAIN_AXI_ROOT_PRE_DIV] = imx_clk_divider2("axi_pre_div", "axi_cg", base + 0x8800, 16, 3); + clks[IMX7D_DISP_AXI_ROOT_PRE_DIV] = imx_clk_divider2("disp_axi_pre_div", "disp_axi_cg", base + 0x8880, 16, 3); + clks[IMX7D_ENET_AXI_ROOT_PRE_DIV] = imx_clk_divider2("enet_axi_pre_div", "enet_axi_cg", base + 0x8900, 16, 3); + clks[IMX7D_NAND_USDHC_BUS_ROOT_PRE_DIV] = imx_clk_divider2("nand_usdhc_pre_div", "nand_usdhc_cg", base + 0x8980, 16, 3); + clks[IMX7D_AHB_CHANNEL_ROOT_PRE_DIV] = imx_clk_divider2("ahb_pre_div", "ahb_cg", base + 0x9000, 16, 3); + clks[IMX7D_DRAM_PHYM_ALT_ROOT_PRE_DIV] = imx_clk_divider2("dram_phym_alt_pre_div", "dram_phym_alt_cg", base + 0xa000, 16, 3); + clks[IMX7D_DRAM_ALT_ROOT_PRE_DIV] = imx_clk_divider2("dram_alt_pre_div", "dram_alt_cg", base + 0xa080, 16, 3); + clks[IMX7D_USB_HSIC_ROOT_PRE_DIV] = imx_clk_divider2("usb_hsic_pre_div", "usb_hsic_cg", base + 0xa100, 16, 3); + clks[IMX7D_PCIE_CTRL_ROOT_PRE_DIV] = imx_clk_divider2("pcie_ctrl_pre_div", "pcie_ctrl_cg", base + 0xa180, 16, 3); + clks[IMX7D_PCIE_PHY_ROOT_PRE_DIV] = imx_clk_divider2("pcie_phy_pre_div", "pcie_phy_cg", base + 0xa200, 16, 3); + clks[IMX7D_EPDC_PIXEL_ROOT_PRE_DIV] = imx_clk_divider2("epdc_pixel_pre_div", "epdc_pixel_cg", base + 0xa280, 16, 3); + clks[IMX7D_LCDIF_PIXEL_ROOT_PRE_DIV] = imx_clk_divider2("lcdif_pixel_pre_div", "lcdif_pixel_cg", base + 0xa300, 16, 3); + clks[IMX7D_MIPI_DSI_ROOT_PRE_DIV] = imx_clk_divider2("mipi_dsi_pre_div", "mipi_dsi_cg", base + 0xa380, 16, 3); + clks[IMX7D_MIPI_CSI_ROOT_PRE_DIV] = imx_clk_divider2("mipi_csi_pre_div", "mipi_csi_cg", base + 0xa400, 16, 3); + clks[IMX7D_MIPI_DPHY_ROOT_PRE_DIV] = imx_clk_divider2("mipi_dphy_pre_div", "mipi_dphy_cg", base + 0xa480, 16, 3); + clks[IMX7D_SAI1_ROOT_PRE_DIV] = imx_clk_divider2("sai1_pre_div", "sai1_cg", base + 0xa500, 16, 3); + clks[IMX7D_SAI2_ROOT_PRE_DIV] = imx_clk_divider2("sai2_pre_div", "sai2_cg", base + 0xa580, 16, 3); + clks[IMX7D_SAI3_ROOT_PRE_DIV] = imx_clk_divider2("sai3_pre_div", "sai3_cg", base + 0xa600, 16, 3); + clks[IMX7D_SPDIF_ROOT_PRE_DIV] = imx_clk_divider2("spdif_pre_div", "spdif_cg", base + 0xa680, 16, 3); + clks[IMX7D_ENET1_REF_ROOT_PRE_DIV] = imx_clk_divider2("enet1_ref_pre_div", "enet1_ref_cg", base + 0xa700, 16, 3); + clks[IMX7D_ENET1_TIME_ROOT_PRE_DIV] = imx_clk_divider2("enet1_time_pre_div", "enet1_time_cg", base + 0xa780, 16, 3); + clks[IMX7D_ENET2_REF_ROOT_PRE_DIV] = imx_clk_divider2("enet2_ref_pre_div", "enet2_ref_cg", base + 0xa800, 16, 3); + clks[IMX7D_ENET2_TIME_ROOT_PRE_DIV] = imx_clk_divider2("enet2_time_pre_div", "enet2_time_cg", base + 0xa880, 16, 3); + clks[IMX7D_ENET_PHY_REF_ROOT_PRE_DIV] = imx_clk_divider2("enet_phy_ref_pre_div", "enet_phy_ref_cg", base + 0xa900, 16, 3); + clks[IMX7D_EIM_ROOT_PRE_DIV] = imx_clk_divider2("eim_pre_div", "eim_cg", base + 0xa980, 16, 3); + clks[IMX7D_NAND_ROOT_PRE_DIV] = imx_clk_divider2("nand_pre_div", "nand_cg", base + 0xaa00, 16, 3); + clks[IMX7D_QSPI_ROOT_PRE_DIV] = imx_clk_divider2("qspi_pre_div", "qspi_cg", base + 0xaa80, 16, 3); + clks[IMX7D_USDHC1_ROOT_PRE_DIV] = imx_clk_divider2("usdhc1_pre_div", "usdhc1_cg", base + 0xab00, 16, 3); + clks[IMX7D_USDHC2_ROOT_PRE_DIV] = imx_clk_divider2("usdhc2_pre_div", "usdhc2_cg", base + 0xab80, 16, 3); + clks[IMX7D_USDHC3_ROOT_PRE_DIV] = imx_clk_divider2("usdhc3_pre_div", "usdhc3_cg", base + 0xac00, 16, 3); + clks[IMX7D_CAN1_ROOT_PRE_DIV] = imx_clk_divider2("can1_pre_div", "can1_cg", base + 0xac80, 16, 3); + clks[IMX7D_CAN2_ROOT_PRE_DIV] = imx_clk_divider2("can2_pre_div", "can2_cg", base + 0xad00, 16, 3); + clks[IMX7D_I2C1_ROOT_PRE_DIV] = imx_clk_divider2("i2c1_pre_div", "i2c1_cg", base + 0xad80, 16, 3); + clks[IMX7D_I2C2_ROOT_PRE_DIV] = imx_clk_divider2("i2c2_pre_div", "i2c2_cg", base + 0xae00, 16, 3); + clks[IMX7D_I2C3_ROOT_PRE_DIV] = imx_clk_divider2("i2c3_pre_div", "i2c3_cg", base + 0xae80, 16, 3); + clks[IMX7D_I2C4_ROOT_PRE_DIV] = imx_clk_divider2("i2c4_pre_div", "i2c4_cg", base + 0xaf00, 16, 3); + clks[IMX7D_UART1_ROOT_PRE_DIV] = imx_clk_divider2("uart1_pre_div", "uart1_cg", base + 0xaf80, 16, 3); + clks[IMX7D_UART2_ROOT_PRE_DIV] = imx_clk_divider2("uart2_pre_div", "uart2_cg", base + 0xb000, 16, 3); + clks[IMX7D_UART3_ROOT_PRE_DIV] = imx_clk_divider2("uart3_pre_div", "uart3_cg", base + 0xb080, 16, 3); + clks[IMX7D_UART4_ROOT_PRE_DIV] = imx_clk_divider2("uart4_pre_div", "uart4_cg", base + 0xb100, 16, 3); + clks[IMX7D_UART5_ROOT_PRE_DIV] = imx_clk_divider2("uart5_pre_div", "uart5_cg", base + 0xb180, 16, 3); + clks[IMX7D_UART6_ROOT_PRE_DIV] = imx_clk_divider2("uart6_pre_div", "uart6_cg", base + 0xb200, 16, 3); + clks[IMX7D_UART7_ROOT_PRE_DIV] = imx_clk_divider2("uart7_pre_div", "uart7_cg", base + 0xb280, 16, 3); + clks[IMX7D_ECSPI1_ROOT_PRE_DIV] = imx_clk_divider2("ecspi1_pre_div", "ecspi1_cg", base + 0xb300, 16, 3); + clks[IMX7D_ECSPI2_ROOT_PRE_DIV] = imx_clk_divider2("ecspi2_pre_div", "ecspi2_cg", base + 0xb380, 16, 3); + clks[IMX7D_ECSPI3_ROOT_PRE_DIV] = imx_clk_divider2("ecspi3_pre_div", "ecspi3_cg", base + 0xb400, 16, 3); + clks[IMX7D_ECSPI4_ROOT_PRE_DIV] = imx_clk_divider2("ecspi4_pre_div", "ecspi4_cg", base + 0xb480, 16, 3); + clks[IMX7D_PWM1_ROOT_PRE_DIV] = imx_clk_divider2("pwm1_pre_div", "pwm1_cg", base + 0xb500, 16, 3); + clks[IMX7D_PWM2_ROOT_PRE_DIV] = imx_clk_divider2("pwm2_pre_div", "pwm2_cg", base + 0xb580, 16, 3); + clks[IMX7D_PWM3_ROOT_PRE_DIV] = imx_clk_divider2("pwm3_pre_div", "pwm3_cg", base + 0xb600, 16, 3); + clks[IMX7D_PWM4_ROOT_PRE_DIV] = imx_clk_divider2("pwm4_pre_div", "pwm4_cg", base + 0xb680, 16, 3); + clks[IMX7D_FLEXTIMER1_ROOT_PRE_DIV] = imx_clk_divider2("flextimer1_pre_div", "flextimer1_cg", base + 0xb700, 16, 3); + clks[IMX7D_FLEXTIMER2_ROOT_PRE_DIV] = imx_clk_divider2("flextimer2_pre_div", "flextimer2_cg", base + 0xb780, 16, 3); + clks[IMX7D_SIM1_ROOT_PRE_DIV] = imx_clk_divider2("sim1_pre_div", "sim1_cg", base + 0xb800, 16, 3); + clks[IMX7D_SIM2_ROOT_PRE_DIV] = imx_clk_divider2("sim2_pre_div", "sim2_cg", base + 0xb880, 16, 3); + clks[IMX7D_GPT1_ROOT_PRE_DIV] = imx_clk_divider2("gpt1_pre_div", "gpt1_cg", base + 0xb900, 16, 3); + clks[IMX7D_GPT2_ROOT_PRE_DIV] = imx_clk_divider2("gpt2_pre_div", "gpt2_cg", base + 0xb980, 16, 3); + clks[IMX7D_GPT3_ROOT_PRE_DIV] = imx_clk_divider2("gpt3_pre_div", "gpt3_cg", base + 0xba00, 16, 3); + clks[IMX7D_GPT4_ROOT_PRE_DIV] = imx_clk_divider2("gpt4_pre_div", "gpt4_cg", base + 0xba80, 16, 3); + clks[IMX7D_TRACE_ROOT_PRE_DIV] = imx_clk_divider2("trace_pre_div", "trace_cg", base + 0xbb00, 16, 3); + clks[IMX7D_WDOG_ROOT_PRE_DIV] = imx_clk_divider2("wdog_pre_div", "wdog_cg", base + 0xbb80, 16, 3); + clks[IMX7D_CSI_MCLK_ROOT_PRE_DIV] = imx_clk_divider2("csi_mclk_pre_div", "csi_mclk_cg", base + 0xbc00, 16, 3); + clks[IMX7D_AUDIO_MCLK_ROOT_PRE_DIV] = imx_clk_divider2("audio_mclk_pre_div", "audio_mclk_cg", base + 0xbc80, 16, 3); + clks[IMX7D_WRCLK_ROOT_PRE_DIV] = imx_clk_divider2("wrclk_pre_div", "wrclk_cg", base + 0xbd00, 16, 3); + clks[IMX7D_CLKO1_ROOT_PRE_DIV] = imx_clk_divider2("clko1_pre_div", "clko1_cg", base + 0xbd80, 16, 3); + clks[IMX7D_CLKO2_ROOT_PRE_DIV] = imx_clk_divider2("clko2_pre_div", "clko2_cg", base + 0xbe00, 16, 3); + + clks[IMX7D_ARM_A7_ROOT_DIV] = imx_clk_divider2("arm_a7_div", "arm_a7_cg", base + 0x8000, 0, 3); + clks[IMX7D_ARM_M4_ROOT_DIV] = imx_clk_divider2("arm_m4_div", "arm_m4_cg", base + 0x8080, 0, 3); + clks[IMX7D_ARM_M0_ROOT_DIV] = imx_clk_divider2("arm_m0_div", "arm_m0_cg", base + 0x8100, 0, 3); + clks[IMX7D_MAIN_AXI_ROOT_DIV] = imx_clk_divider2("axi_post_div", "axi_pre_div", base + 0x8800, 0, 6); + clks[IMX7D_DISP_AXI_ROOT_DIV] = imx_clk_divider2("disp_axi_post_div", "disp_axi_pre_div", base + 0x8880, 0, 6); + clks[IMX7D_ENET_AXI_ROOT_DIV] = imx_clk_divider2("enet_axi_post_div", "enet_axi_pre_div", base + 0x8900, 0, 6); + clks[IMX7D_NAND_USDHC_BUS_ROOT_DIV] = imx_clk_divider2("nand_usdhc_post_div", "nand_usdhc_pre_div", base + 0x8980, 0, 6); + clks[IMX7D_AHB_CHANNEL_ROOT_DIV] = imx_clk_divider2("ahb_post_div", "ahb_pre_div", base + 0x9000, 0, 6); + clks[IMX7D_DRAM_ROOT_DIV] = imx_clk_divider2("dram_post_div", "dram_cg", base + 0x9880, 0, 3); + clks[IMX7D_DRAM_PHYM_ALT_ROOT_DIV] = imx_clk_divider2("dram_phym_alt_post_div", "dram_phym_alt_pre_div", base + 0xa000, 0, 3); + clks[IMX7D_DRAM_ALT_ROOT_DIV] = imx_clk_divider2("dram_alt_post_div", "dram_alt_pre_div", base + 0xa080, 0, 3); + clks[IMX7D_USB_HSIC_ROOT_DIV] = imx_clk_divider2("usb_hsic_post_div", "usb_hsic_pre_div", base + 0xa100, 0, 6); + clks[IMX7D_PCIE_CTRL_ROOT_DIV] = imx_clk_divider2("pcie_ctrl_post_div", "pcie_ctrl_pre_div", base + 0xa180, 0, 6); + clks[IMX7D_PCIE_PHY_ROOT_DIV] = imx_clk_divider2("pcie_phy_post_div", "pcie_phy_pre_div", base + 0xa200, 0, 6); + clks[IMX7D_EPDC_PIXEL_ROOT_DIV] = imx_clk_divider2("epdc_pixel_post_div", "epdc_pixel_pre_div", base + 0xa280, 0, 6); + clks[IMX7D_LCDIF_PIXEL_ROOT_DIV] = imx_clk_divider2("lcdif_pixel_post_div", "lcdif_pixel_pre_div", base + 0xa300, 0, 6); + clks[IMX7D_MIPI_DSI_ROOT_DIV] = imx_clk_divider2("mipi_dsi_post_div", "mipi_dsi_pre_div", base + 0xa380, 0, 6); + clks[IMX7D_MIPI_CSI_ROOT_DIV] = imx_clk_divider2("mipi_csi_post_div", "mipi_csi_pre_div", base + 0xa400, 0, 6); + clks[IMX7D_MIPI_DPHY_ROOT_DIV] = imx_clk_divider2("mipi_dphy_post_div", "mipi_csi_dphy_div", base + 0xa480, 0, 6); + clks[IMX7D_SAI1_ROOT_DIV] = imx_clk_divider2("sai1_post_div", "sai1_pre_div", base + 0xa500, 0, 6); + clks[IMX7D_SAI2_ROOT_DIV] = imx_clk_divider2("sai2_post_div", "sai2_pre_div", base + 0xa580, 0, 6); + clks[IMX7D_SAI3_ROOT_DIV] = imx_clk_divider2("sai3_post_div", "sai3_pre_div", base + 0xa600, 0, 6); + clks[IMX7D_SPDIF_ROOT_DIV] = imx_clk_divider2("spdif_post_div", "spdif_pre_div", base + 0xa680, 0, 6); + clks[IMX7D_ENET1_REF_ROOT_DIV] = imx_clk_divider2("enet1_ref_post_div", "enet1_ref_pre_div", base + 0xa700, 0, 6); + clks[IMX7D_ENET1_TIME_ROOT_DIV] = imx_clk_divider2("enet1_time_post_div", "enet1_time_pre_div", base + 0xa780, 0, 6); + clks[IMX7D_ENET2_REF_ROOT_DIV] = imx_clk_divider2("enet2_ref_post_div", "enet2_ref_pre_div", base + 0xa800, 0, 6); + clks[IMX7D_ENET2_TIME_ROOT_DIV] = imx_clk_divider2("enet2_time_post_div", "enet2_time_pre_div", base + 0xa880, 0, 6); + clks[IMX7D_ENET_PHY_REF_ROOT_DIV] = imx_clk_divider2("enet_phy_ref_post_div", "enet_phy_ref_pre_div", base + 0xa900, 0, 6); + clks[IMX7D_EIM_ROOT_DIV] = imx_clk_divider2("eim_post_div", "eim_pre_div", base + 0xa980, 0, 6); + clks[IMX7D_NAND_ROOT_DIV] = imx_clk_divider2("nand_post_div", "nand_pre_div", base + 0xaa00, 0, 6); + clks[IMX7D_QSPI_ROOT_DIV] = imx_clk_divider2("qspi_post_div", "qspi_pre_div", base + 0xaa80, 0, 6); + clks[IMX7D_USDHC1_ROOT_DIV] = imx_clk_divider2("usdhc1_post_div", "usdhc1_pre_div", base + 0xab00, 0, 6); + clks[IMX7D_USDHC2_ROOT_DIV] = imx_clk_divider2("usdhc2_post_div", "usdhc2_pre_div", base + 0xab80, 0, 6); + clks[IMX7D_USDHC3_ROOT_DIV] = imx_clk_divider2("usdhc3_post_div", "usdhc3_pre_div", base + 0xac00, 0, 6); + clks[IMX7D_CAN1_ROOT_DIV] = imx_clk_divider2("can1_post_div", "can1_pre_div", base + 0xac80, 0, 6); + clks[IMX7D_CAN2_ROOT_DIV] = imx_clk_divider2("can2_post_div", "can2_pre_div", base + 0xad00, 0, 6); + clks[IMX7D_I2C1_ROOT_DIV] = imx_clk_divider2("i2c1_post_div", "i2c1_pre_div", base + 0xad80, 0, 6); + clks[IMX7D_I2C2_ROOT_DIV] = imx_clk_divider2("i2c2_post_div", "i2c2_pre_div", base + 0xae00, 0, 6); + clks[IMX7D_I2C3_ROOT_DIV] = imx_clk_divider2("i2c3_post_div", "i2c3_pre_div", base + 0xae80, 0, 6); + clks[IMX7D_I2C4_ROOT_DIV] = imx_clk_divider2("i2c4_post_div", "i2c4_pre_div", base + 0xaf00, 0, 6); + clks[IMX7D_UART1_ROOT_DIV] = imx_clk_divider2("uart1_post_div", "uart1_pre_div", base + 0xaf80, 0, 6); + clks[IMX7D_UART2_ROOT_DIV] = imx_clk_divider2("uart2_post_div", "uart2_pre_div", base + 0xb000, 0, 6); + clks[IMX7D_UART3_ROOT_DIV] = imx_clk_divider2("uart3_post_div", "uart3_pre_div", base + 0xb080, 0, 6); + clks[IMX7D_UART4_ROOT_DIV] = imx_clk_divider2("uart4_post_div", "uart4_pre_div", base + 0xb100, 0, 6); + clks[IMX7D_UART5_ROOT_DIV] = imx_clk_divider2("uart5_post_div", "uart5_pre_div", base + 0xb180, 0, 6); + clks[IMX7D_UART6_ROOT_DIV] = imx_clk_divider2("uart6_post_div", "uart6_pre_div", base + 0xb200, 0, 6); + clks[IMX7D_UART7_ROOT_DIV] = imx_clk_divider2("uart7_post_div", "uart7_pre_div", base + 0xb280, 0, 6); + clks[IMX7D_ECSPI1_ROOT_DIV] = imx_clk_divider2("ecspi1_post_div", "ecspi1_pre_div", base + 0xb300, 0, 6); + clks[IMX7D_ECSPI2_ROOT_DIV] = imx_clk_divider2("ecspi2_post_div", "ecspi2_pre_div", base + 0xb380, 0, 6); + clks[IMX7D_ECSPI3_ROOT_DIV] = imx_clk_divider2("ecspi3_post_div", "ecspi3_pre_div", base + 0xb400, 0, 6); + clks[IMX7D_ECSPI4_ROOT_DIV] = imx_clk_divider2("ecspi4_post_div", "ecspi4_pre_div", base + 0xb480, 0, 6); + clks[IMX7D_PWM1_ROOT_DIV] = imx_clk_divider2("pwm1_post_div", "pwm1_pre_div", base + 0xb500, 0, 6); + clks[IMX7D_PWM2_ROOT_DIV] = imx_clk_divider2("pwm2_post_div", "pwm2_pre_div", base + 0xb580, 0, 6); + clks[IMX7D_PWM3_ROOT_DIV] = imx_clk_divider2("pwm3_post_div", "pwm3_pre_div", base + 0xb600, 0, 6); + clks[IMX7D_PWM4_ROOT_DIV] = imx_clk_divider2("pwm4_post_div", "pwm4_pre_div", base + 0xb680, 0, 6); + clks[IMX7D_FLEXTIMER1_ROOT_DIV] = imx_clk_divider2("flextimer1_post_div", "flextimer1_pre_div", base + 0xb700, 0, 6); + clks[IMX7D_FLEXTIMER2_ROOT_DIV] = imx_clk_divider2("flextimer2_post_div", "flextimer2_pre_div", base + 0xb780, 0, 6); + clks[IMX7D_SIM1_ROOT_DIV] = imx_clk_divider2("sim1_post_div", "sim1_pre_div", base + 0xb800, 0, 6); + clks[IMX7D_SIM2_ROOT_DIV] = imx_clk_divider2("sim2_post_div", "sim2_pre_div", base + 0xb880, 0, 6); + clks[IMX7D_GPT1_ROOT_DIV] = imx_clk_divider2("gpt1_post_div", "gpt1_pre_div", base + 0xb900, 0, 6); + clks[IMX7D_GPT2_ROOT_DIV] = imx_clk_divider2("gpt2_post_div", "gpt2_pre_div", base + 0xb980, 0, 6); + clks[IMX7D_GPT3_ROOT_DIV] = imx_clk_divider2("gpt3_post_div", "gpt3_pre_div", base + 0xba00, 0, 6); + clks[IMX7D_GPT4_ROOT_DIV] = imx_clk_divider2("gpt4_post_div", "gpt4_pre_div", base + 0xba80, 0, 6); + clks[IMX7D_TRACE_ROOT_DIV] = imx_clk_divider2("trace_post_div", "trace_pre_div", base + 0xbb00, 0, 6); + clks[IMX7D_WDOG_ROOT_DIV] = imx_clk_divider2("wdog_post_div", "wdog_pre_div", base + 0xbb80, 0, 6); + clks[IMX7D_CSI_MCLK_ROOT_DIV] = imx_clk_divider2("csi_mclk_post_div", "csi_mclk_pre_div", base + 0xbc00, 0, 6); + clks[IMX7D_AUDIO_MCLK_ROOT_DIV] = imx_clk_divider2("audio_mclk_post_div", "audio_mclk_pre_div", base + 0xbc80, 0, 6); + clks[IMX7D_WRCLK_ROOT_DIV] = imx_clk_divider2("wrclk_post_div", "wrclk_pre_div", base + 0xbd00, 0, 6); + clks[IMX7D_CLKO1_ROOT_DIV] = imx_clk_divider2("clko1_post_div", "clko1_pre_div", base + 0xbd80, 0, 6); + clks[IMX7D_CLKO2_ROOT_DIV] = imx_clk_divider2("clko2_post_div", "clko2_pre_div", base + 0xbe00, 0, 6); + + clks[IMX7D_ARM_A7_ROOT_CLK] = imx_clk_gate4("arm_a7_root_clk", "arm_a7_div", base + 0x4000, 0); + clks[IMX7D_ARM_M4_ROOT_CLK] = imx_clk_gate4("arm_m4_root_clk", "arm_m4_div", base + 0x4010, 0); + clks[IMX7D_ARM_M0_ROOT_CLK] = imx_clk_gate4("arm_m0_root_clk", "arm_m0_div", base + 0x4020, 0); + clks[IMX7D_MAIN_AXI_ROOT_CLK] = imx_clk_gate4("main_axi_root_clk", "axi_post_div", base + 0x4040, 0); + clks[IMX7D_DISP_AXI_ROOT_CLK] = imx_clk_gate4("disp_axi_root_clk", "disp_axi_post_div", base + 0x4050, 0); + clks[IMX7D_ENET_AXI_ROOT_CLK] = imx_clk_gate4("enet_axi_root_clk", "enet_axi_post_div", base + 0x4060, 0); + clks[IMX7D_OCRAM_CLK] = imx_clk_gate4("ocram_clk", "axi_post_div", base + 0x4110, 0); + clks[IMX7D_OCRAM_S_CLK] = imx_clk_gate4("ocram_s_clk", "ahb_post_div", base + 0x4120, 0); + clks[IMX7D_NAND_USDHC_BUS_ROOT_CLK] = imx_clk_gate4("nand_usdhc_root_clk", "nand_usdhc_post_div", base + 0x4130, 0); + clks[IMX7D_AHB_CHANNEL_ROOT_CLK] = imx_clk_gate4("ahb_root_clk", "ahb_post_div", base + 0x4200, 0); + clks[IMX7D_DRAM_ROOT_CLK] = imx_clk_gate4("dram_root_clk", "dram_post_div", base + 0x4130, 0); + clks[IMX7D_DRAM_PHYM_ROOT_CLK] = imx_clk_gate4("dram_phym_root_clk", "dram_phym_cg", base + 0x4130, 0); + clks[IMX7D_DRAM_PHYM_ALT_ROOT_CLK] = imx_clk_gate4("dram_phym_alt_root_clk", "dram_phym_alt_post_div", base + 0x4130, 0); + clks[IMX7D_DRAM_ALT_ROOT_CLK] = imx_clk_gate4("dram_alt_root_clk", "dram_alt_post_div", base + 0x4130, 0); + clks[IMX7D_USB_HSIC_ROOT_CLK] = imx_clk_gate4("usb_hsic_root_clk", "usb_hsic_post_div", base + 0x4420, 0); + clks[IMX7D_SDMA_CORE_CLK] = imx_clk_gate4("sdma_root_clk", "ahb_root_clk", base + 0x4480, 0); + clks[IMX7D_PCIE_CTRL_ROOT_CLK] = imx_clk_gate4("pcie_ctrl_root_clk", "pcie_ctrl_post_div", base + 0x4600, 0); + clks[IMX7D_PCIE_PHY_ROOT_CLK] = imx_clk_gate4("pcie_phy_root_clk", "pcie_phy_post_div", base + 0x4600, 0); + clks[IMX7D_EPDC_PIXEL_ROOT_CLK] = imx_clk_gate4("epdc_pixel_root_clk", "epdc_pixel_post_div", base + 0x44a0, 0); + clks[IMX7D_LCDIF_PIXEL_ROOT_CLK] = imx_clk_gate4("lcdif_pixel_root_clk", "lcdif_pixel_post_div", base + 0x44b0, 0); + clks[IMX7D_ENET1_REF_ROOT_CLK] = imx_clk_gate4("enet1_ref_root_clk", "enet1_ref_post_div", base + 0x44e0, 0); + clks[IMX7D_ENET1_TIME_ROOT_CLK] = imx_clk_gate4("enet1_time_root_clk", "enet1_time_post_div", base + 0x44f0, 0); + clks[IMX7D_ENET2_REF_ROOT_CLK] = imx_clk_gate4("enet2_ref_root_clk", "enet2_ref_post_div", base + 0x4500, 0); + clks[IMX7D_ENET2_TIME_ROOT_CLK] = imx_clk_gate4("enet2_time_root_clk", "enet2_time_post_div", base + 0x4510, 0); + clks[IMX7D_ENET_PHY_REF_ROOT_CLK] = imx_clk_gate4("enet_phy_ref_root_clk", "enet_phy_ref_post_div", base + 0x4520, 0); + clks[IMX7D_EIM_ROOT_CLK] = imx_clk_gate4("eim_root_clk", "eim_post_div", base + 0x4160, 0); + clks[IMX7D_NAND_ROOT_CLK] = imx_clk_gate4("nand_root_clk", "nand_post_div", base + 0x4140, 0); + clks[IMX7D_QSPI_ROOT_CLK] = imx_clk_gate4("qspi_root_clk", "qspi_post_div", base + 0x4150, 0); + clks[IMX7D_USDHC1_ROOT_CLK] = imx_clk_gate4("usdhc1_root_clk", "usdhc1_post_div", base + 0x46c0, 0); + clks[IMX7D_USDHC2_ROOT_CLK] = imx_clk_gate4("usdhc2_root_clk", "usdhc2_post_div", base + 0x46d0, 0); + clks[IMX7D_USDHC3_ROOT_CLK] = imx_clk_gate4("usdhc3_root_clk", "usdhc3_post_div", base + 0x46e0, 0); + clks[IMX7D_CAN1_ROOT_CLK] = imx_clk_gate4("can1_root_clk", "can1_post_div", base + 0x4740, 0); + clks[IMX7D_CAN2_ROOT_CLK] = imx_clk_gate4("can2_root_clk", "can2_post_div", base + 0x4750, 0); + clks[IMX7D_I2C1_ROOT_CLK] = imx_clk_gate4("i2c1_root_clk", "i2c1_post_div", base + 0x4880, 0); + clks[IMX7D_I2C2_ROOT_CLK] = imx_clk_gate4("i2c2_root_clk", "i2c2_post_div", base + 0x4890, 0); + clks[IMX7D_I2C3_ROOT_CLK] = imx_clk_gate4("i2c3_root_clk", "i2c3_post_div", base + 0x48a0, 0); + clks[IMX7D_I2C4_ROOT_CLK] = imx_clk_gate4("i2c4_root_clk", "i2c4_post_div", base + 0x48b0, 0); + clks[IMX7D_UART1_ROOT_CLK] = imx_clk_gate4("uart1_root_clk", "uart1_post_div", base + 0x4940, 0); + clks[IMX7D_UART2_ROOT_CLK] = imx_clk_gate4("uart2_root_clk", "uart2_post_div", base + 0x4950, 0); + clks[IMX7D_UART3_ROOT_CLK] = imx_clk_gate4("uart3_root_clk", "uart3_post_div", base + 0x4960, 0); + clks[IMX7D_UART4_ROOT_CLK] = imx_clk_gate4("uart4_root_clk", "uart4_post_div", base + 0x4970, 0); + clks[IMX7D_UART5_ROOT_CLK] = imx_clk_gate4("uart5_root_clk", "uart5_post_div", base + 0x4980, 0); + clks[IMX7D_UART6_ROOT_CLK] = imx_clk_gate4("uart6_root_clk", "uart6_post_div", base + 0x4990, 0); + clks[IMX7D_UART7_ROOT_CLK] = imx_clk_gate4("uart7_root_clk", "uart7_post_div", base + 0x49a0, 0); + clks[IMX7D_ECSPI1_ROOT_CLK] = imx_clk_gate4("ecspi1_root_clk", "ecspi1_post_div", base + 0x4780, 0); + clks[IMX7D_ECSPI2_ROOT_CLK] = imx_clk_gate4("ecspi2_root_clk", "ecspi2_post_div", base + 0x4790, 0); + clks[IMX7D_ECSPI3_ROOT_CLK] = imx_clk_gate4("ecspi3_root_clk", "ecspi3_post_div", base + 0x47a0, 0); + clks[IMX7D_ECSPI4_ROOT_CLK] = imx_clk_gate4("ecspi4_root_clk", "ecspi4_post_div", base + 0x47b0, 0); + clks[IMX7D_PWM1_ROOT_CLK] = imx_clk_gate4("pwm1_root_clk", "pwm1_post_div", base + 0x4840, 0); + clks[IMX7D_PWM2_ROOT_CLK] = imx_clk_gate4("pwm2_root_clk", "pwm2_post_div", base + 0x4850, 0); + clks[IMX7D_PWM3_ROOT_CLK] = imx_clk_gate4("pwm3_root_clk", "pwm3_post_div", base + 0x4860, 0); + clks[IMX7D_PWM4_ROOT_CLK] = imx_clk_gate4("pwm4_root_clk", "pwm4_post_div", base + 0x4870, 0); + clks[IMX7D_FLEXTIMER1_ROOT_CLK] = imx_clk_gate4("flextimer1_root_clk", "flextimer1_post_div", base + 0x4800, 0); + clks[IMX7D_FLEXTIMER2_ROOT_CLK] = imx_clk_gate4("flextimer2_root_clk", "flextimer2_post_div", base + 0x4810, 0); + clks[IMX7D_SIM1_ROOT_CLK] = imx_clk_gate4("sim1_root_clk", "sim1_post_div", base + 0x4900, 0); + clks[IMX7D_SIM2_ROOT_CLK] = imx_clk_gate4("sim2_root_clk", "sim2_post_div", base + 0x4910, 0); + clks[IMX7D_GPT1_ROOT_CLK] = imx_clk_gate4("gpt1_root_clk", "gpt1_post_div", base + 0x47c0, 0); + clks[IMX7D_GPT2_ROOT_CLK] = imx_clk_gate4("gpt2_root_clk", "gpt2_post_div", base + 0x47d0, 0); + clks[IMX7D_GPT3_ROOT_CLK] = imx_clk_gate4("gpt3_root_clk", "gpt3_post_div", base + 0x47e0, 0); + clks[IMX7D_GPT4_ROOT_CLK] = imx_clk_gate4("gpt4_root_clk", "gpt4_post_div", base + 0x47f0, 0); + clks[IMX7D_TRACE_ROOT_CLK] = imx_clk_gate4("trace_root_clk", "trace_post_div", base + 0x4300, 0); + clks[IMX7D_WDOG1_ROOT_CLK] = imx_clk_gate4("wdog1_root_clk", "wdog_post_div", base + 0x49c0, 0); + clks[IMX7D_WDOG2_ROOT_CLK] = imx_clk_gate4("wdog2_root_clk", "wdog_post_div", base + 0x49d0, 0); + clks[IMX7D_WDOG3_ROOT_CLK] = imx_clk_gate4("wdog3_root_clk", "wdog_post_div", base + 0x49e0, 0); + clks[IMX7D_WDOG4_ROOT_CLK] = imx_clk_gate4("wdog4_root_clk", "wdog_post_div", base + 0x49f0, 0); + clks[IMX7D_CSI_MCLK_ROOT_CLK] = imx_clk_gate4("csi_mclk_root_clk", "csi_mclk_post_div", base + 0x4490, 0); + clks[IMX7D_AUDIO_MCLK_ROOT_CLK] = imx_clk_gate4("audio_mclk_root_clk", "audio_mclk_post_div", base + 0x4790, 0); + clks[IMX7D_WRCLK_ROOT_CLK] = imx_clk_gate4("wrclk_root_clk", "wrclk_post_div", base + 0x47a0, 0); + clks[IMX7D_ADC_ROOT_CLK] = imx_clk_gate4("adc_root_clk", "ipg_root_clk", base + 0x4200, 0); + + clks[IMX7D_GPT_3M_CLK] = imx_clk_fixed_factor("gpt_3m", "osc", 1, 8); + + clks[IMX7D_CLK_ARM] = imx_clk_cpu("arm", "arm_a7_root_clk", + clks[IMX7D_ARM_A7_ROOT_CLK], + clks[IMX7D_ARM_A7_ROOT_SRC], + clks[IMX7D_PLL_ARM_MAIN_CLK], + clks[IMX7D_PLL_SYS_MAIN_CLK]); + + clk_data.clks = clks; + clk_data.clk_num = ARRAY_SIZE(clks); + of_clk_add_provider(dev->device_node, of_clk_src_onecell_get, &clk_data); + + for (i = 0; i < ARRAY_SIZE(clks_init_on); i++) + clk_enable(clks[clks_init_on[i]]); + + /* use old gpt clk setting, gpt1 root clk must be twice as gpt counter freq */ + clk_set_parent(clks[IMX7D_GPT1_ROOT_SRC], clks[IMX7D_OSC_24M_CLK]); + + /* set uart module clock's parent clock source that must be great then 80MHz */ + clk_set_parent(clks[IMX7D_UART1_ROOT_SRC], clks[IMX7D_OSC_24M_CLK]); + + return 0; +} + +static __maybe_unused struct of_device_id imx7_ccm_dt_ids[] = { + { + .compatible = "fsl,imx7d-ccm", + }, { + /* sentinel */ + } +}; + +static struct driver_d imx7_ccm_driver = { + .probe = imx7_ccm_probe, + .name = "imx6-ccm", + .of_compatible = DRV_OF_COMPAT(imx7_ccm_dt_ids), +}; + +static int imx7_ccm_init(void) +{ + return platform_driver_register(&imx7_ccm_driver); +} +core_initcall(imx7_ccm_init); \ No newline at end of file diff --git a/drivers/clk/imx/clk.h b/drivers/clk/imx/clk.h index 3240231a7..d40aa3d02 100644 --- a/drivers/clk/imx/clk.h +++ b/drivers/clk/imx/clk.h @@ -16,6 +16,12 @@ static inline struct clk *imx_clk_divider_np(const char *name, const char *paren return clk_divider(name, parent, reg, shift, width, 0); } +static inline struct clk *imx_clk_divider2(const char *name, const char *parent, + void __iomem *reg, u8 shift, u8 width) +{ + return clk_divider(name, parent, reg, shift, width, 0); +} + static inline struct clk *imx_clk_divider_table(const char *name, const char *parent, void __iomem *reg, u8 shift, u8 width, const struct clk_div_table *table) @@ -44,6 +50,12 @@ static inline struct clk *imx_clk_mux(const char *name, void __iomem *reg, return clk_mux(name, reg, shift, width, parents, num_parents, 0); } +static inline struct clk *imx_clk_mux2(const char *name, void __iomem *reg, + u8 shift, u8 width, const char **parents, u8 num_parents) +{ + return clk_mux(name, reg, shift, width, parents, num_parents, 0); +} + static inline struct clk *imx_clk_mux_p(const char *name, void __iomem *reg, u8 shift, u8 width, const char **parents, u8 num_parents) { @@ -56,6 +68,12 @@ static inline struct clk *imx_clk_gate(const char *name, const char *parent, return clk_gate(name, parent, reg, shift, CLK_SET_RATE_PARENT, 0); } +static inline struct clk *imx_clk_gate_dis(const char *name, const char *parent, + void __iomem *reg, u8 shift) +{ + return clk_gate_inverted(name, parent, reg, shift, CLK_SET_RATE_PARENT); +} + static inline struct clk *imx_clk_gate2(const char *name, const char *parent, void __iomem *reg, u8 shift) { @@ -68,6 +86,17 @@ static inline struct clk *imx_clk_gate2_cgr(const char *name, const char *parent return clk_gate2(name, parent, reg, shift, cgr_val); } +static inline struct clk *imx_clk_gate3(const char *name, const char *parent, + void __iomem *reg, u8 shift) +{ + return clk_gate(name, parent, reg, shift, CLK_SET_RATE_PARENT, 0); +} + +static inline struct clk *imx_clk_gate4(const char *name, const char *parent, + void __iomem *reg, u8 shift) +{ + return clk_gate2(name, parent, reg, shift, 0x3); +} struct clk *imx_clk_pllv1(const char *name, const char *parent, void __iomem *base); -- 2.11.0 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 19/23] clk: i.MX7: Add missing USB clocks 2017-01-16 10:50 i.MX7 support Sascha Hauer ` (17 preceding siblings ...) 2017-01-16 10:51 ` [PATCH 18/23] clk: i.MX: Add clock support for i.MX7 Sascha Hauer @ 2017-01-16 10:51 ` Sascha Hauer 2017-01-16 10:51 ` [PATCH 20/23] ARM: i.MX: gpt: Add i.MX7 support Sascha Hauer ` (5 subsequent siblings) 24 siblings, 0 replies; 38+ messages in thread From: Sascha Hauer @ 2017-01-16 10:51 UTC (permalink / raw) To: Barebox List The USB clocks are missing in the Kernel clock code. Add them here. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- drivers/clk/imx/clk-imx7.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/clk/imx/clk-imx7.c b/drivers/clk/imx/clk-imx7.c index c8424fe07..45c5a4667 100644 --- a/drivers/clk/imx/clk-imx7.c +++ b/drivers/clk/imx/clk-imx7.c @@ -791,6 +791,9 @@ static int imx7_ccm_probe(struct device_d *dev) clks[IMX7D_EIM_ROOT_CLK] = imx_clk_gate4("eim_root_clk", "eim_post_div", base + 0x4160, 0); clks[IMX7D_NAND_ROOT_CLK] = imx_clk_gate4("nand_root_clk", "nand_post_div", base + 0x4140, 0); clks[IMX7D_QSPI_ROOT_CLK] = imx_clk_gate4("qspi_root_clk", "qspi_post_div", base + 0x4150, 0); + clks[IMX7D_USB_CTRL_CLK] = imx_clk_gate4("usb_ctrl_clk", "osc", base + 0x4680, 0); + clks[IMX7D_USB_PHY1_CLK] = imx_clk_gate4("usbphy1_clk", "osc", base + 0x46a0, 0); + clks[IMX7D_USB_PHY2_CLK] = imx_clk_gate4("usbphy2_clk", "osc", base + 0x46b0, 0); clks[IMX7D_USDHC1_ROOT_CLK] = imx_clk_gate4("usdhc1_root_clk", "usdhc1_post_div", base + 0x46c0, 0); clks[IMX7D_USDHC2_ROOT_CLK] = imx_clk_gate4("usdhc2_root_clk", "usdhc2_post_div", base + 0x46d0, 0); clks[IMX7D_USDHC3_ROOT_CLK] = imx_clk_gate4("usdhc3_root_clk", "usdhc3_post_div", base + 0x46e0, 0); -- 2.11.0 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 20/23] ARM: i.MX: gpt: Add i.MX7 support 2017-01-16 10:50 i.MX7 support Sascha Hauer ` (18 preceding siblings ...) 2017-01-16 10:51 ` [PATCH 19/23] clk: i.MX7: Add missing USB clocks Sascha Hauer @ 2017-01-16 10:51 ` Sascha Hauer 2017-01-16 11:35 ` Juergen Borleis 2017-01-16 10:51 ` [PATCH 21/23] pinmmux: i.MX: add pin mux support for i.MX7 Sascha Hauer ` (4 subsequent siblings) 24 siblings, 1 reply; 38+ messages in thread From: Sascha Hauer @ 2017-01-16 10:51 UTC (permalink / raw) To: Barebox List; +Cc: Juergen Borleis From: Juergen Borleis <jbe@pengutronix.de> Signed-off-by Juergen Borleis <jbe@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- arch/arm/mach-imx/clocksource.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-imx/clocksource.c b/arch/arm/mach-imx/clocksource.c index 8d00bbb3f..b1f59aae2 100644 --- a/arch/arm/mach-imx/clocksource.c +++ b/arch/arm/mach-imx/clocksource.c @@ -155,8 +155,10 @@ static __maybe_unused struct of_device_id imx_gpt_dt_ids[] = { .compatible = "fsl,imx6ul-gpt", .data = ®s_imx31, }, { - /* sentinel */ - } + .compatible = "fsl,imx7d-gpt", + .data = ®s_imx31, + }, { + }, }; static struct platform_device_id imx_gpt_ids[] = { -- 2.11.0 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH 20/23] ARM: i.MX: gpt: Add i.MX7 support 2017-01-16 10:51 ` [PATCH 20/23] ARM: i.MX: gpt: Add i.MX7 support Sascha Hauer @ 2017-01-16 11:35 ` Juergen Borleis 0 siblings, 0 replies; 38+ messages in thread From: Juergen Borleis @ 2017-01-16 11:35 UTC (permalink / raw) To: barebox On Monday 16 January 2017 11:51:05 Sascha Hauer wrote: > [...] > diff --git a/arch/arm/mach-imx/clocksource.c b/arch/arm/mach-imx/clocksource.c > index 8d00bbb3f..b1f59aae2 100644 > --- a/arch/arm/mach-imx/clocksource.c > +++ b/arch/arm/mach-imx/clocksource.c > @@ -155,8 +155,10 @@ static __maybe_unused struct of_device_id > imx_gpt_dt_ids[] = { .compatible = "fsl,imx6ul-gpt", > .data = ®s_imx31, > }, { > - /* sentinel */ > - } > + .compatible = "fsl,imx7d-gpt", > + .data = ®s_imx31, > + }, { > + }, > }; > > static struct platform_device_id imx_gpt_ids[] = { Hmm, maybe we should keep the "/* sentinel */" to make clear this last entry in the table is required. Cheers, Juergen -- Pengutronix e.K. | Juergen Borleis | Industrial Linux Solutions | http://www.pengutronix.de/ | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 21/23] pinmmux: i.MX: add pin mux support for i.MX7 2017-01-16 10:50 i.MX7 support Sascha Hauer ` (19 preceding siblings ...) 2017-01-16 10:51 ` [PATCH 20/23] ARM: i.MX: gpt: Add i.MX7 support Sascha Hauer @ 2017-01-16 10:51 ` Sascha Hauer 2017-01-16 10:51 ` [PATCH 22/23] serial: i.MX: add i.MX7 support Sascha Hauer ` (3 subsequent siblings) 24 siblings, 0 replies; 38+ messages in thread From: Sascha Hauer @ 2017-01-16 10:51 UTC (permalink / raw) To: Barebox List; +Cc: Juergen Borleis From: Juergen Borleis <jbe@pengutronix.de> Signed-off-by Juergen Borleis <jbe@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- drivers/pinctrl/imx-iomux-v3.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/pinctrl/imx-iomux-v3.c b/drivers/pinctrl/imx-iomux-v3.c index 4b3f03389..1dc46e81a 100644 --- a/drivers/pinctrl/imx-iomux-v3.c +++ b/drivers/pinctrl/imx-iomux-v3.c @@ -24,6 +24,7 @@ #include <pinctrl.h> #include <malloc.h> #include <mach/iomux-v3.h> +#include <mach/generic.h> struct imx_iomux_v3 { void __iomem *base; @@ -41,7 +42,7 @@ static void imx_iomuxv3_setup_single(void __iomem *base, struct device_d *dev, "mux: 0x%08x -> 0x%04x, conf: 0x%08x -> 0x%04x input: 0x%08x -> 0x%04x\n", mux_val, mux_reg, conf_val, conf_reg, input_val, input_reg); - if (mux_reg) + if (mux_reg || cpu_is_mx7()) writel(mux_val, base + mux_reg); if (conf_reg) writel(conf_val, base + conf_reg); @@ -209,6 +210,8 @@ static __maybe_unused struct of_device_id imx_iomux_v3_dt_ids[] = { }, { .compatible = "fsl,imx6ul-iomuxc", }, { + .compatible = "fsl,imx7d-iomuxc", + }, { /* sentinel */ } }; -- 2.11.0 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 22/23] serial: i.MX: add i.MX7 support 2017-01-16 10:50 i.MX7 support Sascha Hauer ` (20 preceding siblings ...) 2017-01-16 10:51 ` [PATCH 21/23] pinmmux: i.MX: add pin mux support for i.MX7 Sascha Hauer @ 2017-01-16 10:51 ` Sascha Hauer 2017-01-16 10:51 ` [PATCH 23/23] ARM: i.MX: Add WaRP7 board support Sascha Hauer ` (2 subsequent siblings) 24 siblings, 0 replies; 38+ messages in thread From: Sascha Hauer @ 2017-01-16 10:51 UTC (permalink / raw) To: Barebox List; +Cc: Juergen Borleis From: Juergen Borleis <jbe@pengutronix.de> Signed-off-by Juergen Borleis <jbe@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- drivers/serial/serial_imx.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/serial/serial_imx.c b/drivers/serial/serial_imx.c index c15ab8630..e8c3836a6 100644 --- a/drivers/serial/serial_imx.c +++ b/drivers/serial/serial_imx.c @@ -290,6 +290,9 @@ static __maybe_unused struct of_device_id imx_serial_dt_ids[] = { }, { .compatible = "fsl,imx6ul-uart", .data = &imx21_data, + }, { + .compatible = "fsl,imx7d-uart", + .data = &imx21_data, }, { /* sentinel */ } -- 2.11.0 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 23/23] ARM: i.MX: Add WaRP7 board support 2017-01-16 10:50 i.MX7 support Sascha Hauer ` (21 preceding siblings ...) 2017-01-16 10:51 ` [PATCH 22/23] serial: i.MX: add i.MX7 support Sascha Hauer @ 2017-01-16 10:51 ` Sascha Hauer 2017-01-16 10:58 ` i.MX7 support Fabio Estevam 2017-01-16 11:02 ` Belisko Marek 24 siblings, 0 replies; 38+ messages in thread From: Sascha Hauer @ 2017-01-16 10:51 UTC (permalink / raw) To: Barebox List; +Cc: Juergen Borleis From: Juergen Borleis <jbe@pengutronix.de> Signed-off-by Juergen Borleis <jbe@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- Documentation/boards/imx/Element14-WaRP7.rst | 54 +++++++++++++++ arch/arm/boards/Makefile | 1 + arch/arm/boards/element14-warp7/Makefile | 2 + arch/arm/boards/element14-warp7/board.c | 35 ++++++++++ .../element14-warp7/flash-header-mx7-warp.imxcfg | 81 ++++++++++++++++++++++ arch/arm/boards/element14-warp7/lowlevel.c | 48 +++++++++++++ arch/arm/dts/Makefile | 1 + arch/arm/dts/imx7s-warp.dts | 45 ++++++++++++ arch/arm/mach-imx/Kconfig | 5 ++ images/Makefile.imx | 5 ++ 10 files changed, 277 insertions(+) create mode 100644 Documentation/boards/imx/Element14-WaRP7.rst create mode 100644 arch/arm/boards/element14-warp7/Makefile create mode 100644 arch/arm/boards/element14-warp7/board.c create mode 100644 arch/arm/boards/element14-warp7/flash-header-mx7-warp.imxcfg create mode 100644 arch/arm/boards/element14-warp7/lowlevel.c create mode 100644 arch/arm/dts/imx7s-warp.dts diff --git a/Documentation/boards/imx/Element14-WaRP7.rst b/Documentation/boards/imx/Element14-WaRP7.rst new file mode 100644 index 000000000..d4e5e7991 --- /dev/null +++ b/Documentation/boards/imx/Element14-WaRP7.rst @@ -0,0 +1,54 @@ +element14 WaRP7 +=============== + +This CPU card is based on an NXP i.MX7S SoC. + +Supported hardware +================== + +- NXP PMIC PFUZE3000 +- Kingston 08EMCP04-EL3AV100 eMCP (eMMC and LPDDR3 memory in one package) + - 8 GiB eMMC Triple-Level cell NAND flash, eMMC standard 5.0 (HS400) + - 512 MiB LPDDR3 SDRAM starting at address 0x80000000 + +Bootstrapping barebox +===================== + +The device boots in internal boot mode from eMMC and is shipped with a +vendor modified u-boot imximage. + +Barebox can be used as a drop-in replacement for the shipped bootloader. + +The WaRP7 IO Board has a double DIP switch where switch number two defines the +boot source of the i.MX7 SoC: + + +-----+ + | | + | | O | <--- on = high level + | | | | + | O | | <--- off = low level + | | + | 1 2 | + +-----+ + +Bootsource is the internal eMMC: + + +-----+ + | | + | O | | + | | | | + | | O | <---- eMMC + | | + | 1 2 | + +-----+ + +Bootsource is the USB: + + +-----+ + | | + | O O | <---- USB + | | | | + | | | | + | | + | 1 2 | + +-----+ diff --git a/arch/arm/boards/Makefile b/arch/arm/boards/Makefile index ff0a86fcb..2dec84d8c 100644 --- a/arch/arm/boards/Makefile +++ b/arch/arm/boards/Makefile @@ -140,4 +140,5 @@ obj-$(CONFIG_MACH_ZYLONITE) += zylonite/ obj-$(CONFIG_MACH_VARISCITE_MX6) += variscite-mx6/ obj-$(CONFIG_MACH_VSCOM_BALTOS) += vscom-baltos/ obj-$(CONFIG_MACH_QEMU_VIRT64) += qemu-virt64/ +obj-$(CONFIG_MACH_WARP7) += element14-warp7/ obj-$(CONFIG_MACH_VF610_TWR) += freescale-vf610-twr/ diff --git a/arch/arm/boards/element14-warp7/Makefile b/arch/arm/boards/element14-warp7/Makefile new file mode 100644 index 000000000..01c7a259e --- /dev/null +++ b/arch/arm/boards/element14-warp7/Makefile @@ -0,0 +1,2 @@ +obj-y += board.o +lwl-y += lowlevel.o diff --git a/arch/arm/boards/element14-warp7/board.c b/arch/arm/boards/element14-warp7/board.c new file mode 100644 index 000000000..84fc885da --- /dev/null +++ b/arch/arm/boards/element14-warp7/board.c @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2017 Sascha Hauer, Pengutronix + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include <common.h> +#include <init.h> +#include <environment.h> +#include <mach/bbu.h> +#include <asm/armlinux.h> +#include <generated/mach-types.h> +#include <partition.h> +#include <mach/generic.h> +#include <linux/sizes.h> + +static int warp7_devices_init(void) +{ + if (!of_machine_is_compatible("warp,imx7s-warp")) + return 0; + + imx6_bbu_internal_mmc_register_handler("mmc", "/dev/mmc2.boot0.barebox", + BBU_HANDLER_FLAG_DEFAULT); + + return 0; +} +device_initcall(warp7_devices_init); diff --git a/arch/arm/boards/element14-warp7/flash-header-mx7-warp.imxcfg b/arch/arm/boards/element14-warp7/flash-header-mx7-warp.imxcfg new file mode 100644 index 000000000..a3389218d --- /dev/null +++ b/arch/arm/boards/element14-warp7/flash-header-mx7-warp.imxcfg @@ -0,0 +1,81 @@ +/* + * Copyright (C) 2016 NXP Semiconductors + * + * SPDX-License-Identifier: GPL-2.0 + * + * Refer docs/README.imxmage for more details about how-to configure + * and create imximage boot image + * + * The syntax is taken as close as possible with the kwbimage + */ + +soc imx7 +loadaddr 0x80000000 +dcdofs 0x400 + +wm 32 0x30340004 0x4F400005 + +wm 32 0x30391000 0x00000002 +wm 32 0x307a0000 0x03040008 +wm 32 0x307a0064 0x00200038 +wm 32 0x307a0490 0x00000001 +wm 32 0x307a00d0 0x00350001 +wm 32 0x307a00dc 0x00c3000a +wm 32 0x307a00e0 0x00010000 +wm 32 0x307a00e4 0x00110006 +wm 32 0x307a00f4 0x0000033f +wm 32 0x307a0100 0x0a0e110b +wm 32 0x307a0104 0x00020211 +wm 32 0x307a0108 0x03060708 +wm 32 0x307a010c 0x00a0500c +wm 32 0x307a0110 0x05020307 +wm 32 0x307a0114 0x02020404 +wm 32 0x307a0118 0x02020003 +wm 32 0x307a011c 0x00000202 +wm 32 0x307a0120 0x00000202 + +wm 32 0x307a0180 0x00600018 +wm 32 0x307a0184 0x00e00100 +wm 32 0x307a0190 0x02098205 +wm 32 0x307a0194 0x00060303 +wm 32 0x307a01a0 0x80400003 +wm 32 0x307a01a4 0x00100020 +wm 32 0x307a01a8 0x80100004 + +wm 32 0x307a0200 0x00000015 +wm 32 0x307a0204 0x00161616 +wm 32 0x307a0210 0x00000f0f +wm 32 0x307a0214 0x04040404 +wm 32 0x307a0218 0x0f0f0404 + +wm 32 0x307a0240 0x06000600 +wm 32 0x307a0244 0x00000000 +wm 32 0x30391000 0x00000000 +wm 32 0x30790000 0x17421e40 +wm 32 0x30790004 0x10210100 +wm 32 0x30790008 0x00010000 +wm 32 0x30790010 0x0007080c +wm 32 0x307900b0 0x1010007e + +wm 32 0x3079001C 0x01010000 +wm 32 0x3079009c 0x00000d6e + +wm 32 0x30790030 0x06060606 +wm 32 0x30790020 0x0a0a0a0a +wm 32 0x30790050 0x01000008 +wm 32 0x30790050 0x00000008 +wm 32 0x30790018 0x0000000f +wm 32 0x307900c0 0x0e487304 +wm 32 0x307900c0 0x0e4c7304 +wm 32 0x307900c0 0x0e4c7306 +wm 32 0x307900c0 0x0e4c7304 + +check 32 while_any_bit_clear 0x307900c4 0x1 + +wm 32 0x307900c0 0x0e487304 + +wm 32 0x30384130 0x00000000 +wm 32 0x30340020 0x00000178 +wm 32 0x30384130 0x00000002 + +check 32 while_any_bit_clear 0x307a0004 0x1 diff --git a/arch/arm/boards/element14-warp7/lowlevel.c b/arch/arm/boards/element14-warp7/lowlevel.c new file mode 100644 index 000000000..98d8b6436 --- /dev/null +++ b/arch/arm/boards/element14-warp7/lowlevel.c @@ -0,0 +1,48 @@ +#define DEBUG +#include <io.h> +#include <common.h> +#include <linux/sizes.h> +#include <mach/generic.h> +#include <asm/barebox-arm-head.h> +#include <asm/barebox-arm.h> +#include <mach/debug_ll.h> +#include <asm/cache.h> + +extern char __dtb_imx7s_warp_start[]; + +static noinline void warp7_start(void) +{ + void __iomem *iomuxbase = IOMEM(MX7_IOMUX_BASE_ADDR); + void __iomem *uart = IOMEM(MX7_UART1_BASE_ADDR); + void __iomem *ccmbase = IOMEM(MX7_CCM_BASE_ADDR); + void *fdt; + + writel(0x3, ccmbase + 0x4000 + 16 * 148 + 0x8); + writel(0x10000000, ccmbase + 0x8000 + 128 * 95); + writel(0x3, ccmbase + 0x4000 + 16 * 148 + 0x4); + writel(0x0, iomuxbase + 0x128); + writel(0x0, iomuxbase + 0x12c); + + imx7_uart_setup(uart); + + pbl_set_putc(imx_uart_putc, uart); + + pr_debug("Element14 i.MX7 Warp\n"); + + fdt = __dtb_imx7s_warp_start - get_runtime_offset(); + + barebox_arm_entry(0x80000000, SZ_512M, fdt); +} + +ENTRY_FUNCTION(start_imx7s_element14_warp7, r0, r1, r2) +{ + imx7_cpu_lowlevel_init(); + + arm_early_mmu_cache_invalidate(); + + relocate_to_current_adr(); + setup_c(); + barrier(); + + warp7_start(); +} \ No newline at end of file diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index 8ba99577e..6b2fa34f2 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -79,6 +79,7 @@ pbl-dtb-$(CONFIG_MACH_UDOO) += imx6q-udoo.dtb.o pbl-dtb-$(CONFIG_MACH_USI_TOPKICK) += kirkwood-topkick-bb.dtb.o pbl-dtb-$(CONFIG_MACH_VARISCITE_MX6) += imx6q-var-custom.dtb.o pbl-dtb-$(CONFIG_MACH_VSCOM_BALTOS) += am335x-baltos-minimal.dtb.o +pbl-dtb-$(CONFIG_MACH_WARP7) += imx7s-warp.dtb.o pbl-dtb-$(CONFIG_MACH_VF610_TWR) += vf610-twr.dtb.o clean-files := *.dtb *.dtb.S .*.dtc .*.pre .*.dts *.dtb.lzo diff --git a/arch/arm/dts/imx7s-warp.dts b/arch/arm/dts/imx7s-warp.dts new file mode 100644 index 000000000..8741c1384 --- /dev/null +++ b/arch/arm/dts/imx7s-warp.dts @@ -0,0 +1,45 @@ +/* + * The code contained herein is licensed under the GNU General Public + * License. You may obtain a copy of the GNU General Public License + * Version 2 or later at the following locations: + * + * http://www.opensource.org/licenses/gpl-license.html + * http://www.gnu.org/copyleft/gpl.html + */ + +#include <arm/imx7s-warp.dts> +#include "imx7s.dtsi" + +/ { + chosen { + stdout-path = &uart1; + + environment@0 { + compatible = "barebox,environment"; + device-path = &bareboxenv; + }; + }; + + memory { + device_type = "memory"; + reg = <0x80000000 0x20000000>; + }; +}; + +&usdhc3 { + boot0-partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + barebox@0 { + label = "barebox"; + reg = <0x0 0x300000>; + }; + + bareboxenv: bareboxenv@300000 { + label = "bareboxenv"; + reg = <0x300000 0x0>; + }; + }; +}; \ No newline at end of file diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig index fd1ecb6bb..f371ee075 100644 --- a/arch/arm/mach-imx/Kconfig +++ b/arch/arm/mach-imx/Kconfig @@ -39,6 +39,7 @@ config ARCH_TEXT_BASE default 0x4fc00000 if MACH_UDOO default 0x4fc00000 if MACH_VARISCITE_MX6 default 0x4fc00000 if MACH_PHYTEC_SOM_IMX6 + default 0x9fc00000 if MACH_WARP7 config ARCH_IMX_IMXIMAGE bool @@ -350,6 +351,10 @@ config MACH_CM_FX6 bool "CM FX6" select ARCH_IMX6 +config MACH_WARP7 + bool "NXP i.MX7: element 14 WaRP7 Board" + select ARCH_IMX7 + config MACH_VF610_TWR bool "Freescale VF610 Tower Board" select ARCH_VF610 diff --git a/images/Makefile.imx b/images/Makefile.imx index 3b911ec13..08c804888 100644 --- a/images/Makefile.imx +++ b/images/Makefile.imx @@ -409,6 +409,11 @@ CFG_start_imx6dl_eltec_hipercam.pblx.imximg = $(board)/eltec-hipercam/flash-head FILE_barebox-eltec-hipercam.img = start_imx6dl_eltec_hipercam.pblx.imximg image-$(CONFIG_MACH_ELTEC_HIPERCAM) += barebox-eltec-hipercam.img +pblx-$(CONFIG_MACH_WARP7) += start_imx7s_element14_warp7 +CFG_start_imx7s_element14_warp7.pblx.imximg = $(board)/element14-warp7/flash-header-mx7-warp.imxcfg +FILE_barebox-element14-imx7s-warp7.img = start_imx7s_element14_warp7.pblx.imximg +image-$(CONFIG_MACH_WARP7) += barebox-element14-imx7s-warp7.img + pblx-$(CONFIG_MACH_VF610_TWR) += start_vf610_twr CFG_start_vf610_twr.pblx.imximg = $(board)/freescale-vf610-twr/flash-header-vf610-twr.imxcfg FILE_barebox-vf610-twr.img = start_vf610_twr.pblx.imximg -- 2.11.0 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: i.MX7 support 2017-01-16 10:50 i.MX7 support Sascha Hauer ` (22 preceding siblings ...) 2017-01-16 10:51 ` [PATCH 23/23] ARM: i.MX: Add WaRP7 board support Sascha Hauer @ 2017-01-16 10:58 ` Fabio Estevam 2017-01-16 12:58 ` Sascha Hauer 2017-01-16 11:02 ` Belisko Marek 24 siblings, 1 reply; 38+ messages in thread From: Fabio Estevam @ 2017-01-16 10:58 UTC (permalink / raw) To: Sascha Hauer; +Cc: Barebox List Hi Sascha, On Mon, Jan 16, 2017 at 8:50 AM, Sascha Hauer <s.hauer@pengutronix.de> wrote: > One issue remaining is that I am currently unable to reset the board > using the watchdog or the barebox reset command. Out of ideas, will > fix later. Nice work! Have you tried using MX7D_PAD_GPIO1_IO00__WDOD1_WDOG_B pin to reset the board? _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: i.MX7 support 2017-01-16 10:58 ` i.MX7 support Fabio Estevam @ 2017-01-16 12:58 ` Sascha Hauer 2017-01-17 12:07 ` Fabio Estevam 0 siblings, 1 reply; 38+ messages in thread From: Sascha Hauer @ 2017-01-16 12:58 UTC (permalink / raw) To: Fabio Estevam; +Cc: Barebox List Hi Fabio, On Mon, Jan 16, 2017 at 08:58:01AM -0200, Fabio Estevam wrote: > Hi Sascha, > > On Mon, Jan 16, 2017 at 8:50 AM, Sascha Hauer <s.hauer@pengutronix.de> wrote: > > > One issue remaining is that I am currently unable to reset the board > > using the watchdog or the barebox reset command. Out of ideas, will > > fix later. > > Nice work! > > Have you tried using MX7D_PAD_GPIO1_IO00__WDOD1_WDOG_B pin to reset the board? Yes, I did. I configured MX7D_PAD_GPIO1_IO00 as WDOD1_WDOG_B, still my board only hangs. I also tried configuring it as GPIO. When toggling the gpio the board only hangs. I also tried different variations of the watchdog SRS/WDA bits. I think there is some other piece I am missing. Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: i.MX7 support 2017-01-16 12:58 ` Sascha Hauer @ 2017-01-17 12:07 ` Fabio Estevam 2017-01-18 7:07 ` Sascha Hauer 0 siblings, 1 reply; 38+ messages in thread From: Fabio Estevam @ 2017-01-17 12:07 UTC (permalink / raw) To: Sascha Hauer; +Cc: Barebox List Hi Sascha, On Mon, Jan 16, 2017 at 10:58 AM, Sascha Hauer <s.hauer@pengutronix.de> wrote: > Yes, I did. I configured MX7D_PAD_GPIO1_IO00 as WDOD1_WDOG_B, still my > board only hangs. I also tried configuring it as GPIO. When toggling the > gpio the board only hangs. I also tried different variations of the > watchdog SRS/WDA bits. I think there is some other piece I am missing. What is the version of your warp7 board: rev1.0 or rev2.0? The version number is written on the CPU board. warp rev1.0 did not connect the WDOD1_WDOG_B pin to the PMIC and is not capable of resetting the system. warp7 rev2.0 does connect the WDOD1_WDOG_B pin to the PMIC and the reset works fine. I also found a workaround to reset the rev1.0 board: it consists in setting bit 0 of SRC_A7RCR0 register. _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: i.MX7 support 2017-01-17 12:07 ` Fabio Estevam @ 2017-01-18 7:07 ` Sascha Hauer 2017-01-18 9:36 ` Fabio Estevam 0 siblings, 1 reply; 38+ messages in thread From: Sascha Hauer @ 2017-01-18 7:07 UTC (permalink / raw) To: Fabio Estevam; +Cc: Barebox List On Tue, Jan 17, 2017 at 10:07:14AM -0200, Fabio Estevam wrote: > Hi Sascha, > > On Mon, Jan 16, 2017 at 10:58 AM, Sascha Hauer <s.hauer@pengutronix.de> wrote: > > > Yes, I did. I configured MX7D_PAD_GPIO1_IO00 as WDOD1_WDOG_B, still my > > board only hangs. I also tried configuring it as GPIO. When toggling the > > gpio the board only hangs. I also tried different variations of the > > watchdog SRS/WDA bits. I think there is some other piece I am missing. > > What is the version of your warp7 board: rev1.0 or rev2.0? The version > number is written on the CPU board. > > warp rev1.0 did not connect the WDOD1_WDOG_B pin to the PMIC and is > not capable of resetting the system. > > warp7 rev2.0 does connect the WDOD1_WDOG_B pin to the PMIC and the > reset works fine. I have a rev 2.0 board here. Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: i.MX7 support 2017-01-18 7:07 ` Sascha Hauer @ 2017-01-18 9:36 ` Fabio Estevam 2017-01-19 9:14 ` Sascha Hauer 0 siblings, 1 reply; 38+ messages in thread From: Fabio Estevam @ 2017-01-18 9:36 UTC (permalink / raw) To: Sascha Hauer; +Cc: Barebox List On Wed, Jan 18, 2017 at 5:07 AM, Sascha Hauer <s.hauer@pengutronix.de> wrote: > I have a rev 2.0 board here. Does the 'reboot' command in Linux work? _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: i.MX7 support 2017-01-18 9:36 ` Fabio Estevam @ 2017-01-19 9:14 ` Sascha Hauer 2017-01-19 11:54 ` Fabio Estevam 0 siblings, 1 reply; 38+ messages in thread From: Sascha Hauer @ 2017-01-19 9:14 UTC (permalink / raw) To: Fabio Estevam; +Cc: Barebox List On Wed, Jan 18, 2017 at 07:36:57AM -0200, Fabio Estevam wrote: > On Wed, Jan 18, 2017 at 5:07 AM, Sascha Hauer <s.hauer@pengutronix.de> wrote: > > > I have a rev 2.0 board here. > > Does the 'reboot' command in Linux work? Ok, found it. The i.MX7 has two iomux controllers, the regular one and the LPSR iomux controller. In the warp7 and other dts files the LPSR pins are attached to the regular controller, not the LPSR controller. I just sent out a series fixing this, you are on Cc. With U-Boot this problem does not occur since U-Boot uses it's own code to correctly configure the iomux_lpsr controller which is then not touched again from Linux. With this fix reset works in barebox and also reboot under Linux. Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: i.MX7 support 2017-01-19 9:14 ` Sascha Hauer @ 2017-01-19 11:54 ` Fabio Estevam 2017-01-19 12:38 ` Sascha Hauer 0 siblings, 1 reply; 38+ messages in thread From: Fabio Estevam @ 2017-01-19 11:54 UTC (permalink / raw) To: Sascha Hauer; +Cc: Barebox List On Thu, Jan 19, 2017 at 7:14 AM, Sascha Hauer <s.hauer@pengutronix.de> wrote: > Ok, found it. The i.MX7 has two iomux controllers, the regular one and > the LPSR iomux controller. In the warp7 and other dts files the LPSR > pins are attached to the regular controller, not the LPSR controller. > I just sent out a series fixing this, you are on Cc. > With U-Boot this problem does not occur since U-Boot uses it's own code > to correctly configure the iomux_lpsr controller which is then not > touched again from Linux. > With this fix reset works in barebox and also reboot under Linux. Thanks for the fix! _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: i.MX7 support 2017-01-19 11:54 ` Fabio Estevam @ 2017-01-19 12:38 ` Sascha Hauer 2017-01-19 17:32 ` Fabio Estevam 0 siblings, 1 reply; 38+ messages in thread From: Sascha Hauer @ 2017-01-19 12:38 UTC (permalink / raw) To: Fabio Estevam; +Cc: Barebox List Hi Fabio, On Thu, Jan 19, 2017 at 09:54:57AM -0200, Fabio Estevam wrote: > On Thu, Jan 19, 2017 at 7:14 AM, Sascha Hauer <s.hauer@pengutronix.de> wrote: > > > Ok, found it. The i.MX7 has two iomux controllers, the regular one and > > the LPSR iomux controller. In the warp7 and other dts files the LPSR > > pins are attached to the regular controller, not the LPSR controller. > > I just sent out a series fixing this, you are on Cc. > > With U-Boot this problem does not occur since U-Boot uses it's own code > > to correctly configure the iomux_lpsr controller which is then not > > touched again from Linux. > > With this fix reset works in barebox and also reboot under Linux. > > Thanks for the fix! I have one issue with starting the kernel on i.MX7. The architected timer does not work. In U-Boot I found arch/arm/imx-common/syscounter.c in which the system counter is initialized. I just copied the code and it works, but I wonder what I am doing here. I can't find any documentation in the Reference Manual and also the 8MHz tick rate for the architected timer seems to fall from the sky. Do you have any additional documentation? Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: i.MX7 support 2017-01-19 12:38 ` Sascha Hauer @ 2017-01-19 17:32 ` Fabio Estevam 0 siblings, 0 replies; 38+ messages in thread From: Fabio Estevam @ 2017-01-19 17:32 UTC (permalink / raw) To: Sascha Hauer; +Cc: Barebox List Hi Sascha, On Thu, Jan 19, 2017 at 10:38 AM, Sascha Hauer <s.hauer@pengutronix.de> wrote: > I have one issue with starting the kernel on i.MX7. The architected > timer does not work. In U-Boot I found arch/arm/imx-common/syscounter.c > in which the system counter is initialized. I just copied the code and > it works, but I wonder what I am doing here. I can't find any > documentation in the Reference Manual and also the 8MHz tick rate for > the architected timer seems to fall from the sky. Do you have any > additional documentation? Let me try to get this information. Will let you know if I find out. _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: i.MX7 support 2017-01-16 10:50 i.MX7 support Sascha Hauer ` (23 preceding siblings ...) 2017-01-16 10:58 ` i.MX7 support Fabio Estevam @ 2017-01-16 11:02 ` Belisko Marek 2017-01-16 11:38 ` Robert Schwebel 24 siblings, 1 reply; 38+ messages in thread From: Belisko Marek @ 2017-01-16 11:02 UTC (permalink / raw) To: Sascha Hauer; +Cc: Barebox List Hi Sascha, On Mon, Jan 16, 2017 at 11:50 AM, Sascha Hauer <s.hauer@pengutronix.de> wrote: > The following series adds i.MX7 support to barebox. The port > was done on the WaRP7 board. The board starts, eMMC, USB and serial work. > This board does not have ethernet or NAND, so supporting this is > left for a later exercise. > > It will be some additional fun to support the 2nd CPU for i.MX7d as we'll > need PSCI support then. So far we are limited to a single core, but > the only currently supported board is single core anyway. > > One issue remaining is that I am currently unable to reset the board > using the watchdog or the barebox reset command. Out of ideas, will > fix later. imx7 has know problem that cannot be reset by softreset only by external signal as Fabio suggested. > > Sascha > > > ---------------------------------------------------------------- > Juergen Borleis (10): > imx-usb-loader: let constant data be const > imx-usb-loader: this table is used internally only, so keep it static > imx-usb-loader: add i.MX7S support > ARM: Makefile: format fix > ARM: i.MX: Add i.MX7 base architecture support > clk: i.MX: Add clock support for i.MX7 > ARM: i.MX: gpt: Add i.MX7 support > pinmmux: i.MX: add pin mux support for i.MX7 > serial: i.MX: add i.MX7 support > ARM: i.MX: Add WaRP7 board support > > Sascha Hauer (13): > i2c: i.MX: Enable clock > mci: imx-esdhc: Enable clock > serial: i.MX: Enable clock > usb: imx: Make usb-misc multi instance safe > usb: imx: Add usbmisc support for i.MX7 > usb: imx: Add clock support > phy: usb-nop-xceiv: Add clock support > of: partitions: force "partitions" subnode > mci: Allow to partition eMMC boot partitions > mci: imx-esdhci: remove wrong write protection test > clk: i.MX: pllv3: Add support for the i.MX7 enet pll > clk: imx: Add clk-cpu support > clk: i.MX7: Add missing USB clocks > > Documentation/boards/imx.rst | 1 + > Documentation/boards/imx/Element14-WaRP7.rst | 54 ++ > arch/arm/Makefile | 2 +- > arch/arm/boards/Makefile | 1 + > arch/arm/boards/element14-warp7/Makefile | 2 + > arch/arm/boards/element14-warp7/board.c | 35 + > .../element14-warp7/flash-header-mx7-warp.imxcfg | 81 ++ > arch/arm/boards/element14-warp7/lowlevel.c | 48 ++ > arch/arm/dts/Makefile | 1 + > arch/arm/dts/imx7s-warp.dts | 45 ++ > arch/arm/mach-imx/Kconfig | 9 + > arch/arm/mach-imx/Makefile | 1 + > arch/arm/mach-imx/boot.c | 70 ++ > arch/arm/mach-imx/clocksource.c | 6 +- > arch/arm/mach-imx/cpu_init.c | 5 + > arch/arm/mach-imx/imx.c | 6 + > arch/arm/mach-imx/imx7.c | 75 ++ > arch/arm/mach-imx/include/mach/debug_ll.h | 3 + > arch/arm/mach-imx/include/mach/generic.h | 16 + > arch/arm/mach-imx/include/mach/imx7-regs.h | 23 + > arch/arm/mach-imx/include/mach/imx7.h | 59 ++ > arch/arm/mach-imx/include/mach/imx_cpu_types.h | 1 + > common/Kconfig | 8 + > drivers/clk/imx/Makefile | 2 + > drivers/clk/imx/clk-cpu.c | 110 +++ > drivers/clk/imx/clk-imx7.c | 881 +++++++++++++++++++++ > drivers/clk/imx/clk-pllv3.c | 23 +- > drivers/clk/imx/clk.h | 33 + > drivers/i2c/busses/i2c-imx.c | 1 + > drivers/mci/imx-esdhc.c | 15 +- > drivers/mci/mci-core.c | 78 +- > drivers/of/partition.c | 12 +- > drivers/phy/usb-nop-xceiv.c | 18 +- > drivers/pinctrl/imx-iomux-v3.c | 5 +- > drivers/serial/serial_imx.c | 4 + > drivers/usb/imx/chipidea-imx.c | 22 +- > drivers/usb/imx/imx-usb-misc.c | 87 +- > images/Makefile.imx | 5 + > include/mci.h | 1 + > include/serial/imx-uart.h | 5 + > include/usb/chipidea-imx.h | 4 +- > scripts/imx/imx-usb-loader.c | 21 +- > scripts/imx/imx.c | 1 + > 43 files changed, 1803 insertions(+), 77 deletions(-) > create mode 100644 Documentation/boards/imx/Element14-WaRP7.rst > create mode 100644 arch/arm/boards/element14-warp7/Makefile > create mode 100644 arch/arm/boards/element14-warp7/board.c > create mode 100644 arch/arm/boards/element14-warp7/flash-header-mx7-warp.imxcfg > create mode 100644 arch/arm/boards/element14-warp7/lowlevel.c > create mode 100644 arch/arm/dts/imx7s-warp.dts > create mode 100644 arch/arm/mach-imx/imx7.c > create mode 100644 arch/arm/mach-imx/include/mach/imx7-regs.h > create mode 100644 arch/arm/mach-imx/include/mach/imx7.h > create mode 100644 drivers/clk/imx/clk-cpu.c > create mode 100644 drivers/clk/imx/clk-imx7.c > > > _______________________________________________ > barebox mailing list > barebox@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/barebox BR, marek -- as simple and primitive as possible ------------------------------------------------- Marek Belisko - OPEN-NANDRA Freelance Developer Ruska Nova Ves 219 | Presov, 08005 Slovak Republic Tel: +421 915 052 184 skype: marekwhite twitter: #opennandra web: http://open-nandra.com _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: i.MX7 support 2017-01-16 11:02 ` Belisko Marek @ 2017-01-16 11:38 ` Robert Schwebel 2017-01-16 11:51 ` Belisko Marek 0 siblings, 1 reply; 38+ messages in thread From: Robert Schwebel @ 2017-01-16 11:38 UTC (permalink / raw) To: Belisko Marek; +Cc: Barebox List On Mon, Jan 16, 2017 at 12:02:47PM +0100, Belisko Marek wrote: > > One issue remaining is that I am currently unable to reset the board > > using the watchdog or the barebox reset command. Out of ideas, will > > fix later. > > imx7 has know problem that cannot be reset by softreset only by > external signal as Fabio suggested. Do you have a reference what exactly is broken? I didn't find anything reset- or watchdog related in the errata sheet. rsc -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: i.MX7 support 2017-01-16 11:38 ` Robert Schwebel @ 2017-01-16 11:51 ` Belisko Marek 0 siblings, 0 replies; 38+ messages in thread From: Belisko Marek @ 2017-01-16 11:51 UTC (permalink / raw) To: Robert Schwebel; +Cc: Barebox List On Mon, Jan 16, 2017 at 12:38 PM, Robert Schwebel <r.schwebel@pengutronix.de> wrote: > On Mon, Jan 16, 2017 at 12:02:47PM +0100, Belisko Marek wrote: >> > One issue remaining is that I am currently unable to reset the board >> > using the watchdog or the barebox reset command. Out of ideas, will >> > fix later. >> >> imx7 has know problem that cannot be reset by softreset only by >> external signal as Fabio suggested. > > Do you have a reference what exactly is broken? I didn't find anything > reset- or watchdog related in the errata sheet. Sorry no reference. We have developed board on imx7 and hit the same issue. > > rsc > -- > Pengutronix e.K. | | > Industrial Linux Solutions | http://www.pengutronix.de/ | > Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | > Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | BR, marek -- as simple and primitive as possible ------------------------------------------------- Marek Belisko - OPEN-NANDRA Freelance Developer Ruska Nova Ves 219 | Presov, 08005 Slovak Republic Tel: +421 915 052 184 skype: marekwhite twitter: #opennandra web: http://open-nandra.com _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 38+ messages in thread
end of thread, other threads:[~2017-01-19 17:33 UTC | newest] Thread overview: 38+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2017-01-16 10:50 i.MX7 support Sascha Hauer 2017-01-16 10:50 ` [PATCH 01/23] imx-usb-loader: let constant data be const Sascha Hauer 2017-01-16 10:50 ` [PATCH 02/23] imx-usb-loader: this table is used internally only, so keep it static Sascha Hauer 2017-01-16 11:29 ` Juergen Borleis 2017-01-16 10:50 ` [PATCH 03/23] imx-usb-loader: add i.MX7S support Sascha Hauer 2017-01-16 10:50 ` [PATCH 04/23] ARM: Makefile: format fix Sascha Hauer 2017-01-16 10:50 ` [PATCH 05/23] i2c: i.MX: Enable clock Sascha Hauer 2017-01-16 10:50 ` [PATCH 06/23] mci: imx-esdhc: " Sascha Hauer 2017-01-16 10:50 ` [PATCH 07/23] serial: i.MX: " Sascha Hauer 2017-01-16 10:50 ` [PATCH 08/23] usb: imx: Make usb-misc multi instance safe Sascha Hauer 2017-01-16 10:50 ` [PATCH 09/23] usb: imx: Add usbmisc support for i.MX7 Sascha Hauer 2017-01-16 10:50 ` [PATCH 10/23] usb: imx: Add clock support Sascha Hauer 2017-01-16 10:50 ` [PATCH 11/23] phy: usb-nop-xceiv: " Sascha Hauer 2017-01-16 10:50 ` [PATCH 12/23] of: partitions: force "partitions" subnode Sascha Hauer 2017-01-16 10:50 ` [PATCH 13/23] mci: Allow to partition eMMC boot partitions Sascha Hauer 2017-01-16 10:50 ` [PATCH 14/23] mci: imx-esdhci: remove wrong write protection test Sascha Hauer 2017-01-16 10:51 ` [PATCH 15/23] ARM: i.MX: Add i.MX7 base architecture support Sascha Hauer 2017-01-16 10:51 ` [PATCH 16/23] clk: i.MX: pllv3: Add support for the i.MX7 enet pll Sascha Hauer 2017-01-16 10:51 ` [PATCH 17/23] clk: imx: Add clk-cpu support Sascha Hauer 2017-01-16 10:51 ` [PATCH 18/23] clk: i.MX: Add clock support for i.MX7 Sascha Hauer 2017-01-16 10:51 ` [PATCH 19/23] clk: i.MX7: Add missing USB clocks Sascha Hauer 2017-01-16 10:51 ` [PATCH 20/23] ARM: i.MX: gpt: Add i.MX7 support Sascha Hauer 2017-01-16 11:35 ` Juergen Borleis 2017-01-16 10:51 ` [PATCH 21/23] pinmmux: i.MX: add pin mux support for i.MX7 Sascha Hauer 2017-01-16 10:51 ` [PATCH 22/23] serial: i.MX: add i.MX7 support Sascha Hauer 2017-01-16 10:51 ` [PATCH 23/23] ARM: i.MX: Add WaRP7 board support Sascha Hauer 2017-01-16 10:58 ` i.MX7 support Fabio Estevam 2017-01-16 12:58 ` Sascha Hauer 2017-01-17 12:07 ` Fabio Estevam 2017-01-18 7:07 ` Sascha Hauer 2017-01-18 9:36 ` Fabio Estevam 2017-01-19 9:14 ` Sascha Hauer 2017-01-19 11:54 ` Fabio Estevam 2017-01-19 12:38 ` Sascha Hauer 2017-01-19 17:32 ` Fabio Estevam 2017-01-16 11:02 ` Belisko Marek 2017-01-16 11:38 ` Robert Schwebel 2017-01-16 11:51 ` Belisko Marek
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox