Skip to content

Commit

Permalink
Improve eMMC stability, DSI support
Browse files Browse the repository at this point in the history
  • Loading branch information
mdanikin committed Aug 20, 2024
1 parent 0d34360 commit f3a90f3
Show file tree
Hide file tree
Showing 7 changed files with 275 additions and 0 deletions.
3 changes: 3 additions & 0 deletions conf/includes/hailo_demo.conf
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,6 @@ CORE_IMAGE_EXTRA_INSTALL:append = " \

CORE_IMAGE_EXTRA_INSTALL:append = " x264 gstreamer1.0-plugins-ugly"
PACKAGECONFIG:append:pn-gstreamer1.0-plugins-ugly = " x264"

CORE_IMAGE_EXTRA_INSTALL:append = " libdrm libdrm-kms libdrm-tests fb-test"
PACKAGECONFIG:append:pn-gstreamer1.0-plugins-bad = " kms"
7 changes: 7 additions & 0 deletions recipes-kernel/linux/linux-yocto-hailo.bbappend
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ SRC_URI:append = " \
file://0001-Fix-kernel-symlinks.patch \
file://0001-MXL8611X-support.patch \
file://0002-Hailo-15-SolidRun-support.patch \
file://0004-panel-ronbo-fix-gpio.patch \
"

# Temporary, unless merged into hailo BSP
SRC_URI:append = " \
file://0003-emmc-tunning.patch \
file://0005-panel-ronbo-hailo.patch \
"

# defconfig
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1077,3 +1077,152 @@ index 000000000000..b55fcf8cd0cd
--
2.45.2

From dd8b2a91597e4d52faf571e424ae49f90fae25a9 Mon Sep 17 00:00:00 2001
From: Mikhail Anikin <mikhail.anikin@solid-run.com>
Date: Tue, 20 Aug 2024 11:31:56 +0300
Subject: [PATCH 3/4] [hailo15-sr-som] Enable GPIO IRQ for i2C expander

---
arch/arm64/boot/dts/hailo/hailo15-sr-som.dtsi | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/boot/dts/hailo/hailo15-sr-som.dtsi b/arch/arm64/boot/dts/hailo/hailo15-sr-som.dtsi
index 645fd6882d1a..209d3c63e584 100644
--- a/arch/arm64/boot/dts/hailo/hailo15-sr-som.dtsi
+++ b/arch/arm64/boot/dts/hailo/hailo15-sr-som.dtsi
@@ -56,11 +56,14 @@ csi2rx_in_sensor: endpoint {
&i2c_0 {
status = "okay";
gpio_pca: gpio@74 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_gpio6>;
+
compatible = "nxp,pca9539";
reg = <0x74>;
#gpio-cells = <2>;
- // interrupt-parent = <&gpio0>;
- // interrupts = <6 IRQ_TYPE_LEVEL_LOW>;
+ interrupt-parent = <&gpio0>;
+ interrupts = <6 IRQ_TYPE_LEVEL_LOW>;
reset-gpios = <&gpio0 8 GPIO_ACTIVE_LOW>;
gpio-controller;
gpio-line-names =
@@ -163,6 +166,11 @@ pinctrl_eth: eth {
drive-strength = <2>;
};

+ pinctrl_gpio6: gpio6 {
+ function = "gpio";
+ groups = "gpio6_grp";
+ };
+
pinctrl_i2c2: i2c2 {
function = "i2c2";
groups = "i2c2_1_grp";
--
2.46.0

From 570088ed10767a8c0d8393dc1361241f42f793a1 Mon Sep 17 00:00:00 2001
From: Mikhail Anikin <mikhail.anikin@solid-run.com>
Date: Tue, 20 Aug 2024 11:32:49 +0300
Subject: [PATCH 4/4] [Hummingboard IIoT] DSI support

---
.../boot/dts/hailo/hummingboard-iiot.dtsi | 63 +++++++++++++++----
1 file changed, 50 insertions(+), 13 deletions(-)

diff --git a/arch/arm64/boot/dts/hailo/hummingboard-iiot.dtsi b/arch/arm64/boot/dts/hailo/hummingboard-iiot.dtsi
index b90de6697453..e6d9bbcfa9e2 100644
--- a/arch/arm64/boot/dts/hailo/hummingboard-iiot.dtsi
+++ b/arch/arm64/boot/dts/hailo/hummingboard-iiot.dtsi
@@ -22,6 +22,13 @@ lcd_i2c_rst: lcd_i2c_rst {
enable-active-high;
};

+ mipi_backlight: backlight {
+ compatible = "gpio-backlight";
+ gpios = <&gpio_dsi_expander 3 GPIO_ACTIVE_LOW>;
+ default-on;
+ };
+
+
};

&i2c_2 {
@@ -50,12 +57,12 @@ tca6416_20: gpio@20 {
"TCA_USB1_PWR_EN",
"TCA_VIDEO_PWR_EN";

- // TCA_VIDEO_PWR_EN {
- // gpio-hog;
- // gpios = <15 GPIO_ACTIVE_HIGH>;
- // output-high;
- // line-name = "TCA_VIDEO_PWR_EN";
- // };
+ TCA_VIDEO_PWR_EN {
+ gpio-hog;
+ gpios = <15 GPIO_ACTIVE_HIGH>;
+ output-high;
+ line-name = "TCA_VIDEO_PWR_EN";
+ };
};

tca6416_21: gpio@21 {
@@ -248,13 +255,6 @@ gpio_dsi_expander: tca6408@21 {
"DSI_U/D",
"DSI_CTP_/RST",
"NC";
-
- // DSI_PWM_BL {
- // gpio-hog;
- // gpios = <3 GPIO_ACTIVE_HIGH>;
- // output-low;
- // line-name = "DSI_PWM_BL";
- // };
};
};
};
@@ -296,3 +296,40 @@ &usb3 {
&eth {
status = "okay";
};
+
+&dphy0 {
+ status = "okay";
+};
+
+&dpi0 {
+ status = "okay";
+};
+
+&dsi0 {
+ status = "okay";
+
+ panel@0 {
+ compatible = "ronbo,rb070d30";
+ reg = <0>;
+ power-gpios = <&gpio_dsi_expander 2 GPIO_ACTIVE_HIGH>;
+ reset-gpios = <&gpio_dsi_expander 1 GPIO_ACTIVE_HIGH>;
+ updn-gpios = <&gpio_dsi_expander 5 GPIO_ACTIVE_HIGH>;
+ shlr-gpios = <&gpio_dsi_expander 4 GPIO_ACTIVE_LOW>;
+ backlight = <&mipi_backlight>;
+
+ port {
+ dsi_in_panel: endpoint {
+ remote-endpoint = <&dsi0_out>;
+ };
+ };
+ };
+
+ ports {
+ port@0 {
+ reg = <0>;
+ dsi0_out: endpoint {
+ remote-endpoint = <&dsi_in_panel>;
+ };
+ };
+ };
+};
--
2.46.0

49 changes: 49 additions & 0 deletions recipes-kernel/linux/linux-yocto-hailo/0003-emmc-tunning.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
diff --git a/drivers/mmc/host/sdhci-of-dwcmshc.c b/drivers/mmc/host/sdhci-of-dwcmshc.c
index 3bc2cdc996a1b..036631f5615b3 100644
--- a/drivers/mmc/host/sdhci-of-dwcmshc.c
+++ b/drivers/mmc/host/sdhci-of-dwcmshc.c
@@ -528,6 +528,12 @@ static int hailo15_dwcmshc_execute_tuning(struct mmc_host *mmc, u32 opcode)
err = sdhci_execute_tuning(mmc, opcode);
if (!err && !host->tuning_err)
pr_info("%s Tuning Success!\n", mmc_hostname(host->mmc));
+ else {
+ // MSW-6198 - In case of an Error - try one more time (full iteration loop)
+ err = sdhci_execute_tuning(mmc, opcode);
+ if (!err && !host->tuning_err)
+ pr_info("%s Tuning Success!\n", mmc_hostname(host->mmc));
+ }

return err;
}
@@ -764,12 +770,16 @@ static void dwcmshc_hailo15_phy_config(struct sdhci_host *host)
reg16 |= DWCMSHC_XFER_MODE_R__MULTI_BLK_SEL;
sdhci_writew(host, reg16, DWCMSHC_XFER_MODE_R);

- /* Sampling window threshold value is 31 out of 128 taps */
+ /* Sampling window threshold value */
reg32 = sdhci_readl(host, DWCMSHC_AT_CTRL_R);
reg32 &= ~DWCMSHC_AT_CTRL_R__SWIN_TH_EN;
reg32 |= DWCMSHC_AT_CTRL_R__SWIN_TH_EN;
reg32 &= ~DWCMSHC_AT_CTRL_R__SWIN_TH_VAL;
- reg32 |= FIELD_PREP(DWCMSHC_AT_CTRL_R__SWIN_TH_VAL,0x1f);
+ if (sdio_phy_config->card_is_emmc) {
+ reg32 |= FIELD_PREP(DWCMSHC_AT_CTRL_R__SWIN_TH_VAL,0x3c);
+ } else {
+ reg32 |= FIELD_PREP(DWCMSHC_AT_CTRL_R__SWIN_TH_VAL,0x1f);
+ }
sdhci_writel(host, reg32, DWCMSHC_AT_CTRL_R);

pr_debug("%s phy configuration for %s mode done\n", mmc_hostname(host->mmc), sdio_phy_config->card_is_emmc ? "EMMC ": "SD");
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index cf4524a97e37e..b0d7bbbdb18ac 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -2809,7 +2809,7 @@ static int __sdhci_execute_tuning(struct sdhci_host *host, u32 opcode)

}

- pr_debug("%s: Tuning failed, falling back to fixed sampling clock\n",
+ pr_err("%s: Tuning failed, falling back to fixed sampling clock\n",
mmc_hostname(host->mmc));
sdhci_reset_tuning(host);
return -EAGAIN;
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
From fff9f828b6c6ace62b398b17f9411f06ee860711 Mon Sep 17 00:00:00 2001
From: Mikhail Anikin <mikhail.anikin@solid-run.com>
Date: Tue, 20 Aug 2024 11:29:57 +0300
Subject: [PATCH 1/4] [panel-ronbo] Use gpiod_set_value_cansleep

---
drivers/gpu/drm/panel/panel-ronbo-rb070d30.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c b/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c
index 1fb579a574d9..28088ce1ed64 100644
--- a/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c
+++ b/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c
@@ -54,9 +54,9 @@ static int rb070d30_panel_prepare(struct drm_panel *panel)
}

msleep(20);
- gpiod_set_value(ctx->gpios.power, 1);
+ gpiod_set_value_cansleep(ctx->gpios.power, 1);
msleep(20);
- gpiod_set_value(ctx->gpios.reset, 1);
+ gpiod_set_value_cansleep(ctx->gpios.reset, 1);
msleep(20);
return 0;
}
@@ -65,8 +65,8 @@ static int rb070d30_panel_unprepare(struct drm_panel *panel)
{
struct rb070d30_panel *ctx = panel_to_rb070d30_panel(panel);

- gpiod_set_value(ctx->gpios.reset, 0);
- gpiod_set_value(ctx->gpios.power, 0);
+ gpiod_set_value_cansleep(ctx->gpios.reset, 0);
+ gpiod_set_value_cansleep(ctx->gpios.power, 0);
regulator_disable(ctx->supply);

return 0;
--
2.46.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

From 434bbb6ac7bf033e54d11ee46c8dad366877e152 Mon Sep 17 00:00:00 2001
From: Mikhail Anikin <mikhail.anikin@solid-run.com>
Date: Tue, 20 Aug 2024 11:30:45 +0300
Subject: [PATCH 2/4] [panel-ronbo] Hailo DSI Compatibility

---
drivers/gpu/drm/panel/panel-ronbo-rb070d30.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c b/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c
index 28088ce1ed64..9fbab8922edd 100644
--- a/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c
+++ b/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c
@@ -195,7 +195,8 @@ static int rb070d30_panel_dsi_probe(struct mipi_dsi_device *dsi)

drm_panel_add(&ctx->panel);

- dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST | MIPI_DSI_MODE_LPM;
+ // dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST | MIPI_DSI_MODE_LPM;
+ dsi->mode_flags = MIPI_DSI_MODE_VIDEO;
dsi->format = MIPI_DSI_FMT_RGB888;
dsi->lanes = 4;

--
2.46.0
3 changes: 3 additions & 0 deletions recipes-kernel/linux/linux-yocto-hailo/solidrun-H15-SOM.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@ CONFIG_LEDS_LP55XX_COMMON=m
# CONFIG_LEDS_LP5562 is not set
# CONFIG_LEDS_LP8501 is not set
CONFIG_RTC_DRV_ABX80X=m

CONFIG_DRM_PANEL_RONBO_RB070D30=m
CONFIG_BACKLIGHT_GPIO=m

0 comments on commit f3a90f3

Please sign in to comment.