From: Adam Ford <hidden> Date: 2021-11-06 15:54:49
Most of the blk-ctrl reset bits are found in one register, however
there are two bits in offset 8 for pulling the MIPI DPHY out of reset
and these need to be set when IMX8MM_DISPBLK_PD_MIPI_CSI is brought
out of reset or the MIPI_CSI hangs.
Fixes: 926e57c065df ("soc: imx: imx8m-blk-ctrl: add DISP blk-ctrl")
Signed-off-by: Adam Ford <redacted>
---
V2: Make a note that the extra register is only for Mini/Nano DISPLAY_BLK_CTRL
Rename the new register to mipi_phy_rst_mask
Encapsulate the edits to this register with an if-statement
drivers/soc/imx/imx8m-blk-ctrl.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
@@ -78,6 +88,8 @@ static int imx8m_blk_ctrl_power_on(struct generic_pm_domain *genpd)/* put devices into reset */regmap_clear_bits(bc->regmap,BLK_SFT_RSTN,data->rst_mask);+if(data->mipi_phy_rst_mask)+regmap_clear_bits(bc->regmap,BLK_MIPI_RESET_DIV,data->mipi_phy_rst_mask);/* enable upstream and blk-ctrl clocks to allow reset to propagate */ret=clk_bulk_prepare_enable(data->num_clks,domain->clks);
@@ -120,6 +134,9 @@ static int imx8m_blk_ctrl_power_off(struct generic_pm_domain *genpd)structimx8m_blk_ctrl*bc=domain->bc;/* put devices into reset and disable clocks */+if(data->mipi_phy_rst_mask)+regmap_clear_bits(bc->regmap,BLK_MIPI_RESET_DIV,data->mipi_phy_rst_mask);+regmap_clear_bits(bc->regmap,BLK_SFT_RSTN,data->rst_mask);regmap_clear_bits(bc->regmap,BLK_CLK_EN,data->clk_mask);
From: Adam Ford <hidden> Date: 2021-11-06 15:54:52
There is a csi bridge and csis interface that tie together
to allow csi2 capture.
Signed-off-by: Adam Ford <redacted>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-By: Tim Harvey <tharvey@gateworks.com>
Tested-By: Tim Harvey <tharvey@gateworks.com>
---
V2: No change
arch/arm64/boot/dts/freescale/imx8mm.dtsi | 51 +++++++++++++++++++++++
1 file changed, 51 insertions(+)
On Sat, Nov 6, 2021 at 12:54 PM Adam Ford [off-list ref] wrote:
There is a csi bridge and csis interface that tie together
to allow csi2 capture.
Signed-off-by: Adam Ford <redacted>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-By: Tim Harvey <tharvey@gateworks.com>
Tested-By: Tim Harvey <tharvey@gateworks.com>
From: Adam Ford <hidden> Date: 2021-11-06 15:54:57
To use a camera, the CSIS and CSI drivers need to be enabled with
VIDEO_IMX_MEDIA.
Signed-off-by: Adam Ford <redacted>
---
V2: No Change
arch/arm64/configs/defconfig | 1 +
1 file changed, 1 insertion(+)
From: Adam Ford <hidden> Date: 2021-11-06 15:55:00
The baseboard has support for a TDNext 5640 Camera which
uses an OV5640 connected to a 2-lane CSI2 interface.
With the CSI and mipi_csi2 drivers pointing to an OV5640 camera, the media
pipeline can be configured with the following:
media-ctl --links "'ov5640 1-003c':0->'imx7-mipi-csis.0':0[1]"
The camera and various nodes in the pipeline can be configured for UYVY:
media-ctl -v -V "'ov5640 1-003c':0 [fmt:UYVY8_1X16/640x480 field:none]"
media-ctl -v -V "'csi':0 [fmt:UYVY8_1X16/640x480 field:none]"
Signed-off-by: Adam Ford <redacted>
---
V2: No change
.../freescale/imx8mm-beacon-baseboard.dtsi | 58 +++++++++++++++++++
1 file changed, 58 insertions(+)
On Sat, Nov 6, 2021 at 12:54 PM Adam Ford [off-list ref] wrote:
The baseboard has support for a TDNext 5640 Camera which
uses an OV5640 connected to a 2-lane CSI2 interface.
With the CSI and mipi_csi2 drivers pointing to an OV5640 camera, the media
pipeline can be configured with the following:
media-ctl --links "'ov5640 1-003c':0->'imx7-mipi-csis.0':0[1]"
The camera and various nodes in the pipeline can be configured for UYVY:
media-ctl -v -V "'ov5640 1-003c':0 [fmt:UYVY8_1X16/640x480 field:none]"
media-ctl -v -V "'csi':0 [fmt:UYVY8_1X16/640x480 field:none]"
Signed-off-by: Adam Ford <redacted>
Hi Adam,
Thank you for the patch.
On Sat, Nov 06, 2021 at 10:54:26AM -0500, Adam Ford wrote:
The baseboard has support for a TDNext 5640 Camera which
uses an OV5640 connected to a 2-lane CSI2 interface.
With the CSI and mipi_csi2 drivers pointing to an OV5640 camera, the media
pipeline can be configured with the following:
media-ctl --links "'ov5640 1-003c':0->'imx7-mipi-csis.0':0[1]"
The camera and various nodes in the pipeline can be configured for UYVY:
media-ctl -v -V "'ov5640 1-003c':0 [fmt:UYVY8_1X16/640x480 field:none]"
media-ctl -v -V "'csi':0 [fmt:UYVY8_1X16/640x480 field:none]"
Signed-off-by: Adam Ford <redacted>
As the ov5640 is on an add-on module, would a DT overlay be better ?
From: Adam Ford <hidden> Date: 2021-11-22 03:07:45
On Sun, Nov 21, 2021 at 5:18 PM Laurent Pinchart
[off-list ref] wrote:
Hi Adam,
Thank you for the patch.
On Sat, Nov 06, 2021 at 10:54:26AM -0500, Adam Ford wrote:
quoted
The baseboard has support for a TDNext 5640 Camera which
uses an OV5640 connected to a 2-lane CSI2 interface.
With the CSI and mipi_csi2 drivers pointing to an OV5640 camera, the media
pipeline can be configured with the following:
media-ctl --links "'ov5640 1-003c':0->'imx7-mipi-csis.0':0[1]"
The camera and various nodes in the pipeline can be configured for UYVY:
media-ctl -v -V "'ov5640 1-003c':0 [fmt:UYVY8_1X16/640x480 field:none]"
media-ctl -v -V "'csi':0 [fmt:UYVY8_1X16/640x480 field:none]"
Signed-off-by: Adam Ford <redacted>
As the ov5640 is on an add-on module, would a DT overlay be better ?
At least for the Beacon / LogicPD boards, I would prefer to avoid the
overlays. We have an i.M6Q and an OMAP3 board with cameras enabled in
our development kit device trees. If the cameras are not connected,
they just display a message that the cameras are not communicating and
move on. I'm OK with that.
Hi Adam,
On Sun, Nov 21, 2021 at 09:07:26PM -0600, Adam Ford wrote:
On Sun, Nov 21, 2021 at 5:18 PM Laurent Pinchart wrote:
quoted
On Sat, Nov 06, 2021 at 10:54:26AM -0500, Adam Ford wrote:
quoted
The baseboard has support for a TDNext 5640 Camera which
uses an OV5640 connected to a 2-lane CSI2 interface.
With the CSI and mipi_csi2 drivers pointing to an OV5640 camera, the media
pipeline can be configured with the following:
media-ctl --links "'ov5640 1-003c':0->'imx7-mipi-csis.0':0[1]"
The camera and various nodes in the pipeline can be configured for UYVY:
media-ctl -v -V "'ov5640 1-003c':0 [fmt:UYVY8_1X16/640x480 field:none]"
media-ctl -v -V "'csi':0 [fmt:UYVY8_1X16/640x480 field:none]"
Signed-off-by: Adam Ford <redacted>
As the ov5640 is on an add-on module, would a DT overlay be better ?
At least for the Beacon / LogicPD boards, I would prefer to avoid the
overlays. We have an i.M6Q and an OMAP3 board with cameras enabled in
our development kit device trees. If the cameras are not connected,
they just display a message that the cameras are not communicating and
move on. I'm OK with that.
You know the board better than I do, so I won't push against this, but I
still think it may not lead to the best user experience, especially if a
user wanted to connect a different sensor to the development board.
From: Alexander Stein <hidden> Date: 2021-11-23 07:38:54
Am Dienstag, dem 23.11.2021 um 02:15 +0200 schrieb Laurent Pinchart:
Hi Adam,
On Sun, Nov 21, 2021 at 09:07:26PM -0600, Adam Ford wrote:
quoted
On Sun, Nov 21, 2021 at 5:18 PM Laurent Pinchart wrote:
quoted
On Sat, Nov 06, 2021 at 10:54:26AM -0500, Adam Ford wrote:
quoted
The baseboard has support for a TDNext 5640 Camera which
uses an OV5640 connected to a 2-lane CSI2 interface.
With the CSI and mipi_csi2 drivers pointing to an OV5640
camera, the media
pipeline can be configured with the following:
media-ctl --links "'ov5640 1-003c':0->'imx7-mipi-
csis.0':0[1]"
The camera and various nodes in the pipeline can be configured
for UYVY:
media-ctl -v -V "'ov5640 1-003c':0 [fmt:UYVY8_1X16/640x480
field:none]"
media-ctl -v -V "'csi':0 [fmt:UYVY8_1X16/640x480
field:none]"
Signed-off-by: Adam Ford <
aford173@gmail.com
quoted
As the ov5640 is on an add-on module, would a DT overlay be
better ?
At least for the Beacon / LogicPD boards, I would prefer to avoid
the
overlays. We have an i.M6Q and an OMAP3 board with cameras enabled
in
our development kit device trees. If the cameras are not
connected,
they just display a message that the cameras are not communicating
and
move on. I'm OK with that.
You know the board better than I do, so I won't push against this,
but I
still think it may not lead to the best user experience, especially
if a
user wanted to connect a different sensor to the development board.
I see the advantages of overlays compared to "stacked" .dts files. But
is there any general supported interface how to actually apply an
overlay?
Documentation/devicetree/overlay-notes.rst
states of_overlay_fdt_apply() but there is only exactly one user in-
kernel (rcar-du). Is it expected that the bootloader like u-boot shall
apply the .dtbo files?
Best regards,
Alexander
Hi Alexander,
On Tue, Nov 23, 2021 at 08:38:47AM +0100, Alexander Stein wrote:
Am Dienstag, dem 23.11.2021 um 02:15 +0200 schrieb Laurent Pinchart:
quoted
On Sun, Nov 21, 2021 at 09:07:26PM -0600, Adam Ford wrote:
quoted
On Sun, Nov 21, 2021 at 5:18 PM Laurent Pinchart wrote:
quoted
On Sat, Nov 06, 2021 at 10:54:26AM -0500, Adam Ford wrote:
quoted
The baseboard has support for a TDNext 5640 Camera which
uses an OV5640 connected to a 2-lane CSI2 interface.
With the CSI and mipi_csi2 drivers pointing to an OV5640 camera, the media
pipeline can be configured with the following:
media-ctl --links "'ov5640 1-003c':0->'imx7-mipi-csis.0':0[1]"
The camera and various nodes in the pipeline can be configured for UYVY:
media-ctl -v -V "'ov5640 1-003c':0 [fmt:UYVY8_1X16/640x480 field:none]"
media-ctl -v -V "'csi':0 [fmt:UYVY8_1X16/640x480 field:none]"
Signed-off-by: Adam Ford <redacted>
As the ov5640 is on an add-on module, would a DT overlay be better ?
At least for the Beacon / LogicPD boards, I would prefer to avoid the
overlays. We have an i.M6Q and an OMAP3 board with cameras enabled in
our development kit device trees. If the cameras are not connected,
they just display a message that the cameras are not communicating and
move on. I'm OK with that.
You know the board better than I do, so I won't push against this, but I
still think it may not lead to the best user experience, especially if a
user wanted to connect a different sensor to the development board.
I see the advantages of overlays compared to "stacked" .dts files. But
is there any general supported interface how to actually apply an overlay?
Documentation/devicetree/overlay-notes.rst
states of_overlay_fdt_apply() but there is only exactly one user in-
kernel (rcar-du). Is it expected that the bootloader like u-boot shall
apply the .dtbo files?
I believe the boot loader is expected to apply overlays nowadays, yes.
That's my personal workflow.
--
Regards,
Laurent Pinchart
From: Tim Harvey <tharvey@gateworks.com> Date: 2021-11-29 22:40:31
On Tue, Nov 23, 2021 at 1:47 AM Laurent Pinchart
[off-list ref] wrote:
Hi Alexander,
On Tue, Nov 23, 2021 at 08:38:47AM +0100, Alexander Stein wrote:
quoted
Am Dienstag, dem 23.11.2021 um 02:15 +0200 schrieb Laurent Pinchart:
quoted
On Sun, Nov 21, 2021 at 09:07:26PM -0600, Adam Ford wrote:
quoted
On Sun, Nov 21, 2021 at 5:18 PM Laurent Pinchart wrote:
quoted
On Sat, Nov 06, 2021 at 10:54:26AM -0500, Adam Ford wrote:
quoted
The baseboard has support for a TDNext 5640 Camera which
uses an OV5640 connected to a 2-lane CSI2 interface.
With the CSI and mipi_csi2 drivers pointing to an OV5640 camera, the media
pipeline can be configured with the following:
media-ctl --links "'ov5640 1-003c':0->'imx7-mipi-csis.0':0[1]"
The camera and various nodes in the pipeline can be configured for UYVY:
media-ctl -v -V "'ov5640 1-003c':0 [fmt:UYVY8_1X16/640x480 field:none]"
media-ctl -v -V "'csi':0 [fmt:UYVY8_1X16/640x480 field:none]"
Signed-off-by: Adam Ford <redacted>
As the ov5640 is on an add-on module, would a DT overlay be better ?
At least for the Beacon / LogicPD boards, I would prefer to avoid the
overlays. We have an i.M6Q and an OMAP3 board with cameras enabled in
our development kit device trees. If the cameras are not connected,
they just display a message that the cameras are not communicating and
move on. I'm OK with that.
You know the board better than I do, so I won't push against this, but I
still think it may not lead to the best user experience, especially if a
user wanted to connect a different sensor to the development board.
I see the advantages of overlays compared to "stacked" .dts files. But
is there any general supported interface how to actually apply an overlay?
Documentation/devicetree/overlay-notes.rst
states of_overlay_fdt_apply() but there is only exactly one user in-
kernel (rcar-du). Is it expected that the bootloader like u-boot shall
apply the .dtbo files?
I believe the boot loader is expected to apply overlays nowadays, yes.
That's my personal workflow.
That is my understanding as well. I believe the support to apply dt
overlays within Linux (which the rpi kernel still uses) never got
merged due to race conditions so the focus was moved to bootloader.
I also have begun submitting some dt overlay files [1] [2] which I
will likely repost later this week removing the RFC.
My understanding is that these should be '.dtbo' files in the Linux
Makefile which are handled. My boards use the U-Boot bootloader and to
handle the dt overlays there you need to:
- set CONFIG_OF_LIBFDT_OVERLAY=y which gives you the 'fdt apply' command
- use 'fdt addr <addr> && fdt resize && fdt apply <loadaddr>' prior to
booting with booti
- Note that there is some support at the FIT level as well for
overlays if you need them applied to U-Boot's live dt (I don't for my
needs)
In my U-Boot environment I use scripts for loading the fdt and
applying the overlays. For example for booting kernel/dtb from network
I use:
boot_net setenv fsload tftpboot; run loadfdt && run apply_overlays &&
$fsload $kernel_addr_r venice/Image && booti $kernel_addr_r -
$fdt_addr_r
loadfdt if $fsload $fdt_addr_r $dir/$fdt_file1; then echo loaded
$fdt_file1; elif $fsload $fdt_addr_r $dir/$fdt_file2; then echo loaded
$fdt_file2; elif $fsload $fdt_addr_r $dir/$fdt_file3; then echo loaded
$fdt_file3; elif $fsload $fdt_addr_r $dir/$fdt_file4; then echo loaded
$fdt_file4; elif $fsload $fdt_addr_r $dir/$fdt_file5; then echo loaded
$fdt_file5; fi
apply_overlays fdt addr $fdt_addr_r && fdt resize && for i in
"$fdt_overlays"; do $fsload $loadaddr $dir/$i && fdt apply $loadaddr
&& echo applied $i...; done
Best regards,
Tim
[1] https://www.spinics.net/lists/arm-kernel/msg933447.html
[2] https://www.spinics.net/lists/arm-kernel/msg933638.html
From: Adam Ford <hidden> Date: 2021-11-06 15:55:02
The Beacon EmbeddedWorks imx8mm development kit has a TD Next 5640
Camera. Enable the OV5640 driver to use the camera.
Signed-off-by: Adam Ford <redacted>
---
V2: No Change
arch/arm64/configs/defconfig | 1 +
1 file changed, 1 insertion(+)
On Sat, Nov 6, 2021 at 12:54 PM Adam Ford [off-list ref] wrote:
The Beacon EmbeddedWorks imx8mm development kit has a TD Next 5640
Camera. Enable the OV5640 driver to use the camera.
Signed-off-by: Adam Ford <redacted>
Maybe this one could be squashed with the other defconfig patch. Either way:
Reviewed-by: Fabio Estevam <festevam@gmail.com>
Hi Adam,
On Sat, Nov 6, 2021 at 12:54 PM Adam Ford [off-list ref] wrote:
Most of the blk-ctrl reset bits are found in one register, however
there are two bits in offset 8 for pulling the MIPI DPHY out of reset
and these need to be set when IMX8MM_DISPBLK_PD_MIPI_CSI is brought
out of reset or the MIPI_CSI hangs.
Fixes: 926e57c065df ("soc: imx: imx8m-blk-ctrl: add DISP blk-ctrl")
Signed-off-by: Adam Ford <redacted>
From: Lucas Stach <l.stach@pengutronix.de> Date: 2021-11-08 08:57:03
Am Samstag, dem 06.11.2021 um 10:54 -0500 schrieb Adam Ford:
Most of the blk-ctrl reset bits are found in one register, however
there are two bits in offset 8 for pulling the MIPI DPHY out of reset
and these need to be set when IMX8MM_DISPBLK_PD_MIPI_CSI is brought
out of reset or the MIPI_CSI hangs.
Fixes: 926e57c065df ("soc: imx: imx8m-blk-ctrl: add DISP blk-ctrl")
Signed-off-by: Adam Ford <redacted>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
quoted hunk
---
V2: Make a note that the extra register is only for Mini/Nano DISPLAY_BLK_CTRL
Rename the new register to mipi_phy_rst_mask
Encapsulate the edits to this register with an if-statement
drivers/soc/imx/imx8m-blk-ctrl.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
@@ -78,6 +88,8 @@ static int imx8m_blk_ctrl_power_on(struct generic_pm_domain *genpd)/* put devices into reset */regmap_clear_bits(bc->regmap,BLK_SFT_RSTN,data->rst_mask);+if(data->mipi_phy_rst_mask)+regmap_clear_bits(bc->regmap,BLK_MIPI_RESET_DIV,data->mipi_phy_rst_mask);/* enable upstream and blk-ctrl clocks to allow reset to propagate */ret=clk_bulk_prepare_enable(data->num_clks,domain->clks);
@@ -120,6 +134,9 @@ static int imx8m_blk_ctrl_power_off(struct generic_pm_domain *genpd)structimx8m_blk_ctrl*bc=domain->bc;/* put devices into reset and disable clocks */+if(data->mipi_phy_rst_mask)+regmap_clear_bits(bc->regmap,BLK_MIPI_RESET_DIV,data->mipi_phy_rst_mask);+regmap_clear_bits(bc->regmap,BLK_SFT_RSTN,data->rst_mask);regmap_clear_bits(bc->regmap,BLK_CLK_EN,data->clk_mask);
From: Jagan Teki <jagan@amarulasolutions.com> Date: 2021-11-12 06:55:09
On Sat, Nov 6, 2021 at 9:24 PM Adam Ford [off-list ref] wrote:
Most of the blk-ctrl reset bits are found in one register, however
there are two bits in offset 8 for pulling the MIPI DPHY out of reset
and these need to be set when IMX8MM_DISPBLK_PD_MIPI_CSI is brought
out of reset or the MIPI_CSI hangs.
Fixes: 926e57c065df ("soc: imx: imx8m-blk-ctrl: add DISP blk-ctrl")
Signed-off-by: Adam Ford <redacted>
---
V2: Make a note that the extra register is only for Mini/Nano DISPLAY_BLK_CTRL
Rename the new register to mipi_phy_rst_mask
Encapsulate the edits to this register with an if-statement
This is DPHY reset mask, not sure we can handle this via blk-ctrl.
Marek has similar patch to support this [1]. we need to phandle the
phy in host node in order to work this.
However this current patch change seems directly handling dphy reset
which indeed fine me as well.
May be dphy_rst_mask (above comment may not be required, as it
understand directly with commit message).
quoted hunk
};
#define DOMAIN_MAX_CLKS 3
@@ -78,6 +88,8 @@ static int imx8m_blk_ctrl_power_on(struct generic_pm_domain *genpd) /* put devices into reset */ regmap_clear_bits(bc->regmap, BLK_SFT_RSTN, data->rst_mask);+ if (data->mipi_phy_rst_mask)+ regmap_clear_bits(bc->regmap, BLK_MIPI_RESET_DIV, data->mipi_phy_rst_mask); /* enable upstream and blk-ctrl clocks to allow reset to propagate */ ret = clk_bulk_prepare_enable(data->num_clks, domain->clks);
DPHY has BIT(17) for Master reset and BIT(16) for Slave reset. I think
we just need master reset to enable. I've tested only BIT(17) on
mipi-dsi gpc and it is working.
Jagan.
From: Tim Harvey <tharvey@gateworks.com> Date: 2021-11-19 23:51:57
On Thu, Nov 11, 2021 at 10:55 PM Jagan Teki [off-list ref] wrote:
On Sat, Nov 6, 2021 at 9:24 PM Adam Ford [off-list ref] wrote:
quoted
Most of the blk-ctrl reset bits are found in one register, however
there are two bits in offset 8 for pulling the MIPI DPHY out of reset
and these need to be set when IMX8MM_DISPBLK_PD_MIPI_CSI is brought
out of reset or the MIPI_CSI hangs.
Fixes: 926e57c065df ("soc: imx: imx8m-blk-ctrl: add DISP blk-ctrl")
Signed-off-by: Adam Ford <redacted>
---
V2: Make a note that the extra register is only for Mini/Nano DISPLAY_BLK_CTRL
Rename the new register to mipi_phy_rst_mask
Encapsulate the edits to this register with an if-statement
This is DPHY reset mask, not sure we can handle this via blk-ctrl.
Marek has similar patch to support this [1]. we need to phandle the
phy in host node in order to work this.
However this current patch change seems directly handling dphy reset
which indeed fine me as well.
May be dphy_rst_mask (above comment may not be required, as it
understand directly with commit message).
quoted
};
#define DOMAIN_MAX_CLKS 3
@@ -78,6 +88,8 @@ static int imx8m_blk_ctrl_power_on(struct generic_pm_domain *genpd) /* put devices into reset */ regmap_clear_bits(bc->regmap, BLK_SFT_RSTN, data->rst_mask);+ if (data->mipi_phy_rst_mask)+ regmap_clear_bits(bc->regmap, BLK_MIPI_RESET_DIV, data->mipi_phy_rst_mask); /* enable upstream and blk-ctrl clocks to allow reset to propagate */ ret = clk_bulk_prepare_enable(data->num_clks, domain->clks);
DPHY has BIT(17) for Master reset and BIT(16) for Slave reset. I think
we just need master reset to enable. I've tested only BIT(17) on
mipi-dsi gpc and it is working.
Jagan,
In my testing I had to use BIT(16) | BIT(17) in order to capture via CSI.
Best regards,
Tim
From: Adam Ford <hidden> Date: 2021-11-20 18:33:44
On Fri, Nov 19, 2021 at 5:51 PM Tim Harvey [off-list ref] wrote:
On Thu, Nov 11, 2021 at 10:55 PM Jagan Teki [off-list ref] wrote:
quoted
On Sat, Nov 6, 2021 at 9:24 PM Adam Ford [off-list ref] wrote:
quoted
Most of the blk-ctrl reset bits are found in one register, however
there are two bits in offset 8 for pulling the MIPI DPHY out of reset
and these need to be set when IMX8MM_DISPBLK_PD_MIPI_CSI is brought
out of reset or the MIPI_CSI hangs.
Fixes: 926e57c065df ("soc: imx: imx8m-blk-ctrl: add DISP blk-ctrl")
Signed-off-by: Adam Ford <redacted>
---
V2: Make a note that the extra register is only for Mini/Nano DISPLAY_BLK_CTRL
Rename the new register to mipi_phy_rst_mask
Encapsulate the edits to this register with an if-statement
This is DPHY reset mask, not sure we can handle this via blk-ctrl.
Marek has similar patch to support this [1]. we need to phandle the
phy in host node in order to work this.
However this current patch change seems directly handling dphy reset
which indeed fine me as well.
May be dphy_rst_mask (above comment may not be required, as it
understand directly with commit message).
quoted
};
#define DOMAIN_MAX_CLKS 3
@@ -78,6 +88,8 @@ static int imx8m_blk_ctrl_power_on(struct generic_pm_domain *genpd) /* put devices into reset */ regmap_clear_bits(bc->regmap, BLK_SFT_RSTN, data->rst_mask);+ if (data->mipi_phy_rst_mask)+ regmap_clear_bits(bc->regmap, BLK_MIPI_RESET_DIV, data->mipi_phy_rst_mask); /* enable upstream and blk-ctrl clocks to allow reset to propagate */ ret = clk_bulk_prepare_enable(data->num_clks, domain->clks);
DPHY has BIT(17) for Master reset and BIT(16) for Slave reset. I think
we just need master reset to enable. I've tested only BIT(17) on
mipi-dsi gpc and it is working.
Jagan,
In my testing I had to use BIT(16) | BIT(17) in order to capture via CSI.
Lucas,
Based on this, should I redo the patch but without clearing bits 16
and 17? It seems like both DSI and CSI need at least bit 17, and CSI
appears to need both. If we clear them, we risk stomping on one
peripheral or another. If we need both, in theory, we could drop the
need for a DPHY driver on the DSI side.
adam
Hi Adam,
On Sat, Nov 20, 2021 at 12:33:25PM -0600, Adam Ford wrote:
On Fri, Nov 19, 2021 at 5:51 PM Tim Harvey wrote:
quoted
On Thu, Nov 11, 2021 at 10:55 PM Jagan Teki wrote:
quoted
On Sat, Nov 6, 2021 at 9:24 PM Adam Ford wrote:
quoted
Most of the blk-ctrl reset bits are found in one register, however
there are two bits in offset 8 for pulling the MIPI DPHY out of reset
and these need to be set when IMX8MM_DISPBLK_PD_MIPI_CSI is brought
out of reset or the MIPI_CSI hangs.
Fixes: 926e57c065df ("soc: imx: imx8m-blk-ctrl: add DISP blk-ctrl")
Signed-off-by: Adam Ford <redacted>
---
V2: Make a note that the extra register is only for Mini/Nano DISPLAY_BLK_CTRL
Rename the new register to mipi_phy_rst_mask
Encapsulate the edits to this register with an if-statement
This is DPHY reset mask, not sure we can handle this via blk-ctrl.
Marek has similar patch to support this [1]. we need to phandle the
phy in host node in order to work this.
However this current patch change seems directly handling dphy reset
which indeed fine me as well.
May be dphy_rst_mask (above comment may not be required, as it
understand directly with commit message).
quoted
};
#define DOMAIN_MAX_CLKS 3
@@ -78,6 +88,8 @@ static int imx8m_blk_ctrl_power_on(struct generic_pm_domain *genpd) /* put devices into reset */ regmap_clear_bits(bc->regmap, BLK_SFT_RSTN, data->rst_mask);+ if (data->mipi_phy_rst_mask)+ regmap_clear_bits(bc->regmap, BLK_MIPI_RESET_DIV, data->mipi_phy_rst_mask); /* enable upstream and blk-ctrl clocks to allow reset to propagate */ ret = clk_bulk_prepare_enable(data->num_clks, domain->clks);
DPHY has BIT(17) for Master reset and BIT(16) for Slave reset. I think
we just need master reset to enable. I've tested only BIT(17) on
mipi-dsi gpc and it is working.
Jagan,
In my testing I had to use BIT(16) | BIT(17) in order to capture via CSI.
Lucas,
Based on this, should I redo the patch but without clearing bits 16
and 17? It seems like both DSI and CSI need at least bit 17, and CSI
appears to need both. If we clear them, we risk stomping on one
peripheral or another. If we need both, in theory, we could drop the
need for a DPHY driver on the DSI side.
I've tested camera on the i.MX8MM with an NXP BSP v5.4-based kernel.
Register BLK_MIPI_RESET_DIV is set to 0x00030000 by default. The camera
still works if I clear bit 17, and doesn't if I clear bit 16.
--
Regards,
Laurent Pinchart
Hi Adam,
On Sat, Nov 06, 2021 at 10:54:23AM -0500, Adam Ford wrote:
quoted hunk
Most of the blk-ctrl reset bits are found in one register, however
there are two bits in offset 8 for pulling the MIPI DPHY out of reset
and these need to be set when IMX8MM_DISPBLK_PD_MIPI_CSI is brought
out of reset or the MIPI_CSI hangs.
Fixes: 926e57c065df ("soc: imx: imx8m-blk-ctrl: add DISP blk-ctrl")
Signed-off-by: Adam Ford <redacted>
---
V2: Make a note that the extra register is only for Mini/Nano DISPLAY_BLK_CTRL
Rename the new register to mipi_phy_rst_mask
Encapsulate the edits to this register with an if-statement
drivers/soc/imx/imx8m-blk-ctrl.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
@@ -78,6 +88,8 @@ static int imx8m_blk_ctrl_power_on(struct generic_pm_domain *genpd)/* put devices into reset */regmap_clear_bits(bc->regmap,BLK_SFT_RSTN,data->rst_mask);+if(data->mipi_phy_rst_mask)+regmap_clear_bits(bc->regmap,BLK_MIPI_RESET_DIV,data->mipi_phy_rst_mask);/* enable upstream and blk-ctrl clocks to allow reset to propagate */ret=clk_bulk_prepare_enable(data->num_clks,domain->clks);
@@ -120,6 +134,9 @@ static int imx8m_blk_ctrl_power_off(struct generic_pm_domain *genpd)structimx8m_blk_ctrl*bc=domain->bc;/* put devices into reset and disable clocks */+if(data->mipi_phy_rst_mask)+regmap_clear_bits(bc->regmap,BLK_MIPI_RESET_DIV,data->mipi_phy_rst_mask);+
Is it the best option to enable/disable both the master and slave MIPI
DPHY, regardless of whether they're used or not ? Or would it be better
to implement a reset controller to expose the two resets independently,
and acquire them from the corresponding display and camera drivers ?
Hi Adam,
On Mon, Nov 22, 2021 at 12:25:31AM +0200, Laurent Pinchart wrote:
On Sat, Nov 06, 2021 at 10:54:23AM -0500, Adam Ford wrote:
quoted
Most of the blk-ctrl reset bits are found in one register, however
there are two bits in offset 8 for pulling the MIPI DPHY out of reset
and these need to be set when IMX8MM_DISPBLK_PD_MIPI_CSI is brought
out of reset or the MIPI_CSI hangs.
Fixes: 926e57c065df ("soc: imx: imx8m-blk-ctrl: add DISP blk-ctrl")
Signed-off-by: Adam Ford <redacted>
---
V2: Make a note that the extra register is only for Mini/Nano DISPLAY_BLK_CTRL
Rename the new register to mipi_phy_rst_mask
Encapsulate the edits to this register with an if-statement
drivers/soc/imx/imx8m-blk-ctrl.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
@@ -78,6 +88,8 @@ static int imx8m_blk_ctrl_power_on(struct generic_pm_domain *genpd)/* put devices into reset */regmap_clear_bits(bc->regmap,BLK_SFT_RSTN,data->rst_mask);+if(data->mipi_phy_rst_mask)+regmap_clear_bits(bc->regmap,BLK_MIPI_RESET_DIV,data->mipi_phy_rst_mask);/* enable upstream and blk-ctrl clocks to allow reset to propagate */ret=clk_bulk_prepare_enable(data->num_clks,domain->clks);
@@ -120,6 +134,9 @@ static int imx8m_blk_ctrl_power_off(struct generic_pm_domain *genpd)structimx8m_blk_ctrl*bc=domain->bc;/* put devices into reset and disable clocks */+if(data->mipi_phy_rst_mask)+regmap_clear_bits(bc->regmap,BLK_MIPI_RESET_DIV,data->mipi_phy_rst_mask);+
Is it the best option to enable/disable both the master and slave MIPI
DPHY, regardless of whether they're used or not ? Or would it be better
to implement a reset controller to expose the two resets independently,
and acquire them from the corresponding display and camera drivers ?
And I've now seen this has been raised by Jagan. I'll reply to that
e-mail.
From: Adam Ford <hidden> Date: 2021-11-23 13:59:54
On Sun, Nov 21, 2021 at 4:25 PM Laurent Pinchart
[off-list ref] wrote:
Hi Adam,
On Sat, Nov 06, 2021 at 10:54:23AM -0500, Adam Ford wrote:
quoted
Most of the blk-ctrl reset bits are found in one register, however
there are two bits in offset 8 for pulling the MIPI DPHY out of reset
and these need to be set when IMX8MM_DISPBLK_PD_MIPI_CSI is brought
out of reset or the MIPI_CSI hangs.
Fixes: 926e57c065df ("soc: imx: imx8m-blk-ctrl: add DISP blk-ctrl")
Signed-off-by: Adam Ford <redacted>
---
V2: Make a note that the extra register is only for Mini/Nano DISPLAY_BLK_CTRL
Rename the new register to mipi_phy_rst_mask
Encapsulate the edits to this register with an if-statement
drivers/soc/imx/imx8m-blk-ctrl.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
@@ -78,6 +88,8 @@ static int imx8m_blk_ctrl_power_on(struct generic_pm_domain *genpd)/* put devices into reset */regmap_clear_bits(bc->regmap,BLK_SFT_RSTN,data->rst_mask);+if(data->mipi_phy_rst_mask)+regmap_clear_bits(bc->regmap,BLK_MIPI_RESET_DIV,data->mipi_phy_rst_mask);/* enable upstream and blk-ctrl clocks to allow reset to propagate */ret=clk_bulk_prepare_enable(data->num_clks,domain->clks);
@@ -120,6 +134,9 @@ static int imx8m_blk_ctrl_power_off(struct generic_pm_domain *genpd)structimx8m_blk_ctrl*bc=domain->bc;/* put devices into reset and disable clocks */+if(data->mipi_phy_rst_mask)+regmap_clear_bits(bc->regmap,BLK_MIPI_RESET_DIV,data->mipi_phy_rst_mask);+
Is it the best option to enable/disable both the master and slave MIPI
DPHY, regardless of whether they're used or not ? Or would it be better
to implement a reset controller to expose the two resets independently,
and acquire them from the corresponding display and camera drivers ?
In some early attempts to implement the blk-ctrl driver, there was an
attempt to enable a reset controller, but it caused some hanging and
issues with suspend-resume due to chicken-egg issues where some items
were coming up in the wrong order. I think the decision was made to
make the resets part of the power domain so it's very clear that the
order of operations. Lucas might be able to elaborate more on this.
If bits 16 and 17 can act independently and bit 16 only impacts the
CSI and doesn't require bit 17, it seems reasonable to me to have the
power-domain part of the CSI, since this would only be enabled when
the CSI is active. The power domain is idled when the CSI is idled
which would effectively place the phy in and out of reset only
depending on the state of the CSI. I am guessing this reset bit
should be assigned to DISPBLK_PD_MIPI_CSI and not
DISPBLK_PD_CSI_BRIDGE, but I can run some more tests.
AFAIK, there is no phy driver for the CSI like there is the DSI, so
adding that would require additional work to the CSI driver to work
around this quirk. We don't have an acceptable DSI driver yet, so I'd
like to push a V3 with just the corresponding bit enabled for MIPI_CSI
after some testing. FWICT, NXP set both bits 16 and 17 in their ATF
gpc code, and it never gets cleared, so I think having the bit set and
cleared on demand is an improvement.
From: Jagan Teki <jagan@amarulasolutions.com> Date: 2021-11-25 05:44:33
On Tue, Nov 23, 2021 at 7:29 PM Adam Ford [off-list ref] wrote:
On Sun, Nov 21, 2021 at 4:25 PM Laurent Pinchart
[off-list ref] wrote:
quoted
Hi Adam,
On Sat, Nov 06, 2021 at 10:54:23AM -0500, Adam Ford wrote:
quoted
Most of the blk-ctrl reset bits are found in one register, however
there are two bits in offset 8 for pulling the MIPI DPHY out of reset
and these need to be set when IMX8MM_DISPBLK_PD_MIPI_CSI is brought
out of reset or the MIPI_CSI hangs.
Fixes: 926e57c065df ("soc: imx: imx8m-blk-ctrl: add DISP blk-ctrl")
Signed-off-by: Adam Ford <redacted>
---
V2: Make a note that the extra register is only for Mini/Nano DISPLAY_BLK_CTRL
Rename the new register to mipi_phy_rst_mask
Encapsulate the edits to this register with an if-statement
drivers/soc/imx/imx8m-blk-ctrl.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
@@ -78,6 +88,8 @@ static int imx8m_blk_ctrl_power_on(struct generic_pm_domain *genpd)/* put devices into reset */regmap_clear_bits(bc->regmap,BLK_SFT_RSTN,data->rst_mask);+if(data->mipi_phy_rst_mask)+regmap_clear_bits(bc->regmap,BLK_MIPI_RESET_DIV,data->mipi_phy_rst_mask);/* enable upstream and blk-ctrl clocks to allow reset to propagate */ret=clk_bulk_prepare_enable(data->num_clks,domain->clks);
@@ -120,6 +134,9 @@ static int imx8m_blk_ctrl_power_off(struct generic_pm_domain *genpd)structimx8m_blk_ctrl*bc=domain->bc;/* put devices into reset and disable clocks */+if(data->mipi_phy_rst_mask)+regmap_clear_bits(bc->regmap,BLK_MIPI_RESET_DIV,data->mipi_phy_rst_mask);+
Is it the best option to enable/disable both the master and slave MIPI
DPHY, regardless of whether they're used or not ? Or would it be better
to implement a reset controller to expose the two resets independently,
and acquire them from the corresponding display and camera drivers ?
In some early attempts to implement the blk-ctrl driver, there was an
attempt to enable a reset controller, but it caused some hanging and
issues with suspend-resume due to chicken-egg issues where some items
were coming up in the wrong order. I think the decision was made to
make the resets part of the power domain so it's very clear that the
order of operations. Lucas might be able to elaborate more on this.
I think supporting via phy driver make sense to me since this resent
is DPHY specific and nothing related to blk-ctrl.
If bits 16 and 17 can act independently and bit 16 only impacts the
CSI and doesn't require bit 17, it seems reasonable to me to have the
power-domain part of the CSI, since this would only be enabled when
the CSI is active. The power domain is idled when the CSI is idled
which would effectively place the phy in and out of reset only
depending on the state of the CSI. I am guessing this reset bit
should be assigned to DISPBLK_PD_MIPI_CSI and not
DISPBLK_PD_CSI_BRIDGE, but I can run some more tests.
AFAIK, there is no phy driver for the CSI like there is the DSI, so
adding that would require additional work to the CSI driver to work
around this quirk. We don't have an acceptable DSI driver yet, so I'd
like to push a V3 with just the corresponding bit enabled for MIPI_CSI
after some testing. FWICT, NXP set both bits 16 and 17 in their ATF
gpc code, and it never gets cleared, so I think having the bit set and
cleared on demand is an improvement.
From: Adam Ford <hidden> Date: 2021-11-25 15:21:33
On Wed, Nov 24, 2021 at 11:42 PM Jagan Teki [off-list ref] wrote:
On Tue, Nov 23, 2021 at 7:29 PM Adam Ford [off-list ref] wrote:
quoted
On Sun, Nov 21, 2021 at 4:25 PM Laurent Pinchart
[off-list ref] wrote:
quoted
Hi Adam,
On Sat, Nov 06, 2021 at 10:54:23AM -0500, Adam Ford wrote:
quoted
Most of the blk-ctrl reset bits are found in one register, however
there are two bits in offset 8 for pulling the MIPI DPHY out of reset
and these need to be set when IMX8MM_DISPBLK_PD_MIPI_CSI is brought
out of reset or the MIPI_CSI hangs.
Fixes: 926e57c065df ("soc: imx: imx8m-blk-ctrl: add DISP blk-ctrl")
Signed-off-by: Adam Ford <redacted>
---
V2: Make a note that the extra register is only for Mini/Nano DISPLAY_BLK_CTRL
Rename the new register to mipi_phy_rst_mask
Encapsulate the edits to this register with an if-statement
drivers/soc/imx/imx8m-blk-ctrl.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
@@ -78,6 +88,8 @@ static int imx8m_blk_ctrl_power_on(struct generic_pm_domain *genpd)/* put devices into reset */regmap_clear_bits(bc->regmap,BLK_SFT_RSTN,data->rst_mask);+if(data->mipi_phy_rst_mask)+regmap_clear_bits(bc->regmap,BLK_MIPI_RESET_DIV,data->mipi_phy_rst_mask);/* enable upstream and blk-ctrl clocks to allow reset to propagate */ret=clk_bulk_prepare_enable(data->num_clks,domain->clks);
@@ -120,6 +134,9 @@ static int imx8m_blk_ctrl_power_off(struct generic_pm_domain *genpd)structimx8m_blk_ctrl*bc=domain->bc;/* put devices into reset and disable clocks */+if(data->mipi_phy_rst_mask)+regmap_clear_bits(bc->regmap,BLK_MIPI_RESET_DIV,data->mipi_phy_rst_mask);+
Is it the best option to enable/disable both the master and slave MIPI
DPHY, regardless of whether they're used or not ? Or would it be better
to implement a reset controller to expose the two resets independently,
and acquire them from the corresponding display and camera drivers ?
In some early attempts to implement the blk-ctrl driver, there was an
attempt to enable a reset controller, but it caused some hanging and
issues with suspend-resume due to chicken-egg issues where some items
were coming up in the wrong order. I think the decision was made to
make the resets part of the power domain so it's very clear that the
order of operations. Lucas might be able to elaborate more on this.
I think supporting via phy driver make sense to me since this resent
is DPHY specific and nothing related to blk-ctrl.
I would disagree that isn't not blk-ctrl. The blk-ctrl controls the
reset lines for the CSI and enables clocks. The additional register
does the same thing to the MIPI CSI and DSI. The imx7-mipi-csis
driver configures the dphy already, but this reset bit is not part of
its IP block. It seems weird to me that a phy driver would reference
a phy driver.
quoted
If bits 16 and 17 can act independently and bit 16 only impacts the
CSI and doesn't require bit 17, it seems reasonable to me to have the
power-domain part of the CSI, since this would only be enabled when
the CSI is active. The power domain is idled when the CSI is idled
which would effectively place the phy in and out of reset only
depending on the state of the CSI. I am guessing this reset bit
should be assigned to DISPBLK_PD_MIPI_CSI and not
DISPBLK_PD_CSI_BRIDGE, but I can run some more tests.
AFAIK, there is no phy driver for the CSI like there is the DSI, so
adding that would require additional work to the CSI driver to work
around this quirk. We don't have an acceptable DSI driver yet, so I'd
like to push a V3 with just the corresponding bit enabled for MIPI_CSI
after some testing. FWICT, NXP set both bits 16 and 17 in their ATF
gpc code, and it never gets cleared, so I think having the bit set and
cleared on demand is an improvement.
How about using the previous one that Marek sent. Add it via CSI
pipeline and i think it would directly.
That driver specifically addresses the DSI phy and bringing it out of
reset is just one small part of what that driver does. I don't think
adding CSI functionality to it would be appropriate for that driver as
they are separate IP blocks.
If people don't want the blk-ctl to control this bit, I would advocate
we should do a separate reset controller to be referenced byt the
mipi-csis driver, but that was proposed before and declined. Since
blt-ctrl already is pulling seemingly unrelated IP blocks by
controlling their clocks and resets. The fact that NXP included it in
their ATF power-domain controller tells me they considered it related
to power domains and/or resets and not an explicit phy driver.
adam
Hi Adam,
On Thu, Nov 25, 2021 at 09:18:24AM -0600, Adam Ford wrote:
On Wed, Nov 24, 2021 at 11:42 PM Jagan Teki wrote:
quoted
On Tue, Nov 23, 2021 at 7:29 PM Adam Ford wrote:
quoted
On Sun, Nov 21, 2021 at 4:25 PM Laurent Pinchart wrote:
quoted
On Sat, Nov 06, 2021 at 10:54:23AM -0500, Adam Ford wrote:
quoted
Most of the blk-ctrl reset bits are found in one register, however
there are two bits in offset 8 for pulling the MIPI DPHY out of reset
and these need to be set when IMX8MM_DISPBLK_PD_MIPI_CSI is brought
out of reset or the MIPI_CSI hangs.
Fixes: 926e57c065df ("soc: imx: imx8m-blk-ctrl: add DISP blk-ctrl")
Signed-off-by: Adam Ford <redacted>
---
V2: Make a note that the extra register is only for Mini/Nano DISPLAY_BLK_CTRL
Rename the new register to mipi_phy_rst_mask
Encapsulate the edits to this register with an if-statement
drivers/soc/imx/imx8m-blk-ctrl.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
@@ -78,6 +88,8 @@ static int imx8m_blk_ctrl_power_on(struct generic_pm_domain *genpd)/* put devices into reset */regmap_clear_bits(bc->regmap,BLK_SFT_RSTN,data->rst_mask);+if(data->mipi_phy_rst_mask)+regmap_clear_bits(bc->regmap,BLK_MIPI_RESET_DIV,data->mipi_phy_rst_mask);/* enable upstream and blk-ctrl clocks to allow reset to propagate */ret=clk_bulk_prepare_enable(data->num_clks,domain->clks);
@@ -120,6 +134,9 @@ static int imx8m_blk_ctrl_power_off(struct generic_pm_domain *genpd)structimx8m_blk_ctrl*bc=domain->bc;/* put devices into reset and disable clocks */+if(data->mipi_phy_rst_mask)+regmap_clear_bits(bc->regmap,BLK_MIPI_RESET_DIV,data->mipi_phy_rst_mask);+
Is it the best option to enable/disable both the master and slave MIPI
DPHY, regardless of whether they're used or not ? Or would it be better
to implement a reset controller to expose the two resets independently,
and acquire them from the corresponding display and camera drivers ?
In some early attempts to implement the blk-ctrl driver, there was an
attempt to enable a reset controller, but it caused some hanging and
issues with suspend-resume due to chicken-egg issues where some items
were coming up in the wrong order. I think the decision was made to
make the resets part of the power domain so it's very clear that the
order of operations. Lucas might be able to elaborate more on this.
I think supporting via phy driver make sense to me since this resent
is DPHY specific and nothing related to blk-ctrl.
I would disagree that isn't not blk-ctrl. The blk-ctrl controls the
reset lines for the CSI and enables clocks. The additional register
does the same thing to the MIPI CSI and DSI. The imx7-mipi-csis
driver configures the dphy already, but this reset bit is not part of
its IP block. It seems weird to me that a phy driver would reference
a phy driver.
quoted
quoted
If bits 16 and 17 can act independently and bit 16 only impacts the
CSI and doesn't require bit 17, it seems reasonable to me to have the
power-domain part of the CSI, since this would only be enabled when
the CSI is active. The power domain is idled when the CSI is idled
which would effectively place the phy in and out of reset only
depending on the state of the CSI. I am guessing this reset bit
should be assigned to DISPBLK_PD_MIPI_CSI and not
DISPBLK_PD_CSI_BRIDGE, but I can run some more tests.
AFAIK, there is no phy driver for the CSI like there is the DSI, so
adding that would require additional work to the CSI driver to work
around this quirk. We don't have an acceptable DSI driver yet, so I'd
like to push a V3 with just the corresponding bit enabled for MIPI_CSI
after some testing. FWICT, NXP set both bits 16 and 17 in their ATF
gpc code, and it never gets cleared, so I think having the bit set and
cleared on demand is an improvement.
How about using the previous one that Marek sent. Add it via CSI
pipeline and i think it would directly.
That driver specifically addresses the DSI phy and bringing it out of
reset is just one small part of what that driver does. I don't think
adding CSI functionality to it would be appropriate for that driver as
they are separate IP blocks.
If people don't want the blk-ctl to control this bit, I would advocate
we should do a separate reset controller to be referenced byt the
mipi-csis driver, but that was proposed before and declined. Since
blt-ctrl already is pulling seemingly unrelated IP blocks by
controlling their clocks and resets. The fact that NXP included it in
their ATF power-domain controller tells me they considered it related
to power domains and/or resets and not an explicit phy driver.
I think it's a bit more complicated than that, unfortunately. The
BLK_CTRL is a mix of miscellaneous configuration bits thrown together.
It contains enable/disable bits for clocks and resets, but also D-PHY
configuration parameters (GPR_MIPI_[MS]_DPDN_SWAP_{CLK,DAT} in
GPR_MIPI_RESET_DIV, and all the fields of the GPR_MIPI_M_PLL* and
GPR_MIPI_[BMS]_DPHYCTL* registers). The latter should be controlled by
PHY drivers, but we may be able to control get away with hardcoded
values (possibly even hardware reset default values).
For the resets and clocks, reset and clock controllers could have been
nice. I'm not sure if controlling them through a power domain could
count as a bit of an abuse, as the power domain doesn't control power
rails, but looking at the imx8m-blk-ctrl driver the on/off sequences
required by the clocks and resets would be difficult to handle if clocks
and resets were exposed separately. I'd say that in the worst case it's
probably an acceptable hack.
For the D-PHY resets, exposing them through a reset controller would
also be (in my opinion) the most pedantic approach, bus as we have power
domains for the CSI and DSI controllers, controlling the corresponding
D-PHY resets from there is in no case worse that what we have already.
The only part that bothers me is the control of the master D-PHY, used
for MIPI DSI, from the MIPI CSI power domain. I've received feedback
from NXP today that those two GPR reset signals are connected directly
to the corresponding D-PHY, without any special combinatorial logic
in-between. I think it would be worth a try to control bit 16 from the
MIPI CSI power domain and bit 17 from the MIPI DSI power domain,
especially given that bit 17 didn't make any difference in my camera
tests on the i.MX8MM (I couldn't test display as my board doesn't use
the DSI output). If we then run into any issue, we can try to figure it
out.
From: Adam Ford <hidden> Date: 2021-11-27 13:53:06
On Thu, Nov 25, 2021 at 6:34 PM Laurent Pinchart
[off-list ref] wrote:
Hi Adam,
On Thu, Nov 25, 2021 at 09:18:24AM -0600, Adam Ford wrote:
quoted
On Wed, Nov 24, 2021 at 11:42 PM Jagan Teki wrote:
quoted
On Tue, Nov 23, 2021 at 7:29 PM Adam Ford wrote:
quoted
On Sun, Nov 21, 2021 at 4:25 PM Laurent Pinchart wrote:
quoted
On Sat, Nov 06, 2021 at 10:54:23AM -0500, Adam Ford wrote:
quoted
Most of the blk-ctrl reset bits are found in one register, however
there are two bits in offset 8 for pulling the MIPI DPHY out of reset
and these need to be set when IMX8MM_DISPBLK_PD_MIPI_CSI is brought
out of reset or the MIPI_CSI hangs.
Fixes: 926e57c065df ("soc: imx: imx8m-blk-ctrl: add DISP blk-ctrl")
Signed-off-by: Adam Ford <redacted>
---
V2: Make a note that the extra register is only for Mini/Nano DISPLAY_BLK_CTRL
Rename the new register to mipi_phy_rst_mask
Encapsulate the edits to this register with an if-statement
drivers/soc/imx/imx8m-blk-ctrl.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
@@ -78,6 +88,8 @@ static int imx8m_blk_ctrl_power_on(struct generic_pm_domain *genpd)/* put devices into reset */regmap_clear_bits(bc->regmap,BLK_SFT_RSTN,data->rst_mask);+if(data->mipi_phy_rst_mask)+regmap_clear_bits(bc->regmap,BLK_MIPI_RESET_DIV,data->mipi_phy_rst_mask);/* enable upstream and blk-ctrl clocks to allow reset to propagate */ret=clk_bulk_prepare_enable(data->num_clks,domain->clks);
@@ -120,6 +134,9 @@ static int imx8m_blk_ctrl_power_off(struct generic_pm_domain *genpd)structimx8m_blk_ctrl*bc=domain->bc;/* put devices into reset and disable clocks */+if(data->mipi_phy_rst_mask)+regmap_clear_bits(bc->regmap,BLK_MIPI_RESET_DIV,data->mipi_phy_rst_mask);+
Is it the best option to enable/disable both the master and slave MIPI
DPHY, regardless of whether they're used or not ? Or would it be better
to implement a reset controller to expose the two resets independently,
and acquire them from the corresponding display and camera drivers ?
In some early attempts to implement the blk-ctrl driver, there was an
attempt to enable a reset controller, but it caused some hanging and
issues with suspend-resume due to chicken-egg issues where some items
were coming up in the wrong order. I think the decision was made to
make the resets part of the power domain so it's very clear that the
order of operations. Lucas might be able to elaborate more on this.
I think supporting via phy driver make sense to me since this resent
is DPHY specific and nothing related to blk-ctrl.
I would disagree that isn't not blk-ctrl. The blk-ctrl controls the
reset lines for the CSI and enables clocks. The additional register
does the same thing to the MIPI CSI and DSI. The imx7-mipi-csis
driver configures the dphy already, but this reset bit is not part of
its IP block. It seems weird to me that a phy driver would reference
a phy driver.
quoted
quoted
If bits 16 and 17 can act independently and bit 16 only impacts the
CSI and doesn't require bit 17, it seems reasonable to me to have the
power-domain part of the CSI, since this would only be enabled when
the CSI is active. The power domain is idled when the CSI is idled
which would effectively place the phy in and out of reset only
depending on the state of the CSI. I am guessing this reset bit
should be assigned to DISPBLK_PD_MIPI_CSI and not
DISPBLK_PD_CSI_BRIDGE, but I can run some more tests.
AFAIK, there is no phy driver for the CSI like there is the DSI, so
adding that would require additional work to the CSI driver to work
around this quirk. We don't have an acceptable DSI driver yet, so I'd
like to push a V3 with just the corresponding bit enabled for MIPI_CSI
after some testing. FWICT, NXP set both bits 16 and 17 in their ATF
gpc code, and it never gets cleared, so I think having the bit set and
cleared on demand is an improvement.
How about using the previous one that Marek sent. Add it via CSI
pipeline and i think it would directly.
That driver specifically addresses the DSI phy and bringing it out of
reset is just one small part of what that driver does. I don't think
adding CSI functionality to it would be appropriate for that driver as
they are separate IP blocks.
If people don't want the blk-ctl to control this bit, I would advocate
we should do a separate reset controller to be referenced byt the
mipi-csis driver, but that was proposed before and declined. Since
blt-ctrl already is pulling seemingly unrelated IP blocks by
controlling their clocks and resets. The fact that NXP included it in
their ATF power-domain controller tells me they considered it related
to power domains and/or resets and not an explicit phy driver.
I think it's a bit more complicated than that, unfortunately. The
BLK_CTRL is a mix of miscellaneous configuration bits thrown together.
It contains enable/disable bits for clocks and resets, but also D-PHY
configuration parameters (GPR_MIPI_[MS]_DPDN_SWAP_{CLK,DAT} in
GPR_MIPI_RESET_DIV, and all the fields of the GPR_MIPI_M_PLL* and
GPR_MIPI_[BMS]_DPHYCTL* registers). The latter should be controlled by
PHY drivers, but we may be able to control get away with hardcoded
values (possibly even hardware reset default values).
From my testing, the default values in this register block appeared
sufficient to run
the OV5640 camera I have.
For the resets and clocks, reset and clock controllers could have been
nice. I'm not sure if controlling them through a power domain could
That was attempted by Lucas and others, but there were a bunch of
issues with hanging due to order of operations and the interactions
between the bus clock from the blk-ctrl and the GPC power domains.
count as a bit of an abuse, as the power domain doesn't control power
rails, but looking at the imx8m-blk-ctrl driver the on/off sequences
required by the clocks and resets would be difficult to handle if clocks
and resets were exposed separately. I'd say that in the worst case it's
probably an acceptable hack.
So if I post a revision with only bit-16 and leaving bit 17 for the
DSI Phy driver, do you have any objections? (see my comment below)
For the D-PHY resets, exposing them through a reset controller would
also be (in my opinion) the most pedantic approach, bus as we have power
domains for the CSI and DSI controllers, controlling the corresponding
D-PHY resets from there is in no case worse that what we have already.
The only part that bothers me is the control of the master D-PHY, used
for MIPI DSI, from the MIPI CSI power domain. I've received feedback
from NXP today that those two GPR reset signals are connected directly
to the corresponding D-PHY, without any special combinatorial logic
in-between. I think it would be worth a try to control bit 16 from the
MIPI CSI power domain and bit 17 from the MIPI DSI power domain,
especially given that bit 17 didn't make any difference in my camera
tests on the i.MX8MM (I couldn't test display as my board doesn't use
the DSI output). If we then run into any issue, we can try to figure it
out.
I went back to test this as well. With only bit 16 being used, it
appeared to work too, so it seems like it's likely safe to leave bit
17 alone for this.
adam
Hi Adam,
On Sat, Nov 27, 2021 at 07:50:48AM -0600, Adam Ford wrote:
On Thu, Nov 25, 2021 at 6:34 PM Laurent Pinchart wrote:
quoted
On Thu, Nov 25, 2021 at 09:18:24AM -0600, Adam Ford wrote:
quoted
On Wed, Nov 24, 2021 at 11:42 PM Jagan Teki wrote:
quoted
On Tue, Nov 23, 2021 at 7:29 PM Adam Ford wrote:
quoted
On Sun, Nov 21, 2021 at 4:25 PM Laurent Pinchart wrote:
quoted
On Sat, Nov 06, 2021 at 10:54:23AM -0500, Adam Ford wrote:
quoted
Most of the blk-ctrl reset bits are found in one register, however
there are two bits in offset 8 for pulling the MIPI DPHY out of reset
and these need to be set when IMX8MM_DISPBLK_PD_MIPI_CSI is brought
out of reset or the MIPI_CSI hangs.
Fixes: 926e57c065df ("soc: imx: imx8m-blk-ctrl: add DISP blk-ctrl")
Signed-off-by: Adam Ford <redacted>
---
V2: Make a note that the extra register is only for Mini/Nano DISPLAY_BLK_CTRL
Rename the new register to mipi_phy_rst_mask
Encapsulate the edits to this register with an if-statement
drivers/soc/imx/imx8m-blk-ctrl.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
@@ -78,6 +88,8 @@ static int imx8m_blk_ctrl_power_on(struct generic_pm_domain *genpd)/* put devices into reset */regmap_clear_bits(bc->regmap,BLK_SFT_RSTN,data->rst_mask);+if(data->mipi_phy_rst_mask)+regmap_clear_bits(bc->regmap,BLK_MIPI_RESET_DIV,data->mipi_phy_rst_mask);/* enable upstream and blk-ctrl clocks to allow reset to propagate */ret=clk_bulk_prepare_enable(data->num_clks,domain->clks);
@@ -120,6 +134,9 @@ static int imx8m_blk_ctrl_power_off(struct generic_pm_domain *genpd)structimx8m_blk_ctrl*bc=domain->bc;/* put devices into reset and disable clocks */+if(data->mipi_phy_rst_mask)+regmap_clear_bits(bc->regmap,BLK_MIPI_RESET_DIV,data->mipi_phy_rst_mask);+
Is it the best option to enable/disable both the master and slave MIPI
DPHY, regardless of whether they're used or not ? Or would it be better
to implement a reset controller to expose the two resets independently,
and acquire them from the corresponding display and camera drivers ?
In some early attempts to implement the blk-ctrl driver, there was an
attempt to enable a reset controller, but it caused some hanging and
issues with suspend-resume due to chicken-egg issues where some items
were coming up in the wrong order. I think the decision was made to
make the resets part of the power domain so it's very clear that the
order of operations. Lucas might be able to elaborate more on this.
I think supporting via phy driver make sense to me since this resent
is DPHY specific and nothing related to blk-ctrl.
I would disagree that isn't not blk-ctrl. The blk-ctrl controls the
reset lines for the CSI and enables clocks. The additional register
does the same thing to the MIPI CSI and DSI. The imx7-mipi-csis
driver configures the dphy already, but this reset bit is not part of
its IP block. It seems weird to me that a phy driver would reference
a phy driver.
quoted
quoted
If bits 16 and 17 can act independently and bit 16 only impacts the
CSI and doesn't require bit 17, it seems reasonable to me to have the
power-domain part of the CSI, since this would only be enabled when
the CSI is active. The power domain is idled when the CSI is idled
which would effectively place the phy in and out of reset only
depending on the state of the CSI. I am guessing this reset bit
should be assigned to DISPBLK_PD_MIPI_CSI and not
DISPBLK_PD_CSI_BRIDGE, but I can run some more tests.
AFAIK, there is no phy driver for the CSI like there is the DSI, so
adding that would require additional work to the CSI driver to work
around this quirk. We don't have an acceptable DSI driver yet, so I'd
like to push a V3 with just the corresponding bit enabled for MIPI_CSI
after some testing. FWICT, NXP set both bits 16 and 17 in their ATF
gpc code, and it never gets cleared, so I think having the bit set and
cleared on demand is an improvement.
How about using the previous one that Marek sent. Add it via CSI
pipeline and i think it would directly.
That driver specifically addresses the DSI phy and bringing it out of
reset is just one small part of what that driver does. I don't think
adding CSI functionality to it would be appropriate for that driver as
they are separate IP blocks.
If people don't want the blk-ctl to control this bit, I would advocate
we should do a separate reset controller to be referenced byt the
mipi-csis driver, but that was proposed before and declined. Since
blt-ctrl already is pulling seemingly unrelated IP blocks by
controlling their clocks and resets. The fact that NXP included it in
their ATF power-domain controller tells me they considered it related
to power domains and/or resets and not an explicit phy driver.
I think it's a bit more complicated than that, unfortunately. The
BLK_CTRL is a mix of miscellaneous configuration bits thrown together.
It contains enable/disable bits for clocks and resets, but also D-PHY
configuration parameters (GPR_MIPI_[MS]_DPDN_SWAP_{CLK,DAT} in
GPR_MIPI_RESET_DIV, and all the fields of the GPR_MIPI_M_PLL* and
GPR_MIPI_[BMS]_DPHYCTL* registers). The latter should be controlled by
PHY drivers, but we may be able to control get away with hardcoded
values (possibly even hardware reset default values).
From my testing, the default values in this register block appeared
sufficient to run the OV5640 camera I have.
quoted
For the resets and clocks, reset and clock controllers could have been
nice. I'm not sure if controlling them through a power domain could
That was attempted by Lucas and others, but there were a bunch of
issues with hanging due to order of operations and the interactions
between the bus clock from the blk-ctrl and the GPC power domains.
quoted
count as a bit of an abuse, as the power domain doesn't control power
rails, but looking at the imx8m-blk-ctrl driver the on/off sequences
required by the clocks and resets would be difficult to handle if clocks
and resets were exposed separately. I'd say that in the worst case it's
probably an acceptable hack.
So if I post a revision with only bit-16 and leaving bit 17 for the
DSI Phy driver, do you have any objections? (see my comment below)
For the D-PHY resets, exposing them through a reset controller would
also be (in my opinion) the most pedantic approach, bus as we have power
domains for the CSI and DSI controllers, controlling the corresponding
D-PHY resets from there is in no case worse that what we have already.
The only part that bothers me is the control of the master D-PHY, used
for MIPI DSI, from the MIPI CSI power domain. I've received feedback
from NXP today that those two GPR reset signals are connected directly
to the corresponding D-PHY, without any special combinatorial logic
in-between. I think it would be worth a try to control bit 16 from the
MIPI CSI power domain and bit 17 from the MIPI DSI power domain,
especially given that bit 17 didn't make any difference in my camera
tests on the i.MX8MM (I couldn't test display as my board doesn't use
the DSI output). If we then run into any issue, we can try to figure it
out.
I went back to test this as well. With only bit 16 being used, it
appeared to work too, so it seems like it's likely safe to leave bit
17 alone for this.