Skip to contentSkip to conversation

imx: dm: Update mccmon6 board to only use DM/DTS in u-boot proper

PATCH Superseded Lukasz Majewski 2 participants 24 messages Jan 31, 2019

Subsystems (7)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v2 cover imx: dm: Update mccmon6 board to only use DM/DTS in u-boot proper

This patch series converts mccmon6 to use Driver Model and Device Tree in u-boot proper.
As the SPL is size constrained (and most notably the device has a strict boot time requirements) for this board (and uses falcon boot)
- its conversion to DM/DTB will be added with separate patch series.

In the SPL/u-boot proper it now uses fitImage instead of legacy uImage and DTB.

First patches are responsible for porting Linux's Common Clock Framework [CCF] to u-boot. They add only support for reading clock frequencies and enabling gate'd clocks.

Some notable changes:
- Use fitImage to boot Linux kernel (and also use of SPL's Falcon mode when running from parallel NOR flash)
- DTS sync with kernel (tag: v4.20)
- Decoupling SPL and u-boot proper for easy SPL DM/DTS conversion
- Adding CONFIG_CLK for IMX6Q (reuse clock.c file functions)
- Conversion to DM_MMC, DM_SPI, and BLK (u-boot proper)
- Removal of DM_USB (as this board is not using it - no connector present)
- Port of CCF (tag: 5.0-rc3) for imx6q ('dm tree', 'clk dump') (more information regarding design decisions in the patch commit message).

Footprint changes (u-boot.imx):
Before conversion: 345 KiB
DM conversion (without CCF): 415 KiB
With CCF: 421 KiB

Buildman CI:

./tools/buildman/buildman.py --branch=HEAD imx6 mccmon6 --detail \
	--verbose --show_errors --force-build --count=17 \
	--output-dir=../BUILD/

Travis-CI:
https://travis-ci.org/lmajewski/u-boot-dfu/builds/486666862

Patches applicable on top of master branch:

    SHA1: 535d74a8ae8d194269cefdf59ae17a92cd6e75dc

Changes in v2:
- Port the Common Clock Framework from Linux to U-boot (tag: 5.0-rc3)

Lukasz Majewski (17):
dm: Fix documentation entry as there is no UCLASS_CLOCK uclass
cmd: Do not show frequency for clocks which .get_rate() return error
dm: clk: Define clk_get_parent_rate() for clk operations
dm: clk: Define clk_get_by_id() for clk operations
clk: Port Linux common clock framework [CCF] for imx6q to U-boot (tag:

    5.0-rc3)

ARM: imx: cosmetic: Remove not needed comment from the mccmon6.h file
ARM: imx: config: Disable support for USB on MCCMON6
net: imx: Add support for waiting some time after FEC gpio reset
spi: imx: Add support for 'per' clock enabling via driver model
ARM: imx: Covnert mccmon6 to use DM/DTS in the u-boot proper
ARM: imx: Decouple mccmon6's SPL and u-boot proper code
ARM: imx: Disable 1Gbps support on MCCMON6's KSZ9031 PHY
Kconfig: Make CMD_SPL_NAND_OFS only available when proper memory is
used
Kconfig: cosmetic: Update description of CMD_SPL_NAND_OFS
Kconfig: Add CMD_SPL_NOR_OFS config for falcon boot argument offset
doc: Update parallel NOR flash related information in README.falcon
imx: Convert mccmon6 to use fitImage instead of uImage+DTB

 arch/arm/dts/imx6q-mccmon6.dts   | 382 +++++++++++++++++++++++++++++++++
 arch/arm/mach-imx/mx6/Kconfig    |   7 +
 board/liebherr/mccmon6/Makefile  |   7 +-
 board/liebherr/mccmon6/mccmon6.c | 446 ---------------------------------------
 board/liebherr/mccmon6/spl.c     | 271 +++++++++++++++++++++++-
 cmd/Kconfig                      |  12 +-
 cmd/clk.c                        |   5 +-
 common/spl/spl_nor.c             |   5 +
 configs/mccmon6_nor_defconfig    |  40 +++-
 configs/mccmon6_sd_defconfig     |  37 +++-
 doc/README.falcon                |   3 +
 drivers/clk/Kconfig              |   7 +
 drivers/clk/Makefile             |   2 +
 drivers/clk/clk-divider.c        | 148 +++++++++++++
 drivers/clk/clk-fixed-factor.c   |  87 ++++++++
 drivers/clk/clk-mux.c            | 164 ++++++++++++++
 drivers/clk/clk-uclass.c         |  63 ++++++
 drivers/clk/clk.c                |  56 +++++
 drivers/clk/imx/Kconfig          |   8 +
 drivers/clk/imx/Makefile         |   2 +
 drivers/clk/imx/clk-gate2.c      | 113 ++++++++++
 drivers/clk/imx/clk-imx6q.c      | 179 ++++++++++++++++
 drivers/clk/imx/clk-pfd.c        |  91 ++++++++
 drivers/clk/imx/clk-pllv3.c      |  83 ++++++++
 drivers/clk/imx/clk.h            |  75 +++++++
 drivers/net/fec_mxc.c            |  11 +
 drivers/net/fec_mxc.h            |   1 +
 drivers/spi/mxc_spi.c            |  17 ++
 include/clk.h                    |  22 +-
 include/configs/mccmon6.h        |  83 +++-----
 include/linux/clk-provider.h     |  94 +++++++++
 31 files changed, 1998 insertions(+), 523 deletions(-)
 create mode 100644 arch/arm/dts/imx6q-mccmon6.dts
 create mode 100644 drivers/clk/clk-divider.c
 create mode 100644 drivers/clk/clk-fixed-factor.c
 create mode 100644 drivers/clk/clk-mux.c
 create mode 100644 drivers/clk/clk.c
 create mode 100644 drivers/clk/imx/clk-gate2.c
 create mode 100644 drivers/clk/imx/clk-imx6q.c
 create mode 100644 drivers/clk/imx/clk-pfd.c
 create mode 100644 drivers/clk/imx/clk-pllv3.c
 create mode 100644 drivers/clk/imx/clk.h
 create mode 100644 include/linux/clk-provider.h
Signature · 1 line
2.11.0
#1 lore raw

PATCH v2 1/17 dm: Fix documentation entry as there is no UCLASS_CLOCK uclass

There is no UCLASS_CLOCK uclass defined. Instead we do use the UCLASS_CLK.

---

Changes in v2: None

 include/clk.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/clk.h +1 -1
index 8e366163f9..f6fbcc6634 100644
@@ -19,7 +19,7 @@
  * clock provider. This API provides a standard means for drivers to enable and
  * disable clocks, and to set the rate at which they oscillate.
  *
- * A driver that implements UCLASS_CLOCK is a clock provider. A provider will
+ * A driver that implements UCLASS_CLK is a clock provider. A provider will
  * often implement multiple separate clocks, since the hardware it manages
  * often has this capability. clk-uclass.h describes the interface which
  * clock providers must implement.
Signature · 1 line
2.11.0
#3 lore raw

PATCH v2 2/17 cmd: Do not show frequency for clocks which .get_rate() return error

In reply to Lukasz Majewski

It may happen that some UCLASS_CLK clocks drivers work as a "managers", to call other, proper clocks. This situation is present in the iMX{6|8} clocks when supporting CONFIG_CLK (and CCF).

To avoid bogus output of "clk dump" we omit clocks which return error value - allowing reusing default implementation of this command.

---

Changes in v2: None

 cmd/clk.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
cmd/clk.c +4 -1
index fd4231589c..2ea82176aa 100644
@@ -16,6 +16,7 @@ int __weak soc_clk_dump(void)
 	struct udevice *dev;
 	struct uclass *uc;
 	struct clk clk;
+	ulong rate;
 	int ret;
 
 	/* Device addresses start at 1 */
@@ -37,7 +38,9 @@ int __weak soc_clk_dump(void)
 			continue;
 		}
 
-		printf("%-30.30s : %lu Hz\n", dev->name, clk_get_rate(&clk));
+		rate = clk_get_rate(&clk);
+		if (!IS_ERR_VALUE(rate))
+			printf("%-30.30s : %lu Hz\n", dev->name, rate);
 
 		clk_free(&clk);
 	}
Signature · 1 line
2.11.0
#4 lore raw

PATCH v2 2/17 cmd: Do not show frequency for clocks which .get_rate() return error

+Stephen

Quoted 8 lines · Lukasz Majewski

It may happen that some UCLASS_CLK clocks drivers work as a "managers", to call other, proper clocks. This situation is present in the iMX{6|8} clocks when supporting CONFIG_CLK (and CCF).

To avoid bogus output of "clk dump" we omit clocks which return error value - allowing reusing default implementation of this command.

Quoted 7 lines

---

Changes in v2: None

 cmd/clk.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
#5 lore raw

PATCH v2 3/17 dm: clk: Define clk_get_parent_rate() for clk operations

In reply to Lukasz Majewski

This commit adds the clk_get_parent_rate() function, which is responsible for getting the rate of parent clock.
Unfortunately, u-boot's DM support for getting parent is different (the parent relationship is in udevice) than the one in common clock framework (CCF) in Linux.

To alleviate this problem - the clk_get_parent_rate() function has been introduced to clk-uclass.c.

As written in the in-code comment - some clocks do not set clk->id (and require it to be set to 0) and hence the standard ckl_{request|get_rate| free} API is used.

---

Changes in v2: None

 drivers/clk/clk-uclass.c | 41 +++++++++++++++++++++++++++++++++++++++++
 include/clk.h            |  9 +++++++++
 2 files changed, 50 insertions(+)
drivers/clk/clk-uclass.c +41 -0
index 6d7a514006..f1640dda67 100644
@@ -340,6 +340,47 @@ ulong clk_get_rate(struct clk *clk)
 	return ops->get_rate(clk);
 }
 
+ulong clk_get_parent_rate(struct clk *clk)
+{
+	const struct clk_ops *ops;
+	struct udevice *pdev;
+	struct clk pclk;
+	ulong rate;
+	int ret;
+
+	debug("%s(clk=%p)\n", __func__, clk);
+
+	pdev = clk->dev->parent;
+	if (!pdev)
+		return -ENODEV;
+
+	ops = clk_dev_ops(pdev);
+	if (!ops->get_rate)
+		return -ENOSYS;
+
+	/*
+	 * We do use memset, clk_{request|get_rate|free}
+	 * as there are clocks - like the "fixed" ones, which
+	 * doesn't posses the clk wrapper struct (just added to
+	 * UCLASS_CLK) and explicitly check if clk->id = 0.
+	 *
+	 * In fact the "clock" resources (like ops, description)
+	 * are accessed via udevice structure (pdev - parent's one)
+	 */
+
+	memset(&pclk, 0, sizeof(pclk));
+	ret = clk_request(pdev, &pclk);
+	if (ret) {
+		printf("%s: pclk: %s request failed!\n", __func__, pdev->name);
+		return ret;
+	}
+
+	rate = clk_get_rate(&pclk);
+	clk_free(&pclk);
+
+	return rate;
+}
+
 ulong clk_set_rate(struct clk *clk, ulong rate)
 {
 	const struct clk_ops *ops = clk_dev_ops(clk->dev);
include/clk.h +9 -0
index f6fbcc6634..8224295ec3 100644
@@ -238,6 +238,15 @@ int clk_free(struct clk *clk);
 ulong clk_get_rate(struct clk *clk);
 
 /**
+ * clk_get_parent_rate() - Get parent of current clock rate.
+ *
+ * @clk:	A clock struct that was previously successfully requested by
+ *		clk_request/get_by_*().
+ * @return clock rate in Hz, or -ve error code.
+ */
+ulong clk_get_parent_rate(struct clk *clk);
+
+/**
  * clk_set_rate() - Set current clock rate.
  *
  * @clk:	A clock struct that was previously successfully requested by
Signature · 1 line
2.11.0
#6 lore raw

PATCH v2 3/17 dm: clk: Define clk_get_parent_rate() for clk operations

+Stephen

Hi Lukasz,

Quoted 14 lines · Lukasz Majewski

This commit adds the clk_get_parent_rate() function, which is responsible for getting the rate of parent clock.
Unfortunately, u-boot's DM support for getting parent is different (the parent relationship is in udevice) than the one in common clock framework (CCF) in Linux.

To alleviate this problem - the clk_get_parent_rate() function has been introduced to clk-uclass.c.

As written in the in-code comment - some clocks do not set clk->id (and require it to be set to 0) and hence the standard ckl_{request|get_rate| free} API is used.

Quoted 8 lines

---

Changes in v2: None

 drivers/clk/clk-uclass.c | 41 +++++++++++++++++++++++++++++++++++++++++
 include/clk.h            |  9 +++++++++
 2 files changed, 50 insertions(+)

Can we please call this from test/dm/clk.c?

Quoted 10 lines
drivers/clk/clk-uclass.c +1 -0
index 6d7a514006..f1640dda67 100644
@@ -340,6 +340,47 @@ ulong clk_get_rate(struct clk *clk)
        return ops->get_rate(clk);
 }
 
+ulong clk_get_parent_rate(struct clk *clk)

drivers/clk/clk-uclass.c ulong clk_get_rate(struct clk *clk) · line 353

Quoted 10 lines
drivers/clk/clk-uclass.c +10 -0
+{
+       const struct clk_ops *ops;
+       struct udevice *pdev;
+       struct clk pclk;
+       ulong rate;
+       int ret;
+
+       debug("%s(clk=%p)\n", __func__, clk);
+
+       pdev = clk->dev->parent;

dev_get_parent(clk->dev)

drivers/clk/clk-uclass.c ulong clk_get_rate(struct clk *clk) · line 355

Quoted 2 lines
drivers/clk/clk-uclass.c +2 -0
+       if (!pdev)
+               return -ENODEV;

Not needed, all devices have parents except the root, which is not in UCLASS_CLK

Quoted 5 lines
drivers/clk/clk-uclass.c +5 -0
+
+       ops = clk_dev_ops(pdev);
+       if (!ops->get_rate)
+               return -ENOSYS;
+

drivers/clk/clk-uclass.c ulong clk_get_rate(struct clk *clk) · line 370

Quoted 10 lines
drivers/clk/clk-uclass.c +10 -0
+       /*
+        * We do use memset, clk_{request|get_rate|free}
+        * as there are clocks - like the "fixed" ones, which
+        * doesn't posses the clk wrapper struct (just added to
+        * UCLASS_CLK) and explicitly check if clk->id = 0.
+        *
+        * In fact the "clock" resources (like ops, description)
+        * are accessed via udevice structure (pdev - parent's one)
+        */
+

drop blank line. Also is that comment wrapped to use the full number of columns?

Also, this seems like a bug that should be fixed?

Quoted 37 lines
drivers/clk/clk-uclass.c +13 -0
+       memset(&pclk, 0, sizeof(pclk));
+       ret = clk_request(pdev, &pclk);
+       if (ret) {
+               printf("%s: pclk: %s request failed!\n", __func__, pdev->name);
+               return ret;
+       }
+
+       rate = clk_get_rate(&pclk);
+       clk_free(&pclk);
+
+       return rate;
+}
+
 ulong clk_set_rate(struct clk *clk, ulong rate)
 {
        const struct clk_ops *ops = clk_dev_ops(clk->dev);
include/clk.h +9 -1
index f6fbcc6634..8224295ec3 100644
@@ -238,6 +238,15 @@ int clk_free(struct clk *clk);
 ulong clk_get_rate(struct clk *clk);
 
 /**
+ * clk_get_parent_rate() - Get parent of current clock rate.
+ *
+ * @clk:       A clock struct that was previously successfully requested by
+ *             clk_request/get_by_*().
+ * @return clock rate in Hz, or -ve error code.
+ */
+ulong clk_get_parent_rate(struct clk *clk);
+
+/**
  * clk_set_rate() - Set current clock rate.
  *
  * @clk:       A clock struct that was previously successfully requested by
--
Quoted 2 lines

2.11.0

Regards,
Simon

#7 lore raw

PATCH v2 3/17 dm: clk: Define clk_get_parent_rate() for clk operations

Hi Simon,

Quoted 22 lines

+Stephen

Hi Lukasz,

Quoted 17 lines · Lukasz Majewski

This commit adds the clk_get_parent_rate() function, which is responsible for getting the rate of parent clock. Unfortunately, u-boot's DM support for getting parent is different (the parent relationship is in udevice) than the one in common clock framework (CCF) in Linux.

To alleviate this problem - the clk_get_parent_rate() function has been introduced to clk-uclass.c.

As written in the in-code comment - some clocks do not set clk->id (and require it to be set to 0) and hence the standard ckl_{request|get_rate| free} API is used.

---

Quoted 7 lines
Quoted 5 lines

Changes in v2: None

 drivers/clk/clk-uclass.c | 41

+++++++++++++++++++++++++++++++++++++++++ include/clk.h | 9 +++++++++ 2 files changed, 50 insertions(+)

Can we please call this from test/dm/clk.c?

Ok.

Quoted 10 lines
Quoted 10 lines
drivers/clk/clk-uclass.c +0 -0
index 6d7a514006..f1640dda67 100644
@@ -340,6 +340,47 @@ ulong clk_get_rate(struct clk *clk)
        return ops->get_rate(clk);
 }
 
Quoted 13 lines

drivers/clk/clk-uclass.c ulong clk_get_rate(struct clk *clk) · line 353

Quoted 11 lines
drivers/clk/clk-uclass.c +11 -0
+ulong clk_get_parent_rate(struct clk *clk)
+{
+       const struct clk_ops *ops;
+       struct udevice *pdev;
+       struct clk pclk;
+       ulong rate;
+       int ret;
+
+       debug("%s(clk=%p)\n", __func__, clk);
+
+       pdev = clk->dev->parent;  

dev_get_parent(clk->dev)

Yes, correct.

Quoted 6 lines

drivers/clk/clk-uclass.c ulong clk_get_rate(struct clk *clk) · line 355

Quoted 3 lines
drivers/clk/clk-uclass.c +2 -0
+       if (!pdev)
+               return -ENODEV;  

Not needed, all devices have parents except the root, which is not in UCLASS_CLK

Ok.

Quoted 11 lines
Quoted 11 lines
drivers/clk/clk-uclass.c +10 -0
+
+       ops = clk_dev_ops(pdev);
+       if (!ops->get_rate)
+               return -ENOSYS;
+
+       /*
+        * We do use memset, clk_{request|get_rate|free}
+        * as there are clocks - like the "fixed" ones, which
+        * doesn't posses the clk wrapper struct (just added to
+        * UCLASS_CLK) and explicitly check if clk->id = 0.
Quoted 8 lines

drivers/clk/clk-uclass.c ulong clk_get_rate(struct clk *clk) · line 370

Quoted 5 lines
drivers/clk/clk-uclass.c +5 -0
+        *
+        * In fact the "clock" resources (like ops, description)
+        * are accessed via udevice structure (pdev - parent's one)
+        */
+  

drop blank line. Also is that comment wrapped to use the full number of columns?

I will refactor the comment.

Quoted 2 lines

Also, this seems like a bug that should be fixed?

Yes, this seems strange to me:

The main structure passed in the clock API in U-boot is struct clk *clk pointer.

However, the fixed clocks (clk_fixed_rate.c) require the clk->id to be set to 0. This is strange as imposes in practice passing new, memset'ed to 0 clk structure pointer. Moreover, they doesn't have corresponding struct clk definition and exists only linked in UCLASS_CLK.

The pattern to get clock rate:

memset(clk, 0, sizeof(clk);
clk_request(pdev, clk) --> clk->dev = pdev [*]; (this is _the_ defacto
clock assignment)
clk_get_rate(clk)
clk_free(clk)

is also used in socfpga [1] and 'clk dump' command and IMHO is wrong (but I cannot understand why it was done in that way - we _shall_ pass pointer to struct clk, not rely on udevices - like in [*]).

Such approach causes the passed clk pointer to be useless as it is NULL when we call clk_get_rate() recursively.
And for this reason the struct clk *clk pointer is stored in driver_data for udevice.

[1] - arch/arm/mach-socfpga/clock_manager_arria10.c

Quoted 37 lines
Quoted 37 lines
drivers/clk/clk-uclass.c +13 -0
+       memset(&pclk, 0, sizeof(pclk));
+       ret = clk_request(pdev, &pclk);
+       if (ret) {
+               printf("%s: pclk: %s request failed!\n", __func__,
 pdev->name);
+               return ret;
+       }
+
+       rate = clk_get_rate(&pclk);
+       clk_free(&pclk);
+
+       return rate;
+}
+
 ulong clk_set_rate(struct clk *clk, ulong rate)
 {
        const struct clk_ops *ops = clk_dev_ops(clk->dev);
include/clk.h +3 -0
index f6fbcc6634..8224295ec3 100644
@@ -238,6 +238,15 @@ int clk_free(struct clk *clk);
 ulong clk_get_rate(struct clk *clk);
 
 /**
+ * clk_get_parent_rate() - Get parent of current clock rate.
+ *
+ * @clk:       A clock struct that was previously successfully

requested by
+ * clk_request/get_by_*().
+ * @return clock rate in Hz, or -ve error code.
+ */

include/clk.h +3 -0
+ulong clk_get_parent_rate(struct clk *clk);
+
+/**
  * clk_set_rate() - Set current clock rate.
Quoted 8 lines
Quoted 5 lines

*
* @clk: A clock struct that was previously successfully
requested by --
2.11.0

Regards,
Simon

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190131/3ffb682d/attachment.sig>

#8 lore raw

PATCH v2 4/17 dm: clk: Define clk_get_by_id() for clk operations

In reply to Lukasz Majewski

This commit adds the clk_get_by_id() function, which is responsible for getting the udevice with matching clk->id. Such approach allows re-usage of inherit DM list relationship for the same class (UCLASS_CLK). As a result - we don't need any other external list - it is just enough to look for UCLASS_CLK related udevices.

---

Changes in v2: None

 drivers/clk/clk-uclass.c | 22 ++++++++++++++++++++++
 include/clk.h            | 11 +++++++++++
 2 files changed, 33 insertions(+)
drivers/clk/clk-uclass.c +22 -0
index f1640dda67..12ec0baa74 100644
@@ -455,6 +455,28 @@ int clk_disable_bulk(struct clk_bulk *bulk)
 	return 0;
 }
 
+int clk_get_by_id(ulong id, struct clk **c)
+{
+	struct udevice *dev;
+	struct uclass *uc;
+	int ret;
+
+	ret = uclass_get(UCLASS_CLK, &uc);
+	if (ret)
+		return ret;
+
+	uclass_foreach_dev(dev, uc) {
+		struct clk *clk = (struct clk *)dev_get_driver_data(dev);
+
+		if (clk->id == id) {
+			*c = clk;
+			return 0;
+		}
+	}
+
+	return -ENODEV;
+}
+
 UCLASS_DRIVER(clk) = {
 	.id		= UCLASS_CLK,
 	.name		= "clk",
include/clk.h +11 -0
index 8224295ec3..045e60357d 100644
@@ -315,4 +315,15 @@ static inline bool clk_valid(struct clk *clk)
 {
 	return !!clk->dev;
 }
+
+/**
+ * clk_get_by_id() - Get the clock by knowing its ID
+ *
+ * @id:	The clock ID to search for
+ *
+ * @c:	A pointer to clock struct that has been found among added clocks
+ *      to UCLASS_CLK
+ * @return zero on success, or -ve error code.
+ */
+int clk_get_by_id(ulong id, struct clk **c);
 #endif
Signature · 1 line
2.11.0
#9 lore raw

PATCH v2 4/17 dm: clk: Define clk_get_by_id() for clk operations

Quoted 7 lines · Lukasz Majewski

This commit adds the clk_get_by_id() function, which is responsible for getting the udevice with matching clk->id. Such approach allows re-usage of inherit DM list relationship for the same class (UCLASS_CLK). As a result - we don't need any other external list - it is just enough to look for UCLASS_CLK related udevices.

Quoted 9 lines

---

Changes in v2: None

 drivers/clk/clk-uclass.c | 22 ++++++++++++++++++++++
 include/clk.h            | 11 +++++++++++
 2 files changed, 33 insertions(+)

Please add a test that calls this.

drivers/clk/clk-uclass.c int clk_disable_bulk(struct clk_bulk *bulk) · line 458

Quoted 9 lines
drivers/clk/clk-uclass.c +1 -0
index f1640dda67..12ec0baa74 100644
@@ -455,6 +455,28 @@ int clk_disable_bulk(struct clk_bulk *bulk)
        return 0;
 }
 
+int clk_get_by_id(ulong id, struct clk **c)

Can you use clkp instead of c?

Quoted 9 lines
drivers/clk/clk-uclass.c +9 -0
+{
+       struct udevice *dev;
+       struct uclass *uc;
+       int ret;
+
+       ret = uclass_get(UCLASS_CLK, &uc);
+       if (ret)
+               return ret;
+

drivers/clk/clk-uclass.c int clk_disable_bulk(struct clk_bulk *bulk) · line 477

Quoted 10 lines
drivers/clk/clk-uclass.c +10 -0
+       uclass_foreach_dev(dev, uc) {
+               struct clk *clk = (struct clk *)dev_get_driver_data(dev);
+
+               if (clk->id == id) {
+                       *c = clk;
+                       return 0;
+               }
+       }
+
+       return -ENODEV;

I wonder if -ENOENT would be better?

Quoted 12 lines
drivers/clk/clk-uclass.c +2 -0
+}
+
 UCLASS_DRIVER(clk) = {
        .id             = UCLASS_CLK,
        .name           = "clk",
include/clk.h +0 -0
index 8224295ec3..045e60357d 100644
@@ -315,4 +315,15 @@ static inline bool clk_valid(struct clk *clk)
 {
        return !!clk->dev;

include/clk.h static inline bool clk_valid(struct clk *clk) · line 326

Quoted 10 lines
include/clk.h +9 -0
 }
+
+/**
+ * clk_get_by_id() - Get the clock by knowing its ID
+ *
+ * @id:        The clock ID to search for
+ *
+ * @c: A pointer to clock struct that has been found among added clocks
+ *      to UCLASS_CLK
+ * @return zero on success, or -ve error code.

-NOENT on error? I think you can be specific here

Quoted 6 lines
include/clk.h +2 -1
+ */
+int clk_get_by_id(ulong id, struct clk **c);
 #endif
--

2.11.0

Regards,
Simon

#10 lore raw

PATCH v2 4/17 dm: clk: Define clk_get_by_id() for clk operations

Hi Simon,

Quoted 11 lines · Lukasz Majewski
Quoted 10 lines

This commit adds the clk_get_by_id() function, which is responsible for getting the udevice with matching clk->id. Such approach allows re-usage of inherit DM list relationship for the same class (UCLASS_CLK). As a result - we don't need any other external list - it is just enough to look for UCLASS_CLK related udevices.

---

Quoted 8 lines
Quoted 6 lines

Changes in v2: None

 drivers/clk/clk-uclass.c | 22 ++++++++++++++++++++++
 include/clk.h            | 11 +++++++++++
 2 files changed, 33 insertions(+)

Please add a test that calls this.

Ok.

Quoted 9 lines
Quoted 9 lines
drivers/clk/clk-uclass.c +0 -0
index f1640dda67..12ec0baa74 100644
@@ -455,6 +455,28 @@ int clk_disable_bulk(struct clk_bulk *bulk)
        return 0;
 }
 
Quoted 3 lines

drivers/clk/clk-uclass.c int clk_disable_bulk(struct clk_bulk *bulk) · line 458

Quoted 1 line
drivers/clk/clk-uclass.c +1 -0
+int clk_get_by_id(ulong id, struct clk **c)  

Can you use clkp instead of c?

Ok.

Quoted 14 lines
Quoted 14 lines
drivers/clk/clk-uclass.c +12 -0
+{
+       struct udevice *dev;
+       struct uclass *uc;
+       int ret;
+
+       ret = uclass_get(UCLASS_CLK, &uc);
+       if (ret)
+               return ret;
+
+       uclass_foreach_dev(dev, uc) {
+               struct clk *clk = (struct clk
 *)dev_get_driver_data(dev); +
+               if (clk->id == id) {
Quoted 8 lines

drivers/clk/clk-uclass.c int clk_disable_bulk(struct clk_bulk *bulk) · line 477

Quoted 6 lines
drivers/clk/clk-uclass.c +6 -0
+                       *c = clk;
+                       return 0;
+               }
+       }
+
+       return -ENODEV;  

I wonder if -ENOENT would be better?

Yes, it would better describe the situation.

Quoted 18 lines
Quoted 18 lines
drivers/clk/clk-uclass.c +2 -0
+}
+
 UCLASS_DRIVER(clk) = {
        .id             = UCLASS_CLK,
        .name           = "clk",
include/clk.h +4 -0
index 8224295ec3..045e60357d 100644
@@ -315,4 +315,15 @@ static inline bool clk_valid(struct clk *clk)
 {
        return !!clk->dev;
 }
+
+/**
+ * clk_get_by_id() - Get the clock by knowing its ID
+ *
Quoted 8 lines
Quoted 6 lines
include/clk.h +3 -0
+ * @id:        The clock ID to search for
+ *
+ * @c: A pointer to clock struct that has been found among added

clocks
+ * to UCLASS_CLK
+ * @return zero on success, or -ve error code.

-NOENT on error? I think you can be specific here

Ok.

Quoted 10 lines
Quoted 7 lines

+ */
+int clk_get_by_id(ulong id, struct clk **c);
#endif
--
2.11.0

Regards,
Simon

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190131/8ba3c6e7/attachment.sig>

#11 lore raw

PATCH v2 5/17 clk: Port Linux common clock framework [CCF] for imx6q to U-boot (tag: 5.0-rc3)

In reply to Lukasz Majewski

This commit brings the files from Linux kernel to provide clocks support as it is used on the Linux kernel with common clock framework [CCF] setup.

The directory structure has been preserved. The ported code only supports reading information from PLL, MUX, Divider, etc and enabling/disabling the clocks USDHCx/ECSPIx depending on used bus. Moreover, it is agnostic to the alias numbering as the information about the clock is read from device tree.

One needs to pay attention to the comments indicating necessary for U-boot's DM changes.

If needed the code can be extended to support the "set" part of the clock management.

---

Changes in v2: None

Design decisions/issues:

- U-boot's DM for clk differs from Linux CCF. The most notably difference is the lack of support for hierarchical clocks and "clock as a manager driver" (single clock DTS node acts as a starting point for all other clocks).

- The "central" structure of this patch series is struct udevice and its driver_data field contains the struct clk pointer (to the originally created one).

- Clocks access (rate reading) is by following API: clk_request(..,clk), clk_get_rate(clk), clk_free(clk).

Now U-boot only relies on udevice's dev pointer in struct clk and passes cleared clk (memset(clk,0,sizeof(clk)). This is necessary for e.g. clk_fixed_rate.c clocks (and checked explicitly).

- The clk_get_rate() is recursive now (we go up till "osc" clock). This could be improved if necessary

- On purpose the "manager" clk driver (clk-imx6q.c) is not using large table to store pointers to clocks - e.g. clk[IMX6QDL_CLK_USDHC2_SEL] = .... Instead we use udevice's linked list for the same class (UCLASS_CLK). The rationale - when porting the code as is from Linux, one would need ~1KiB of RAM to store it. This is way too much if we do plan to use this driver in SPL.

---
 drivers/clk/Kconfig            |   7 ++
 drivers/clk/Makefile           |   2 +
 drivers/clk/clk-divider.c      | 148 ++++++++++++++++++++++++++++++++++
 drivers/clk/clk-fixed-factor.c |  87 ++++++++++++++++++++
 drivers/clk/clk-mux.c          | 164 +++++++++++++++++++++++++++++++++++++
 drivers/clk/clk.c              |  56 +++++++++++++
 drivers/clk/imx/Kconfig        |   8 ++
 drivers/clk/imx/Makefile       |   2 +
 drivers/clk/imx/clk-gate2.c    | 113 ++++++++++++++++++++++++++
 drivers/clk/imx/clk-imx6q.c    | 179 +++++++++++++++++++++++++++++++++++++++++
 drivers/clk/imx/clk-pfd.c      |  91 +++++++++++++++++++++
 drivers/clk/imx/clk-pllv3.c    |  83 +++++++++++++++++++
 drivers/clk/imx/clk.h          |  75 +++++++++++++++++
 include/linux/clk-provider.h   |  94 ++++++++++++++++++++++
 14 files changed, 1109 insertions(+)
 create mode 100644 drivers/clk/clk-divider.c
 create mode 100644 drivers/clk/clk-fixed-factor.c
 create mode 100644 drivers/clk/clk-mux.c
 create mode 100644 drivers/clk/clk.c
 create mode 100644 drivers/clk/imx/clk-gate2.c
 create mode 100644 drivers/clk/imx/clk-imx6q.c
 create mode 100644 drivers/clk/imx/clk-pfd.c
 create mode 100644 drivers/clk/imx/clk-pllv3.c
 create mode 100644 drivers/clk/imx/clk.h
 create mode 100644 include/linux/clk-provider.h
drivers/clk/Kconfig +7 -0
index 51c931b906..d37c0e86b5 100644
@@ -46,6 +46,13 @@ config CLK_BOSTON
 	help
 	  Enable this to support the clocks
 
+config CLK_CCF
+	bool "Common Clock Framework [CCF] support "
+	depends on CLK
+	help
+	  Enable this option if you want to (re-)use the Linux kernel's Common
+	  Clock Framework [CCF] code in U-Boot's clock driver.
+
 config CLK_STM32F
 	bool "Enable clock driver support for STM32F family"
 	depends on CLK && (STM32F7 || STM32F4)
drivers/clk/Makefile +2 -0
index 6a4ff9143b..d426414ca6 100644
@@ -5,6 +5,8 @@
 #
 
 obj-$(CONFIG_$(SPL_TPL_)CLK) += clk-uclass.o clk_fixed_rate.o
+obj-$(CONFIG_$(SPL_TPL_)CLK_CCF) += clk-fixed-factor.o clk.o clk-divider.o \
+				    clk-mux.o
 
 obj-y += imx/
 obj-y += tegra/
drivers/clk/clk-divider.c new file +148 -0

148 lines not on this page · raw message

drivers/clk/clk-fixed-factor.c new file +87 -0

87 lines not on this page · raw message

drivers/clk/clk-mux.c new file +164 -0

164 lines not on this page · raw message

drivers/clk/clk.c new file +56 -0

56 lines not on this page · raw message

drivers/clk/imx/Kconfig +8 -0
index a6fb58d6cf..ae7bdf1cb5 100644
@@ -1,3 +1,11 @@
+config CLK_IMX6Q
+	bool "Clock support for i.MX6Q"
+	depends on ARCH_MX6
+	select CLK
+	select CLK_CCF
+	help
+	  This enables DM/DTS support for clock driver in i.MX6Q platforms.
+
 config CLK_IMX8
 	bool "Clock support for i.MX8"
 	depends on ARCH_IMX8
drivers/clk/imx/Makefile +2 -0
index 5505ae52e2..beba3bff39 100644
@@ -2,4 +2,6 @@
 #
 # SPDX-License-Identifier: GPL-2.0
 
+obj-$(CONFIG_$(SPL_TPL_)CLK_CCF) += clk-gate2.o clk-pllv3.o clk-pfd.o
+obj-$(CONFIG_CLK_IMX6Q) += clk-imx6q.o
 obj-$(CONFIG_CLK_IMX8) += clk-imx8.o
drivers/clk/imx/clk-gate2.c new file +113 -0

113 lines not on this page · raw message

drivers/clk/imx/clk-imx6q.c new file +179 -0

179 lines not on this page · raw message

drivers/clk/imx/clk-pfd.c new file +91 -0

91 lines not on this page · raw message

drivers/clk/imx/clk-pllv3.c new file +83 -0

83 lines not on this page · raw message

drivers/clk/imx/clk.h new file +75 -0

75 lines not on this page · raw message

include/linux/clk-provider.h new file +94 -0

94 lines not on this page · raw message

Signature · 1 line
2.11.0
#12 lore raw

PATCH v2 6/17 ARM: imx: cosmetic: Remove not needed comment from the mccmon6.h file

In reply to Lukasz Majewski

This comment is a leftover from the Kconfig CONFIG_*MTD* move.

---

Changes in v2: None

 include/configs/mccmon6.h | 2 --
 1 file changed, 2 deletions(-)
include/configs/mccmon6.h +0 -2
index 644f339993..86ab66f3ab 100644
@@ -70,8 +70,6 @@
 #define CONFIG_SYS_FLASH_BANKS_LIST	{ (CONFIG_SYS_FLASH_BASE) }
 #define CONFIG_SYS_FLASH_BANKS_SIZES	{ (32 * SZ_1M) }
 
-/* MTD support */
-
 /* USB Configs */
 #define CONFIG_USB_MAX_CONTROLLER_COUNT	2
 #define CONFIG_MXC_USB_PORTSC		(PORT_PTS_UTMI | PORT_PTS_PTW)
Signature · 1 line
2.11.0
#13 lore raw

PATCH v2 7/17 ARM: imx: config: Disable support for USB on MCCMON6

In reply to Lukasz Majewski

The IMX6Q based MCCMON6 is not using USB for any purpose.

---

Changes in v2: None

 configs/mccmon6_nor_defconfig | 2 --
 configs/mccmon6_sd_defconfig  | 2 --
 include/configs/mccmon6.h     | 5 -----
 3 files changed, 9 deletions(-)
configs/mccmon6_nor_defconfig +0 -2
index 1ab29c1ca6..18070cd0b1 100644
@@ -19,7 +19,6 @@ CONFIG_CMD_GPIO=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_SF=y
-CONFIG_CMD_USB=y
 CONFIG_CMD_CACHE=y
 CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_MTDPARTS=y
@@ -46,5 +45,4 @@ CONFIG_MII=y
 CONFIG_SPI=y
 CONFIG_MXC_SPI=y
 CONFIG_DM_THERMAL=y
-CONFIG_USB=y
 CONFIG_OF_LIBFDT=y
configs/mccmon6_sd_defconfig +0 -2
index 6d47db57ee..d1d1313e1e 100644
@@ -20,7 +20,6 @@ CONFIG_CMD_GPIO=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_SF=y
-CONFIG_CMD_USB=y
 CONFIG_CMD_CACHE=y
 CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_MTDPARTS=y
@@ -47,5 +46,4 @@ CONFIG_MII=y
 CONFIG_SPI=y
 CONFIG_MXC_SPI=y
 CONFIG_DM_THERMAL=y
-CONFIG_USB=y
 CONFIG_OF_LIBFDT=y
include/configs/mccmon6.h +0 -5
index 86ab66f3ab..5ca9bc6848 100644
@@ -70,11 +70,6 @@
 #define CONFIG_SYS_FLASH_BANKS_LIST	{ (CONFIG_SYS_FLASH_BASE) }
 #define CONFIG_SYS_FLASH_BANKS_SIZES	{ (32 * SZ_1M) }
 
-/* USB Configs */
-#define CONFIG_USB_MAX_CONTROLLER_COUNT	2
-#define CONFIG_MXC_USB_PORTSC		(PORT_PTS_UTMI | PORT_PTS_PTW)
-#define CONFIG_MXC_USB_FLAGS		0
-
 /* Ethernet Configuration */
 #define CONFIG_FEC_MXC
 #define IMX_FEC_BASE			ENET_BASE_ADDR
Signature · 1 line
2.11.0
#14 lore raw

PATCH v2 8/17 net: imx: Add support for waiting some time after FEC gpio reset

In reply to Lukasz Majewski

The support for in-kernel (v4.20) "phy-reset-post-delay" property has been implemented in u-boot's FEC IMX driver. It has the same range (1 to 1000ms) as in Linux.

Some PHYs require waiting some time after the reset to be accessible via MII bus. This problem has been observed on mccmon6 board with KSZ9031 PHY IC, when DM_ETH was enabled (as DM slightly changes time between PHY initialization and first access).

---

Changes in v2: None

 drivers/net/fec_mxc.c | 11 +++++++++++
 drivers/net/fec_mxc.h |  1 +
 2 files changed, 12 insertions(+)
drivers/net/fec_mxc.c +11 -0
index 1a59026a62..6305aa5c05 100644
@@ -1315,6 +1315,8 @@ static void fec_gpio_reset(struct fec_priv *priv)
 		dm_gpio_set_value(&priv->phy_reset_gpio, 1);
 		mdelay(priv->reset_delay);
 		dm_gpio_set_value(&priv->phy_reset_gpio, 0);
+		if (priv->post_reset_delay)
+			mdelay(priv->post_reset_delay);
 	}
 }
 #endif
@@ -1474,6 +1476,15 @@ static int fecmxc_ofdata_to_platdata(struct udevice *dev)
 		/* property value wrong, use default value */
 		priv->reset_delay = 1;
 	}
+
+	priv->post_reset_delay = dev_read_u32_default(dev,
+						      "phy-reset-post-delay",
+						      0);
+	if (priv->post_reset_delay > 1000) {
+		printf("FEC MXC: phy reset post delay should be <= 1000ms\n");
+		/* property value wrong, use default value */
+		priv->post_reset_delay = 0;
+	}
 #endif
 
 	return 0;
drivers/net/fec_mxc.h +1 -0
index e9a661f0a1..d069af533a 100644
@@ -258,6 +258,7 @@ struct fec_priv {
 #ifdef CONFIG_DM_GPIO
 	struct gpio_desc phy_reset_gpio;
 	uint32_t reset_delay;
+	u32 post_reset_delay;
 #endif
 #ifdef CONFIG_DM_ETH
 	u32 interface;
Signature · 1 line
2.11.0
#15 lore raw

PATCH v2 9/17 spi: imx: Add support for 'per' clock enabling via driver model

In reply to Lukasz Majewski

With this commit one can enable ECSPI clock on imx6q without the need to define direct call to it in the board file (as it is done up to now).

The information regarding proper clocks is provided via DTS description.

---

Changes in v2: None

 drivers/spi/mxc_spi.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
drivers/spi/mxc_spi.c +17 -0
index 6846762719..f34506099e 100644
@@ -7,6 +7,7 @@
 #include <dm.h>
 #include <malloc.h>
 #include <spi.h>
+#include <clk.h>
 #include <linux/errno.h>
 #include <asm/io.h>
 #include <asm/gpio.h>
@@ -50,6 +51,9 @@ struct mxc_spi_slave {
 	unsigned int	max_hz;
 	unsigned int	mode;
 	struct gpio_desc ss;
+#if CONFIG_IS_ENABLED(CLK)
+	struct clk per_clk;
+#endif
 };
 
 static inline struct mxc_spi_slave *to_mxc_spi_slave(struct spi_slave *slave)
@@ -494,6 +498,19 @@ static int mxc_spi_probe(struct udevice *bus)
 	const void *blob = gd->fdt_blob;
 	int ret;
 
+#if CONFIG_IS_ENABLED(CLK)
+	ret = clk_get_by_name(bus, "per", &mxcs->per_clk);
+	if (ret) {
+		printf("%s: Failed to get per_clk\n", __func__);
+		return ret;
+	}
+
+	ret = clk_enable(&mxcs->per_clk);
+	if (ret) {
+		printf("%s: Failed to enable per_clk\n", __func__);
+		return ret;
+	}
+#endif
 	if (gpio_request_by_name(bus, "cs-gpios", 0, &plat->ss,
 				 GPIOD_IS_OUT)) {
 		dev_err(bus, "No cs-gpios property\n");
Signature · 1 line
2.11.0
#16 lore raw

PATCH v2 10/17 ARM: imx: Covnert mccmon6 to use DM/DTS in the u-boot proper

In reply to Lukasz Majewski

This commit converts mccmon6's u-boot proper (in a single commit to avoid build breaks) to use solely DM/DTS.

The DTS description of the mccmon6 has been ported from Linux kernel (v4.20, SHA1: 8fe28cb58bcb235034b64cbbb7550a8a43fd88be)

---

Changes in v2: None

 arch/arm/dts/imx6q-mccmon6.dts   | 382 +++++++++++++++++++++++++++++++++++++++
 arch/arm/mach-imx/mx6/Kconfig    |   7 +
 board/liebherr/mccmon6/mccmon6.c | 161 -----------------
 configs/mccmon6_nor_defconfig    |  30 ++-
 configs/mccmon6_sd_defconfig     |  29 ++-
 include/configs/mccmon6.h        |  18 --
 6 files changed, 444 insertions(+), 183 deletions(-)
 create mode 100644 arch/arm/dts/imx6q-mccmon6.dts
arch/arm/dts/imx6q-mccmon6.dts new file +382 -0
new file mode 100644
index 0000000000..27cde56115
@@ -0,0 +1,382 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2019
+ * Lukasz Majewski, DENX Software Engineering, lukma at denx.de
+ *
+ * SPDX-License-Identifier:     GPL-2.0+ or X11
+ */
+
+/dts-v1/;
+#include <dt-bindings/gpio/gpio.h>
+#include "imx6q.dtsi"
+
+/ {
+	model = "Liebherr Nenzig (LWN) iMX6Q";
+	compatible = "lwn,imx6-mccmon6", "fsl,imx6";
+
+	aliases {
+		mmc0 = &usdhc3;
+		mmc1 = &usdhc2;
+		spi0 = &ecspi3;
+	};
+
+	chosen {
+		stdout-path = &uart1;
+	};
+
+	memory at 10000000 {
+		reg = <0x10000000 0x80000000>;
+	};
+};
+
+&ecspi3 {
+	cs-gpios = <&gpio4 24 GPIO_ACTIVE_LOW>;
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_ecspi3 &pinctrl_ecspi3_cs &pinctrl_ecspi3_flwp>;
+	spi-max-frequency = <25000000>;
+	status = "okay";
+
+	s25sl032p: flash at 0 {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		compatible = "jedec,spi-nor";
+		spi-max-frequency = <40000000>;
+		reg = <0>;
+	};
+};
+
+&fec {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_enet>;
+	phy-mode = "rgmii";
+	phy-reset-gpios = <&gpio1 27 GPIO_ACTIVE_LOW>;
+	phy-reset-duration = <10>;
+	phy-reset-post-delay = <1>;
+	/* KSZ9031 PHY SKEW setup - old values * 60 ps */
+	rxc-skew-ps = <1860>;
+	txc-skew-ps = <1860>;
+	txen-skew-ps = <900>;
+	rxdv-skew-ps = <900>;
+	rxd0-skew-ps = <180>;
+	rxd1-skew-ps = <180>;
+	rxd2-skew-ps = <180>;
+	rxd3-skew-ps = <180>;
+	txd0-skew-ps = <120>;
+	txd1-skew-ps = <300>;
+	txd2-skew-ps = <0>;
+	txd3-skew-ps = <120>;
+	status = "okay";
+};
+
+&i2c1 {
+	clock-frequency = <100000>;
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_i2c1>;
+	status = "okay";
+};
+
+&i2c2 {
+	clock-frequency = <100000>;
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_i2c2>;
+	status = "okay";
+
+	pfuze100: pmic at 8 {
+		compatible = "fsl,pfuze100";
+		reg = <0x08>;
+
+		regulators {
+			sw1a_reg: sw1ab {
+				regulator-min-microvolt = <300000>;
+				regulator-max-microvolt = <1875000>;
+				regulator-boot-on;
+				regulator-always-on;
+				regulator-ramp-delay = <6250>;
+			};
+
+			sw1c_reg: sw1c {
+				regulator-min-microvolt = <300000>;
+				regulator-max-microvolt = <1875000>;
+				regulator-boot-on;
+				regulator-always-on;
+				regulator-ramp-delay = <6250>;
+			};
+
+			sw2_reg: sw2 {
+				regulator-min-microvolt = <800000>;
+				regulator-max-microvolt = <3950000>;
+				regulator-boot-on;
+				regulator-always-on;
+			};
+
+			sw3a_reg: sw3a {
+				regulator-min-microvolt = <400000>;
+				regulator-max-microvolt = <1975000>;
+				regulator-boot-on;
+				regulator-always-on;
+			};
+
+			sw3b_reg: sw3b {
+				regulator-min-microvolt = <400000>;
+				regulator-max-microvolt = <1975000>;
+				regulator-boot-on;
+				regulator-always-on;
+			};
+
+			sw4_reg: sw4 {
+				regulator-min-microvolt = <800000>;
+				regulator-max-microvolt = <3300000>;
+			};
+
+			swbst_reg: swbst {
+				regulator-min-microvolt = <5000000>;
+				regulator-max-microvolt = <5150000>;
+			};
+
+			snvs_reg: vsnvs {
+				regulator-min-microvolt = <1000000>;
+				regulator-max-microvolt = <3000000>;
+				regulator-boot-on;
+				regulator-always-on;
+			};
+
+			vref_reg: vrefddr {
+				regulator-boot-on;
+				regulator-always-on;
+			};
+
+			vgen1_reg: vgen1 {
+				regulator-min-microvolt = <800000>;
+				regulator-max-microvolt = <1550000>;
+			};
+
+			vgen2_reg: vgen2 {
+				regulator-min-microvolt = <800000>;
+				regulator-max-microvolt = <1550000>;
+			};
+
+			vgen3_reg: vgen3 {
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <3300000>;
+			};
+
+			vgen4_reg: vgen4 {
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-always-on;
+			};
+
+			vgen5_reg: vgen5 {
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-always-on;
+			};
+
+			vgen6_reg: vgen6 {
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-always-on;
+			};
+		};
+	};
+};
+
+&weim {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_weim_nor &pinctrl_weim_cs0>;
+	ranges = <0 0 0x08000000 0x08000000>;
+	status = "okay";
+
+	nor at 0,0 {
+		compatible = "cfi-flash";
+		reg = <0 0 0x02000000>;
+		#address-cells = <1>;
+		#size-cells = <1>;
+		bank-width = <2>;
+		use-advanced-sector-protection;
+		fsl,weim-cs-timing = <0x00620081 0x00000001 0x1c022000
+				0x0000c000 0x1404a38e 0x00000000>;
+	};
+};
+
+&iomuxc {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_hog>;
+
+	pinctrl_ecspi3: ecspi3grp {
+		fsl,pins = <
+			MX6QDL_PAD_DISP0_DAT2__ECSPI3_MISO	0x100b1
+			MX6QDL_PAD_DISP0_DAT1__ECSPI3_MOSI	0x100b1
+			MX6QDL_PAD_DISP0_DAT0__ECSPI3_SCLK	0x100b1
+		>;
+	};
+
+	pinctrl_ecspi3_cs: ecspi3csgrp {
+		fsl,pins = <
+			MX6QDL_PAD_DISP0_DAT3__GPIO4_IO24 0x80000000
+		>;
+	};
+
+	pinctrl_ecspi3_flwp: ecspi3flwpgrp {
+		fsl,pins = <
+			MX6QDL_PAD_DISP0_DAT6__GPIO4_IO27 0x80000000
+		>;
+	};
+
+	pinctrl_enet: enetgrp {
+		fsl,pins = <
+			MX6QDL_PAD_ENET_MDIO__ENET_MDIO		0x1b0b0
+			MX6QDL_PAD_ENET_MDC__ENET_MDC		0x1b0b0
+			MX6QDL_PAD_RGMII_TXC__RGMII_TXC		0x1b0b0
+			MX6QDL_PAD_RGMII_TD0__RGMII_TD0		0x1b0b0
+			MX6QDL_PAD_RGMII_TD1__RGMII_TD1		0x1b0b0
+			MX6QDL_PAD_RGMII_TD2__RGMII_TD2		0x1b0b0
+			MX6QDL_PAD_RGMII_TD3__RGMII_TD3		0x1b0b0
+			MX6QDL_PAD_RGMII_TX_CTL__RGMII_TX_CTL	0x1b0b0
+			MX6QDL_PAD_ENET_REF_CLK__ENET_TX_CLK	0x1b0b0
+			MX6QDL_PAD_RGMII_RXC__RGMII_RXC		0x1b0b0
+			MX6QDL_PAD_RGMII_RD0__RGMII_RD0		0x1b0b0
+			MX6QDL_PAD_RGMII_RD1__RGMII_RD1		0x1b0b0
+			MX6QDL_PAD_RGMII_RD2__RGMII_RD2		0x1b0b0
+			MX6QDL_PAD_RGMII_RD3__RGMII_RD3		0x1b0b0
+			MX6QDL_PAD_RGMII_RX_CTL__RGMII_RX_CTL	0x1b0b0
+			MX6QDL_PAD_GPIO_16__ENET_REF_CLK 0x4001b0a8
+			MX6QDL_PAD_GPIO_6__ENET_IRQ		0x000b1
+			MX6QDL_PAD_ENET_RXD0__GPIO1_IO27        0x1b0b0
+		>;
+	};
+
+	pinctrl_hog: hoggrp {
+		fsl,pins = <
+			MX6QDL_PAD_GPIO_2__GPIO1_IO02 0x1b0b0
+			MX6QDL_PAD_GPIO_1__GPIO1_IO01 0x1b0b0
+		>;
+	};
+
+	pinctrl_i2c1: i2c1grp {
+		fsl,pins = <
+			MX6QDL_PAD_CSI0_DAT9__I2C1_SCL	0x4001b8b1
+			MX6QDL_PAD_CSI0_DAT8__I2C1_SDA	0x4001b8b1
+		>;
+	};
+
+	pinctrl_i2c2: i2c2grp {
+		fsl,pins = <
+			MX6QDL_PAD_KEY_COL3__I2C2_SCL	0x4001b8b1
+			MX6QDL_PAD_KEY_ROW3__I2C2_SDA	0x4001b8b1
+		>;
+	};
+
+	pinctrl_uart1: uart1grp {
+		fsl,pins = <
+			MX6QDL_PAD_CSI0_DAT10__UART1_TX_DATA	0x1b0b1
+			MX6QDL_PAD_CSI0_DAT11__UART1_RX_DATA	0x1b0b1
+		>;
+	};
+
+	pinctrl_usdhc2: usdhc2grp {
+		fsl,pins = <
+			MX6QDL_PAD_SD2_CMD__SD2_CMD		0x17059
+			MX6QDL_PAD_SD2_CLK__SD2_CLK		0x10059
+			MX6QDL_PAD_SD2_DAT0__SD2_DATA0		0x17059
+			MX6QDL_PAD_SD2_DAT1__SD2_DATA1		0x17059
+			MX6QDL_PAD_SD2_DAT2__SD2_DATA2		0x17059
+			MX6QDL_PAD_SD2_DAT3__SD2_DATA3		0x17059
+			MX6QDL_PAD_GPIO_4__GPIO1_IO04           0x1b0b1
+		>;
+	};
+
+	pinctrl_usdhc3: usdhc3grp {
+		fsl,pins = <
+			MX6QDL_PAD_SD3_CMD__SD3_CMD		0x17059
+			MX6QDL_PAD_SD3_CLK__SD3_CLK		0x10059
+			MX6QDL_PAD_SD3_DAT0__SD3_DATA0		0x17059
+			MX6QDL_PAD_SD3_DAT1__SD3_DATA1		0x17059
+			MX6QDL_PAD_SD3_DAT2__SD3_DATA2		0x17059
+			MX6QDL_PAD_SD3_DAT3__SD3_DATA3		0x17059
+			MX6QDL_PAD_SD3_DAT4__SD3_DATA4		0x17059
+			MX6QDL_PAD_SD3_DAT5__SD3_DATA5		0x17059
+			MX6QDL_PAD_SD3_DAT6__SD3_DATA6		0x17059
+			MX6QDL_PAD_SD3_DAT7__SD3_DATA7		0x17059
+			MX6QDL_PAD_SD3_RST__SD3_RESET		0x17059
+		>;
+	};
+
+	pinctrl_weim_cs0: weimcs0grp {
+		fsl,pins = <
+			MX6QDL_PAD_EIM_CS0__EIM_CS0_B		0xb0b1
+		>;
+	};
+
+	pinctrl_weim_nor: weimnorgrp {
+		fsl,pins = <
+			MX6QDL_PAD_EIM_OE__EIM_OE_B		0xb0b1
+			MX6QDL_PAD_EIM_RW__EIM_RW		0xb0b1
+			MX6QDL_PAD_EIM_WAIT__EIM_WAIT_B	0xb060
+			MX6QDL_PAD_EIM_D16__EIM_DATA16		0x1b0b0
+			MX6QDL_PAD_EIM_D17__EIM_DATA17		0x1b0b0
+			MX6QDL_PAD_EIM_D18__EIM_DATA18		0x1b0b0
+			MX6QDL_PAD_EIM_D19__EIM_DATA19		0x1b0b0
+			MX6QDL_PAD_EIM_D20__EIM_DATA20		0x1b0b0
+			MX6QDL_PAD_EIM_D21__EIM_DATA21		0x1b0b0
+			MX6QDL_PAD_EIM_D22__EIM_DATA22		0x1b0b0
+			MX6QDL_PAD_EIM_D23__EIM_DATA23		0x1b0b0
+			MX6QDL_PAD_EIM_D24__EIM_DATA24		0x1b0b0
+			MX6QDL_PAD_EIM_D25__EIM_DATA25		0x1b0b0
+			MX6QDL_PAD_EIM_D26__EIM_DATA26		0x1b0b0
+			MX6QDL_PAD_EIM_D27__EIM_DATA27		0x1b0b0
+			MX6QDL_PAD_EIM_D28__EIM_DATA28		0x1b0b0
+			MX6QDL_PAD_EIM_D29__EIM_DATA29		0x1b0b0
+			MX6QDL_PAD_EIM_D30__EIM_DATA30		0x1b0b0
+			MX6QDL_PAD_EIM_D31__EIM_DATA31		0x1b0b0
+			MX6QDL_PAD_EIM_A23__EIM_ADDR23		0xb0b1
+			MX6QDL_PAD_EIM_A22__EIM_ADDR22		0xb0b1
+			MX6QDL_PAD_EIM_A21__EIM_ADDR21		0xb0b1
+			MX6QDL_PAD_EIM_A20__EIM_ADDR20		0xb0b1
+			MX6QDL_PAD_EIM_A19__EIM_ADDR19		0xb0b1
+			MX6QDL_PAD_EIM_A18__EIM_ADDR18		0xb0b1
+			MX6QDL_PAD_EIM_A17__EIM_ADDR17		0xb0b1
+			MX6QDL_PAD_EIM_A16__EIM_ADDR16		0xb0b1
+			MX6QDL_PAD_EIM_DA15__EIM_AD15		0xb0b1
+			MX6QDL_PAD_EIM_DA14__EIM_AD14		0xb0b1
+			MX6QDL_PAD_EIM_DA13__EIM_AD13		0xb0b1
+			MX6QDL_PAD_EIM_DA12__EIM_AD12		0xb0b1
+			MX6QDL_PAD_EIM_DA11__EIM_AD11		0xb0b1
+			MX6QDL_PAD_EIM_DA10__EIM_AD10		0xb0b1
+			MX6QDL_PAD_EIM_DA9__EIM_AD09		0xb0b1
+			MX6QDL_PAD_EIM_DA8__EIM_AD08		0xb0b1
+			MX6QDL_PAD_EIM_DA7__EIM_AD07		0xb0b1
+			MX6QDL_PAD_EIM_DA6__EIM_AD06		0xb0b1
+			MX6QDL_PAD_EIM_DA5__EIM_AD05		0xb0b1
+			MX6QDL_PAD_EIM_DA4__EIM_AD04		0xb0b1
+			MX6QDL_PAD_EIM_DA3__EIM_AD03		0xb0b1
+			MX6QDL_PAD_EIM_DA2__EIM_AD02		0xb0b1
+			MX6QDL_PAD_EIM_DA1__EIM_AD01		0xb0b1
+			MX6QDL_PAD_EIM_DA0__EIM_AD00		0xb0b1
+		>;
+	};
+};
+
+&uart1 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_uart1>;
+	status = "okay";
+};
+
+&usdhc2 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_usdhc2>;
+	bus-width = <4>;
+	cd-gpios = <&gpio1 4 GPIO_ACTIVE_LOW>;
+	status = "okay";
+};
+
+&usdhc3 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_usdhc3>;
+	bus-width = <8>;
+	non-removable;
+	no-1-8-v;
+	keep-power-in-suspend;
+	status = "okay";
+};
arch/arm/mach-imx/mx6/Kconfig +7 -0
index d0cee514a2..b81ba79f46 100644
@@ -205,6 +205,13 @@ config TARGET_MCCMON6
 	bool "mccmon6"
 	select MX6QDL
 	select SUPPORT_SPL
+	select DM
+	select DM_GPIO
+	select DM_ETH
+	select DM_SERIAL
+	select DM_I2C
+	select DM_SPI
+	imply CMD_DM
 
 config TARGET_MX6CUBOXI
 	bool "Solid-run mx6 boards"
board/liebherr/mccmon6/mccmon6.c +0 -161

214 lines not on this page · raw message

configs/mccmon6_nor_defconfig +28 -2
index 18070cd0b1..93290fcbaf 100644
@@ -9,24 +9,36 @@ CONFIG_SPL=y
 # CONFIG_CMD_BMODE is not set
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_NR_DRAM_BANKS=1
+CONFIG_FIT=y
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/liebherr/mccmon6/mon6_imximage_nor.cfg"
 # CONFIG_USE_BOOTCOMMAND is not set
 CONFIG_BOUNCE_BUFFER=y
 CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_ENV_SUPPORT=y
 CONFIG_SPL_NOR_SUPPORT=y
+CONFIG_CMD_CLK=y
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
+# CONFIG_CMD_PINMUX is not set
 CONFIG_CMD_SF=y
 CONFIG_CMD_CACHE=y
+CONFIG_CMD_PMIC=y
+CONFIG_CMD_REGULATOR=y
 CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_MTDPARTS=y
 CONFIG_MTDIDS_DEFAULT="nor0=8000000.nor"
 CONFIG_MTDPARTS_DEFAULT="mtdparts=8000000.nor:32m at 0x0(mccmon6-image.nor),256k at 0x40000(u-boot-env.nor),1m at 0x80000(u-boot.nor),8m at 0x180000(kernel.nor),8m at 0x980000(swupdate-kernel.nor),8m at 0x1180000(swupdate-rootfs.nor),128k at 0x1980000(kernel-dtb.nor),128k at 0x19C0000(swupdate-kernel-dtb.nor)"
+CONFIG_OF_CONTROL=y
+CONFIG_DEFAULT_DEVICE_TREE="imx6q-mccmon6"
 CONFIG_ENV_IS_IN_FLASH=y
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
-CONFIG_DM=y
+CONFIG_CLK_IMX6Q=y
+CONFIG_I2C_SET_DEFAULT_BUS_NUM=y
+CONFIG_SYS_I2C_MXC=y
+CONFIG_SYS_I2C_MXC_I2C1=y
+CONFIG_SYS_I2C_MXC_I2C2=y
+CONFIG_DM_MMC=y
 CONFIG_FSL_ESDHC=y
 CONFIG_MTD=y
 CONFIG_MTD_NOR_FLASH=y
@@ -36,13 +48,27 @@ CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_FLASH_CFI_MTD=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_PHYLIB=y
 CONFIG_PHY_MICREL=y
 CONFIG_PHY_MICREL_KSZ90X1=y
+CONFIG_FEC_MXC=y
+CONFIG_RGMII=y
 CONFIG_MII=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_IMX6=y
+CONFIG_DM_PMIC=y
+# CONFIG_SPL_PMIC_CHILDREN is not set
+CONFIG_DM_PMIC_PFUZE100=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_PFUZE100=y
+# CONFIG_REQUIRE_SERIAL_CONSOLE is not set
+# CONFIG_SPECIFY_CONSOLE_INDEX is not set
+# CONFIG_SPL_SERIAL_PRESENT is not set
+# CONFIG_TPL_SERIAL_PRESENT is not set
+CONFIG_MXC_UART=y
 CONFIG_SPI=y
 CONFIG_MXC_SPI=y
 CONFIG_DM_THERMAL=y
-CONFIG_OF_LIBFDT=y
configs/mccmon6_sd_defconfig +27 -2
index d1d1313e1e..caa8ec70f9 100644
@@ -10,24 +10,36 @@ CONFIG_SPL=y
 # CONFIG_CMD_BMODE is not set
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_NR_DRAM_BANKS=1
+CONFIG_FIT=y
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/liebherr/mccmon6/mon6_imximage_sd.cfg"
 # CONFIG_USE_BOOTCOMMAND is not set
 CONFIG_BOUNCE_BUFFER=y
 CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_ENV_SUPPORT=y
 CONFIG_SPL_NOR_SUPPORT=y
+CONFIG_CMD_CLK=y
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
+# CONFIG_CMD_PINMUX is not set
 CONFIG_CMD_SF=y
 CONFIG_CMD_CACHE=y
+CONFIG_CMD_PMIC=y
+CONFIG_CMD_REGULATOR=y
 CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_MTDPARTS=y
 CONFIG_MTDIDS_DEFAULT="nor0=8000000.nor"
 CONFIG_MTDPARTS_DEFAULT="mtdparts=8000000.nor:32m at 0x0(mccmon6-image.nor),256k at 0x40000(u-boot-env.nor),1m at 0x80000(u-boot.nor),8m at 0x180000(kernel.nor),8m at 0x980000(swupdate-kernel.nor),8m at 0x1180000(swupdate-rootfs.nor),128k at 0x1980000(kernel-dtb.nor),128k at 0x19C0000(swupdate-kernel-dtb.nor)"
+CONFIG_OF_CONTROL=y
+CONFIG_DEFAULT_DEVICE_TREE="imx6q-mccmon6"
 CONFIG_ENV_IS_IN_FLASH=y
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
-CONFIG_DM=y
+CONFIG_CLK_IMX6Q=y
+CONFIG_I2C_SET_DEFAULT_BUS_NUM=y
+CONFIG_SYS_I2C_MXC=y
+CONFIG_SYS_I2C_MXC_I2C1=y
+CONFIG_SYS_I2C_MXC_I2C2=y
+CONFIG_DM_MMC=y
 CONFIG_FSL_ESDHC=y
 CONFIG_MTD=y
 CONFIG_MTD_NOR_FLASH=y
@@ -37,13 +49,26 @@ CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_FLASH_CFI_MTD=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
+CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_PHYLIB=y
 CONFIG_PHY_MICREL=y
 CONFIG_PHY_MICREL_KSZ90X1=y
+CONFIG_FEC_MXC=y
+CONFIG_RGMII=y
 CONFIG_MII=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_IMX6=y
+CONFIG_DM_PMIC=y
+# CONFIG_SPL_PMIC_CHILDREN is not set
+CONFIG_DM_PMIC_PFUZE100=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_PFUZE100=y
+# CONFIG_REQUIRE_SERIAL_CONSOLE is not set
+# CONFIG_SPL_SERIAL_PRESENT is not set
+# CONFIG_TPL_SERIAL_PRESENT is not set
+CONFIG_MXC_UART=y
 CONFIG_SPI=y
 CONFIG_MXC_SPI=y
 CONFIG_DM_THERMAL=y
-CONFIG_OF_LIBFDT=y
include/configs/mccmon6.h +0 -18
index 5ca9bc6848..f72d8cba2b 100644
@@ -34,27 +34,12 @@
 /* Size of malloc() pool */
 #define CONFIG_SYS_MALLOC_LEN		(10 * SZ_1M)
 
-#define CONFIG_BOARD_EARLY_INIT_F
 #define CONFIG_BOARD_LATE_INIT
-
-#define CONFIG_MXC_UART
 #define CONFIG_MXC_UART_BASE		UART1_BASE
 
 #define CONFIG_SYS_MEMTEST_START	0x10000000
 #define CONFIG_SYS_MEMTEST_END		(CONFIG_SYS_MEMTEST_START + 500 * SZ_1M)
 
-#define CONFIG_SF_DEFAULT_BUS  2
-#define CONFIG_SF_DEFAULT_CS   0
-#define CONFIG_SF_DEFAULT_SPEED 25000000
-#define CONFIG_SF_DEFAULT_MODE (SPI_MODE_0)
-
-/* I2C Configs */
-#define CONFIG_SYS_I2C
-#define CONFIG_SYS_I2C_MXC
-#define CONFIG_SYS_I2C_MXC_I2C1		/* enable I2C bus 1 */
-#define CONFIG_SYS_I2C_MXC_I2C2		/* enable I2C bus 2 */
-#define CONFIG_SYS_I2C_SPEED		100000
-
 /* MMC Configuration */
 #define CONFIG_SYS_FSL_USDHC_NUM	2
 #define CONFIG_SYS_FSL_ESDHC_ADDR	0
@@ -71,10 +56,7 @@
 #define CONFIG_SYS_FLASH_BANKS_SIZES	{ (32 * SZ_1M) }
 
 /* Ethernet Configuration */
-#define CONFIG_FEC_MXC
 #define IMX_FEC_BASE			ENET_BASE_ADDR
-#define CONFIG_FEC_XCV_TYPE		RGMII
-#define CONFIG_ETHPRIME			"FEC"
 #define CONFIG_FEC_MXC_PHYADDR		1
 
 #define CONFIG_EXTRA_ENV_SETTINGS \
Signature · 1 line
2.11.0
#17 lore raw

PATCH v2 11/17 ARM: imx: Decouple mccmon6's SPL and u-boot proper code

In reply to Lukasz Majewski

The mccmon6 has been used a "mixed" approach between SPL and u-boot proper sources.

This commit decoupes SPL and u-boot proper, which allows clear distinction between those two code bases and facilitates conversion to DM/DTS on this particular board.

---

Changes in v2: None

 board/liebherr/mccmon6/Makefile  |   7 +-
 board/liebherr/mccmon6/mccmon6.c | 285 ---------------------------------------
 board/liebherr/mccmon6/spl.c     | 266 +++++++++++++++++++++++++++++++++++-
 3 files changed, 268 insertions(+), 290 deletions(-)
board/liebherr/mccmon6/Makefile +5 -2
index ead6750ebf..3c9786c6b7 100644
@@ -2,5 +2,8 @@
 #
 # (C) Copyright 2016-2017
 # Lukasz Majewski, DENX Software Engineering, lukma at denx.de
-
-obj-y  := mccmon6.o spl.o
+ifdef CONFIG_SPL_BUILD
+obj-y  := spl.o
+else
+obj-y  := mccmon6.o
+endif
board/liebherr/mccmon6/mccmon6.c +0 -285

310 lines not on this page · raw message

board/liebherr/mccmon6/spl.c +263 -3

287 lines not on this page · raw message

Signature · 1 line
2.11.0
#18 lore raw

PATCH v2 12/17 ARM: imx: Disable 1Gbps support on MCCMON6's KSZ9031 PHY

In reply to Lukasz Majewski

mccmon6 works in 10/100 MiB Ethernet environment, so disabling 1GiB support improves robustness of the network after power up (as one don't need to wait for autoneg).

---

Changes in v2:
- Port the Common Clock Framework from Linux to U-boot (tag: 5.0-rc3)

 include/configs/mccmon6.h | 1 +
 1 file changed, 1 insertion(+)
include/configs/mccmon6.h +1 -0
index f72d8cba2b..b25aacbf41 100644
@@ -65,6 +65,7 @@
 	"fdt_high=0xffffffff\0" \
 	"initrd_high=0xffffffff\0" \
 	"boot_os=yes\0" \
+	"disable_giga=yes\0" \
 	"download_kernel=" \
 		"tftpboot ${kernel_addr} ${kernel_file};" \
 		"tftpboot ${fdt_addr} ${fdtfile};\0" \
Signature · 1 line
2.11.0
#19 lore raw

PATCH v2 13/17 Kconfig: Make CMD_SPL_NAND_OFS only available when proper memory is used

In reply to Lukasz Majewski

This commit makes the CMD_SPL_NAND_OFS only visible when we use NAND memory.
Before this change it was present when only CMD_SPL was enabled (and would stay when board with other falcon boot medium is used).

---

Changes in v2: None

 cmd/Kconfig | 1 +
 1 file changed, 1 insertion(+)
cmd/Kconfig +1 -0
index ea1a325eb3..bc08b935a5 100644
@@ -316,6 +316,7 @@ config CMD_SPL
 config CMD_SPL_NAND_OFS
 	hex "Offset of OS command line args for Falcon-mode NAND boot"
 	depends on CMD_SPL
+	depends on CMD_SPL && (TPL_NAND_SUPPORT || SPL_NAND_SUPPORT)
 	default 0
 	help
 	  This provides the offset of the command line arguments for Linux
Signature · 1 line
2.11.0
#20 lore raw

PATCH v2 14/17 Kconfig: cosmetic: Update description of CMD_SPL_NAND_OFS

In reply to Lukasz Majewski

The CMD_SPL_NAND_OFS description was a bit misleading, has been updated.

---

Changes in v2: None

 cmd/Kconfig | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
cmd/Kconfig +1 -2
index bc08b935a5..f9a668b80f 100644
@@ -314,8 +314,7 @@ config CMD_SPL
 	  command.
 
 config CMD_SPL_NAND_OFS
-	hex "Offset of OS command line args for Falcon-mode NAND boot"
-	depends on CMD_SPL
+	hex "Offset of OS args or dtb for Falcon-mode NAND boot"
 	depends on CMD_SPL && (TPL_NAND_SUPPORT || SPL_NAND_SUPPORT)
 	default 0
 	help
Signature · 1 line
2.11.0
#21 lore raw

PATCH v2 15/17 Kconfig: Add CMD_SPL_NOR_OFS config for falcon boot argument offset

In reply to Lukasz Majewski

This option will provide the offset in the parallel NOR flash memory to, which the falcon boot data is stored.

---

Changes in v2: None

 cmd/Kconfig | 8 ++++++++
 1 file changed, 8 insertions(+)
cmd/Kconfig +8 -0
index f9a668b80f..e37d28e86a 100644
@@ -323,6 +323,14 @@ config CMD_SPL_NAND_OFS
 	  for full information about how to use this option (and also see
 	  board/gateworks/gw_ventana/README for an example).
 
+config CMD_SPL_NOR_OFS
+	hex "Offset of OS args or dtb for Falcon-mode NOR boot"
+	depends on CMD_SPL && SPL_NOR_SUPPORT
+	default 0
+	help
+	  This provides the offset of the command line arguments or dtb for
+	  Linux when booting from NOR in Falcon mode.
+
 config CMD_SPL_WRITE_SIZE
 	hex "Size of argument area"
 	depends on CMD_SPL
Signature · 1 line
2.11.0
#22 lore raw

PATCH v2 16/17 doc: Update parallel NOR flash related information in README.falcon

In reply to Lukasz Majewski

This commit updates the doc/README.falcon regarding Falcon boot on NOR flash memories.

---

Changes in v2: None

 doc/README.falcon | 3 +++
 1 file changed, 3 insertions(+)
doc/README.falcon +3 -0
index 9a7f0bc235..204f4b12b6 100644
@@ -67,6 +67,9 @@ CONFIG_SYS_NAND_SPL_KERNEL_OFFS	Offset in NAND where the kernel is stored
 
 CONFIG_CMD_SPL_NAND_OFS	Offset in NAND where the parameters area was saved.
 
+CONFIG_CMD_SPL_NOR_OFS	Offset in NOR where the parameters area was saved.
+			(Please refer to MCCMON6 board's configuraiton)
+
 CONFIG_CMD_SPL_WRITE_SIZE 	Size of the parameters area to be copied
 
 CONFIG_SPL_OS_BOOT	Activate Falcon Mode.
Signature · 1 line
2.11.0
#23 lore raw

PATCH v2 17/17 imx: Convert mccmon6 to use fitImage instead of uImage+DTB

In reply to Lukasz Majewski

This commit enabled support for fitImage on mccmon6 when we switch to DT/DTS.

Moreover, it provides Falcon boot functionality to parallel NOR flash memories (spl_nor.c).

---

Changes in v2: None

 board/liebherr/mccmon6/spl.c  |  7 ++++++
 common/spl/spl_nor.c          |  5 ++++
 configs/mccmon6_nor_defconfig |  8 +++++-
 configs/mccmon6_sd_defconfig  |  6 ++++-
 include/configs/mccmon6.h     | 57 +++++++++++++++++--------------------------
 5 files changed, 47 insertions(+), 36 deletions(-)
board/liebherr/mccmon6/spl.c +7 -0
index afd080fe26..c5cfea2a55 100644
@@ -324,6 +324,13 @@ void board_boot_order(u32 *spl_boot_list)
 	}
 }
 
+#ifdef CONFIG_SPL_LOAD_FIT
+int board_fit_config_name_match(const char *name)
+{
+	return 0;
+}
+#endif
+
 #ifdef CONFIG_SPL_OS_BOOT
 int spl_start_uboot(void)
 {
common/spl/spl_nor.c +5 -0
index 969e319de0..c9364072f3 100644
@@ -48,6 +48,11 @@ static int spl_nor_load_image(struct spl_image_info *spl_image,
 						  CONFIG_SYS_OS_BASE,
 						  (void *)header);
 
+#ifdef CONFIG_SYS_SPL_ARGS_ADDR
+			memcpy((void *)CONFIG_SYS_SPL_ARGS_ADDR,
+			       (void *)CONFIG_CMD_SPL_NOR_OFS,
+			       CONFIG_CMD_SPL_WRITE_SIZE);
+#endif
 			return ret;
 		}
 #endif
configs/mccmon6_nor_defconfig +7 -1
index 93290fcbaf..c69e482eef 100644
@@ -10,12 +10,18 @@ CONFIG_SPL=y
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_FIT=y
+CONFIG_SPL_LOAD_FIT=y
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/liebherr/mccmon6/mon6_imximage_nor.cfg"
 # CONFIG_USE_BOOTCOMMAND is not set
 CONFIG_BOUNCE_BUFFER=y
 CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_ENV_SUPPORT=y
 CONFIG_SPL_NOR_SUPPORT=y
+CONFIG_SPL_OS_BOOT=y
+CONFIG_SYS_OS_BASE=0x8180000
+CONFIG_CMD_SPL=y
+CONFIG_CMD_SPL_NOR_OFS=0x09600000
+CONFIG_CMD_SPL_WRITE_SIZE=0x20000
 CONFIG_CMD_CLK=y
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_I2C=y
@@ -28,7 +34,7 @@ CONFIG_CMD_REGULATOR=y
 CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_MTDPARTS=y
 CONFIG_MTDIDS_DEFAULT="nor0=8000000.nor"
-CONFIG_MTDPARTS_DEFAULT="mtdparts=8000000.nor:32m at 0x0(mccmon6-image.nor),256k at 0x40000(u-boot-env.nor),1m at 0x80000(u-boot.nor),8m at 0x180000(kernel.nor),8m at 0x980000(swupdate-kernel.nor),8m at 0x1180000(swupdate-rootfs.nor),128k at 0x1980000(kernel-dtb.nor),128k at 0x19C0000(swupdate-kernel-dtb.nor)"
+CONFIG_MTDPARTS_DEFAULT="mtdparts=8000000.nor:32m at 0x0(mccmon6-image.nor),256k at 0x40000(u-boot-env.nor),1m at 0x80000(u-boot.nor),8m at 0x180000(kernel.nor),8m at 0x980000(swupdate-kernel.nor),8m at 0x1180000(swupdate-rootfs.nor)"
 CONFIG_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="imx6q-mccmon6"
 CONFIG_ENV_IS_IN_FLASH=y
configs/mccmon6_sd_defconfig +5 -1
index caa8ec70f9..cb0f5698b1 100644
@@ -11,12 +11,16 @@ CONFIG_SPL=y
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_FIT=y
+CONFIG_SPL_LOAD_FIT=y
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/liebherr/mccmon6/mon6_imximage_sd.cfg"
 # CONFIG_USE_BOOTCOMMAND is not set
 CONFIG_BOUNCE_BUFFER=y
 CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_ENV_SUPPORT=y
 CONFIG_SPL_NOR_SUPPORT=y
+CONFIG_CMD_SPL=y
+CONFIG_CMD_SPL_NOR_OFS=0x09600000
+CONFIG_CMD_SPL_WRITE_SIZE=0x20000
 CONFIG_CMD_CLK=y
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_I2C=y
@@ -29,7 +33,7 @@ CONFIG_CMD_REGULATOR=y
 CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_MTDPARTS=y
 CONFIG_MTDIDS_DEFAULT="nor0=8000000.nor"
-CONFIG_MTDPARTS_DEFAULT="mtdparts=8000000.nor:32m at 0x0(mccmon6-image.nor),256k at 0x40000(u-boot-env.nor),1m at 0x80000(u-boot.nor),8m at 0x180000(kernel.nor),8m at 0x980000(swupdate-kernel.nor),8m at 0x1180000(swupdate-rootfs.nor),128k at 0x1980000(kernel-dtb.nor),128k at 0x19C0000(swupdate-kernel-dtb.nor)"
+CONFIG_MTDPARTS_DEFAULT="mtdparts=8000000.nor:32m at 0x0(mccmon6-image.nor),256k at 0x40000(u-boot-env.nor),1m at 0x80000(u-boot.nor),8m at 0x180000(kernel.nor),8m at 0x980000(swupdate-kernel.nor),8m at 0x1180000(swupdate-rootfs.nor)"
 CONFIG_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="imx6q-mccmon6"
 CONFIG_ENV_IS_IN_FLASH=y
include/configs/mccmon6.h +23 -34

145 lines not on this page · raw message

Signature · 1 line
2.11.0