dm: core: Create a new header file for 'compat' features
At present dm/device.h includes the linux-compatible features. This
requires including linux/compat.h which in turn includes a lot of headers.
One of these is malloc.h which we thus end up including in every file in
U-Boot. Apart from the inefficiency of this, it is problematic for sandbox
which needs to use the system malloc() in some files.
Move the compatibility features into a separate header file.
Signed-off-by: Simon Glass <sjg@chromium.org>
diff --git a/drivers/phy/allwinner/phy-sun4i-usb.c b/drivers/phy/allwinner/phy-sun4i-usb.c
index 2c12fa6..612c428 100644
--- a/drivers/phy/allwinner/phy-sun4i-usb.c
+++ b/drivers/phy/allwinner/phy-sun4i-usb.c
@@ -21,6 +21,7 @@
#include <asm/io.h>
#include <asm/arch/clock.h>
#include <asm/arch/cpu.h>
+#include <dm/device_compat.h>
#include <linux/err.h>
#define REG_ISCR 0x00
diff --git a/drivers/phy/bcm6318-usbh-phy.c b/drivers/phy/bcm6318-usbh-phy.c
index de055a3..2de343d 100644
--- a/drivers/phy/bcm6318-usbh-phy.c
+++ b/drivers/phy/bcm6318-usbh-phy.c
@@ -11,6 +11,7 @@
#include <clk.h>
#include <dm.h>
#include <generic-phy.h>
+#include <malloc.h>
#include <power-domain.h>
#include <reset.h>
#include <asm/io.h>
diff --git a/drivers/phy/bcm6348-usbh-phy.c b/drivers/phy/bcm6348-usbh-phy.c
index e7761e3..ed9f02b 100644
--- a/drivers/phy/bcm6348-usbh-phy.c
+++ b/drivers/phy/bcm6348-usbh-phy.c
@@ -11,6 +11,7 @@
#include <clk.h>
#include <dm.h>
#include <generic-phy.h>
+#include <malloc.h>
#include <reset.h>
#include <asm/io.h>
#include <dm/device.h>
diff --git a/drivers/phy/bcm6358-usbh-phy.c b/drivers/phy/bcm6358-usbh-phy.c
index 189a1c1..f0fda02 100644
--- a/drivers/phy/bcm6358-usbh-phy.c
+++ b/drivers/phy/bcm6358-usbh-phy.c
@@ -10,6 +10,7 @@
#include <common.h>
#include <dm.h>
#include <generic-phy.h>
+#include <malloc.h>
#include <reset.h>
#include <asm/io.h>
#include <dm/device.h>
diff --git a/drivers/phy/bcm6368-usbh-phy.c b/drivers/phy/bcm6368-usbh-phy.c
index 99da97a..53d1f45 100644
--- a/drivers/phy/bcm6368-usbh-phy.c
+++ b/drivers/phy/bcm6368-usbh-phy.c
@@ -11,6 +11,7 @@
#include <clk.h>
#include <dm.h>
#include <generic-phy.h>
+#include <malloc.h>
#include <power-domain.h>
#include <reset.h>
#include <asm/io.h>
diff --git a/drivers/phy/marvell/comphy_core.c b/drivers/phy/marvell/comphy_core.c
index d52f42d..244beef 100644
--- a/drivers/phy/marvell/comphy_core.c
+++ b/drivers/phy/marvell/comphy_core.c
@@ -8,6 +8,7 @@
#include <common.h>
#include <dm.h>
#include <fdtdec.h>
+#include <dm/device_compat.h>
#include <linux/err.h>
#include <linux/errno.h>
#include <asm/io.h>
diff --git a/drivers/phy/meson-g12a-usb2.c b/drivers/phy/meson-g12a-usb2.c
index ad1a77f..c23bc87 100644
--- a/drivers/phy/meson-g12a-usb2.c
+++ b/drivers/phy/meson-g12a-usb2.c
@@ -8,6 +8,7 @@
*/
#include <common.h>
+#include <malloc.h>
#include <asm/io.h>
#include <bitfield.h>
#include <dm.h>
diff --git a/drivers/phy/meson-g12a-usb3-pcie.c b/drivers/phy/meson-g12a-usb3-pcie.c
index 920675d..82655f2 100644
--- a/drivers/phy/meson-g12a-usb3-pcie.c
+++ b/drivers/phy/meson-g12a-usb3-pcie.c
@@ -10,6 +10,7 @@
#include <common.h>
#include <clk.h>
#include <dm.h>
+#include <malloc.h>
#include <regmap.h>
#include <errno.h>
#include <asm/io.h>
diff --git a/drivers/phy/meson-gxl-usb2.c b/drivers/phy/meson-gxl-usb2.c
index 86e69c7..c98d12b 100644
--- a/drivers/phy/meson-gxl-usb2.c
+++ b/drivers/phy/meson-gxl-usb2.c
@@ -8,6 +8,7 @@
*/
#include <common.h>
+#include <malloc.h>
#include <asm/io.h>
#include <bitfield.h>
#include <dm.h>
diff --git a/drivers/phy/meson-gxl-usb3.c b/drivers/phy/meson-gxl-usb3.c
index 5cbbd4d..c2a8593 100644
--- a/drivers/phy/meson-gxl-usb3.c
+++ b/drivers/phy/meson-gxl-usb3.c
@@ -8,6 +8,7 @@
*/
#include <common.h>
+#include <malloc.h>
#include <asm/io.h>
#include <bitfield.h>
#include <dm.h>
diff --git a/drivers/phy/phy-mtk-tphy.c b/drivers/phy/phy-mtk-tphy.c
index 255d722..bd089b7 100644
--- a/drivers/phy/phy-mtk-tphy.c
+++ b/drivers/phy/phy-mtk-tphy.c
@@ -9,8 +9,10 @@
#include <clk.h>
#include <dm.h>
#include <generic-phy.h>
+#include <malloc.h>
#include <mapmem.h>
#include <asm/io.h>
+#include <dm/device_compat.h>
#include <dm/devres.h>
#include <dt-bindings/phy/phy.h>
diff --git a/drivers/phy/phy-rcar-gen2.c b/drivers/phy/phy-rcar-gen2.c
index ee70b81..e93130a 100644
--- a/drivers/phy/phy-rcar-gen2.c
+++ b/drivers/phy/phy-rcar-gen2.c
@@ -11,10 +11,12 @@
#include <dm.h>
#include <fdtdec.h>
#include <generic-phy.h>
+#include <malloc.h>
#include <reset.h>
#include <syscon.h>
#include <usb.h>
#include <asm/io.h>
+#include <dm/device_compat.h>
#include <linux/bitops.h>
#include <power/regulator.h>
diff --git a/drivers/phy/phy-rcar-gen3.c b/drivers/phy/phy-rcar-gen3.c
index b662935..ce39cd8 100644
--- a/drivers/phy/phy-rcar-gen3.c
+++ b/drivers/phy/phy-rcar-gen3.c
@@ -11,6 +11,7 @@
#include <dm.h>
#include <fdtdec.h>
#include <generic-phy.h>
+#include <malloc.h>
#include <reset.h>
#include <syscon.h>
#include <usb.h>
diff --git a/drivers/phy/phy-stm32-usbphyc.c b/drivers/phy/phy-stm32-usbphyc.c
index 6f11190..6ba3721 100644
--- a/drivers/phy/phy-stm32-usbphyc.c
+++ b/drivers/phy/phy-stm32-usbphyc.c
@@ -13,6 +13,7 @@
#include <syscon.h>
#include <usb.h>
#include <asm/io.h>
+#include <dm/device_compat.h>
#include <linux/bitops.h>
#include <power/regulator.h>
diff --git a/drivers/phy/phy-ti-am654.c b/drivers/phy/phy-ti-am654.c
index 1c7db0d..0b2b241 100644
--- a/drivers/phy/phy-ti-am654.c
+++ b/drivers/phy/phy-ti-am654.c
@@ -10,6 +10,7 @@
#include <clk-uclass.h>
#include <dm.h>
#include <dm/device.h>
+#include <dm/device_compat.h>
#include <dm/lists.h>
#include <dt-bindings/phy/phy.h>
#include <generic-phy.h>