Re: [PATCH v1 1/1] usb: ci_udc: don't use "advance" feature when setting address

2024-10-27 Thread Svyatoslav Ryhel
нд, 27 жовт. 2024 р. о 18:09 Marek Vasut  пише:
>
> On 10/13/24 4:58 PM, Svyatoslav Ryhel wrote:
>
> Sorry for the late reply.
>
> > +++ b/drivers/usb/gadget/ci_udc.c
> > @@ -649,12 +649,30 @@ static void flip_ep0_direction(void)
> >   }
> >   }
> >
> > +/*
> > + * This function explicitly sets the address, without the "USBADRA" 
> > (advance)
> > + * feature, which is not supported by older versions of the controller.
> > + */
> > +static void ci_set_address(struct ci_udc *udc, u8 address)
> > +{
> > + DBG("%s %x\n", __func__, address);
>
> log_debug() or dev_dbg() please.
>

DBG macro is used across entire driver, if you wish to replace it,
then pls, send a followup with patch for entire driver. This is out of
scope of this patch.

> > + writel(address << 25, &udc->devaddr);
> > +}
> > +
> >   static void handle_ep_complete(struct ci_ep *ci_ep)
> >   {
> >   struct ept_queue_item *item, *next_td;
> >   int num, in, len, j;
> >   struct ci_req *ci_req;
> >
> > + /* Set the device address that was previously sent by SET_ADDRESS */
> > + if (controller.next_device_address != 0) {
> > + struct ci_udc *udc = (struct ci_udc *)controller.ctrl->hcor;
> > +
> > + ci_set_address(udc, controller.next_device_address);
> > + controller.next_device_address = 0;
> > + }
> > +
> >   num = ci_ep->desc->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK;
> >   in = (ci_ep->desc->bEndpointAddress & USB_DIR_IN) != 0;
> >   item = ci_get_qtd(num, in);
> > @@ -783,7 +801,7 @@ static void handle_setup(void)
> >* write address delayed (will take effect
> >* after the next IN txn)
> >*/
> > - writel((r.wValue << 25) | (1 << 24), &udc->devaddr);
> > + controller.next_device_address = r.wValue;
>
> wValue is word , u16 , but next_device_address is u8 below , why ?
>

wValue is u16 but only 8 bits are relevant since USB address is 8 bit,
hence u8. Changing wValue to u8 is out of scope of this patch as well.

> >   req->length = 0;
> >   usb_ep_queue(controller.gadget.ep0, req, 0);
> >   return;
> > @@ -814,6 +832,9 @@ static void stop_activity(void)
> >   int i, num, in;
> >   struct ept_queue_head *head;
> >   struct ci_udc *udc = (struct ci_udc *)controller.ctrl->hcor;
> > +
> > + ci_set_address(udc, 0);
> > +
> >   writel(readl(&udc->epcomp), &udc->epcomp);
> >   #ifdef CONFIG_CI_UDC_HAS_HOSTPC
> >   writel(readl(&udc->epsetupstat), &udc->epsetupstat);
> > @@ -934,6 +955,7 @@ static int ci_pullup(struct usb_gadget *gadget, int 
> > is_on)
> >   struct ci_udc *udc = (struct ci_udc *)controller.ctrl->hcor;
> >   if (is_on) {
> >   /* RESET */
> > + controller.next_device_address = 0;
> >   writel(USBCMD_ITC(MICRO_8FRAME) | USBCMD_RST, &udc->usbcmd);
> >   udelay(200);
> >
> > diff --git a/drivers/usb/gadget/ci_udc.h b/drivers/usb/gadget/ci_udc.h
> > index bea2f9f3fe3..807f2084c1e 100644
> > --- a/drivers/usb/gadget/ci_udc.h
> > +++ b/drivers/usb/gadget/ci_udc.h
> > @@ -105,6 +105,7 @@ struct ci_drv {
> >   struct ept_queue_head   *epts;
> >   uint8_t *items_mem;
> >   struct ci_epep[NUM_ENDPOINTS];
> > + u8  next_device_address;
>
> Should this be u16 ?

No, USB address is only 8bits (u8)


Re: [PATCH v1 1/1] usb: ci_udc: don't use "advance" feature when setting address

2024-10-17 Thread Svyatoslav Ryhel
чт, 17 жовт. 2024 р. о 15:21 Mattijs Korpershoek
 пише:
>
> Hi,
>
> On mer., oct. 16, 2024 at 21:57, Ion Agorria  wrote:
>
> > Hello,
> >
> > Yes that's the correct commit I found when researching why the issue
> > didn't happen in Linux, I already found that Tegra 2 reference docs
> > had a different information about the register compared to Tegra 3.
> >
> > I consider that a single variable is enough since the value is only
> > non-zero when we want to set a new address. But if is necessary i can
> > copy like Linux does.
>
> You are right, a single variable is enough. I'd still prefer to have
> what Linux does because it will make it easier to compare with the Linux
> driver in the future,
>

Hello!

Proposed patch already does what Linux changes do. Your request to
make it "same" as Linux is impossible to achieve since the u-boot
driver itself does not descend from Linux, nor it is similar to Linux
one. There is nothing to compare with Linux in the future.

Best regards,
Svyatoslav R.

> Thanks
> Mattijs
>
> >
> > Regards,
> > Ion Agorria
> >
> > El mar, 15 oct 2024 a las 11:56, Mattijs Korpershoek
> > () escribió:
> >>
> >> Hi Svyatoslav,
> >>
> >> Thank you for the patch.
> >>
> >> On dim., oct. 13, 2024 at 17:58, Svyatoslav Ryhel  
> >> wrote:
> >>
> >> > From: Ion Agorria 
> >> >
> >> > In the older USB controllers like for example in ChipIdea controller
> >> > used by the Tegra 2 the "USBADRA: Device Address Advance" bitflag
> >> > does not exist, so the new device address set during SET_ADDRESS
> >> > can't be deferred by hardware, which causes the host to not recognize
> >> > the device and give an error.
> >> >
> >> > Instead store it until ep completes to apply the change into the hw
> >> > register as Linux kernel does. This should fix regression on old and
> >> > and be compatible with newer controllers.
> >>
> >> Since this is based on a linux commit, can we please mention the
> >> revision in the commit message?
> >>
> >> Per my understanding, this would be:
> >> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ef15e5490edc7edf808d3477ab32e0e320792f65
> >>
> >> >
> >> > Signed-off-by: Ion Agorria 
> >> > Signed-off-by: Svyatoslav Ryhel 
> >> > ---
> >> >  drivers/usb/gadget/ci_udc.c | 24 +++-
> >> >  drivers/usb/gadget/ci_udc.h |  1 +
> >> >  2 files changed, 24 insertions(+), 1 deletion(-)
> >> >
> >> > diff --git a/drivers/usb/gadget/ci_udc.c b/drivers/usb/gadget/ci_udc.c
> >> > index bbe03cfff1f..4bff75da759 100644
> >> > --- a/drivers/usb/gadget/ci_udc.c
> >> > +++ b/drivers/usb/gadget/ci_udc.c
> >> > @@ -649,12 +649,30 @@ static void flip_ep0_direction(void)
> >> >   }
> >> >  }
> >> >
> >> > +/*
> >> > + * This function explicitly sets the address, without the "USBADRA" 
> >> > (advance)
> >> > + * feature, which is not supported by older versions of the controller.
> >> > + */
> >> > +static void ci_set_address(struct ci_udc *udc, u8 address)
> >> > +{
> >> > + DBG("%s %x\n", __func__, address);
> >> > + writel(address << 25, &udc->devaddr);
> >> > +}
> >> > +
> >> >  static void handle_ep_complete(struct ci_ep *ci_ep)
> >> >  {
> >> >   struct ept_queue_item *item, *next_td;
> >> >   int num, in, len, j;
> >> >   struct ci_req *ci_req;
> >> >
> >> > + /* Set the device address that was previously sent by SET_ADDRESS 
> >> > */
> >> > + if (controller.next_device_address != 0) {
> >> > + struct ci_udc *udc = (struct ci_udc 
> >> > *)controller.ctrl->hcor;
> >> > +
> >> > + ci_set_address(udc, controller.next_device_address);
> >> > + controller.next_device_address = 0;
> >> > + }
> >> > +
> >> >   num = ci_ep->desc->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK;
> >> >   in = (ci_ep->desc->bEndpointAddress & USB_DIR_IN) != 0;
> >> >   item = ci_get_qtd(num, in);
> >> > @@ -783,7 +801,7 @@ static void handle_setup(v

Re: Please pull u-boot-tegra staging

2024-10-14 Thread Svyatoslav Ryhel
пн, 14 жовт. 2024 р. о 00:54 Tom Rini  пише:
>
> On Sun, Oct 13, 2024 at 06:55:58PM +0300, Svyatoslav Ryhel wrote:
>
> > Dear Tom,
> >
> > The following changes since commit 93b9cd792089e536f2bfa85d9903fd4798209f76:
> >
> >   mtd: simplify CONFIG_DM_SPI_FLASH dependencies (2024-10-09 14:52:44 -0600)
> >
> > are available in the Git repository at:
> >
> >   https://source.denx.de/u-boot/custodians/u-boot-tegra.git staging
> >
> > for you to fetch changes up to 711fcd3bdad52ba058e8ca3cf1673bf1b8299be2:
> >
> >   video: panel: add Sharp LQ101R1SX01 MIPI DSI panel driver (2024-10-13 
> > 17:33:46 +0300)
> >
>
> Please note that I made a few fixes before pushing this out. One of
> these was a merge problem,
This is actually an odd incident since I have rebased all commits onto
u-boot/master (same day I asked for pull, 2 hours earlier). No issues
occurred while rebasing.

> but another set were whitespace problems
> checkpatch.pl noted
This refers to migration of bootscripts to text env. Last time I
worked with bootscripts they were quite sensitive to whitespaces and
broke easily so I assumed that checkpatch mistreated those as errors.
Seems that checkpatch was well adjusted to check env as well. Sorry,
this will not happen again.

> and the finally a small mistake of mis-naming the
> apalis-tk1 env file (which is a - and not _ like the rest of the
> platforms from the vendor).
Thanks for spotting this out, I must have automatically used _

>
> Applied to u-boot/master, thanks!
>
> --
> Tom

Thank you very much and sorry for discomforts.

Best regards,
Svyatoslav R.


Please pull u-boot-tegra staging

2024-10-13 Thread Svyatoslav Ryhel
Dear Tom,

The following changes since commit 93b9cd792089e536f2bfa85d9903fd4798209f76:

  mtd: simplify CONFIG_DM_SPI_FLASH dependencies (2024-10-09 14:52:44 -0600)

are available in the Git repository at:

  https://source.denx.de/u-boot/custodians/u-boot-tegra.git staging

for you to fetch changes up to 711fcd3bdad52ba058e8ca3cf1673bf1b8299be2:

  video: panel: add Sharp LQ101R1SX01 MIPI DSI panel driver (2024-10-13 
17:33:46 +0300)


Ion Agorria (2):
  arm: tegra: fix typo in logging functions
  arm: tegra: add AP20 and AP20H SKU

Jonas Schwöbel (1):
  Tegra30: Add funcmux for UART over SD slot

Svyatoslav Ryhel (13):
  disk: add TegraPT support
  board: tegra: convert boards to text env
  ARM: tegra: board2: add common dtb reselect logic
  ARM: tegra-u-boot: add recipe for multi-dtb image
  drivers: tegra_gpio: add early SPL functions
  board: asus: grouper: dynamically detect correct SPL configuration
  board: htc: endeavoru: simplify RCM hook
  board: asus: grouper: implement multi-DTB support
  board: asus: transformer: implement multi-DTB support
  usb: host: tegra: get usb phy configuration from phy node
  video: tegra20: dc: remove DECLARE_GLOBAL_DATA_PTR use
  video: tegra20: dsi: add ganged mode support
  video: panel: add Sharp LQ101R1SX01 MIPI DSI panel driver

 arch/arm/dts/tegra-u-boot.dtsi  |  22 +
 arch/arm/include/asm/arch-tegra/tegra.h |   3 +-
 arch/arm/include/asm/arch-tegra/usb.h   |  11 ++-
 arch/arm/include/asm/arch-tegra30/funcmux.h |   1 +
 arch/arm/mach-tegra/ap.c|  11 ++-
 arch/arm/mach-tegra/board.c |   2 +-
 arch/arm/mach-tegra/board2.c|  16 
 board/asus/grouper/MAINTAINERS  |   4 +-
 board/asus/grouper/Makefile |   6 +-
 board/asus/grouper/board-info.c |  84 
 board/asus/grouper/configs/grouper_E1565.config |   6 --
 board/asus/grouper/configs/grouper_PM269.config |   6 --
 board/asus/grouper/configs/tilapia.config   |   7 --
 board/asus/grouper/grouper-spl-max.c|  45 -
 board/asus/grouper/grouper-spl-ti.c |  41 
 board/asus/grouper/grouper-spl.c| 105 

 board/asus/grouper/grouper.env  |  15 +++
 board/asus/transformer-t20/transformer-t20.env  |  17 
 board/asus/transformer-t30/MAINTAINERS  |   1 -
 board/asus/transformer-t30/Makefile |   1 +
 board/asus/transformer-t30/board-info.c | 110 
+
 board/asus/transformer-t30/configs/p1801-t.config   |   3 -
 board/asus/transformer-t30/configs/tf201.config |   3 -
 board/asus/transformer-t30/configs/tf300t.config|   3 -
 board/asus/transformer-t30/configs/tf300tg.config   |   3 -
 board/asus/transformer-t30/configs/tf300tl.config   |   3 -
 board/asus/transformer-t30/configs/tf600t.config|   6 --
 board/asus/transformer-t30/configs/tf700t.config|   4 -
 board/asus/transformer-t30/transformer-t30.env  |  17 
 board/htc/endeavoru/endeavoru-spl.c |  63 +---
 board/htc/endeavoru/endeavoru.env   |  13 +++
 board/lenovo/ideapad-yoga-11/ideapad-yoga-11.env|  16 
 board/lg/x3-t30/configs/p880.config |   1 +
 board/lg/x3-t30/configs/p895.config |   1 +
 board/lg/x3-t30/p880.env|  15 +++
 board/lg/x3-t30/p895.env|  13 +++
 board/microsoft/surface-rt/surface-rt.env   |  14 +++
 board/nvidia/cardhu/cardhu.env  |   2 +
 board/nvidia/p2771-/p2771-.env  |  22 +
 board/nvidia/p3450-/p3450-.env  |   7 ++
 board/toradex/apalis-tk1/apalis_tk1.env |  45 +
 board/toradex/apalis_t30/apalis_t30.env |   9 ++
 board/toradex/colibri_t20/colibri_t20.env   |   3 +
 board/toradex/colibri_t30/colibri_t30.env   |   9 ++
 board/wexler/qc750/qc750.env|  15 +++
 configs/apalis-tk1_defconfig|   3 +-
 configs/apalis_t30_defconfig|   1 +
 configs/cardhu_defconfig|   1 +
 configs/colibri_t20_defconfig   |   1 +
 configs/colibri_t30_defconfig   |   1 +
 configs/endeavoru_defconfig |   1 +
 configs/{grouper_common_defconfig => grouper_defconfig} |  11 +++
 configs/ideapad-yoga-11_defcon

[PATCH v1 1/1] usb: ci_udc: don't use "advance" feature when setting address

2024-10-13 Thread Svyatoslav Ryhel
From: Ion Agorria 

In the older USB controllers like for example in ChipIdea controller
used by the Tegra 2 the "USBADRA: Device Address Advance" bitflag
does not exist, so the new device address set during SET_ADDRESS
can't be deferred by hardware, which causes the host to not recognize
the device and give an error.

Instead store it until ep completes to apply the change into the hw
register as Linux kernel does. This should fix regression on old and
and be compatible with newer controllers.

Signed-off-by: Ion Agorria 
Signed-off-by: Svyatoslav Ryhel 
---
 drivers/usb/gadget/ci_udc.c | 24 +++-
 drivers/usb/gadget/ci_udc.h |  1 +
 2 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/ci_udc.c b/drivers/usb/gadget/ci_udc.c
index bbe03cfff1f..4bff75da759 100644
--- a/drivers/usb/gadget/ci_udc.c
+++ b/drivers/usb/gadget/ci_udc.c
@@ -649,12 +649,30 @@ static void flip_ep0_direction(void)
}
 }
 
+/*
+ * This function explicitly sets the address, without the "USBADRA" (advance)
+ * feature, which is not supported by older versions of the controller.
+ */
+static void ci_set_address(struct ci_udc *udc, u8 address)
+{
+   DBG("%s %x\n", __func__, address);
+   writel(address << 25, &udc->devaddr);
+}
+
 static void handle_ep_complete(struct ci_ep *ci_ep)
 {
struct ept_queue_item *item, *next_td;
int num, in, len, j;
struct ci_req *ci_req;
 
+   /* Set the device address that was previously sent by SET_ADDRESS */
+   if (controller.next_device_address != 0) {
+   struct ci_udc *udc = (struct ci_udc *)controller.ctrl->hcor;
+
+   ci_set_address(udc, controller.next_device_address);
+   controller.next_device_address = 0;
+   }
+
num = ci_ep->desc->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK;
in = (ci_ep->desc->bEndpointAddress & USB_DIR_IN) != 0;
item = ci_get_qtd(num, in);
@@ -783,7 +801,7 @@ static void handle_setup(void)
 * write address delayed (will take effect
 * after the next IN txn)
 */
-   writel((r.wValue << 25) | (1 << 24), &udc->devaddr);
+   controller.next_device_address = r.wValue;
req->length = 0;
usb_ep_queue(controller.gadget.ep0, req, 0);
return;
@@ -814,6 +832,9 @@ static void stop_activity(void)
int i, num, in;
struct ept_queue_head *head;
struct ci_udc *udc = (struct ci_udc *)controller.ctrl->hcor;
+
+   ci_set_address(udc, 0);
+
writel(readl(&udc->epcomp), &udc->epcomp);
 #ifdef CONFIG_CI_UDC_HAS_HOSTPC
writel(readl(&udc->epsetupstat), &udc->epsetupstat);
@@ -934,6 +955,7 @@ static int ci_pullup(struct usb_gadget *gadget, int is_on)
struct ci_udc *udc = (struct ci_udc *)controller.ctrl->hcor;
if (is_on) {
/* RESET */
+   controller.next_device_address = 0;
writel(USBCMD_ITC(MICRO_8FRAME) | USBCMD_RST, &udc->usbcmd);
udelay(200);
 
diff --git a/drivers/usb/gadget/ci_udc.h b/drivers/usb/gadget/ci_udc.h
index bea2f9f3fe3..807f2084c1e 100644
--- a/drivers/usb/gadget/ci_udc.h
+++ b/drivers/usb/gadget/ci_udc.h
@@ -105,6 +105,7 @@ struct ci_drv {
struct ept_queue_head   *epts;
uint8_t *items_mem;
struct ci_epep[NUM_ENDPOINTS];
+   u8  next_device_address;
 };
 
 struct ept_queue_head {
-- 
2.43.0



[PATCH v1 0/1] Fix peripheral USB mode detection

2024-10-13 Thread Svyatoslav Ryhel
In the older USB controllers like for example in ChipIdea controller
used by the Tegra 2 the "USBADRA: Device Address Advance" bitflag
does not exist, so the new device address set during SET_ADDRESS
can't be deferred by hardware, which causes the host to not recognize
the device and give an error.

Instead store it until ep completes to apply the change into the hw
register as Linux kernel does. This should fix regression on old and
and be compatible with newer controllers.

Fixes usb peripheral on Tegra 2 devices.

Ion Agorria (1):
  usb: ci_udc: don't use "advance" feature when setting address

 drivers/usb/gadget/ci_udc.c | 24 +++-
 drivers/usb/gadget/ci_udc.h |  1 +
 2 files changed, 24 insertions(+), 1 deletion(-)

-- 
2.43.0



Re: [PATCH v3 2/4] power: regulator: Convert regulators_enable_boot_on/off() to regulator_post_probe

2024-10-03 Thread Svyatoslav Ryhel
чт, 3 жовт. 2024 р. о 18:03 Simon Glass  пише:
>
> Hi Tom,
>
> On Wed, 2 Oct 2024 at 19:40, Tom Rini  wrote:
> >
> > On Wed, Oct 02, 2024 at 04:55:39PM -0600, Simon Glass wrote:
> > > Hi,
> > >
> > > On Thu, 26 Sept 2024 at 17:15, Marek Vasut  wrote:
> > > >
> > > > Turn regulators_enable_boot_on() and regulators_enable_boot_off() into
> > > > empty functions. Implement matching functionality in 
> > > > regulator_post_probe()
> > > > instead. The regulator_post_probe() is called for all regulators after 
> > > > they
> > > > probe, and regulators that have regulator-always-on or 
> > > > regulator-boot-on DT
> > > > properties now always probe due to DM_FLAG_PROBE_AFTER_BIND being set on
> > > > such regulators in regulator_post_bind().
> > > >
> > > > Finally, fold regulator_unset() functionality into regulator_autoset().
> > > >
> > > > Signed-off-by: Marek Vasut 
> > > > ---
> > > > Cc: Ben Wolsieffer 
> > > > Cc: Caleb Connolly 
> > > > Cc: Chris Morgan 
> > > > Cc: Dragan Simic 
> > > > Cc: Eugen Hristev 
> > > > Cc: Francesco Dolcini 
> > > > Cc: Heinrich Schuchardt 
> > > > Cc: Jaehoon Chung 
> > > > Cc: Jagan Teki 
> > > > Cc: Jonas Karlman 
> > > > Cc: Kever Yang 
> > > > Cc: Matteo Lisi 
> > > > Cc: Mattijs Korpershoek 
> > > > Cc: Max Krummenacher 
> > > > Cc: Neil Armstrong 
> > > > Cc: Patrice Chotard 
> > > > Cc: Patrick Delaunay 
> > > > Cc: Philipp Tomsich 
> > > > Cc: Quentin Schulz 
> > > > Cc: Sam Day 
> > > > Cc: Simon Glass 
> > > > Cc: Sumit Garg 
> > > > Cc: Svyatoslav Ryhel 
> > > > Cc: Thierry Reding 
> > > > Cc: Tom Rini 
> > > > Cc: Volodymyr Babchuk 
> > > > Cc: u-boot-amlo...@groups.io
> > > > Cc: u-boot-q...@groups.io
> > > > Cc: u-b...@dh-electronics.com
> > > > Cc: u-boot@lists.denx.de
> > > > Cc: uboot-st...@st-md-mailman.stormreply.com
> > > > ---
> > > > V2: Rebase on current u-boot/next
> > > > V3: No change
> > > > ---
> > > >  drivers/power/regulator/regulator-uclass.c | 60 +++---
> > > >  1 file changed, 19 insertions(+), 41 deletions(-)
> > > >
> > > > diff --git a/drivers/power/regulator/regulator-uclass.c 
> > > > b/drivers/power/regulator/regulator-uclass.c
> > > > index 1a970004540..9fcc4bd85b9 100644
> > > > --- a/drivers/power/regulator/regulator-uclass.c
> > > > +++ b/drivers/power/regulator/regulator-uclass.c
> > > > @@ -314,6 +314,11 @@ int regulator_autoset(struct udevice *dev)
> > > > return ret;
> > > > }
> > > >
> > > > +   if (uc_pdata->force_off) {
> > > > +   ret = regulator_set_enable(dev, false);
> > > > +   goto out;
> > > > +   }
> > > > +
> > > > if (!uc_pdata->always_on && !uc_pdata->boot_on) {
> > > > ret = -EMEDIUMTYPE;
> > > > goto out;
> > > > @@ -518,56 +523,28 @@ static int regulator_pre_probe(struct udevice 
> > > > *dev)
> > > > return 0;
> > > >  }
> > > >
> > > > -int regulators_enable_boot_on(bool verbose)
> > > > +static int regulator_post_probe(struct udevice *dev)
> > > >  {
> > > > -   struct udevice *dev;
> > > > -   struct uclass *uc;
> > > > int ret;
> > > >
> > > > -   ret = uclass_get(UCLASS_REGULATOR, &uc);
> > > > -   if (ret)
> > > > +   ret = regulator_autoset(dev);
> > > > +   if (ret && ret != -EMEDIUMTYPE && ret != -EALREADY && ret != 
> > > > ENOSYS)
> > > > return ret;
> > > > -   for (uclass_first_device(UCLASS_REGULATOR, &dev);
> > > > -dev;
> > > > -uclass_next_device(&dev)) {
> > > > -   ret = regulator_autoset(dev);
> > > > -   if (ret == -EMEDIUMTYPE || ret == -EALREADY) {
> > > > -   ret = 0;
> > > > -   

Re: [PATCH 1/4] power: regulator: Trigger probe of regulators which are always-on or boot-on

2024-09-25 Thread Svyatoslav Ryhel
ср, 25 вер. 2024 р. о 15:48 Marek Vasut  пише:
>
> On 9/25/24 12:18 PM, Svyatoslav Ryhel wrote:
>
> [...]
>
> > Hello there!
> > I was digging this when I had some free time and found that with
> > patches from Marek the only difference is that function
> > i2c_get_chip_for_busnum is not called for PMIC's main i2c address
>
> Is it possible this is called earlier, before UART output is
> initialized, so it does not show up in the log below ?
>
It is highly unlikely, this function is called when uart is already
working and pinmux is set.

> Could it be that it is called before your pinmux is properly
> initialized, hence no UART, and that is why the I2C communication fails?
>
But if we assume that pinmux is not set, then how we resolve situation
when pinmux and regulator enable are both set by probe after bind and
regulators are probed before pinmux. Regulators will fail, they will
not deffer till pinmux probes. Or you propose return to pre-DM version
of pinmux? Inconsistency.

> So far, I only found Toradex Tegra T20 board here, no T30.
What do you mean? Specify please


Re: [PATCH 1/4] power: regulator: Trigger probe of regulators which are always-on or boot-on

2024-09-25 Thread Svyatoslav Ryhel
ср, 25 вер. 2024 р. о 02:44 Tom Rini  пише:
>
> On Fri, Sep 20, 2024 at 10:48:56AM -0600, Tom Rini wrote:
> > On Fri, Sep 20, 2024 at 07:40:35PM +0300, Svyatoslav Ryhel wrote:
> > > пн, 16 вер. 2024 р. о 19:28 Tom Rini  пише:
> > > >
> > > > On Wed, Sep 11, 2024 at 07:00:56PM -0600, Simon Glass wrote:
> > > > > Hi Marek,
> > > > >
> > > > > On Fri, 28 Jun 2024 at 07:26, Marek Vasut  wrote:
> > > > > >
> > > > > > On 6/28/24 9:32 AM, Simon Glass wrote:
> > > > > > > Hi Marek,
> > > > > >
> > > > > > Hi,
> > > > > >
> > > > > > [...]
> > > > > >
> > > > > > >>>> @@ -473,8 +483,6 @@ static int regulator_pre_probe(struct 
> > > > > > >>>> udevice *dev)
> > > > > > >>>>   -ENODATA);
> > > > > > >>>>   uc_pdata->max_uA = dev_read_u32_default(dev, 
> > > > > > >>>> "regulator-max-microamp",
> > > > > > >>>>   -ENODATA);
> > > > > > >>>> -   uc_pdata->always_on = dev_read_bool(dev, 
> > > > > > >>>> "regulator-always-on");
> > > > > > >>>> -   uc_pdata->boot_on = dev_read_bool(dev, 
> > > > > > >>>> "regulator-boot-on");
> > > > > > >>>>   uc_pdata->ramp_delay = dev_read_u32_default(dev, 
> > > > > > >>>> "regulator-ramp-delay",
> > > > > > >>>>   0);
> > > > > > >>>>   uc_pdata->force_off = dev_read_bool(dev, 
> > > > > > >>>> "regulator-force-boot-off");
> > > > > > >>>> --
> > > > > > >>>> 2.43.0
> > > > > > >>>>
> > > > > > >>>
> > > > > > >>> This is reading a lot of DT stuff very early, which may be 
> > > > > > >>> slow. It is
> > > > > > >>> also reading from the DT in the bind() step which we sometimes 
> > > > > > >>> have to
> > > > > > >>> do, but try to avoid.
> > > > > > >>
> > > > > > >> Actually, it is reading only the bare minimum very early in 
> > > > > > >> bind, the
> > > > > > >> always-on and boot-on, the rest is in pre_probe, i.e. later.
> > > > > > >
> > > > > > > Yes, I see that. Also it is inevitable that these properties need 
> > > > > > > to
> > > > > > > be read before probe(), since they control whether to probe().
> > > > > > >
> > > > > > >>
> > > > > > >>> Also this seems to happen in SPL and again pre-reloc and again 
> > > > > > >>> in
> > > > > > >>> U-Boot post-reloc?
> > > > > > >>
> > > > > > >> What does, the uclass post_bind ?
> > > > > > >
> > > > > > > I mean that this code will be called in SPL (if the regulators 
> > > > > > > are in
> > > > > > > the DT there), U-Boot pre-reloc and post-reloc, each time turning 
> > > > > > > on
> > > > > > > the regulators. We need a way to control that, don't we?
> > > > > >
> > > > > > I would assume that if those regulators are turned on once in the
> > > > > > earliest stage , turning them on again in the follow up stage would 
> > > > > > be a
> > > > > > noop ? This is the point of regulator-*-on, to keep the regulators 
> > > > > > on.
> > > > >
> > > > > No, there is sometimes a particular sequence needed.
> > > > >
> > > > > >
> > > > > > >>> Should we have a step in the init sequence where we set up the
> > > > > > >>> regulators, by calling regulators_enable_boot_on() ?
> > > > > > >>
> > > > > > >> Let's not do

Re: [PATCH 1/4] power: regulator: Trigger probe of regulators which are always-on or boot-on

2024-09-20 Thread Svyatoslav Ryhel
пн, 16 вер. 2024 р. о 19:28 Tom Rini  пише:
>
> On Wed, Sep 11, 2024 at 07:00:56PM -0600, Simon Glass wrote:
> > Hi Marek,
> >
> > On Fri, 28 Jun 2024 at 07:26, Marek Vasut  wrote:
> > >
> > > On 6/28/24 9:32 AM, Simon Glass wrote:
> > > > Hi Marek,
> > >
> > > Hi,
> > >
> > > [...]
> > >
> > > >>>> @@ -473,8 +483,6 @@ static int regulator_pre_probe(struct udevice 
> > > >>>> *dev)
> > > >>>>   -ENODATA);
> > > >>>>   uc_pdata->max_uA = dev_read_u32_default(dev, 
> > > >>>> "regulator-max-microamp",
> > > >>>>   -ENODATA);
> > > >>>> -   uc_pdata->always_on = dev_read_bool(dev, 
> > > >>>> "regulator-always-on");
> > > >>>> -   uc_pdata->boot_on = dev_read_bool(dev, "regulator-boot-on");
> > > >>>>   uc_pdata->ramp_delay = dev_read_u32_default(dev, 
> > > >>>> "regulator-ramp-delay",
> > > >>>>   0);
> > > >>>>   uc_pdata->force_off = dev_read_bool(dev, 
> > > >>>> "regulator-force-boot-off");
> > > >>>> --
> > > >>>> 2.43.0
> > > >>>>
> > > >>>
> > > >>> This is reading a lot of DT stuff very early, which may be slow. It is
> > > >>> also reading from the DT in the bind() step which we sometimes have to
> > > >>> do, but try to avoid.
> > > >>
> > > >> Actually, it is reading only the bare minimum very early in bind, the
> > > >> always-on and boot-on, the rest is in pre_probe, i.e. later.
> > > >
> > > > Yes, I see that. Also it is inevitable that these properties need to
> > > > be read before probe(), since they control whether to probe().
> > > >
> > > >>
> > > >>> Also this seems to happen in SPL and again pre-reloc and again in
> > > >>> U-Boot post-reloc?
> > > >>
> > > >> What does, the uclass post_bind ?
> > > >
> > > > I mean that this code will be called in SPL (if the regulators are in
> > > > the DT there), U-Boot pre-reloc and post-reloc, each time turning on
> > > > the regulators. We need a way to control that, don't we?
> > >
> > > I would assume that if those regulators are turned on once in the
> > > earliest stage , turning them on again in the follow up stage would be a
> > > noop ? This is the point of regulator-*-on, to keep the regulators on.
> >
> > No, there is sometimes a particular sequence needed.
> >
> > >
> > > >>> Should we have a step in the init sequence where we set up the
> > > >>> regulators, by calling regulators_enable_boot_on() ?
> > > >>
> > > >> Let's not do this , the entire point of this series is to get rid of
> > > >> those functions and do the regulator configuration the same way LED
> > > >> subsystem does it -- by probing always-on/boot-on regulators and
> > > >> configuring them correctly on probe.
> > > >>
> > > >> To me regulators_enable_boot_on() and the like was always an
> > > >> inconsistently applied workaround for missing DM_FLAG_PROBE_AFTER_BIND 
> > > >> ,
> > > >> which is now implemented, so such workarounds can be removed.
> > > >
> > > > That patch seemed to slip under the radar, sent and applied on the
> > > > same day! We really need to add a test for it, BTW.
> > >
> > > Which patch ? My recollection of DM_FLAG_PROBE_AFTER_BIND was that it
> > > took a while to get in.
> >
> > [1]
> >
> > >
> > > > My concern is that this might cause us ordering problems. We perhaps
> > > > want the regulators to be done first. If drivers are probed which use
> > > > regulators, then presumably they will enable them. Consider this:
> > > >
> > > > - LED driver auto-probes
> > > > - probes I2C bus 2
> > > > - probes LDO1 which is autoset so turns on
> > > > - LDO1 probes, but is already running
> > > > - LDO2 probes, which is autoset so turns on
> > > >
> > > > So long as it is OK to enable the regulators in any order, then this
> > > > seems fine. But is it? How do we handle the case where are particular
> > > > sequence is needed?
> > >
> > > Did we finally arrive at the point where we need -EPROBE_DEFER alike
> > > mechanism ?
> >
> > Nope. But I am concerned that this patch is leading us there. bind()
> > really needs to be as clean as possible. It is one of the design
> > elements of driver model which Linux should adopt.
> >
> > There is always a race to be the first to init something, move the
> > init earlier, etc... I don't see any general need to init the
> > regulators right at the start. It should be done in a separate
> > function and be optional. I am happy to send a patch if you like.
>
> Since we're currently stuck on the point where Marek has patches that
> fix a real problem, and Svyatoslav has a problem with them, but isn't
> currently able to debug it, yes, please put forward your patch that
> might address both sets of problems so we can all figure out how to
> resolve the problems, thanks!
>
> --
> Tom

With patches from Marek there is no i2c chip probe of PMIC, while
without i2c chip probe is called (probe_chip function). How this is
even possible?


Re: [PATCH 1/4] power: regulator: Trigger probe of regulators which are always-on or boot-on

2024-09-11 Thread Svyatoslav Ryhel
ср, 11 вер. 2024 р. о 14:01 Marek Vasut  пише:
>
> On 9/11/24 7:57 AM, Svyatoslav Ryhel wrote:
>
> [...]
>
> >>>> You did mention something regarding I2C/PMIC driver probe timing, but it
> >>>> seems the I2C driver and PMIC drivers probe roughly around the same time
> >>>> in both pass and fail cases ?
> >>>
> >>> Yes, here I agree that they both probe and probe passes, but I assume
> >>> timing of i2c call is critical and there may be some dependency which
> >>> is not ready.
> >>
> >> My guess would be pinmux or clock, maybe the i2c controller is marked as
> >> bootph-* in DT and its pinmux/clock is not? Maybe the i2c on tegra works
> >> by sheer coincidence right now? Can you have a look?
> >
> > Power i2c line (one that hosts PMIC) is configured extremely early in
> > SPL since it is needed for cpu and core voltage setup so even if, as
> > you say, tegra works by sheer coincidence, specifically this i2c line
> > should work non the less, since it has all its pre-requisites (clock
> > and pinmux) configured on early stage.
>
> Is it possible that this configuration is somehow reset or reconfigured
> from DT early on in U-Boot proper ?

No

> Do you have serial console output in board_f.c time in U-Boot proper ,
> possibly using DEUBG_UART , to check if there might be some prior
> failing I2C transfer at that board_f.c time ?

Haven't spotted anything weird there.

> > As I have told, I was not able to determine exact reason why this
> > happens, it should not and yet it does. This is why I have abandoned
> > my attempt to implement same changes you are currently proposing.
>
> If tegra has a problem, it should be fixed on tegra side and not block
> core plumbing. I am not seeing the problem on stm32 or imx systems, so I
> am banking toward tegra-specific issue.
>

And yet you are pushing tegra breaking stuff. I will insist on
reverting this is it passes.

> Are you able to debug this ?

No, I am not able find exact cuse of this behavior.


Re: [PATCH 1/4] power: regulator: Trigger probe of regulators which are always-on or boot-on

2024-09-10 Thread Svyatoslav Ryhel
вт, 10 вер. 2024 р. о 13:18 Marek Vasut  пише:
>
> On 9/10/24 11:05 AM, Svyatoslav Ryhel wrote:
> > пн, 9 вер. 2024 р. о 19:13 Marek Vasut  пише:
> >>
> >> On 8/20/24 9:08 AM, Svyatoslav Ryhel wrote:
> >>> пн, 19 серп. 2024 р. о 20:27 Marek Vasut  пише:
> >>>>
> >>>> On 8/1/24 2:28 AM, Marek Vasut wrote:
> >>>>> On 7/29/24 1:55 PM, Svyatoslav Ryhel wrote:
> >>>>>
> >>>>> [...]
> >>>>>
> >>>>>>>>> What is the problem you observe on tegra 3 ?
> >>>>>>>> i2c line fails since it probes in spl with your patch, but it does 
> >>>>>>>> not
> >>>>>>>> relocate and then probes once more after relocation. Probe fails 
> >>>>>>>> along
> >>>>>>>> with all devices on same line.
> >>>>>>>
> >>>>>>> Could it be that you either have to:
> >>>>>>> - Add DM_I2C to tegra 3 SPL
> >>>>>>> - Remove bootph-* from DT to remove the regulator node from SPL
> >>>>>>> - /delete-property/ regulator-always-on; and /delete-property/
> >>>>>>> regulator-boot-on; in -u-boot.dtsi to prevent the regulator from being
> >>>>>>> enabled in SPL ?
> >>>>>>>
> >>>>>> Obviously NO, you propose nonsense. Same dts is used for both stages.
> >>>>>
> >>>>> DT source yes, DT blob likely no.
> >>>>>
> >>>>>> And I have to add hack-ish stuff just because you wanna introduce code
> >>>>>> which causes known regressions.
> >>>>>
> >>>>> I am trying to understand what problem there is on tegra 3, but it is
> >>>>> still not clear to me.
> >>>>>
> >>>>> Is the problem somehow related to PMICs (?) being probed in SPL (?)
> >>>>> because they have regulators (?) which are marked as regulator-always-on
> >>>>> ? If so, then this is correct behavior, and if this is not desired in
> >>>>> SPL, then you can remove this property from SPL DT in -u-boot.dtsi using
> >>>>> /delete-property/ .
> >>>>>
> >>>>> [...]
> >>>>>
> >>>>>> "We must not probe things as we go. There might be other
> >>>>>> dependencies not yet bound. It may also take some time. This is not
> >>>>>> following driver model design, sorry.
> >>>>>>
> >>>>>> So please think of a way to do this properly."
> >>>>>
> >>>>> What is this quote about ? Where is this from ?
> >>>>
> >>>> What is the problem with Tegra 3 and this patchset ?
> >>>>
> >>>> Can you please explain that so this patchset can move forward ?
> >>>>
> >>>
> >>> with your changes
> >>>
> >>> U-Boot 2024.07-00696-ge217e2769db9-dirty (Aug 20 2024 - 09:55:29 +0300)
> >>>
> >>> SoC: tegra114
> >>> Model: NVIDIA Tegra Note 7
> >>> Board: NVIDIA TegraTab
> >>> DRAM:  1 GiB
> >>> tegra_i2c_probe: called
> >>> i2c: controller bus 0 at 7000d000, speed 0: tegra_i2c_probe: exit
> >>> i2c_init_controller: speed=40
> >>> i2c_init_controller: CLK_DIV_STD_FAST_MODE setting = 25
> >>> i2c_xfer: 2 messages
> >>> i2c_xfer: chip=0x58, len=0x1
> >>> i2c_write_data: chip=0x58, len=0x1
> >>> write_data:  0x37
> >>> pkt header 1 sent (0x10010)
> >>> pkt header 2 sent (0x0)
> >>> pkt header 3 sent (0x100b0)
> >>> pkt data sent (0x37)
> >>> tegra_i2c_write_data: Error (-1) !!!
> >>> i2c_write_data(): rc=-1
> >>> i2c_write: error sending
> >>> read error from device: bd26f8e0 register: 0x37!
> >>
> >> This seems like the PMIC driver (palmas?) is trying to read register
> >> 0x37 PGOOD and the I2C transfer fails . Why does the I2C transfer fail ?
> >
> > You  are asking me? Because your patches break some important setup 
> > sequence.
> > PMIC model does not matter, all behave same way.
>
> These regulator patches do not modify anything related to I2C and I
> don't observe this kind of behavior on iMX8M or STM32 platforms, so I
> suspect this is something specific to tegra.
>
> >> You did mention something regarding I2C/PMIC driver probe timing, but it
> >> seems the I2C driver and PMIC drivers probe roughly around the same time
> >> in both pass and fail cases ?
> >
> > Yes, here I agree that they both probe and probe passes, but I assume
> > timing of i2c call is critical and there may be some dependency which
> > is not ready.
>
> My guess would be pinmux or clock, maybe the i2c controller is marked as
> bootph-* in DT and its pinmux/clock is not? Maybe the i2c on tegra works
> by sheer coincidence right now? Can you have a look?

Power i2c line (one that hosts PMIC) is configured extremely early in
SPL since it is needed for cpu and core voltage setup so even if, as
you say, tegra works by sheer coincidence, specifically this i2c line
should work non the less, since it has all its pre-requisites (clock
and pinmux) configured on early stage.

As I have told, I was not able to determine exact reason why this
happens, it should not and yet it does. This is why I have abandoned
my attempt to implement same changes you are currently proposing.


Re: [PATCH 1/4] power: regulator: Trigger probe of regulators which are always-on or boot-on

2024-09-10 Thread Svyatoslav Ryhel
пн, 9 вер. 2024 р. о 19:13 Marek Vasut  пише:
>
> On 8/20/24 9:08 AM, Svyatoslav Ryhel wrote:
> > пн, 19 серп. 2024 р. о 20:27 Marek Vasut  пише:
> >>
> >> On 8/1/24 2:28 AM, Marek Vasut wrote:
> >>> On 7/29/24 1:55 PM, Svyatoslav Ryhel wrote:
> >>>
> >>> [...]
> >>>
> >>>>>>> What is the problem you observe on tegra 3 ?
> >>>>>> i2c line fails since it probes in spl with your patch, but it does not
> >>>>>> relocate and then probes once more after relocation. Probe fails along
> >>>>>> with all devices on same line.
> >>>>>
> >>>>> Could it be that you either have to:
> >>>>> - Add DM_I2C to tegra 3 SPL
> >>>>> - Remove bootph-* from DT to remove the regulator node from SPL
> >>>>> - /delete-property/ regulator-always-on; and /delete-property/
> >>>>> regulator-boot-on; in -u-boot.dtsi to prevent the regulator from being
> >>>>> enabled in SPL ?
> >>>>>
> >>>> Obviously NO, you propose nonsense. Same dts is used for both stages.
> >>>
> >>> DT source yes, DT blob likely no.
> >>>
> >>>> And I have to add hack-ish stuff just because you wanna introduce code
> >>>> which causes known regressions.
> >>>
> >>> I am trying to understand what problem there is on tegra 3, but it is
> >>> still not clear to me.
> >>>
> >>> Is the problem somehow related to PMICs (?) being probed in SPL (?)
> >>> because they have regulators (?) which are marked as regulator-always-on
> >>> ? If so, then this is correct behavior, and if this is not desired in
> >>> SPL, then you can remove this property from SPL DT in -u-boot.dtsi using
> >>> /delete-property/ .
> >>>
> >>> [...]
> >>>
> >>>> "We must not probe things as we go. There might be other
> >>>> dependencies not yet bound. It may also take some time. This is not
> >>>> following driver model design, sorry.
> >>>>
> >>>> So please think of a way to do this properly."
> >>>
> >>> What is this quote about ? Where is this from ?
> >>
> >> What is the problem with Tegra 3 and this patchset ?
> >>
> >> Can you please explain that so this patchset can move forward ?
> >>
> >
> > with your changes
> >
> > U-Boot 2024.07-00696-ge217e2769db9-dirty (Aug 20 2024 - 09:55:29 +0300)
> >
> > SoC: tegra114
> > Model: NVIDIA Tegra Note 7
> > Board: NVIDIA TegraTab
> > DRAM:  1 GiB
> > tegra_i2c_probe: called
> > i2c: controller bus 0 at 7000d000, speed 0: tegra_i2c_probe: exit
> > i2c_init_controller: speed=40
> > i2c_init_controller: CLK_DIV_STD_FAST_MODE setting = 25
> > i2c_xfer: 2 messages
> > i2c_xfer: chip=0x58, len=0x1
> > i2c_write_data: chip=0x58, len=0x1
> > write_data:  0x37
> > pkt header 1 sent (0x10010)
> > pkt header 2 sent (0x0)
> > pkt header 3 sent (0x100b0)
> > pkt data sent (0x37)
> > tegra_i2c_write_data: Error (-1) !!!
> > i2c_write_data(): rc=-1
> > i2c_write: error sending
> > read error from device: bd26f8e0 register: 0x37!
>
> This seems like the PMIC driver (palmas?) is trying to read register
> 0x37 PGOOD and the I2C transfer fails . Why does the I2C transfer fail ?

You  are asking me? Because your patches break some important setup sequence.
PMIC model does not matter, all behave same way.

> You did mention something regarding I2C/PMIC driver probe timing, but it
> seems the I2C driver and PMIC drivers probe roughly around the same time
> in both pass and fail cases ?

Yes, here I agree that they both probe and probe passes, but I assume
timing of i2c call is critical and there may be some dependency which
is not ready.

> It seems the tegra3 DTs have most of the PMIC regulators marked as
> boot-on and always-on , so enabling the regulators early is the right
> thing to do.

Only essentials are added, thus they are marked this way.

>
> [...]
>
> > SoC: tegra114
> > Model: NVIDIA Tegra Note 7
> > Board: NVIDIA TegraTab
> > DRAM:  1 GiB
> > tegra_i2c_probe: called
> > i2c: controller bus 0 at 7000d000, speed 0: tegra_i2c_probe: exit
> > i2c_init_controller: speed=40
> > i2c_init_controller: CLK_DIV_STD_FAST_MODE setting = 25
> > pkt header 1 sent (0x10010)
> > pkt header 2 sent (0x0)
> > pkt header 3 sent (0xb0)
> > pkt data sent (0x0)
> > i2c_xfer: 2 messages
> > i2c_xfer: chip=0x58, len=0x1
> > i2c_write_data: chip=0x58, len=0x1
> > write_data:  0xfb
> This seems to be access to register 0xfb , i.e. something else ?


Re: [PATCH 1/4] power: regulator: Trigger probe of regulators which are always-on or boot-on

2024-08-20 Thread Svyatoslav Ryhel
пн, 19 серп. 2024 р. о 20:27 Marek Vasut  пише:
>
> On 8/1/24 2:28 AM, Marek Vasut wrote:
> > On 7/29/24 1:55 PM, Svyatoslav Ryhel wrote:
> >
> > [...]
> >
> >>>>> What is the problem you observe on tegra 3 ?
> >>>> i2c line fails since it probes in spl with your patch, but it does not
> >>>> relocate and then probes once more after relocation. Probe fails along
> >>>> with all devices on same line.
> >>>
> >>> Could it be that you either have to:
> >>> - Add DM_I2C to tegra 3 SPL
> >>> - Remove bootph-* from DT to remove the regulator node from SPL
> >>> - /delete-property/ regulator-always-on; and /delete-property/
> >>> regulator-boot-on; in -u-boot.dtsi to prevent the regulator from being
> >>> enabled in SPL ?
> >>>
> >> Obviously NO, you propose nonsense. Same dts is used for both stages.
> >
> > DT source yes, DT blob likely no.
> >
> >> And I have to add hack-ish stuff just because you wanna introduce code
> >> which causes known regressions.
> >
> > I am trying to understand what problem there is on tegra 3, but it is
> > still not clear to me.
> >
> > Is the problem somehow related to PMICs (?) being probed in SPL (?)
> > because they have regulators (?) which are marked as regulator-always-on
> > ? If so, then this is correct behavior, and if this is not desired in
> > SPL, then you can remove this property from SPL DT in -u-boot.dtsi using
> > /delete-property/ .
> >
> > [...]
> >
> >> "We must not probe things as we go. There might be other
> >> dependencies not yet bound. It may also take some time. This is not
> >> following driver model design, sorry.
> >>
> >> So please think of a way to do this properly."
> >
> > What is this quote about ? Where is this from ?
>
> What is the problem with Tegra 3 and this patchset ?
>
> Can you please explain that so this patchset can move forward ?
>

with your changes

U-Boot 2024.07-00696-ge217e2769db9-dirty (Aug 20 2024 - 09:55:29 +0300)

SoC: tegra114
Model: NVIDIA Tegra Note 7
Board: NVIDIA TegraTab
DRAM:  1 GiB
tegra_i2c_probe: called
i2c: controller bus 0 at 7000d000, speed 0: tegra_i2c_probe: exit
i2c_init_controller: speed=40
i2c_init_controller: CLK_DIV_STD_FAST_MODE setting = 25
i2c_xfer: 2 messages
i2c_xfer: chip=0x58, len=0x1
i2c_write_data: chip=0x58, len=0x1
write_data:  0x37
pkt header 1 sent (0x10010)
pkt header 2 sent (0x0)
pkt header 3 sent (0x100b0)
pkt data sent (0x37)
tegra_i2c_write_data: Error (-1) !!!
i2c_write_data(): rc=-1
i2c_write: error sending
read error from device: bd26f8e0 register: 0x37!
i2c_xfer: 2 messages
i2c_xfer: chip=0x58, len=0x1
i2c_write_data: chip=0x58, len=0x1
write_data:  0x3b
pkt header 1 sent (0x10010)
pkt header 2 sent (0x0)
pkt header 3 sent (0x100b0)
pkt data sent (0x3b)
tegra_i2c_write_data: Error (-1) !!!
i2c_write_data(): rc=-1
i2c_write: error sending
read error from device: bd26f8e0 register: 0x3b!
i2c_xfer: 2 messages
i2c_xfer: chip=0x58, len=0x1
i2c_write_data: chip=0x58, len=0x1
write_data:  0x61
pkt header 1 sent (0x10010)
pkt header 2 sent (0x0)
pkt header 3 sent (0x100b0)
pkt data sent (0x61)
tegra_i2c_write_data: Error (-1) !!!
i2c_write_data(): rc=-1
i2c_write: error sending
read error from device: bd26f8e0 register: 0x61!
i2c_xfer: 2 messages
i2c_xfer: chip=0x58, len=0x1
i2c_write_data: chip=0x58, len=0x1
i2c_xfer: chip=0x58, len=0x1
i2c_write_data: chip=0x58, len=0x1
write_data:  0x65
pkt header 1 sent (0x10010)
pkt header 2 sent (0x0)
pkt header 3 sent (0x100b0)
pkt data sent (0x65)
tegra_i2c_write_data: Error (-1) !!!
i2c_write_data(): rc=-1
i2c_write: error sending
read error from device: bd26f8e0 register: 0x65!
pkt header 1 sent (0x10010)
pkt header 2 sent (0x0)
pkt header 3 sent (0xb0)
pkt data sent (0xbd)
tegra_i2c_write_data: Error (-1) !!!

without your changes

U-Boot 2024.07-00696-g45c25f82f356-dirty (Aug 20 2024 - 09:58:40 +0300)

SoC: tegra114
Model: NVIDIA Tegra Note 7
Board: NVIDIA TegraTab
DRAM:  1 GiB
tegra_i2c_probe: called
i2c: controller bus 0 at 7000d000, speed 0: tegra_i2c_probe: exit
i2c_init_controller: speed=40
i2c_init_controller: CLK_DIV_STD_FAST_MODE setting = 25
pkt header 1 sent (0x10010)
pkt header 2 sent (0x0)
pkt header 3 sent (0xb0)
pkt data sent (0x0)
i2c_xfer: 2 messages
i2c_xfer: chip=0x58, len=0x1
i2c_write_data: chip=0x58, len=0x1
write_data:  0xfb
pkt header 1 sent (0x10010)
pkt header 2 sent (0x0)
pkt header 3 sent (0x100b0)
pkt data sent (0xfb)
i2c_xfer: chip=0x58, len=0x1
inside i2c_read_data():
pkt header 1 sent (0x10010)
pkt header 2 sent (0x0)
pkt header 3 sent (0x800b1)
pkt data received (0x2)
i2c_read_data:  0x02
i2c_xfer: 1 messages
i2c_xfer: chip=0

Re: [PATCH v2 1/1] board: tegra: convert boards to text env

2024-08-16 Thread Svyatoslav Ryhel
ср, 7 серп. 2024 р. о 17:36 Simon Glass  пише:
>
> On Wed, 7 Aug 2024 at 06:14, Svyatoslav Ryhel  wrote:
> >
> > Convert boards to use text based env. This is the first stage of
> > conversion, common inclusions should be converted next.
> >
> > Signed-off-by: Svyatoslav Ryhel 
> > ---
> >  board/asus/grouper/grouper.env| 15 +++
> >  .../asus/transformer-t20/transformer-t20.env  | 17 
> >  .../transformer-t30/configs/tf600t.config |  1 +
> >  board/asus/transformer-t30/tf600t.env | 16 
> >  .../asus/transformer-t30/transformer-t30.env  | 17 
> >  board/htc/endeavoru/endeavoru.env | 13 +++
> >  .../ideapad-yoga-11/ideapad-yoga-11.env   | 16 
> >  board/lg/x3-t30/configs/p880.config   |  1 +
> >  board/lg/x3-t30/configs/p895.config   |  1 +
> >  board/lg/x3-t30/p880.env  | 15 +++
> >  board/lg/x3-t30/p895.env  | 13 +++
> >  board/microsoft/surface-rt/surface-rt.env | 14 +++
> >  board/nvidia/cardhu/cardhu.env|  2 +
> >  board/nvidia/p2771-/p2771-.env| 22 +
> >  board/nvidia/p3450-/p3450-.env|  7 ++
> >  board/toradex/apalis-tk1/apalis_tk1.env   | 45 +
> >  board/toradex/apalis_t30/apalis_t30.env   |  9 ++
> >  board/toradex/colibri_t20/colibri_t20.env |  3 +
> >  board/toradex/colibri_t30/colibri_t30.env |  9 ++
> >  board/wexler/qc750/qc750.env  | 15 +++
> >  configs/apalis-tk1_defconfig  |  3 +-
> >  configs/apalis_t30_defconfig  |  1 +
> >  configs/cardhu_defconfig  |  1 +
> >  configs/colibri_t20_defconfig |  1 +
> >  configs/colibri_t30_defconfig |  1 +
> >  configs/endeavoru_defconfig   |  1 +
> >  configs/grouper_common_defconfig  |  1 +
> >  configs/ideapad-yoga-11_defconfig |  1 +
> >  configs/p2771--000_defconfig  |  1 +
> >  configs/p3450-_defconfig  |  1 +
> >  configs/qc750_defconfig   |  1 +
> >  configs/surface-rt_defconfig  |  1 +
> >  configs/transformer_t20_defconfig |  1 +
> >  configs/transformer_t30_defconfig |  1 +
> >  include/configs/apalis-tk1.h  | 58 
> >  include/configs/apalis_t30.h  | 12 ---
> >  include/configs/cardhu.h  |  4 -
> >  include/configs/colibri_t20.h | 11 ---
> >  include/configs/colibri_t30.h | 12 ---
> >  include/configs/endeavoru.h   | 43 -
> >  include/configs/grouper.h | 45 -
> >  include/configs/ideapad-yoga-11.h | 58 
> >  include/configs/p2771-.h  | 20 
> >  include/configs/p3450-.h  | 13 ---
> >  include/configs/qc750.h   | 42 -
> >  include/configs/surface-rt.h  | 18 
> >  include/configs/transformer-common.h  | 91 ---
> >  include/configs/transformer-t20.h |  4 +-
> >  include/configs/transformer-t30.h |  6 +-
> >  include/configs/x3-t30.h  | 44 -
> >  include/env/nvidia/prod_upd.env   | 60 
> >  51 files changed, 332 insertions(+), 476 deletions(-)
> >  create mode 100644 board/asus/grouper/grouper.env
> >  create mode 100644 board/asus/transformer-t20/transformer-t20.env
> >  create mode 100644 board/asus/transformer-t30/tf600t.env
> >  create mode 100644 board/asus/transformer-t30/transformer-t30.env
> >  create mode 100644 board/htc/endeavoru/endeavoru.env
> >  create mode 100644 board/lenovo/ideapad-yoga-11/ideapad-yoga-11.env
> >  create mode 100644 board/lg/x3-t30/p880.env
> >  create mode 100644 board/lg/x3-t30/p895.env
> >  create mode 100644 board/microsoft/surface-rt/surface-rt.env
> >  create mode 100644 board/nvidia/cardhu/cardhu.env
> >  create mode 100644 board/nvidia/p2771-/p2771-.env
> >  create mode 100644 board/nvidia/p3450-/p3450-.env
> >  create mode 100644 board/toradex/apalis-tk1/apalis_tk1.env
> >  create mode 100644 board/toradex/apalis_t30/apalis_t30.env
> >  create mode 100644 board/toradex/colibri_t20/colibri_t20.env
> >  create mode 100644 board/toradex/colibri_t30/colibri_t30.env
> >  create mode 100644 board/wexler/qc750/qc750.env
> >  delete mode 100644 include/configs/transformer-common.h
> >  create mode 100644 include/env/nvidia/prod_upd.env
> >
>
> Reviewed-by: Simon Glass 

Francesco, have you checked this commit on apalis-tk1?


Re: [PATCH v2 1/1] disk: add TegraPT support

2024-08-16 Thread Svyatoslav Ryhel
Since there were no objections (apart help Kconfig expansion which I
will add) or improvement suggestions to this patch for over 2 weeks
(first patchset submitted on 01.08.24) I am picking it into Tegra
custodian tree.

пн, 12 серп. 2024 р. о 21:42 Tom Rini  пише:
>
> On Sat, Aug 10, 2024 at 08:29:57AM +0300, Svyatoslav Ryhel wrote:
>
> > сб, 10 серп. 2024 р. о 01:02 Tom Rini  пише:
> > >
> > > On Fri, Aug 09, 2024 at 08:57:03AM +0300, Svyatoslav Ryhel wrote:
> > > > пт, 9 серп. 2024 р. о 08:49 Heinrich Schuchardt  
> > > > пише:
> > > > >
> > > > >
> > > > >
> > > > > Am 7. August 2024 14:10:24 MESZ schrieb Svyatoslav Ryhel 
> > > > > :
> > > > > >TegraPT is compatible with EFI part but it can't pass Protective MBR 
> > > > > >check.
> > > > > >Skip this check if CONFIG_TEGRA_PARTITION is enabled, storage uclass 
> > > > > >is MMC
> > > > > >and devnum is 0. Note, eMMC on supported devices MUST be aliased to 
> > > > > >mmc0.
> > > > >
> > > > > Why wouldn't you use U-Boot's gpt command to fix the non-conformant 
> > > > > partition table?
> > > > >
> > > >
> > > > I would love to, but I am forced to use TegraPT and DON'T modify it.
> > > > Tegra114 bootloader is RSA signed and there is no possible way to
> > > > replace it with open source one unless vendor allows this. SO I am
> > > > stuck with vendor bootloader to chainload from which enforces TegraPT
> > > > as well. Modification of existing partition table can irreversibly
> > > > brick the device.
> > >
> > > Can we please incorporate some of this information to the help text, so
> > > it's clear what the use case is? Thanks.
> >
> > Sure, though usually those who know what they are dealing with will
> > understand. BTW, Tom, may I pick patchsets assigned to Thierry (tagr)
> > via Tegra custodian tree if they pass? Even if they, apart being
> > related to Tegra, belong to different subsystems (like this patch and,
> > for example, tegra gpio driver changes).
>
> Yes, that's fine.
>
> --
> Tom


Re: [PATCH v2 1/1] disk: add TegraPT support

2024-08-09 Thread Svyatoslav Ryhel
сб, 10 серп. 2024 р. о 01:02 Tom Rini  пише:
>
> On Fri, Aug 09, 2024 at 08:57:03AM +0300, Svyatoslav Ryhel wrote:
> > пт, 9 серп. 2024 р. о 08:49 Heinrich Schuchardt  пише:
> > >
> > >
> > >
> > > Am 7. August 2024 14:10:24 MESZ schrieb Svyatoslav Ryhel 
> > > :
> > > >TegraPT is compatible with EFI part but it can't pass Protective MBR 
> > > >check.
> > > >Skip this check if CONFIG_TEGRA_PARTITION is enabled, storage uclass is 
> > > >MMC
> > > >and devnum is 0. Note, eMMC on supported devices MUST be aliased to mmc0.
> > >
> > > Why wouldn't you use U-Boot's gpt command to fix the non-conformant 
> > > partition table?
> > >
> >
> > I would love to, but I am forced to use TegraPT and DON'T modify it.
> > Tegra114 bootloader is RSA signed and there is no possible way to
> > replace it with open source one unless vendor allows this. SO I am
> > stuck with vendor bootloader to chainload from which enforces TegraPT
> > as well. Modification of existing partition table can irreversibly
> > brick the device.
>
> Can we please incorporate some of this information to the help text, so
> it's clear what the use case is? Thanks.

Sure, though usually those who know what they are dealing with will
understand. BTW, Tom, may I pick patchsets assigned to Thierry (tagr)
via Tegra custodian tree if they pass? Even if they, apart being
related to Tegra, belong to different subsystems (like this patch and,
for example, tegra gpio driver changes).

> --
> Tom


Re: [PATCH v2 1/1] disk: add TegraPT support

2024-08-08 Thread Svyatoslav Ryhel
пт, 9 серп. 2024 р. о 08:49 Heinrich Schuchardt  пише:
>
>
>
> Am 7. August 2024 14:10:24 MESZ schrieb Svyatoslav Ryhel :
> >TegraPT is compatible with EFI part but it can't pass Protective MBR check.
> >Skip this check if CONFIG_TEGRA_PARTITION is enabled, storage uclass is MMC
> >and devnum is 0. Note, eMMC on supported devices MUST be aliased to mmc0.
>
> Why wouldn't you use U-Boot's gpt command to fix the non-conformant partition 
> table?
>

I would love to, but I am forced to use TegraPT and DON'T modify it.
Tegra114 bootloader is RSA signed and there is no possible way to
replace it with open source one unless vendor allows this. SO I am
stuck with vendor bootloader to chainload from which enforces TegraPT
as well. Modification of existing partition table can irreversibly
brick the device.

Best regards,
Svyatoslav R.

> Best regards
>
> Heinrich
>
> >
> >Signed-off-by: Svyatoslav Ryhel 
> >---
> > disk/Kconfig|  8 
> > disk/part_efi.c | 13 +
> > 2 files changed, 21 insertions(+)
> >
> >diff --git a/disk/Kconfig b/disk/Kconfig
> >index ffa835eb35..75a849ec8c 100644
> >--- a/disk/Kconfig
> >+++ b/disk/Kconfig
> >@@ -49,6 +49,14 @@ config SPL_MAC_PARTITION
> >   default y if MAC_PARTITION
> >   select SPL_PARTITIONS
> >
> >+config TEGRA_PARTITION
> >+  bool "Enable Nvidia Tegra partition table"
> >+  select PARTITIONS
> >+  select EFI_PARTITION
> >+  help
> >+Say Y here if you would like to use U-Boot on a device with
> >+Nvidia Tegra partition table.
> >+
> > config DOS_PARTITION
> >   bool "Enable MS Dos partition table"
> >   default y if BOOT_DEFAULTS
> >diff --git a/disk/part_efi.c b/disk/part_efi.c
> >index b1a03bd165..350a8a6dc5 100644
> >--- a/disk/part_efi.c
> >+++ b/disk/part_efi.c
> >@@ -318,6 +318,19 @@ static int part_test_efi(struct blk_desc *desc)
> >   /* Read legacy MBR from block 0 and validate it */
> >   if ((blk_dread(desc, 0, 1, (ulong *)legacymbr) != 1)
> >   || (is_pmbr_valid(legacymbr) != 1)) {
> >+
> >+  /*
> >+   * TegraPT is compatible with EFI part, but it
> >+   * cannot pass the Protective MBR check. Skip it
> >+   * if CONFIG_TEGRA_PARTITION is enabled and the
> >+   * device in question is eMMC.
> >+   */
> >+  if (IS_ENABLED(CONFIG_TEGRA_PARTITION))
> >+  if (!is_pmbr_valid(legacymbr) &&
> >+  desc->uclass_id == UCLASS_MMC &&
> >+  !desc->devnum)
> >+  return 0;
> >+
> >   return -1;
> >   }
> >   return 0;


[PATCH v2 1/1] board: tegra: convert boards to text env

2024-08-07 Thread Svyatoslav Ryhel
Convert boards to use text based env. This is the first stage of
conversion, common inclusions should be converted next.

Signed-off-by: Svyatoslav Ryhel 
---
 board/asus/grouper/grouper.env| 15 +++
 .../asus/transformer-t20/transformer-t20.env  | 17 
 .../transformer-t30/configs/tf600t.config |  1 +
 board/asus/transformer-t30/tf600t.env | 16 
 .../asus/transformer-t30/transformer-t30.env  | 17 
 board/htc/endeavoru/endeavoru.env | 13 +++
 .../ideapad-yoga-11/ideapad-yoga-11.env   | 16 
 board/lg/x3-t30/configs/p880.config   |  1 +
 board/lg/x3-t30/configs/p895.config   |  1 +
 board/lg/x3-t30/p880.env  | 15 +++
 board/lg/x3-t30/p895.env  | 13 +++
 board/microsoft/surface-rt/surface-rt.env | 14 +++
 board/nvidia/cardhu/cardhu.env|  2 +
 board/nvidia/p2771-/p2771-.env| 22 +
 board/nvidia/p3450-/p3450-.env|  7 ++
 board/toradex/apalis-tk1/apalis_tk1.env   | 45 +
 board/toradex/apalis_t30/apalis_t30.env   |  9 ++
 board/toradex/colibri_t20/colibri_t20.env |  3 +
 board/toradex/colibri_t30/colibri_t30.env |  9 ++
 board/wexler/qc750/qc750.env  | 15 +++
 configs/apalis-tk1_defconfig  |  3 +-
 configs/apalis_t30_defconfig  |  1 +
 configs/cardhu_defconfig  |  1 +
 configs/colibri_t20_defconfig |  1 +
 configs/colibri_t30_defconfig |  1 +
 configs/endeavoru_defconfig   |  1 +
 configs/grouper_common_defconfig  |  1 +
 configs/ideapad-yoga-11_defconfig |  1 +
 configs/p2771--000_defconfig  |  1 +
 configs/p3450-_defconfig  |  1 +
 configs/qc750_defconfig   |  1 +
 configs/surface-rt_defconfig  |  1 +
 configs/transformer_t20_defconfig |  1 +
 configs/transformer_t30_defconfig |  1 +
 include/configs/apalis-tk1.h  | 58 
 include/configs/apalis_t30.h  | 12 ---
 include/configs/cardhu.h  |  4 -
 include/configs/colibri_t20.h | 11 ---
 include/configs/colibri_t30.h | 12 ---
 include/configs/endeavoru.h   | 43 -
 include/configs/grouper.h | 45 -
 include/configs/ideapad-yoga-11.h | 58 
 include/configs/p2771-.h  | 20 
 include/configs/p3450-.h  | 13 ---
 include/configs/qc750.h   | 42 -
 include/configs/surface-rt.h  | 18 
 include/configs/transformer-common.h  | 91 ---
 include/configs/transformer-t20.h |  4 +-
 include/configs/transformer-t30.h |  6 +-
 include/configs/x3-t30.h  | 44 -
 include/env/nvidia/prod_upd.env   | 60 
 51 files changed, 332 insertions(+), 476 deletions(-)
 create mode 100644 board/asus/grouper/grouper.env
 create mode 100644 board/asus/transformer-t20/transformer-t20.env
 create mode 100644 board/asus/transformer-t30/tf600t.env
 create mode 100644 board/asus/transformer-t30/transformer-t30.env
 create mode 100644 board/htc/endeavoru/endeavoru.env
 create mode 100644 board/lenovo/ideapad-yoga-11/ideapad-yoga-11.env
 create mode 100644 board/lg/x3-t30/p880.env
 create mode 100644 board/lg/x3-t30/p895.env
 create mode 100644 board/microsoft/surface-rt/surface-rt.env
 create mode 100644 board/nvidia/cardhu/cardhu.env
 create mode 100644 board/nvidia/p2771-/p2771-.env
 create mode 100644 board/nvidia/p3450-/p3450-.env
 create mode 100644 board/toradex/apalis-tk1/apalis_tk1.env
 create mode 100644 board/toradex/apalis_t30/apalis_t30.env
 create mode 100644 board/toradex/colibri_t20/colibri_t20.env
 create mode 100644 board/toradex/colibri_t30/colibri_t30.env
 create mode 100644 board/wexler/qc750/qc750.env
 delete mode 100644 include/configs/transformer-common.h
 create mode 100644 include/env/nvidia/prod_upd.env

diff --git a/board/asus/grouper/grouper.env b/board/asus/grouper/grouper.env
new file mode 100644
index 00..b1f4aeb555
--- /dev/null
+++ b/board/asus/grouper/grouper.env
@@ -0,0 +1,15 @@
+#include 
+
+button_cmd_0_name=Volume Down
+button_cmd_0=bootmenu
+button_cmd_1_name=Lid
+button_cmd_1=poweroff
+partitions=name=emmc,start=0,size=-,uuid=${uuid_gpt_rootfs}
+
+bootmenu_0=mount internal storage=usb start && ums 0 mmc 0; bootmenu
+bootmenu_1=fastboot=echo Starting Fastboot protocol ...; fastboot usb 0; 
bootmenu
+bootmenu_2=update bootloader=run flash_uboot
+bootmenu_3=reboot RCM=enterrcm
+bootmenu_4=reboot=reset
+bootmenu_5=power off=poweroff
+bootmenu_delay=-1
diff --git a/board/asus/transformer-t20/transformer-t20.env 
b/board/asus/transformer-t20/transformer-t20.env
new f

[PATCH v2 0/1] board: tegra: convert boards to text env

2024-08-07 Thread Svyatoslav Ryhel
Move env stuff into dedicated files in boards (1st stage).

U-Boot CI passed, boards I own work fine, tests are welcomed.

---
Changes from v1
- parameterized self-update script
- complete stdboot convertion of Apalis TK1
---

Svyatoslav Ryhel (1):
  board: tegra: convert boards to text env

 board/asus/grouper/grouper.env| 15 +++
 .../asus/transformer-t20/transformer-t20.env  | 17 
 .../transformer-t30/configs/tf600t.config |  1 +
 board/asus/transformer-t30/tf600t.env | 16 
 .../asus/transformer-t30/transformer-t30.env  | 17 
 board/htc/endeavoru/endeavoru.env | 13 +++
 .../ideapad-yoga-11/ideapad-yoga-11.env   | 16 
 board/lg/x3-t30/configs/p880.config   |  1 +
 board/lg/x3-t30/configs/p895.config   |  1 +
 board/lg/x3-t30/p880.env  | 15 +++
 board/lg/x3-t30/p895.env  | 13 +++
 board/microsoft/surface-rt/surface-rt.env | 14 +++
 board/nvidia/cardhu/cardhu.env|  2 +
 board/nvidia/p2771-/p2771-.env| 22 +
 board/nvidia/p3450-/p3450-.env|  7 ++
 board/toradex/apalis-tk1/apalis_tk1.env   | 45 +
 board/toradex/apalis_t30/apalis_t30.env   |  9 ++
 board/toradex/colibri_t20/colibri_t20.env |  3 +
 board/toradex/colibri_t30/colibri_t30.env |  9 ++
 board/wexler/qc750/qc750.env  | 15 +++
 configs/apalis-tk1_defconfig  |  3 +-
 configs/apalis_t30_defconfig  |  1 +
 configs/cardhu_defconfig  |  1 +
 configs/colibri_t20_defconfig |  1 +
 configs/colibri_t30_defconfig |  1 +
 configs/endeavoru_defconfig   |  1 +
 configs/grouper_common_defconfig  |  1 +
 configs/ideapad-yoga-11_defconfig |  1 +
 configs/p2771--000_defconfig  |  1 +
 configs/p3450-_defconfig  |  1 +
 configs/qc750_defconfig   |  1 +
 configs/surface-rt_defconfig  |  1 +
 configs/transformer_t20_defconfig |  1 +
 configs/transformer_t30_defconfig |  1 +
 include/configs/apalis-tk1.h  | 58 
 include/configs/apalis_t30.h  | 12 ---
 include/configs/cardhu.h  |  4 -
 include/configs/colibri_t20.h | 11 ---
 include/configs/colibri_t30.h | 12 ---
 include/configs/endeavoru.h   | 43 -
 include/configs/grouper.h | 45 -
 include/configs/ideapad-yoga-11.h | 58 
 include/configs/p2771-.h  | 20 
 include/configs/p3450-.h  | 13 ---
 include/configs/qc750.h   | 42 -
 include/configs/surface-rt.h  | 18 
 include/configs/transformer-common.h  | 91 ---
 include/configs/transformer-t20.h |  4 +-
 include/configs/transformer-t30.h |  6 +-
 include/configs/x3-t30.h  | 44 -
 include/env/nvidia/prod_upd.env   | 60 
 51 files changed, 332 insertions(+), 476 deletions(-)
 create mode 100644 board/asus/grouper/grouper.env
 create mode 100644 board/asus/transformer-t20/transformer-t20.env
 create mode 100644 board/asus/transformer-t30/tf600t.env
 create mode 100644 board/asus/transformer-t30/transformer-t30.env
 create mode 100644 board/htc/endeavoru/endeavoru.env
 create mode 100644 board/lenovo/ideapad-yoga-11/ideapad-yoga-11.env
 create mode 100644 board/lg/x3-t30/p880.env
 create mode 100644 board/lg/x3-t30/p895.env
 create mode 100644 board/microsoft/surface-rt/surface-rt.env
 create mode 100644 board/nvidia/cardhu/cardhu.env
 create mode 100644 board/nvidia/p2771-/p2771-.env
 create mode 100644 board/nvidia/p3450-/p3450-.env
 create mode 100644 board/toradex/apalis-tk1/apalis_tk1.env
 create mode 100644 board/toradex/apalis_t30/apalis_t30.env
 create mode 100644 board/toradex/colibri_t20/colibri_t20.env
 create mode 100644 board/toradex/colibri_t30/colibri_t30.env
 create mode 100644 board/wexler/qc750/qc750.env
 delete mode 100644 include/configs/transformer-common.h
 create mode 100644 include/env/nvidia/prod_upd.env

-- 
2.43.0



[PATCH v2 1/1] disk: add TegraPT support

2024-08-07 Thread Svyatoslav Ryhel
TegraPT is compatible with EFI part but it can't pass Protective MBR check.
Skip this check if CONFIG_TEGRA_PARTITION is enabled, storage uclass is MMC
and devnum is 0. Note, eMMC on supported devices MUST be aliased to mmc0.

Signed-off-by: Svyatoslav Ryhel 
---
 disk/Kconfig|  8 
 disk/part_efi.c | 13 +
 2 files changed, 21 insertions(+)

diff --git a/disk/Kconfig b/disk/Kconfig
index ffa835eb35..75a849ec8c 100644
--- a/disk/Kconfig
+++ b/disk/Kconfig
@@ -49,6 +49,14 @@ config SPL_MAC_PARTITION
default y if MAC_PARTITION
select SPL_PARTITIONS
 
+config TEGRA_PARTITION
+   bool "Enable Nvidia Tegra partition table"
+   select PARTITIONS
+   select EFI_PARTITION
+   help
+ Say Y here if you would like to use U-Boot on a device with
+ Nvidia Tegra partition table.
+
 config DOS_PARTITION
bool "Enable MS Dos partition table"
default y if BOOT_DEFAULTS
diff --git a/disk/part_efi.c b/disk/part_efi.c
index b1a03bd165..350a8a6dc5 100644
--- a/disk/part_efi.c
+++ b/disk/part_efi.c
@@ -318,6 +318,19 @@ static int part_test_efi(struct blk_desc *desc)
/* Read legacy MBR from block 0 and validate it */
if ((blk_dread(desc, 0, 1, (ulong *)legacymbr) != 1)
|| (is_pmbr_valid(legacymbr) != 1)) {
+
+   /*
+* TegraPT is compatible with EFI part, but it
+* cannot pass the Protective MBR check. Skip it
+* if CONFIG_TEGRA_PARTITION is enabled and the
+* device in question is eMMC.
+*/
+   if (IS_ENABLED(CONFIG_TEGRA_PARTITION))
+   if (!is_pmbr_valid(legacymbr) &&
+   desc->uclass_id == UCLASS_MMC &&
+   !desc->devnum)
+   return 0;
+
return -1;
}
return 0;
-- 
2.43.0



[PATCH v2 0/1] disk: add TegraPT support

2024-08-07 Thread Svyatoslav Ryhel
Production Tegra20/30/114/124/132 devices use Nvidia's own
partition table, which makes them a bit complicated to deal
with. Luckily, it is compatible with the existing EFI
partition already available in U-Boot, apart from the fact
that it cannot pass Protective MBR check.

In order to address this without unwanted code additions,
I have come up with this solution.

---
Changes from v1
- fix typo in code comment
---

Svyatoslav Ryhel (1):
  disk: add TegraPT support

 disk/Kconfig|  8 
 disk/part_efi.c | 13 +
 2 files changed, 21 insertions(+)

-- 
2.43.0



Re: [PATCH v1 1/1] board: tegra: convert tegra-based boards to text env

2024-08-05 Thread Svyatoslav Ryhel
пн, 5 серп. 2024 р. о 10:08 Francesco Dolcini  пише:
>
> On Mon, Aug 05, 2024 at 10:06:04AM +0300, Svyatoslav Ryhel wrote:
> > пн, 5 серп. 2024 р. о 10:05 Francesco Dolcini  пише:
> > >
> > > On Mon, Aug 05, 2024 at 10:01:27AM +0300, Svyatoslav Ryhel wrote:
> > > > пн, 5 серп. 2024 р. о 08:32 Francesco Dolcini  
> > > > пише:
> > > > > On Thu, Aug 01, 2024 at 08:57:38AM +0300, Svyatoslav Ryhel wrote:
> > > > > > Convert boards to use text based env. This is the first stage of
> > > > > > conversion, common inclusions should be converted next.
> > > > > >
> > > > > > Signed-off-by: Svyatoslav Ryhel 
> > > > > > ---
> > > > > >  board/asus/grouper/grouper.env| 15 +++
> > > > > >  .../asus/transformer-t20/transformer-t20.env  | 16 
> > > > > >  .../transformer-t30/configs/tf600t.config |  1 +
> > > > > >  board/asus/transformer-t30/tf600t.env | 16 
> > > > > >  .../asus/transformer-t30/transformer-t30.env  | 16 
> > > > > >  board/htc/endeavoru/endeavoru.env | 13 +++
> > > > > >  .../ideapad-yoga-11/ideapad-yoga-11.env   | 16 
> > > > > >  board/lg/x3-t30/configs/p880.config   |  1 +
> > > > > >  board/lg/x3-t30/configs/p895.config   |  1 +
> > > > > >  board/lg/x3-t30/p880.env  | 14 +++
> > > > > >  board/lg/x3-t30/p895.env  | 13 +++
> > > > > >  board/microsoft/surface-rt/surface-rt.env | 14 +++
> > > > > >  board/nvidia/cardhu/cardhu.env|  2 +
> > > > > >  board/nvidia/p2771-/p2771-.env| 22 +
> > > > > >  board/nvidia/p3450-/p3450-.env|  7 ++
> > > > > >  board/toradex/apalis-tk1/apalis_tk1.env   | 45 +
> > > > > >  board/toradex/apalis_t30/apalis_t30.env   |  9 ++
> > > > > >  board/toradex/colibri_t20/colibri_t20.env |  3 +
> > > > > >  board/toradex/colibri_t30/colibri_t30.env |  9 ++
> > > > > >  board/wexler/qc750/qc750.env  | 14 +++
> > > > > >  configs/apalis-tk1_defconfig  |  1 +
> > > > > >  configs/apalis_t30_defconfig  |  1 +
> > > > > >  configs/cardhu_defconfig  |  1 +
> > > > > >  configs/colibri_t20_defconfig |  1 +
> > > > > >  configs/colibri_t30_defconfig |  1 +
> > > > >
> > > > > ...
> > > > >
> > > > > > diff --git a/board/toradex/apalis-tk1/apalis_tk1.env 
> > > > > > b/board/toradex/apalis-tk1/apalis_tk1.env
> > > > > > new file mode 100644
> > > > > > index 00..90db361be3
> > > > > > --- /dev/null
> > > > > > +++ b/board/toradex/apalis-tk1/apalis_tk1.env
> > > > > > @@ -0,0 +1,45 @@
> > > > > > +/*
> > > > > > + * Custom Distro Boot configuration:
> > > > > > + * 1. 8bit SD port (MMC1)
> > > > > > + * 2. 4bit SD port (MMC2)
> > > > > > + * 3. eMMC (MMC0)
> > > > > > + */
> > > > > > +boot_targets=mmc1 mmc2 mmc0 usb pxe dhcp
> > > > > > +
> > > > > > +boot_file=zImage
> > > > > > +boot_script_dhcp=boot.scr
> > > > > > +console=ttyS0
> > > > > > +defargs=lp0_vec=2064@0xf46ff000 core_edp_mv=1150 core_edp_ma=4000
> > > > > > + usb_port_owner_info=2 lane_owner_info=6 emc_max_dvfs=0
> > > > > > + user_debug=30 pcie_aspm=off
> > > > > > +dfu_alt_info=apalis-tk1.img raw 0x0 0x500 mmcpart 1;
> > > > > > + boot part 0 1 mmcpart 0;
> > > > > > + rootfs part 0 2 mmcpart 0;
> > > > > > + zImage fat 0 1 mmcpart 0;
> > > > > > + tegra124-apalis-eval.dtb fat 0 1 mmcpart 0
> > > > > > +fdt_board=eval
> > > > > > +fdt_fixup=;
> > > > > > +fdt_module=apalis-v1.2
> > > > > > +uboot_hwpart=1
> > > > > > +uboot_blk=0
> > > > > > +set_blkcnt=setexpr blkcnt ${filesize} + 0x1ff &&
> > > > > > + setexpr blkcnt ${blkcnt} / 0x200
> >

Re: [PATCH v1 1/1] board: tegra: convert tegra-based boards to text env

2024-08-05 Thread Svyatoslav Ryhel
пн, 5 серп. 2024 р. о 10:08 Francesco Dolcini  пише:
>
> On Mon, Aug 05, 2024 at 10:06:04AM +0300, Svyatoslav Ryhel wrote:
> > пн, 5 серп. 2024 р. о 10:05 Francesco Dolcini  пише:
> > >
> > > On Mon, Aug 05, 2024 at 10:01:27AM +0300, Svyatoslav Ryhel wrote:
> > > > пн, 5 серп. 2024 р. о 08:32 Francesco Dolcini  
> > > > пише:
> > > > > On Thu, Aug 01, 2024 at 08:57:38AM +0300, Svyatoslav Ryhel wrote:
> > > > > > Convert boards to use text based env. This is the first stage of
> > > > > > conversion, common inclusions should be converted next.
> > > > > >
> > > > > > Signed-off-by: Svyatoslav Ryhel 
> > > > > > ---
> > > > > >  board/asus/grouper/grouper.env| 15 +++
> > > > > >  .../asus/transformer-t20/transformer-t20.env  | 16 
> > > > > >  .../transformer-t30/configs/tf600t.config |  1 +
> > > > > >  board/asus/transformer-t30/tf600t.env | 16 
> > > > > >  .../asus/transformer-t30/transformer-t30.env  | 16 
> > > > > >  board/htc/endeavoru/endeavoru.env | 13 +++
> > > > > >  .../ideapad-yoga-11/ideapad-yoga-11.env   | 16 
> > > > > >  board/lg/x3-t30/configs/p880.config   |  1 +
> > > > > >  board/lg/x3-t30/configs/p895.config   |  1 +
> > > > > >  board/lg/x3-t30/p880.env  | 14 +++
> > > > > >  board/lg/x3-t30/p895.env  | 13 +++
> > > > > >  board/microsoft/surface-rt/surface-rt.env | 14 +++
> > > > > >  board/nvidia/cardhu/cardhu.env|  2 +
> > > > > >  board/nvidia/p2771-/p2771-.env| 22 +
> > > > > >  board/nvidia/p3450-/p3450-.env|  7 ++
> > > > > >  board/toradex/apalis-tk1/apalis_tk1.env   | 45 +
> > > > > >  board/toradex/apalis_t30/apalis_t30.env   |  9 ++
> > > > > >  board/toradex/colibri_t20/colibri_t20.env |  3 +
> > > > > >  board/toradex/colibri_t30/colibri_t30.env |  9 ++
> > > > > >  board/wexler/qc750/qc750.env  | 14 +++
> > > > > >  configs/apalis-tk1_defconfig  |  1 +
> > > > > >  configs/apalis_t30_defconfig  |  1 +
> > > > > >  configs/cardhu_defconfig  |  1 +
> > > > > >  configs/colibri_t20_defconfig |  1 +
> > > > > >  configs/colibri_t30_defconfig |  1 +
> > > > >
> > > > > ...
> > > > >
> > > > > > diff --git a/board/toradex/apalis-tk1/apalis_tk1.env 
> > > > > > b/board/toradex/apalis-tk1/apalis_tk1.env
> > > > > > new file mode 100644
> > > > > > index 00..90db361be3
> > > > > > --- /dev/null
> > > > > > +++ b/board/toradex/apalis-tk1/apalis_tk1.env
> > > > > > @@ -0,0 +1,45 @@
> > > > > > +/*
> > > > > > + * Custom Distro Boot configuration:
> > > > > > + * 1. 8bit SD port (MMC1)
> > > > > > + * 2. 4bit SD port (MMC2)
> > > > > > + * 3. eMMC (MMC0)
> > > > > > + */
> > > > > > +boot_targets=mmc1 mmc2 mmc0 usb pxe dhcp
> > > > > > +
> > > > > > +boot_file=zImage
> > > > > > +boot_script_dhcp=boot.scr
> > > > > > +console=ttyS0
> > > > > > +defargs=lp0_vec=2064@0xf46ff000 core_edp_mv=1150 core_edp_ma=4000
> > > > > > + usb_port_owner_info=2 lane_owner_info=6 emc_max_dvfs=0
> > > > > > + user_debug=30 pcie_aspm=off
> > > > > > +dfu_alt_info=apalis-tk1.img raw 0x0 0x500 mmcpart 1;
> > > > > > + boot part 0 1 mmcpart 0;
> > > > > > + rootfs part 0 2 mmcpart 0;
> > > > > > + zImage fat 0 1 mmcpart 0;
> > > > > > + tegra124-apalis-eval.dtb fat 0 1 mmcpart 0
> > > > > > +fdt_board=eval
> > > > > > +fdt_fixup=;
> > > > > > +fdt_module=apalis-v1.2
> > > > > > +uboot_hwpart=1
> > > > > > +uboot_blk=0
> > > > > > +set_blkcnt=setexpr blkcnt ${filesize} + 0x1ff &&
> > > > > > + setexpr blkcnt ${blkcnt} / 0x200
> >

Re: [PATCH v1 1/1] board: tegra: convert tegra-based boards to text env

2024-08-05 Thread Svyatoslav Ryhel
пн, 5 серп. 2024 р. о 10:05 Francesco Dolcini  пише:
>
> On Mon, Aug 05, 2024 at 10:01:27AM +0300, Svyatoslav Ryhel wrote:
> > пн, 5 серп. 2024 р. о 08:32 Francesco Dolcini  пише:
> > > On Thu, Aug 01, 2024 at 08:57:38AM +0300, Svyatoslav Ryhel wrote:
> > > > Convert boards to use text based env. This is the first stage of
> > > > conversion, common inclusions should be converted next.
> > > >
> > > > Signed-off-by: Svyatoslav Ryhel 
> > > > ---
> > > >  board/asus/grouper/grouper.env| 15 +++
> > > >  .../asus/transformer-t20/transformer-t20.env  | 16 
> > > >  .../transformer-t30/configs/tf600t.config |  1 +
> > > >  board/asus/transformer-t30/tf600t.env | 16 
> > > >  .../asus/transformer-t30/transformer-t30.env  | 16 
> > > >  board/htc/endeavoru/endeavoru.env | 13 +++
> > > >  .../ideapad-yoga-11/ideapad-yoga-11.env   | 16 
> > > >  board/lg/x3-t30/configs/p880.config   |  1 +
> > > >  board/lg/x3-t30/configs/p895.config   |  1 +
> > > >  board/lg/x3-t30/p880.env  | 14 +++
> > > >  board/lg/x3-t30/p895.env  | 13 +++
> > > >  board/microsoft/surface-rt/surface-rt.env | 14 +++
> > > >  board/nvidia/cardhu/cardhu.env|  2 +
> > > >  board/nvidia/p2771-/p2771-.env| 22 +
> > > >  board/nvidia/p3450-/p3450-.env|  7 ++
> > > >  board/toradex/apalis-tk1/apalis_tk1.env   | 45 +
> > > >  board/toradex/apalis_t30/apalis_t30.env   |  9 ++
> > > >  board/toradex/colibri_t20/colibri_t20.env |  3 +
> > > >  board/toradex/colibri_t30/colibri_t30.env |  9 ++
> > > >  board/wexler/qc750/qc750.env  | 14 +++
> > > >  configs/apalis-tk1_defconfig  |  1 +
> > > >  configs/apalis_t30_defconfig  |  1 +
> > > >  configs/cardhu_defconfig  |  1 +
> > > >  configs/colibri_t20_defconfig |  1 +
> > > >  configs/colibri_t30_defconfig |  1 +
> > >
> > > ...
> > >
> > > > diff --git a/board/toradex/apalis-tk1/apalis_tk1.env 
> > > > b/board/toradex/apalis-tk1/apalis_tk1.env
> > > > new file mode 100644
> > > > index 00..90db361be3
> > > > --- /dev/null
> > > > +++ b/board/toradex/apalis-tk1/apalis_tk1.env
> > > > @@ -0,0 +1,45 @@
> > > > +/*
> > > > + * Custom Distro Boot configuration:
> > > > + * 1. 8bit SD port (MMC1)
> > > > + * 2. 4bit SD port (MMC2)
> > > > + * 3. eMMC (MMC0)
> > > > + */
> > > > +boot_targets=mmc1 mmc2 mmc0 usb pxe dhcp
> > > > +
> > > > +boot_file=zImage
> > > > +boot_script_dhcp=boot.scr
> > > > +console=ttyS0
> > > > +defargs=lp0_vec=2064@0xf46ff000 core_edp_mv=1150 core_edp_ma=4000
> > > > + usb_port_owner_info=2 lane_owner_info=6 emc_max_dvfs=0
> > > > + user_debug=30 pcie_aspm=off
> > > > +dfu_alt_info=apalis-tk1.img raw 0x0 0x500 mmcpart 1;
> > > > + boot part 0 1 mmcpart 0;
> > > > + rootfs part 0 2 mmcpart 0;
> > > > + zImage fat 0 1 mmcpart 0;
> > > > + tegra124-apalis-eval.dtb fat 0 1 mmcpart 0
> > > > +fdt_board=eval
> > > > +fdt_fixup=;
> > > > +fdt_module=apalis-v1.2
> > > > +uboot_hwpart=1
> > > > +uboot_blk=0
> > > > +set_blkcnt=setexpr blkcnt ${filesize} + 0x1ff &&
> > > > + setexpr blkcnt ${blkcnt} / 0x200
> > > > +update_uboot=run set_blkcnt && mmc dev 0 ${uboot_hwpart} &&
> > > > + mmc write ${loadaddr} ${uboot_blk} ${blkcnt}
> > > > +setethupdate=if env exists ethaddr; then; else setenv ethaddr
> > > > + 00:14:2d:00:00:00; fi; pci enum && tftpboot ${loadaddr}
> > > > + flash_eth.img && source ${loadaddr}
> > > > +setsdupdate=setenv interface mmc; setenv drive 1; mmc rescan;
> > > > + load ${interface} ${drive}:1 ${loadaddr} flash_blk.img
> > > > + || setenv drive 2; mmc rescan; load ${interface} ${drive}:1
> > > > + ${loadaddr} flash_blk.img &&
> > > > + source ${loadaddr}
> > > > +setup=setenv setupargs igb_mac=${ethaddr}
> > > > + consol

Re: [PATCH v1 1/1] board: tegra: convert tegra-based boards to text env

2024-08-05 Thread Svyatoslav Ryhel
пн, 5 серп. 2024 р. о 08:32 Francesco Dolcini  пише:
>
> Hello Clamor,
>
> On Thu, Aug 01, 2024 at 08:57:38AM +0300, Svyatoslav Ryhel wrote:
> > Convert boards to use text based env. This is the first stage of
> > conversion, common inclusions should be converted next.
> >
> > Signed-off-by: Svyatoslav Ryhel 
> > ---
> >  board/asus/grouper/grouper.env| 15 +++
> >  .../asus/transformer-t20/transformer-t20.env  | 16 
> >  .../transformer-t30/configs/tf600t.config |  1 +
> >  board/asus/transformer-t30/tf600t.env | 16 
> >  .../asus/transformer-t30/transformer-t30.env  | 16 
> >  board/htc/endeavoru/endeavoru.env | 13 +++
> >  .../ideapad-yoga-11/ideapad-yoga-11.env   | 16 
> >  board/lg/x3-t30/configs/p880.config   |  1 +
> >  board/lg/x3-t30/configs/p895.config   |  1 +
> >  board/lg/x3-t30/p880.env  | 14 +++
> >  board/lg/x3-t30/p895.env  | 13 +++
> >  board/microsoft/surface-rt/surface-rt.env | 14 +++
> >  board/nvidia/cardhu/cardhu.env|  2 +
> >  board/nvidia/p2771-/p2771-.env| 22 +
> >  board/nvidia/p3450-/p3450-.env|  7 ++
> >  board/toradex/apalis-tk1/apalis_tk1.env   | 45 +
> >  board/toradex/apalis_t30/apalis_t30.env   |  9 ++
> >  board/toradex/colibri_t20/colibri_t20.env |  3 +
> >  board/toradex/colibri_t30/colibri_t30.env |  9 ++
> >  board/wexler/qc750/qc750.env  | 14 +++
> >  configs/apalis-tk1_defconfig  |  1 +
> >  configs/apalis_t30_defconfig  |  1 +
> >  configs/cardhu_defconfig  |  1 +
> >  configs/colibri_t20_defconfig |  1 +
> >  configs/colibri_t30_defconfig |  1 +
>
> ...
>
> > diff --git a/board/toradex/apalis-tk1/apalis_tk1.env 
> > b/board/toradex/apalis-tk1/apalis_tk1.env
> > new file mode 100644
> > index 00..90db361be3
> > --- /dev/null
> > +++ b/board/toradex/apalis-tk1/apalis_tk1.env
> > @@ -0,0 +1,45 @@
> > +/*
> > + * Custom Distro Boot configuration:
> > + * 1. 8bit SD port (MMC1)
> > + * 2. 4bit SD port (MMC2)
> > + * 3. eMMC (MMC0)
> > + */
> > +boot_targets=mmc1 mmc2 mmc0 usb pxe dhcp
> > +
> > +boot_file=zImage
> > +boot_script_dhcp=boot.scr
> > +console=ttyS0
> > +defargs=lp0_vec=2064@0xf46ff000 core_edp_mv=1150 core_edp_ma=4000
> > + usb_port_owner_info=2 lane_owner_info=6 emc_max_dvfs=0
> > + user_debug=30 pcie_aspm=off
> > +dfu_alt_info=apalis-tk1.img raw 0x0 0x500 mmcpart 1;
> > + boot part 0 1 mmcpart 0;
> > + rootfs part 0 2 mmcpart 0;
> > + zImage fat 0 1 mmcpart 0;
> > + tegra124-apalis-eval.dtb fat 0 1 mmcpart 0
> > +fdt_board=eval
> > +fdt_fixup=;
> > +fdt_module=apalis-v1.2
> > +uboot_hwpart=1
> > +uboot_blk=0
> > +set_blkcnt=setexpr blkcnt ${filesize} + 0x1ff &&
> > + setexpr blkcnt ${blkcnt} / 0x200
> > +update_uboot=run set_blkcnt && mmc dev 0 ${uboot_hwpart} &&
> > + mmc write ${loadaddr} ${uboot_blk} ${blkcnt}
> > +setethupdate=if env exists ethaddr; then; else setenv ethaddr
> > + 00:14:2d:00:00:00; fi; pci enum && tftpboot ${loadaddr}
> > + flash_eth.img && source ${loadaddr}
> > +setsdupdate=setenv interface mmc; setenv drive 1; mmc rescan;
> > + load ${interface} ${drive}:1 ${loadaddr} flash_blk.img
> > + || setenv drive 2; mmc rescan; load ${interface} ${drive}:1
> > + ${loadaddr} flash_blk.img &&
> > + source ${loadaddr}
> > +setup=setenv setupargs igb_mac=${ethaddr}
> > + consoleblank=0 no_console_suspend=1 console=tty1
> > + console=${console},${baudrate}n8 debug_uartport=lsport,0
> > + ${memargs}
> > +setupdate=run setsdupdate || run setusbupdate || run setethupdate
> > +setusbupdate=usb start && setenv interface usb; setenv drive 0;
> > + load ${interface} ${drive}:1 ${loadaddr} flash_blk.img &&
> > + source ${loadaddr}
> > +vidargs=fbcon=map:1
>
> ...
>
> > diff --git a/include/configs/apalis-tk1.h b/include/configs/apalis-tk1.h
> > index 71d4727ca9..4c690a1785 100644
> > --- a/include/configs/apalis-tk1.h
> > +++ b/include/configs/apalis-tk1.h
> > @@ -18,64 +18,6 @@
> >  #define FDT_MODULE   "apalis-v1.2"
> >  #define FDT_MODULE_V1_0  "apalis"
> >
> > -/*
> > - * Cus

Re: [PATCH v1 0/1] board: tegra: convert boards to text env

2024-08-04 Thread Svyatoslav Ryhel
пн, 5 серп. 2024 р. о 08:33 Francesco Dolcini  пише:
>
> Hello Tom,
>
> On Thu, Aug 01, 2024 at 08:57:37AM +0300, Svyatoslav Ryhel wrote:
> > Move env stuff into dedicated files in boards (1st stage).
>
> Is there any plan or expectation to move existing boards to text env file?
> And what about newly added boards?
>
> Francesco

If Toradex developers want to deal with this on their own, I have no
objections and I will load v2 without Toradex boards.

Best regards,
Svyatoslav R.


[PATCH v1 1/1] board: tegra: convert tegra-based boards to text env

2024-07-31 Thread Svyatoslav Ryhel
Convert boards to use text based env. This is the first stage of
conversion, common inclusions should be converted next.

Signed-off-by: Svyatoslav Ryhel 
---
 board/asus/grouper/grouper.env| 15 +++
 .../asus/transformer-t20/transformer-t20.env  | 16 
 .../transformer-t30/configs/tf600t.config |  1 +
 board/asus/transformer-t30/tf600t.env | 16 
 .../asus/transformer-t30/transformer-t30.env  | 16 
 board/htc/endeavoru/endeavoru.env | 13 +++
 .../ideapad-yoga-11/ideapad-yoga-11.env   | 16 
 board/lg/x3-t30/configs/p880.config   |  1 +
 board/lg/x3-t30/configs/p895.config   |  1 +
 board/lg/x3-t30/p880.env  | 14 +++
 board/lg/x3-t30/p895.env  | 13 +++
 board/microsoft/surface-rt/surface-rt.env | 14 +++
 board/nvidia/cardhu/cardhu.env|  2 +
 board/nvidia/p2771-/p2771-.env| 22 +
 board/nvidia/p3450-/p3450-.env|  7 ++
 board/toradex/apalis-tk1/apalis_tk1.env   | 45 +
 board/toradex/apalis_t30/apalis_t30.env   |  9 ++
 board/toradex/colibri_t20/colibri_t20.env |  3 +
 board/toradex/colibri_t30/colibri_t30.env |  9 ++
 board/wexler/qc750/qc750.env  | 14 +++
 configs/apalis-tk1_defconfig  |  1 +
 configs/apalis_t30_defconfig  |  1 +
 configs/cardhu_defconfig  |  1 +
 configs/colibri_t20_defconfig |  1 +
 configs/colibri_t30_defconfig |  1 +
 configs/endeavoru_defconfig   |  1 +
 configs/grouper_common_defconfig  |  1 +
 configs/ideapad-yoga-11_defconfig |  1 +
 configs/p2771--000_defconfig  |  1 +
 configs/p3450-_defconfig  |  1 +
 configs/qc750_defconfig   |  1 +
 configs/surface-rt_defconfig  |  1 +
 configs/transformer_t20_defconfig |  1 +
 configs/transformer_t30_defconfig |  1 +
 include/configs/apalis-tk1.h  | 58 
 include/configs/apalis_t30.h  | 12 ---
 include/configs/cardhu.h  |  4 -
 include/configs/colibri_t20.h | 11 ---
 include/configs/colibri_t30.h | 12 ---
 include/configs/endeavoru.h   | 43 -
 include/configs/grouper.h | 45 -
 include/configs/ideapad-yoga-11.h | 58 
 include/configs/p2771-.h  | 20 
 include/configs/p3450-.h  | 13 ---
 include/configs/qc750.h   | 42 -
 include/configs/surface-rt.h  | 18 
 include/configs/transformer-common.h  | 91 ---
 include/configs/transformer-t20.h |  4 +-
 include/configs/transformer-t30.h |  6 +-
 include/configs/x3-t30.h  | 44 -
 include/env/nvidia/prod_upd.env   | 59 
 51 files changed, 326 insertions(+), 475 deletions(-)
 create mode 100644 board/asus/grouper/grouper.env
 create mode 100644 board/asus/transformer-t20/transformer-t20.env
 create mode 100644 board/asus/transformer-t30/tf600t.env
 create mode 100644 board/asus/transformer-t30/transformer-t30.env
 create mode 100644 board/htc/endeavoru/endeavoru.env
 create mode 100644 board/lenovo/ideapad-yoga-11/ideapad-yoga-11.env
 create mode 100644 board/lg/x3-t30/p880.env
 create mode 100644 board/lg/x3-t30/p895.env
 create mode 100644 board/microsoft/surface-rt/surface-rt.env
 create mode 100644 board/nvidia/cardhu/cardhu.env
 create mode 100644 board/nvidia/p2771-/p2771-.env
 create mode 100644 board/nvidia/p3450-/p3450-.env
 create mode 100644 board/toradex/apalis-tk1/apalis_tk1.env
 create mode 100644 board/toradex/apalis_t30/apalis_t30.env
 create mode 100644 board/toradex/colibri_t20/colibri_t20.env
 create mode 100644 board/toradex/colibri_t30/colibri_t30.env
 create mode 100644 board/wexler/qc750/qc750.env
 delete mode 100644 include/configs/transformer-common.h
 create mode 100644 include/env/nvidia/prod_upd.env

diff --git a/board/asus/grouper/grouper.env b/board/asus/grouper/grouper.env
new file mode 100644
index 00..b1f4aeb555
--- /dev/null
+++ b/board/asus/grouper/grouper.env
@@ -0,0 +1,15 @@
+#include 
+
+button_cmd_0_name=Volume Down
+button_cmd_0=bootmenu
+button_cmd_1_name=Lid
+button_cmd_1=poweroff
+partitions=name=emmc,start=0,size=-,uuid=${uuid_gpt_rootfs}
+
+bootmenu_0=mount internal storage=usb start && ums 0 mmc 0; bootmenu
+bootmenu_1=fastboot=echo Starting Fastboot protocol ...; fastboot usb 0; 
bootmenu
+bootmenu_2=update bootloader=run flash_uboot
+bootmenu_3=reboot RCM=enterrcm
+bootmenu_4=reboot=reset
+bootmenu_5=power off=poweroff
+bootmenu_delay=-1
diff --git a/board/asus/transformer-t20/transformer-t20.env 
b/board/asus/transformer-t20/transformer-t20.env
new f

[PATCH v1 0/1] board: tegra: convert boards to text env

2024-07-31 Thread Svyatoslav Ryhel
Move env stuff into dedicated files in boards (1st stage).

U-Boot CI passed, boards I own work fine, tests are welcomed.

Svyatoslav Ryhel (1):
  board: tegra: convert tegra-based boards to text env

 board/asus/grouper/grouper.env| 15 +++
 .../asus/transformer-t20/transformer-t20.env  | 16 
 .../transformer-t30/configs/tf600t.config |  1 +
 board/asus/transformer-t30/tf600t.env | 16 
 .../asus/transformer-t30/transformer-t30.env  | 16 
 board/htc/endeavoru/endeavoru.env | 13 +++
 .../ideapad-yoga-11/ideapad-yoga-11.env   | 16 
 board/lg/x3-t30/configs/p880.config   |  1 +
 board/lg/x3-t30/configs/p895.config   |  1 +
 board/lg/x3-t30/p880.env  | 14 +++
 board/lg/x3-t30/p895.env  | 13 +++
 board/microsoft/surface-rt/surface-rt.env | 14 +++
 board/nvidia/cardhu/cardhu.env|  2 +
 board/nvidia/p2771-/p2771-.env| 22 +
 board/nvidia/p3450-/p3450-.env|  7 ++
 board/toradex/apalis-tk1/apalis_tk1.env   | 45 +
 board/toradex/apalis_t30/apalis_t30.env   |  9 ++
 board/toradex/colibri_t20/colibri_t20.env |  3 +
 board/toradex/colibri_t30/colibri_t30.env |  9 ++
 board/wexler/qc750/qc750.env  | 14 +++
 configs/apalis-tk1_defconfig  |  1 +
 configs/apalis_t30_defconfig  |  1 +
 configs/cardhu_defconfig  |  1 +
 configs/colibri_t20_defconfig |  1 +
 configs/colibri_t30_defconfig |  1 +
 configs/endeavoru_defconfig   |  1 +
 configs/grouper_common_defconfig  |  1 +
 configs/ideapad-yoga-11_defconfig |  1 +
 configs/p2771--000_defconfig  |  1 +
 configs/p3450-_defconfig  |  1 +
 configs/qc750_defconfig   |  1 +
 configs/surface-rt_defconfig  |  1 +
 configs/transformer_t20_defconfig |  1 +
 configs/transformer_t30_defconfig |  1 +
 include/configs/apalis-tk1.h  | 58 
 include/configs/apalis_t30.h  | 12 ---
 include/configs/cardhu.h  |  4 -
 include/configs/colibri_t20.h | 11 ---
 include/configs/colibri_t30.h | 12 ---
 include/configs/endeavoru.h   | 43 -
 include/configs/grouper.h | 45 -
 include/configs/ideapad-yoga-11.h | 58 
 include/configs/p2771-.h  | 20 
 include/configs/p3450-.h  | 13 ---
 include/configs/qc750.h   | 42 -
 include/configs/surface-rt.h  | 18 
 include/configs/transformer-common.h  | 91 ---
 include/configs/transformer-t20.h |  4 +-
 include/configs/transformer-t30.h |  6 +-
 include/configs/x3-t30.h  | 44 -
 include/env/nvidia/prod_upd.env   | 59 
 51 files changed, 326 insertions(+), 475 deletions(-)
 create mode 100644 board/asus/grouper/grouper.env
 create mode 100644 board/asus/transformer-t20/transformer-t20.env
 create mode 100644 board/asus/transformer-t30/tf600t.env
 create mode 100644 board/asus/transformer-t30/transformer-t30.env
 create mode 100644 board/htc/endeavoru/endeavoru.env
 create mode 100644 board/lenovo/ideapad-yoga-11/ideapad-yoga-11.env
 create mode 100644 board/lg/x3-t30/p880.env
 create mode 100644 board/lg/x3-t30/p895.env
 create mode 100644 board/microsoft/surface-rt/surface-rt.env
 create mode 100644 board/nvidia/cardhu/cardhu.env
 create mode 100644 board/nvidia/p2771-/p2771-.env
 create mode 100644 board/nvidia/p3450-/p3450-.env
 create mode 100644 board/toradex/apalis-tk1/apalis_tk1.env
 create mode 100644 board/toradex/apalis_t30/apalis_t30.env
 create mode 100644 board/toradex/colibri_t20/colibri_t20.env
 create mode 100644 board/toradex/colibri_t30/colibri_t30.env
 create mode 100644 board/wexler/qc750/qc750.env
 delete mode 100644 include/configs/transformer-common.h
 create mode 100644 include/env/nvidia/prod_upd.env

-- 
2.43.0



[PATCH v1 0/1] disk: add TegraPT support

2024-07-31 Thread Svyatoslav Ryhel
Production Tegra20/30/114/124/132 devices use Nvidia's own
partition table, which makes them a bit complicated to deal
with. Luckily, it is compatible with the existing EFI
partition already available in U-Boot, apart from the fact
that it cannot pass Protective MBR check.

In order to address this without unwanted code additions,
I have come up with this solution.

Svyatoslav Ryhel (1):
  disk: add TegraPT support

 disk/Kconfig|  8 
 disk/part_efi.c | 13 +
 2 files changed, 21 insertions(+)

-- 
2.43.0



[PATCH v1 1/1] disk: add TegraPT support

2024-07-31 Thread Svyatoslav Ryhel
TegraPT is compatible with EFI part but it can't pass Protective MBR check.
Skip this check if CONFIG_TEGRA_PARTITION is enabled, storage uclass is MMC
and devnum is 0. Note, eMMC on supported devices MUST be aliased to mmc0.

Signed-off-by: Svyatoslav Ryhel 
---
 disk/Kconfig|  8 
 disk/part_efi.c | 13 +
 2 files changed, 21 insertions(+)

diff --git a/disk/Kconfig b/disk/Kconfig
index ffa835eb35..75a849ec8c 100644
--- a/disk/Kconfig
+++ b/disk/Kconfig
@@ -49,6 +49,14 @@ config SPL_MAC_PARTITION
default y if MAC_PARTITION
select SPL_PARTITIONS
 
+config TEGRA_PARTITION
+   bool "Enable Nvidia Tegra partition table"
+   select PARTITIONS
+   select EFI_PARTITION
+   help
+ Say Y here if you would like to use U-Boot on a device with
+ Nvidia Tegra partition table.
+
 config DOS_PARTITION
bool "Enable MS Dos partition table"
default y if BOOT_DEFAULTS
diff --git a/disk/part_efi.c b/disk/part_efi.c
index b1a03bd165..3afc871409 100644
--- a/disk/part_efi.c
+++ b/disk/part_efi.c
@@ -318,6 +318,19 @@ static int part_test_efi(struct blk_desc *desc)
/* Read legacy MBR from block 0 and validate it */
if ((blk_dread(desc, 0, 1, (ulong *)legacymbr) != 1)
|| (is_pmbr_valid(legacymbr) != 1)) {
+
+   /*
+* TegraPT is compatible with EFI part but it
+* cannot pass Protective MBR check. Skip it
+* if CONFIG_TEGRA_PARTITION is enabled and
+* device is question is eMMC.
+*/
+   if (IS_ENABLED(CONFIG_TEGRA_PARTITION))
+   if (!is_pmbr_valid(legacymbr) &&
+   desc->uclass_id == UCLASS_MMC &&
+   !desc->devnum)
+   return 0;
+
return -1;
}
return 0;
-- 
2.43.0



[PATCH v1 3/3] video: panel: add Sharp LQ101R1SX01 MIPI DSI panel driver

2024-07-31 Thread Svyatoslav Ryhel
This module is a color active matrix LCD module incorporating
Oxide TFT (Thin Film Transistor). It is composed of a color TFT-LCD
panel, driver ICs, a control circuit and power supply circuit, and
a backlight unit. Graphics and texts can be displayed on a 2560×1600
dots panel with (16,777,216) colors by using MIPI DUAL DSI interface,
supplying +3.3V DC supply voltage for TFT-LCD panel driving and
supplying DC supply voltage for LED Backlight.

Signed-off-by: Svyatoslav Ryhel 
---
 drivers/video/Kconfig |   9 +
 drivers/video/Makefile|   1 +
 drivers/video/sharp-lq101r1sx01.c | 282 ++
 3 files changed, 292 insertions(+)
 create mode 100644 drivers/video/sharp-lq101r1sx01.c

diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 7808ae7919..8ef7690744 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -564,6 +564,15 @@ config VIDEO_LCD_SAMSUNG_LTL106HL02
  LCD module found in Microsoft Surface 2. The panel has a FullHD
  resolution (1920x1080).
 
+config VIDEO_LCD_SHARP_LQ101R1SX01
+   tristate "Sharp LQ101R1SX01 2560x1600 DSI video mode panel"
+   depends on PANEL && BACKLIGHT
+   select VIDEO_MIPI_DSI
+   help
+ Say Y here if you want to enable support for Sharp LQ101R1SX01
+ LCD module found in ASUS Transformer TF701T. The panel has a
+ WQXGA resolution (2560x1600).
+
 config VIDEO_LCD_SSD2828
bool "SSD2828 bridge chip"
---help---
diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index f3f70cd04a..5973bad742 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -64,6 +64,7 @@ obj-$(CONFIG_VIDEO_LCD_RAYDIUM_RM68200) += raydium-rm68200.o
 obj-$(CONFIG_VIDEO_LCD_RENESAS_R61307) += renesas-r61307.o
 obj-$(CONFIG_VIDEO_LCD_RENESAS_R69328) += renesas-r69328.o
 obj-$(CONFIG_VIDEO_LCD_SAMSUNG_LTL106HL02) += samsung-ltl106hl02.o
+obj-$(CONFIG_VIDEO_LCD_SHARP_LQ101R1SX01) += sharp-lq101r1sx01.o
 obj-$(CONFIG_VIDEO_LCD_SSD2828) += ssd2828.o
 obj-$(CONFIG_VIDEO_LCD_TDO_TL070WSH30) += tdo-tl070wsh30.o
 obj-$(CONFIG_VIDEO_MCDE_SIMPLE) += mcde_simple.o
diff --git a/drivers/video/sharp-lq101r1sx01.c 
b/drivers/video/sharp-lq101r1sx01.c
new file mode 100644
index 00..5d8453fd79
--- /dev/null
+++ b/drivers/video/sharp-lq101r1sx01.c
@@ -0,0 +1,282 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Sharp LQ101R1SX01 DSI panel driver
+ *
+ * Copyright (C) 2014 NVIDIA Corporation
+ * Copyright (c) 2023 Svyatoslav Ryhel 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+struct sharp_lq101r1sx01_priv {
+   struct udevice *backlight;
+   struct udevice *panel_sec;
+   struct udevice *vcc;
+};
+
+static struct display_timing default_timing = {
+   .pixelclock.typ = 27800,
+   .hactive.typ= 2560,
+   .hfront_porch.typ   = 128,
+   .hback_porch.typ= 64,
+   .hsync_len.typ  = 64,
+   .vactive.typ= 1600,
+   .vfront_porch.typ   = 4,
+   .vback_porch.typ= 8,
+   .vsync_len.typ  = 32,
+};
+
+static int sharp_lq101r1sx01_write(struct mipi_dsi_device *dsi,
+  u16 offset, u8 value)
+{
+   u8 payload[3] = { offset >> 8, offset & 0xff, value };
+   int ret;
+
+   ret = mipi_dsi_generic_write(dsi, payload, sizeof(payload));
+   if (ret < 0) {
+   log_debug("%s: failed to write %02x to %04x: %zd\n",
+ __func__, value, offset, ret);
+   return ret;
+   }
+
+   ret = mipi_dsi_dcs_nop(dsi);
+   if (ret < 0) {
+   log_debug("%s: failed to send DCS nop: %zd\n",
+ __func__, ret);
+   return ret;
+   }
+
+   udelay(20);
+
+   return 0;
+}
+
+static int sharp_setup_symmetrical_split(struct mipi_dsi_device *left,
+struct mipi_dsi_device *right,
+struct display_timing *timing)
+{
+   int ret;
+
+   ret = mipi_dsi_dcs_set_column_address(left, 0,
+ timing->hactive.typ / 2 - 1);
+   if (ret < 0) {
+   log_debug("%s: failed to set column address: %d\n",
+ __func__, ret);
+   return ret;
+   }
+
+   ret = mipi_dsi_dcs_set_page_address(left, 0, timing->vactive.typ - 1);
+   if (ret < 0) {
+   log_debug("%s: failed to set page address: %d\n",
+ __func__, ret);
+   return ret;
+   }
+
+   ret = mipi_dsi_dcs_set_column_address(right, timing->hactive.typ / 2,
+ timing->hactive.typ - 1);
+   if (ret < 0) {
+   log_debug("%s: failed to set column

[PATCH v1 2/3] video: tegra20: dsi: add ganged mode support

2024-07-31 Thread Svyatoslav Ryhel
Implement ganged mode support for the Tegra DSI driver. The DSI host
controller to gang up with is specified via a phandle in the device tree
and the resolved DSI host controller used for the programming of the
ganged-mode registers.

Signed-off-by: Svyatoslav Ryhel 
---
 drivers/video/tegra20/tegra-dsi.c | 95 +--
 drivers/video/tegra20/tegra-dsi.h | 15 -
 2 files changed, 104 insertions(+), 6 deletions(-)

diff --git a/drivers/video/tegra20/tegra-dsi.c 
b/drivers/video/tegra20/tegra-dsi.c
index 35a8e6c176..6327266dd2 100644
--- a/drivers/video/tegra20/tegra-dsi.c
+++ b/drivers/video/tegra20/tegra-dsi.c
@@ -20,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "tegra-dc.h"
 #include "tegra-dsi.h"
@@ -50,6 +51,10 @@ struct tegra_dsi_priv {
int host_fifo_depth;
 
u32 version;
+
+   /* for ganged-mode support */
+   struct udevice *master;
+   struct udevice *slave;
 };
 
 static void tegra_dc_enable_controller(struct udevice *dev)
@@ -595,6 +600,17 @@ static void tegra_dsi_set_phy_timing(struct dsi_timing_reg 
*ptiming,
writel(value, &ptiming->dsi_bta_timing);
 }
 
+static void tegra_dsi_ganged_enable(struct udevice *dev, unsigned int start,
+   unsigned int size)
+{
+   struct tegra_dsi_priv *priv = dev_get_priv(dev);
+   struct dsi_ganged_mode_reg *ganged = &priv->dsi->ganged;
+
+   writel(start, &ganged->ganged_mode_start);
+   writel(size << 16 | size, &ganged->ganged_mode_size);
+   writel(DSI_GANGED_MODE_CONTROL_ENABLE, &ganged->ganged_mode_ctrl);
+}
+
 static void tegra_dsi_configure(struct udevice *dev,
unsigned long mode_flags)
 {
@@ -679,9 +695,19 @@ static void tegra_dsi_configure(struct udevice *dev,
writel(hact << 16 | hbp, &len->dsi_pkt_len_2_3);
writel(hfp, &len->dsi_pkt_len_4_5);
writel(0x0f0f << 16, &len->dsi_pkt_len_6_7);
+
+   /* set SOL delay (for non-burst mode only) */
+   writel(8 * mul / div, &misc->dsi_sol_delay);
} else {
-   /* 1 byte (DCS command) + pixel data */
-   value = 1 + timing->hactive.typ * mul / div;
+   if (priv->master || priv->slave) {
+   /*
+* For ganged mode, assume symmetric left-right mode.
+*/
+   value = 1 + (timing->hactive.typ / 2) * mul / div;
+   } else {
+   /* 1 byte (DCS command) + pixel data */
+   value = 1 + timing->hactive.typ * mul / div;
+   }
 
writel(0, &len->dsi_pkt_len_0_1);
writel(value << 16, &len->dsi_pkt_len_2_3);
@@ -691,10 +717,40 @@ static void tegra_dsi_configure(struct udevice *dev,
value = MIPI_DCS_WRITE_MEMORY_START << 8 |
MIPI_DCS_WRITE_MEMORY_CONTINUE;
writel(value, &len->dsi_dcs_cmds);
+
+   /* set SOL delay */
+   if (priv->master || priv->slave) {
+   unsigned long delay, bclk, bclk_ganged;
+   unsigned int lanes = device->lanes;
+   unsigned long htotal = timing->hactive.typ + 
timing->hfront_porch.typ +
+  timing->hback_porch.typ + 
timing->hsync_len.typ;
+
+   /* SOL to valid, valid to FIFO and FIFO write delay */
+   delay = 4 + 4 + 2;
+   delay = DIV_ROUND_UP(delay * mul, div * lanes);
+   /* FIFO read delay */
+   delay = delay + 6;
+
+   bclk = DIV_ROUND_UP(htotal * mul, div * lanes);
+   bclk_ganged = DIV_ROUND_UP(bclk * lanes / 2, lanes);
+   value = bclk - bclk_ganged + delay + 20;
+   } else {
+   /* TODO: revisit for non-ganged mode */
+   value = 8 * mul / div;
+   }
+
+   writel(value, &misc->dsi_sol_delay);
}
 
-   /* set SOL delay (for non-burst mode only) */
-   writel(8 * mul / div, &misc->dsi_sol_delay);
+   if (priv->slave) {
+   /*
+* TODO: Support modes other than symmetrical left-right
+* split.
+*/
+   tegra_dsi_ganged_enable(dev, 0, timing->hactive.typ / 2);
+   tegra_dsi_ganged_enable(priv->slave, timing->hactive.typ / 2,
+   timing->hactive.typ / 2);
+   }
 }
 
 static int tegra_dsi_encoder_enable(struct udevice *dev)
@@ -774,6 +830,9 @@ static int tegra_dsi_encoder_enable(struct

[PATCH v1 1/3] video: tegra20: dc: remove DECLARE_GLOBAL_DATA_PTR use

2024-07-31 Thread Svyatoslav Ryhel
It seems that DECLARE_GLOBAL_DATA_PTR use is not needed and video system
works perfectly fine without it.

Signed-off-by: Svyatoslav Ryhel 
---
 drivers/video/tegra20/tegra-dc.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/video/tegra20/tegra-dc.c b/drivers/video/tegra20/tegra-dc.c
index accabbf4db..d24aa375b3 100644
--- a/drivers/video/tegra20/tegra-dc.c
+++ b/drivers/video/tegra20/tegra-dc.c
@@ -26,8 +26,6 @@
 
 #include "tegra-dc.h"
 
-DECLARE_GLOBAL_DATA_PTR;
-
 /* Holder of Tegra per-SOC DC differences */
 struct tegra_dc_soc_info {
bool has_timer;
-- 
2.43.0



[PATCH v1 0/3] video: tegra: implement ganged dsi mode

2024-07-31 Thread Svyatoslav Ryhel
This patchset implements DSI ganged mode and basically implements
the same ideas introduced by Thierry Reding for Linux Tegra DSI
driver. The Sharp LQ101R1SX01 driver is both an example of a panel
that supports ganged mode and a preparation for upstreaming the
ASUS Transformer TF701T which uses both this panel and DSI mode.

Patches were tested on ASUS TF701T which benefits most from this
change, along with other Tegra114 and Tegra30 devices. No
regressions were found; U-Boot CI passed successfully.

Svyatoslav Ryhel (3):
  video: tegra20: dc: remove DECLARE_GLOBAL_DATA_PTR use
  video: tegra20: dsi: add ganged mode support
  video: panel: add Sharp LQ101R1SX01 MIPI DSI panel driver

 drivers/video/Kconfig |   9 +
 drivers/video/Makefile|   1 +
 drivers/video/sharp-lq101r1sx01.c | 282 ++
 drivers/video/tegra20/tegra-dc.c  |   2 -
 drivers/video/tegra20/tegra-dsi.c |  95 +-
 drivers/video/tegra20/tegra-dsi.h |  15 +-
 6 files changed, 396 insertions(+), 8 deletions(-)
 create mode 100644 drivers/video/sharp-lq101r1sx01.c

-- 
2.43.0



Re: [PATCH 1/4] power: regulator: Trigger probe of regulators which are always-on or boot-on

2024-07-29 Thread Svyatoslav Ryhel
пн, 29 лип. 2024 р. о 13:42 Marek Vasut  пише:
>
> On 7/29/24 7:38 AM, Svyatoslav Ryhel wrote:
>
> [...]
>
> >> The PMIC is on I2C, DM_PMIC enabled in SPL, both buck4 and buck5
> >> regulators are enabled in SPL, have regulator-always-on and
> >> regulator-boot-on and bootph-pre-ram properties.
> >>
> >> This seems similar enough, right ?
> >>
> > Yes, though SPL must remain as small as possible and you propose add
> > there i2c driver,  PMIC driver, PMIC regulator drivers, PMIC GPIO
> > drivers along with relocation of all this stuff. It is not optimal at
> > all.
>
> Sure, if you do use DM_PMIC for PMIC on I2C bus, then you also need
> DM_I2C . You can also do non-DM PMIC configuration in SPL, non-DM in SPL
> is allowed.
>
Thanks for explaining an obvious stuff, it seems that we are talking
on different languages.

> >> What is the problem you observe on tegra 3 ?
> > i2c line fails since it probes in spl with your patch, but it does not
> > relocate and then probes once more after relocation. Probe fails along
> > with all devices on same line.
>
> Could it be that you either have to:
> - Add DM_I2C to tegra 3 SPL
> - Remove bootph-* from DT to remove the regulator node from SPL
> - /delete-property/ regulator-always-on; and /delete-property/
> regulator-boot-on; in -u-boot.dtsi to prevent the regulator from being
> enabled in SPL ?
>
Obviously NO, you propose nonsense. Same dts is used for both stages.
And I have to add hack-ish stuff just because you wanna introduce code
which causes known regressions.

> regulator-always-on means the regulator has to be enabled
> unconditionally, and the system software has no other way to test
> whether the regulator is enabled but access the PMIC, so that is why the
> regulator is probed, even if it is early.
Thanks for explaining an obvious stuff, it seems that we are talking
on different languages.

Anyway,

"We must not probe things as we go. There might be other
dependencies not yet bound. It may also take some time. This is not
following driver model design, sorry.

So please think of a way to do this properly."


Re: [PATCH 1/4] power: regulator: Trigger probe of regulators which are always-on or boot-on

2024-07-28 Thread Svyatoslav Ryhel
нд, 28 лип. 2024 р. о 23:08 Marek Vasut  пише:
>
> On 7/28/24 9:02 PM, Svyatoslav wrote:
>
> Hi,
>
> I'm trimming the CC because I keep getting ML blockage due to large CC
> list. If someone has been removed too hastily, sorry.
>
> > 28 липня 2024 р. 21:35:27 GMT+03:00, Marek Vasut  
> > написав(-ла):
> >> On 7/28/24 7:55 PM, Svyatoslav Ryhel wrote:
> >>> нд, 28 лип. 2024 р. о 19:38 Marek Vasut  пише:
> >>>>
> >>>> On 6/27/24 1:55 AM, Marek Vasut wrote:
> >>>>> In case a regulator DT node contains regulator-always-on or 
> >>>>> regulator-boot-on
> >>>>> property, make sure the regulator gets correctly configured by U-Boot 
> >>>>> on start
> >>>>> up. Unconditionally probe such regulator drivers. This is a preparatory 
> >>>>> patch
> >>>>> for introduction of .regulator_post_probe() which would trigger the 
> >>>>> regulator
> >>>>> configuration.
> >>>>>
> >>>>> Parsing of regulator-always-on and regulator-boot-on DT property has 
> >>>>> been
> >>>>> moved to regulator_post_bind() as the information is required early, the
> >>>>> rest of the DT parsing has been kept in regulator_pre_probe() to avoid
> >>>>> slowing down the boot process.
> >>>>
> >>>> Is there anything blocking this series from being applied ?
> >>>
> >>> This patchset causes PMIC regulators probe too early which results in
> >>> i2c line setup failure. These patches MUST NOT be applied in this form
> >>> since they will break at least 15 Tegra 3 devices which use DM PMIC,
> >>> maybe more.
> >>
> >> Thank you for testing. I do not have any tegra 3 devices, but this 
> >> patchset does not do anything with pinmuxing. If a regulator is probed, 
> >> all of its dependencies (i2c bus, pinmux configuration, etc.) should be 
> >> probed as well. Can you have a look at what the problem with pinmuxing is 
> >> on tegra 3? It seems it might be unrelated to this patchset and would 
> >> eventually show up elsewhere?
> >
> > Pinmux? Wdym, I wrote about a PMIC which is usually located on i2c line.
> >
> > <https://patchwork.ozlabs.org/project/uboot/patch/20231003062126.42026-4-clamo...@gmail.com/>
> >
> > This is a similar patch.
> >
> > You may be able to reproduce the issue I face if you have a device which 
> > uses SPL and has DM PMIC with regulators that need always-on/boot-on 
> > properties.
>
> I actually do use:
>
> configs/imx8mp_dhcom_pdk3_defconfig:CONFIG_DM_PMIC=y
> configs/imx8mp_dhcom_pdk3_defconfig:CONFIG_DM_PMIC_PCA9450=y
> configs/imx8mp_dhcom_pdk3_defconfig:CONFIG_SPL_DM_PMIC_PCA9450=y
>
> which is one of the devices I test this on.
>
> The PMIC is on I2C, DM_PMIC enabled in SPL, both buck4 and buck5
> regulators are enabled in SPL, have regulator-always-on and
> regulator-boot-on and bootph-pre-ram properties.
>
> This seems similar enough, right ?
>
Yes, though SPL must remain as small as possible and you propose add
there i2c driver,  PMIC driver, PMIC regulator drivers, PMIC GPIO
drivers along with relocation of all this stuff. It is not optimal at
all.

> What is the problem you observe on tegra 3 ?
i2c line fails since it probes in spl with your patch, but it does not
relocate and then probes once more after relocation. Probe fails along
with all devices on same line.

Even with
CONFIG_SPL_I2C=y
CONFIG_SPL_PMIC_PALMAS=y
CONFIG_SPL_DM_REGULATOR_PALMAS=y
CONFIG_SPL_PALMAS_GPIO=y
and all bootph-pre-ram; set I still get i2c failure

Here is log
(bootloader) read error from device: bd26f8e0 register: 0x37!
(bootloader) read error from device: bd26f8e0 register: 0x3b!
(bootloader) read error from device: bd26f8e0 register: 0x61!
(bootloader) read error from device: bd26f8e0 register: 0x65!
(bootloader) Core:  177 devices, 27 uclasses, devicetree: separate
(bootloader) MMC:   sdhci@78000400: 1, sdhci@78000600: 0
(bootloader) Loading Environment from MMC... Reading from MMC(0)... ***
(bootloader) Warning - bad CRC, using default environment
(bootloader)
(bootloader) read error from device: bd26f8e0 register: 0x53!
(bootloader) read error from device: bd26f8e0 register: 0x2f!
(bootloader) tegra_dsi_bridge_probe: Cannot get panel: error -5
(bootloader) tegra_dsi_bridge_probe: Cannot get panel: error -114
(bootloader) In:serial,usbkbd,button-kbd
(bootloader) Out:   serial,vidconsole
(bootloader) Err:   serial,vidconsole
(bootloader) Net:   No ethernet found.


Re: [PATCH 1/4] power: regulator: Trigger probe of regulators which are always-on or boot-on

2024-07-28 Thread Svyatoslav



28 липня 2024 р. 21:35:27 GMT+03:00, Marek Vasut  написав(-ла):
>On 7/28/24 7:55 PM, Svyatoslav Ryhel wrote:
>> нд, 28 лип. 2024 р. о 19:38 Marek Vasut  пише:
>>> 
>>> On 6/27/24 1:55 AM, Marek Vasut wrote:
>>>> In case a regulator DT node contains regulator-always-on or 
>>>> regulator-boot-on
>>>> property, make sure the regulator gets correctly configured by U-Boot on 
>>>> start
>>>> up. Unconditionally probe such regulator drivers. This is a preparatory 
>>>> patch
>>>> for introduction of .regulator_post_probe() which would trigger the 
>>>> regulator
>>>> configuration.
>>>> 
>>>> Parsing of regulator-always-on and regulator-boot-on DT property has been
>>>> moved to regulator_post_bind() as the information is required early, the
>>>> rest of the DT parsing has been kept in regulator_pre_probe() to avoid
>>>> slowing down the boot process.
>>> 
>>> Is there anything blocking this series from being applied ?
>> 
>> This patchset causes PMIC regulators probe too early which results in
>> i2c line setup failure. These patches MUST NOT be applied in this form
>> since they will break at least 15 Tegra 3 devices which use DM PMIC,
>> maybe more.
>
>Thank you for testing. I do not have any tegra 3 devices, but this patchset 
>does not do anything with pinmuxing. If a regulator is probed, all of its 
>dependencies (i2c bus, pinmux configuration, etc.) should be probed as well. 
>Can you have a look at what the problem with pinmuxing is on tegra 3? It seems 
>it might be unrelated to this patchset and would eventually show up elsewhere?

Pinmux? Wdym, I wrote about a PMIC which is usually located on i2c line.

<https://patchwork.ozlabs.org/project/uboot/patch/20231003062126.42026-4-clamo...@gmail.com/>

This is a similar patch.

You may be able to reproduce the issue I face if you have a device which uses 
SPL and has DM PMIC with regulators that need always-on/boot-on properties.


Re: [PATCH 1/4] power: regulator: Trigger probe of regulators which are always-on or boot-on

2024-07-28 Thread Svyatoslav Ryhel
нд, 28 лип. 2024 р. о 19:38 Marek Vasut  пише:
>
> On 6/27/24 1:55 AM, Marek Vasut wrote:
> > In case a regulator DT node contains regulator-always-on or 
> > regulator-boot-on
> > property, make sure the regulator gets correctly configured by U-Boot on 
> > start
> > up. Unconditionally probe such regulator drivers. This is a preparatory 
> > patch
> > for introduction of .regulator_post_probe() which would trigger the 
> > regulator
> > configuration.
> >
> > Parsing of regulator-always-on and regulator-boot-on DT property has been
> > moved to regulator_post_bind() as the information is required early, the
> > rest of the DT parsing has been kept in regulator_pre_probe() to avoid
> > slowing down the boot process.
>
> Is there anything blocking this series from being applied ?

This patchset causes PMIC regulators probe too early which results in
i2c line setup failure. These patches MUST NOT be applied in this form
since they will break at least 15 Tegra 3 devices which use DM PMIC,
maybe more.


Re: [PATCH 1/4] power: regulator: Trigger probe of regulators which are always-on or boot-on

2024-07-28 Thread Svyatoslav Ryhel
нд, 28 лип. 2024 р. о 19:38 Marek Vasut  пише:
>
> On 6/27/24 1:55 AM, Marek Vasut wrote:
> > In case a regulator DT node contains regulator-always-on or 
> > regulator-boot-on
> > property, make sure the regulator gets correctly configured by U-Boot on 
> > start
> > up. Unconditionally probe such regulator drivers. This is a preparatory 
> > patch
> > for introduction of .regulator_post_probe() which would trigger the 
> > regulator
> > configuration.
> >
> > Parsing of regulator-always-on and regulator-boot-on DT property has been
> > moved to regulator_post_bind() as the information is required early, the
> > rest of the DT parsing has been kept in regulator_pre_probe() to avoid
> > slowing down the boot process.
>
> Is there anything blocking this series from being applied ?

I would like to try it to be sure that it does not break my devices. I
will respond within next 24 hours.


Please pull u-boot-tegra staging

2024-07-05 Thread Svyatoslav Ryhel
Dear Tom,

The following changes since commit 7c9c5c0562347dccb8ac89148784a34de402ea9e:

  Merge patch series "xtensa: Enable qemu-xtensa board" (2024-07-04 16:11:08 
-0600)

are available in the Git repository at:

  https://source.denx.de/u-boot/custodians/u-boot-tegra.git staging

for you to fetch changes up to f6fb6b2608214b3ee2aef955ec18cf97c14f562e:

  board: lenovo: ideapad-yoga-11: add Lenovo Ideapad Yoga 11 support 
(2024-07-05 10:18:36 +0300)


Jonas Schwöbel (2):
  board: microsoft: surface-rt: add Microsoft Surface RT support
  board: lenovo: ideapad-yoga-11: add Lenovo Ideapad Yoga 11 support

Svyatoslav Ryhel (7):
  configs: paz00: enable EDID support
  video: tegra20: dc: use nvidia,head property to identify DC controller
  include: configs: tegra-common-post: make usb first boot target
  configs: transformer: simplify boot command
  arm: tegra20: bct: add missing 
  board: asus: transformer: add ASUS Transformer T20 family support
  board: wexler: qc750: add WEXLER Tab 7t support

 arch/arm/dts/Makefile  |9 +-
 arch/arm/dts/tegra20-asus-sl101.dts|9 +
 arch/arm/dts/tegra20-asus-tf101.dts|9 +
 arch/arm/dts/tegra20-asus-tf101g.dts   |9 +
 arch/arm/dts/tegra20-asus-transformer.dtsi |  545 
+
 arch/arm/dts/tegra30-lenovo-ideapad-yoga-11.dts| 1266 
++
 arch/arm/dts/tegra30-microsoft-surface-rt.dts  | 1083 
+
 arch/arm/dts/tegra30-wexler-qc750.dts  | 1106 
++
 arch/arm/mach-tegra/tegra20/Kconfig|5 +
 arch/arm/mach-tegra/tegra20/bct.c  |1 +
 arch/arm/mach-tegra/tegra30/Kconfig|   15 +
 board/asus/transformer-t20/Kconfig |   12 +
 board/asus/transformer-t20/MAINTAINERS |8 +
 board/asus/transformer-t20/Makefile|9 +
 board/asus/transformer-t20/configs/sl101.config|1 +
 board/asus/transformer-t20/configs/tf101.config|1 +
 board/asus/transformer-t20/configs/tf101g.config   |1 +
 board/asus/transformer-t20/transformer-t20.c   |   57 +++
 board/lenovo/ideapad-yoga-11/Kconfig   |   12 +
 board/lenovo/ideapad-yoga-11/MAINTAINERS   |7 +
 board/lenovo/ideapad-yoga-11/Makefile  |6 +
 board/lenovo/ideapad-yoga-11/ideapad-yoga-11-spl.c |   41 ++
 board/microsoft/surface-rt/Kconfig |   12 +
 board/microsoft/surface-rt/MAINTAINERS |7 +
 board/microsoft/surface-rt/Makefile|6 +
 board/microsoft/surface-rt/surface-rt-spl.c|   41 ++
 board/wexler/qc750/Kconfig |   12 +
 board/wexler/qc750/MAINTAINERS |7 +
 board/wexler/qc750/Makefile|   11 +
 board/wexler/qc750/qc750-spl.c |   45 +++
 board/wexler/qc750/qc750.c |   21 +
 configs/ideapad-yoga-11_defconfig  |   84 
 configs/paz00_defconfig|1 +
 configs/qc750_defconfig|   81 
 configs/surface-rt_defconfig   |   80 
 configs/transformer_t20_defconfig  |   82 
 configs/transformer_t30_defconfig  |2 +-
 doc/board/asus/index.rst   |1 +
 doc/board/asus/transformer_t20.rst |  129 ++
 doc/board/index.rst|3 +
 doc/board/lenovo/ideapad-yoga-11.rst   |   41 ++
 doc/board/lenovo/index.rst |9 +
 doc/board/microsoft/index.rst  |9 +
 doc/board/microsoft/surface-rt.rst |   41 ++
 doc/board/wexler/index.rst |9 +
 doc/board/wexler/qc750.rst |  125 ++
 drivers/video/tegra20/tegra-dc.c   |6 +-
 drivers/video/tegra20/tegra-dc.h   |4 +-
 include/configs/ideapad-yoga-11.h  |   77 
 include/configs/qc750.h|   65 +++
 include/configs/surface-rt.h   |   39 ++
 include/configs/tegra-common-post.h|2 +-
 include/configs/transformer-t20.h  |   21 +
 53 files changed, 5275 insertions(+), 10 deletions(-)
 create mode 100644 arch/arm/dts/tegra20-asus-sl101.dts
 create mode 100644 arch/arm/dts/tegra20-asus-tf101.dts
 create mode 100644 arch/arm/dts/tegra20-asus-tf101g.dts
 create mode 100644 arch/arm/dts/tegra20-asus-transformer.dtsi
 create mode 100644 arch/arm/dts/tegra30-lenovo-ideapad-yoga-11.dts
 create mode 100644 arch/arm/dts/tegra30-microsoft-surface-rt.d

Re: [PATCH v1 1/1] include: configs: tegra-common-post: make usb first boot target

2024-06-27 Thread Svyatoslav Ryhel
чт, 27 черв. 2024 р. о 14:36 Thierry Reding  пише:
>
> On Thu Jun 27, 2024 at 12:27 PM CEST, Svyatoslav Ryhel wrote:
> > вт, 18 черв. 2024 р. о 17:16 Svyatoslav  пише:
> > >
> > >
> > >
> > > 18 червня 2024 р. 15:23:09 GMT+03:00, Thierry Reding  
> > > написав(-ла):
> > > >On Tue Jun 18, 2024 at 2:00 PM CEST, Svyatoslav Ryhel wrote:
> > > >> This ensures that the device can boot from a USB device prior to MMC. 
> > > >> Useful
> > > >> cases are when installing a new OS from USB while MMC still has a 
> > > >> working OS
> > > >> configuration or if the OS configuration is broken in late boot stages
> > > >> (kernel boots but the system does not start).
> > > >>
> > > >> Signed-off-by: Svyatoslav Ryhel 
> > > >> ---
> > > >>  include/configs/tegra-common-post.h | 2 +-
> > > >>  1 file changed, 1 insertion(+), 1 deletion(-)
> > > >
> > > >What's the implication of this if no USB mass storage device is found?
> > > >How does this behave when USB cannot be read or booting from it doesn't
> > > >work?
> > > >
> > > >I vaguely recall that boot order doesn't always proceed, though
> > > >admittedly I haven't tested all of these edge-cases in a long time.
> > > >
> > > >Thierry
> > >
> > > If no USB mass storage is found bootflow will continue with the next
> > > device in the list (mmc1) with co-responding info that booting from
> > > usb failed. I have tested this on lg p895 which has only mmc0 and
> > > with asus transformers which have usb, mmc0 and mmc1 in all
> > > possible configurations. I did not have booting issues whatsoever.
> > > ATM, transformers use boot order which I have proposed in this
> > > commit.
> > >
> > > Best regards,
> > > Svyatoslav R.
> >
> > Thierry,
> >
> > Since you have not responded to my statement above I assume that
> > you are fine with applying this change. In case you have any
> > objections please answer as soon as you can since I am planning to
> > include it into merge request for the next merge window.
>
> Sorry, I had meant to reply to this. I have no objections if this was
> properly tested and there's a reasonable fallback that works.
>

Np. Thanks for feedback!

> Thierry


Re: [PATCH 1/4] power: regulator: Trigger probe of regulators which are always-on or boot-on

2024-06-27 Thread Svyatoslav Ryhel
чт, 27 черв. 2024 р. о 12:26 Simon Glass  пише:
>
> Hi Svyatoslav,
>
> On Thu, 27 Jun 2024 at 10:09, Svyatoslav  wrote:
> >
> >
> >
> > 27 червня 2024 р. 11:48:46 GMT+03:00, Caleb Connolly 
> >  написав(-ла):
> > >
> > >
> > >On 27/06/2024 10:37, Simon Glass wrote:
> > >> Hi Marek,
> > >>
> > >> On Thu, 27 Jun 2024 at 00:57, Marek Vasut  wrote:
> > >>>
> > >>> In case a regulator DT node contains regulator-always-on or 
> > >>> regulator-boot-on
> > >>> property, make sure the regulator gets correctly configured by U-Boot 
> > >>> on start
> > >>> up. Unconditionally probe such regulator drivers. This is a preparatory 
> > >>> patch
> > >>> for introduction of .regulator_post_probe() which would trigger the 
> > >>> regulator
> > >>> configuration.
> > >>>
> > >>> Parsing of regulator-always-on and regulator-boot-on DT property has 
> > >>> been
> > >>> moved to regulator_post_bind() as the information is required early, the
> > >>> rest of the DT parsing has been kept in regulator_pre_probe() to avoid
> > >>> slowing down the boot process.
> > >>>
> > >>> Signed-off-by: Marek Vasut 
> > >>> ---
> > >>> Cc: Ben Wolsieffer 
> > >>> Cc: Caleb Connolly 
> > >>> Cc: Chris Morgan 
> > >>> Cc: Dragan Simic 
> > >>> Cc: Eugen Hristev 
> > >>> Cc: Francesco Dolcini 
> > >>> Cc: Heinrich Schuchardt 
> > >>> Cc: Jaehoon Chung 
> > >>> Cc: Jagan Teki 
> > >>> Cc: Jonas Karlman 
> > >>> Cc: Kever Yang 
> > >>> Cc: Kostya Porotchkin 
> > >>> Cc: Matteo Lisi 
> > >>> Cc: Mattijs Korpershoek 
> > >>> Cc: Max Krummenacher 
> > >>> Cc: Neil Armstrong 
> > >>> Cc: Patrice Chotard 
> > >>> Cc: Patrick Delaunay 
> > >>> Cc: Philipp Tomsich 
> > >>> Cc: Quentin Schulz 
> > >>> Cc: Sam Day 
> > >>> Cc: Simon Glass 
> > >>> Cc: Sumit Garg 
> > >>> Cc: Svyatoslav Ryhel 
> > >>> Cc: Thierry Reding 
> > >>> Cc: Tom Rini 
> > >>> Cc: Volodymyr Babchuk 
> > >>> Cc: u-boot-amlo...@groups.io
> > >>> Cc: u-boot-q...@groups.io
> > >>> Cc: u-b...@dh-electronics.com
> > >>> Cc: u-boot@lists.denx.de
> > >>> Cc: uboot-st...@st-md-mailman.stormreply.com
> > >>> ---
> > >>>   drivers/power/regulator/regulator-uclass.c | 22 +++---
> > >>>   1 file changed, 15 insertions(+), 7 deletions(-)
> > >>>
> > >>> diff --git a/drivers/power/regulator/regulator-uclass.c 
> > >>> b/drivers/power/regulator/regulator-uclass.c
> > >>> index 66fd531da04..ccc4ef33d83 100644
> > >>> --- a/drivers/power/regulator/regulator-uclass.c
> > >>> +++ b/drivers/power/regulator/regulator-uclass.c
> > >>> @@ -433,6 +433,8 @@ static int regulator_post_bind(struct udevice *dev)
> > >>>  const char *property = "regulator-name";
> > >>>
> > >>>  uc_pdata = dev_get_uclass_plat(dev);
> > >>> +   uc_pdata->always_on = dev_read_bool(dev, "regulator-always-on");
> > >>> +   uc_pdata->boot_on = dev_read_bool(dev, "regulator-boot-on");
> > >>>
> > >>>  /* Regulator's mandatory constraint */
> > >>>  uc_pdata->name = dev_read_string(dev, property);
> > >>> @@ -444,13 +446,21 @@ static int regulator_post_bind(struct udevice 
> > >>> *dev)
> > >>>  return -EINVAL;
> > >>>  }
> > >>>
> > >>> -   if (regulator_name_is_unique(dev, uc_pdata->name))
> > >>> -   return 0;
> > >>> +   if (!regulator_name_is_unique(dev, uc_pdata->name)) {
> > >>> +   debug("'%s' of dev: '%s', has nonunique value: '%s\n",
> > >>> + property, dev->name, uc_pdata->name);
> > >>> +   return -EINVAL;
> > >>> +   }
> > >>>
> > >>> -   debug(&qu

Re: [PATCH 1/4] power: regulator: Trigger probe of regulators which are always-on or boot-on

2024-06-27 Thread Svyatoslav



27 червня 2024 р. 11:48:46 GMT+03:00, Caleb Connolly 
 написав(-ла):
>
>
>On 27/06/2024 10:37, Simon Glass wrote:
>> Hi Marek,
>> 
>> On Thu, 27 Jun 2024 at 00:57, Marek Vasut  wrote:
>>> 
>>> In case a regulator DT node contains regulator-always-on or 
>>> regulator-boot-on
>>> property, make sure the regulator gets correctly configured by U-Boot on 
>>> start
>>> up. Unconditionally probe such regulator drivers. This is a preparatory 
>>> patch
>>> for introduction of .regulator_post_probe() which would trigger the 
>>> regulator
>>> configuration.
>>> 
>>> Parsing of regulator-always-on and regulator-boot-on DT property has been
>>> moved to regulator_post_bind() as the information is required early, the
>>> rest of the DT parsing has been kept in regulator_pre_probe() to avoid
>>> slowing down the boot process.
>>> 
>>> Signed-off-by: Marek Vasut 
>>> ---
>>> Cc: Ben Wolsieffer 
>>> Cc: Caleb Connolly 
>>> Cc: Chris Morgan 
>>> Cc: Dragan Simic 
>>> Cc: Eugen Hristev 
>>> Cc: Francesco Dolcini 
>>> Cc: Heinrich Schuchardt 
>>> Cc: Jaehoon Chung 
>>> Cc: Jagan Teki 
>>> Cc: Jonas Karlman 
>>> Cc: Kever Yang 
>>> Cc: Kostya Porotchkin 
>>> Cc: Matteo Lisi 
>>> Cc: Mattijs Korpershoek 
>>> Cc: Max Krummenacher 
>>> Cc: Neil Armstrong 
>>> Cc: Patrice Chotard 
>>> Cc: Patrick Delaunay 
>>> Cc: Philipp Tomsich 
>>> Cc: Quentin Schulz 
>>> Cc: Sam Day 
>>> Cc: Simon Glass 
>>> Cc: Sumit Garg 
>>> Cc: Svyatoslav Ryhel 
>>> Cc: Thierry Reding 
>>> Cc: Tom Rini 
>>> Cc: Volodymyr Babchuk 
>>> Cc: u-boot-amlo...@groups.io
>>> Cc: u-boot-q...@groups.io
>>> Cc: u-b...@dh-electronics.com
>>> Cc: u-boot@lists.denx.de
>>> Cc: uboot-st...@st-md-mailman.stormreply.com
>>> ---
>>>   drivers/power/regulator/regulator-uclass.c | 22 +++---
>>>   1 file changed, 15 insertions(+), 7 deletions(-)
>>> 
>>> diff --git a/drivers/power/regulator/regulator-uclass.c 
>>> b/drivers/power/regulator/regulator-uclass.c
>>> index 66fd531da04..ccc4ef33d83 100644
>>> --- a/drivers/power/regulator/regulator-uclass.c
>>> +++ b/drivers/power/regulator/regulator-uclass.c
>>> @@ -433,6 +433,8 @@ static int regulator_post_bind(struct udevice *dev)
>>>  const char *property = "regulator-name";
>>> 
>>>  uc_pdata = dev_get_uclass_plat(dev);
>>> +   uc_pdata->always_on = dev_read_bool(dev, "regulator-always-on");
>>> +   uc_pdata->boot_on = dev_read_bool(dev, "regulator-boot-on");
>>> 
>>>  /* Regulator's mandatory constraint */
>>>  uc_pdata->name = dev_read_string(dev, property);
>>> @@ -444,13 +446,21 @@ static int regulator_post_bind(struct udevice *dev)
>>>  return -EINVAL;
>>>  }
>>> 
>>> -   if (regulator_name_is_unique(dev, uc_pdata->name))
>>> -   return 0;
>>> +   if (!regulator_name_is_unique(dev, uc_pdata->name)) {
>>> +   debug("'%s' of dev: '%s', has nonunique value: '%s\n",
>>> + property, dev->name, uc_pdata->name);
>>> +   return -EINVAL;
>>> +   }
>>> 
>>> -   debug("'%s' of dev: '%s', has nonunique value: '%s\n",
>>> - property, dev->name, uc_pdata->name);
>>> +   /*
>>> +* In case the regulator has regulator-always-on or
>>> +* regulator-boot-on DT property, trigger probe() to
>>> +* configure its default state during startup.
>>> +*/
>>> +   if (uc_pdata->always_on && uc_pdata->boot_on)
>>> +   dev_or_flags(dev, DM_FLAG_PROBE_AFTER_BIND);
>>> 
>>> -   return -EINVAL;
>>> +   return 0;
>>>   }
>>> 
>>>   static int regulator_pre_probe(struct udevice *dev)
>>> @@ -473,8 +483,6 @@ static int regulator_pre_probe(struct udevice *dev)
>>>  -ENODATA);
>>>  uc_pdata->max_uA = dev_read_u32_default(dev, 
>>> "regulator-max-microamp",
>>> 

Re: [PATCH v1 1/1] include: configs: tegra-common-post: make usb first boot target

2024-06-27 Thread Svyatoslav Ryhel
вт, 18 черв. 2024 р. о 17:16 Svyatoslav  пише:
>
>
>
> 18 червня 2024 р. 15:23:09 GMT+03:00, Thierry Reding  
> написав(-ла):
> >On Tue Jun 18, 2024 at 2:00 PM CEST, Svyatoslav Ryhel wrote:
> >> This ensures that the device can boot from a USB device prior to MMC. 
> >> Useful
> >> cases are when installing a new OS from USB while MMC still has a working 
> >> OS
> >> configuration or if the OS configuration is broken in late boot stages
> >> (kernel boots but the system does not start).
> >>
> >> Signed-off-by: Svyatoslav Ryhel 
> >> ---
> >>  include/configs/tegra-common-post.h | 2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> >What's the implication of this if no USB mass storage device is found?
> >How does this behave when USB cannot be read or booting from it doesn't
> >work?
> >
> >I vaguely recall that boot order doesn't always proceed, though
> >admittedly I haven't tested all of these edge-cases in a long time.
> >
> >Thierry
>
> If no USB mass storage is found bootflow will continue with the next
> device in the list (mmc1) with co-responding info that booting from
> usb failed. I have tested this on lg p895 which has only mmc0 and
> with asus transformers which have usb, mmc0 and mmc1 in all
> possible configurations. I did not have booting issues whatsoever.
> ATM, transformers use boot order which I have proposed in this
> commit.
>
> Best regards,
> Svyatoslav R.

Thierry,

Since you have not responded to my statement above I assume that
you are fine with applying this change. In case you have any
objections please answer as soon as you can since I am planning to
include it into merge request for the next merge window.

Best regards,
Svyatoslav R.


Re: [PATCH v1 1/1] include: configs: tegra-common-post: make usb first boot target

2024-06-18 Thread Svyatoslav



18 червня 2024 р. 15:23:09 GMT+03:00, Thierry Reding  
написав(-ла):
>On Tue Jun 18, 2024 at 2:00 PM CEST, Svyatoslav Ryhel wrote:
>> This ensures that the device can boot from a USB device prior to MMC. Useful
>> cases are when installing a new OS from USB while MMC still has a working OS
>> configuration or if the OS configuration is broken in late boot stages
>> (kernel boots but the system does not start).
>>
>> Signed-off-by: Svyatoslav Ryhel 
>> ---
>>  include/configs/tegra-common-post.h | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>
>What's the implication of this if no USB mass storage device is found?
>How does this behave when USB cannot be read or booting from it doesn't
>work?
>
>I vaguely recall that boot order doesn't always proceed, though
>admittedly I haven't tested all of these edge-cases in a long time.
>
>Thierry

If no USB mass storage is found bootflow will continue with the next
device in the list (mmc1) with co-responding info that booting from
usb failed. I have tested this on lg p895 which has only mmc0 and
with asus transformers which have usb, mmc0 and mmc1 in all
possible configurations. I did not have booting issues whatsoever.
ATM, transformers use boot order which I have proposed in this
commit.

Best regards,
Svyatoslav R.


[PATCH v1 1/1] include: configs: tegra-common-post: make usb first boot target

2024-06-18 Thread Svyatoslav Ryhel
This ensures that the device can boot from a USB device prior to MMC. Useful
cases are when installing a new OS from USB while MMC still has a working OS
configuration or if the OS configuration is broken in late boot stages
(kernel boots but the system does not start).

Signed-off-by: Svyatoslav Ryhel 
---
 include/configs/tegra-common-post.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/configs/tegra-common-post.h 
b/include/configs/tegra-common-post.h
index fc74980f7c..2f08dfed02 100644
--- a/include/configs/tegra-common-post.h
+++ b/include/configs/tegra-common-post.h
@@ -7,7 +7,7 @@
 #ifndef __TEGRA_COMMON_POST_H
 #define __TEGRA_COMMON_POST_H
 
-#define BOOT_TARGETS   "mmc1 mmc0 usb pxe dhcp"
+#define BOOT_TARGETS   "usb mmc1 mmc0 pxe dhcp"
 
 #ifdef CONFIG_TEGRA_KEYBOARD
 #define STDIN_KBD_KBC ",tegra-kbc"
-- 
2.43.0



[PATCH v1 0/1] Adjust Tegra boot order

2024-06-18 Thread Svyatoslav Ryhel
This ensures that the device can boot from a USB device prior to MMC. Useful
cases are when installing a new OS from USB while MMC still has a working OS
configuration or if the OS configuration is broken in late boot stages
(kernel boots but the system does not start).

Svyatoslav Ryhel (1):
  include: configs: tegra-common-post: make usb first boot target

 include/configs/tegra-common-post.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.43.0



[PATCH v1 1/1] video: tegra20: dc: use nvidia, head property to identify DC controller

2024-06-18 Thread Svyatoslav Ryhel
Use existing nvidia,head device tree property to get DC controller id.

Signed-off-by: Svyatoslav Ryhel 
---
 drivers/video/tegra20/tegra-dc.c | 6 ++
 drivers/video/tegra20/tegra-dc.h | 4 +---
 2 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/video/tegra20/tegra-dc.c b/drivers/video/tegra20/tegra-dc.c
index d073da7d7d..accabbf4db 100644
--- a/drivers/video/tegra20/tegra-dc.c
+++ b/drivers/video/tegra20/tegra-dc.c
@@ -49,7 +49,7 @@ struct tegra_lcd_priv {
int dc_clk[2];  /* Contains clk and its parent */
ulong scdiv;/* Clock divider used by disp_clk_ctrl 
*/
bool rotation;  /* 180 degree panel turn */
-   bool pipe;  /* DC controller: 0 for A, 1 for B */
+   int pipe;   /* DC controller: 0 for A, 1 for B */
 };
 
 enum {
@@ -461,9 +461,7 @@ static int tegra_lcd_of_to_plat(struct udevice *dev)
}
 
priv->rotation = dev_read_bool(dev, "nvidia,180-rotation");
-
-   if (!strcmp(dev->name, TEGRA_DC_B))
-   priv->pipe = 1;
+   priv->pipe = dev_read_u32_default(dev, "nvidia,head", 0);
 
rgb = fdt_subnode_offset(blob, node, "rgb");
if (rgb < 0) {
diff --git a/drivers/video/tegra20/tegra-dc.h b/drivers/video/tegra20/tegra-dc.h
index 05042dab1c..7d0c189ec8 100644
--- a/drivers/video/tegra20/tegra-dc.h
+++ b/drivers/video/tegra20/tegra-dc.h
@@ -14,15 +14,13 @@
 /* arch-tegra/dc exists only because T124 uses it */
 #include 
 
-#define TEGRA_DC_A "dc@5420"
-#define TEGRA_DC_B "dc@5424"
 #define TEGRA_DSI_A"dsi@5430"
 #define TEGRA_DSI_B"dsi@5440"
 
 struct tegra_dc_plat {
struct udevice *dev;/* Display controller device */
struct dc_ctlr *dc; /* Display controller regmap */
-   bool pipe;  /* DC number: 0 for A, 1 for B */
+   int pipe;   /* DC number: 0 for A, 1 for B */
ulong scdiv;/* Shift clock divider */
 };
 
-- 
2.43.0



[PATCH v1 0/1] video: tegra: dc: improve DC id detection

2024-06-18 Thread Svyatoslav Ryhel
Use dedicated property to detect DC rather then use device name.

Svyatoslav Ryhel (1):
  video: tegra20: dc: use nvidia,head property to identify DC controller

 drivers/video/tegra20/tegra-dc.c | 6 ++
 drivers/video/tegra20/tegra-dc.h | 4 +---
 2 files changed, 3 insertions(+), 7 deletions(-)

-- 
2.43.0



[PATCH v2 4/4] board: lenovo: ideapad-yoga-11: Lenovo Ideapad Yoga 11

2024-06-18 Thread Svyatoslav Ryhel
From: Jonas Schwöbel 

The Lenovo IdeaPad Yoga 11 is a hybrid laptop/tablet Windows RT-based
computer released in late 2012. The device uses a 1.3 GHz quad-core
Nvidia Tegra 3 chipset with 2 GB of RAM, features a 11.6 inch 1366x768
screen and 32/64 GB of internal memory that can be supplemented with
a microSDXC card slot, full size SD card slot and 2 full size USB 2.0
ports.

Tested-by: Jethro Bull 
Signed-off-by: Jonas Schwöbel 
Signed-off-by: Svyatoslav Ryhel 
---
 arch/arm/dts/Makefile |1 +
 .../dts/tegra30-lenovo-ideapad-yoga-11.dts| 1266 +
 arch/arm/mach-tegra/tegra30/Kconfig   |5 +
 board/lenovo/ideapad-yoga-11/Kconfig  |   12 +
 board/lenovo/ideapad-yoga-11/MAINTAINERS  |7 +
 board/lenovo/ideapad-yoga-11/Makefile |6 +
 .../ideapad-yoga-11/ideapad-yoga-11-spl.c |   41 +
 configs/ideapad-yoga-11_defconfig |   84 ++
 doc/board/index.rst   |1 +
 doc/board/lenovo/ideapad-yoga-11.rst  |   41 +
 doc/board/lenovo/index.rst|9 +
 include/configs/ideapad-yoga-11.h |   77 +
 12 files changed, 1550 insertions(+)
 create mode 100644 arch/arm/dts/tegra30-lenovo-ideapad-yoga-11.dts
 create mode 100644 board/lenovo/ideapad-yoga-11/Kconfig
 create mode 100644 board/lenovo/ideapad-yoga-11/MAINTAINERS
 create mode 100644 board/lenovo/ideapad-yoga-11/Makefile
 create mode 100644 board/lenovo/ideapad-yoga-11/ideapad-yoga-11-spl.c
 create mode 100644 configs/ideapad-yoga-11_defconfig
 create mode 100644 doc/board/lenovo/ideapad-yoga-11.rst
 create mode 100644 doc/board/lenovo/index.rst
 create mode 100644 include/configs/ideapad-yoga-11.h

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 8041faa228..4a63243fae 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -130,6 +130,7 @@ dtb-$(CONFIG_ARCH_TEGRA) += \
tegra30-cardhu.dtb \
tegra30-colibri.dtb \
tegra30-htc-endeavoru.dtb \
+   tegra30-lenovo-ideapad-yoga-11.dtb \
tegra30-lg-p880.dtb \
tegra30-lg-p895.dtb \
tegra30-microsoft-surface-rt.dtb \
diff --git a/arch/arm/dts/tegra30-lenovo-ideapad-yoga-11.dts 
b/arch/arm/dts/tegra30-lenovo-ideapad-yoga-11.dts
new file mode 100644
index 00..9a1e8c0601
--- /dev/null
+++ b/arch/arm/dts/tegra30-lenovo-ideapad-yoga-11.dts
@@ -0,0 +1,1266 @@
+// SPDX-License-Identifier: GPL-2.0
+/dts-v1/;
+
+#include 
+#include "tegra30.dtsi"
+
+/ {
+   model = "Lenovo Ideapad Yoga 11 Slate";
+   compatible = "lenovo,ideapad-yoga-11", "nvidia,tegra30";
+
+   chosen {
+   stdout-path = &uarta;
+   };
+
+   aliases {
+   i2c0 = &pwr_i2c;
+   i2c1 = &gen2_i2c;
+
+   mmc0 = &sdmmc4; /* eMMC */
+   mmc1 = &sdmmc1; /* uSD slot */
+
+   rtc0 = &pmic;
+   rtc1 = "/rtc@7000e000";
+
+   spi0 = &spi4;
+
+   usb0 = &usb1;
+   usb1 = &usb3;
+   };
+
+   memory {
+   device_type = "memory";
+   reg = <0x8000 0x8000>;
+   };
+
+   host1x@5000 {
+   dc@5420 {
+   rgb {
+   status = "okay";
+
+   nvidia,panel = <&bridge>;
+   };
+   };
+   };
+
+   pinmux@7868 {
+   pinctrl-names = "default";
+   pinctrl-0 = <&state_default>;
+
+   state_default: pinmux {
+   /* SDMMC1 pinmux */
+   sdmmc1-clk {
+   nvidia,pins = "sdmmc1_clk_pz0";
+   nvidia,function = "sdmmc1";
+   nvidia,pull = ;
+   nvidia,tristate = ;
+   nvidia,enable-input = ;
+   };
+   sdmmc1-cmd {
+   nvidia,pins = "sdmmc1_dat3_py4",
+   "sdmmc1_dat2_py5",
+   "sdmmc1_dat1_py6",
+   "sdmmc1_dat0_py7",
+   "sdmmc1_cmd_pz1";
+   nvidia,function = "sdmmc1";
+   nvidia,pull = ;
+   nvidia,tristate = ;
+   nvidia,enable-input = ;
+   };
+
+   /* SDMMC3 pinmux */
+   sdmmc3-clk {
+   nvidia,pins = "s

[PATCH v2 3/4] board: microsoft: surface-rt: add Microsoft Surface RT support

2024-06-18 Thread Svyatoslav Ryhel
From: Jonas Schwöbel 

Surface RT is a hybrid tablet computer developed and manufactured
by Microsoft and shipped with Windows RT. The tablet uses a 1.3 GHz
quad-core Nvidia Tegra 3 chipset with 2 GB of RAM, features 10.8
inch 1366x768 screen and 32/64 GB of internal memory that can be
supplemented with a microSDXC card giving up to 200 GB of
additional storage.

Tested-by: Jethro Bull 
Signed-off-by: Jonas Schwöbel 
Signed-off-by: Svyatoslav Ryhel 
---
 arch/arm/dts/Makefile |1 +
 arch/arm/dts/tegra30-microsoft-surface-rt.dts | 1083 +
 arch/arm/mach-tegra/tegra30/Kconfig   |5 +
 board/microsoft/surface-rt/Kconfig|   12 +
 board/microsoft/surface-rt/MAINTAINERS|7 +
 board/microsoft/surface-rt/Makefile   |6 +
 board/microsoft/surface-rt/surface-rt-spl.c   |   41 +
 configs/surface-rt_defconfig  |   80 ++
 doc/board/index.rst   |1 +
 doc/board/microsoft/index.rst |9 +
 doc/board/microsoft/surface-rt.rst|   41 +
 include/configs/surface-rt.h  |   39 +
 12 files changed, 1325 insertions(+)
 create mode 100644 arch/arm/dts/tegra30-microsoft-surface-rt.dts
 create mode 100644 board/microsoft/surface-rt/Kconfig
 create mode 100644 board/microsoft/surface-rt/MAINTAINERS
 create mode 100644 board/microsoft/surface-rt/Makefile
 create mode 100644 board/microsoft/surface-rt/surface-rt-spl.c
 create mode 100644 configs/surface-rt_defconfig
 create mode 100644 doc/board/microsoft/index.rst
 create mode 100644 doc/board/microsoft/surface-rt.rst
 create mode 100644 include/configs/surface-rt.h

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 8ca10c307f..8041faa228 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -132,6 +132,7 @@ dtb-$(CONFIG_ARCH_TEGRA) += \
tegra30-htc-endeavoru.dtb \
tegra30-lg-p880.dtb \
tegra30-lg-p895.dtb \
+   tegra30-microsoft-surface-rt.dtb \
tegra30-tec-ng.dtb \
tegra30-wexler-qc750.dtb \
tegra114-dalmore.dtb \
diff --git a/arch/arm/dts/tegra30-microsoft-surface-rt.dts 
b/arch/arm/dts/tegra30-microsoft-surface-rt.dts
new file mode 100644
index 00..6810350a90
--- /dev/null
+++ b/arch/arm/dts/tegra30-microsoft-surface-rt.dts
@@ -0,0 +1,1083 @@
+// SPDX-License-Identifier: GPL-2.0
+/dts-v1/;
+
+#include 
+#include "tegra30.dtsi"
+
+/ {
+   model = "Microsoft Surface RT Tablet";
+   compatible = "microsoft,surface-rt", "nvidia,tegra30";
+
+   chosen {
+   stdout-path = &uarta;
+   };
+
+   aliases {
+   i2c0 = &pwr_i2c;
+
+   mmc0 = &sdmmc4; /* eMMC */
+   mmc1 = &sdmmc1; /* uSD slot */
+
+   rtc0 = &pmic;
+   rtc1 = "/rtc@7000e000";
+
+   spi0 = &spi4;
+
+   usb0 = &usb1;
+   };
+
+   memory {
+   device_type = "memory";
+   reg = <0x8000 0x8000>;
+   };
+
+   host1x@5000 {
+   dc@5420 {
+   rgb {
+   status = "okay";
+
+   nvidia,panel = <&panel>;
+   };
+   };
+   };
+
+   gpio@6000d000 {
+   /* in case usb vbus is on for some reason */
+   usb-vbus-hog {
+   gpio-hog;
+   gpios = ;
+   output-low;
+   };
+   };
+
+   pinmux@7868 {
+   pinctrl-names = "default";
+   pinctrl-0 = <&state_default>;
+
+   state_default: pinmux {
+   /* SDMMC1 pinmux */
+   sdmmc1-clk {
+   nvidia,pins = "sdmmc1_clk_pz0";
+   nvidia,function = "sdmmc1";
+   nvidia,pull = ;
+   nvidia,tristate = ;
+   nvidia,enable-input = ;
+   };
+   sdmmc1-cmd {
+   nvidia,pins = "sdmmc1_dat3_py4",
+   "sdmmc1_dat2_py5",
+   "sdmmc1_dat1_py6",
+   "sdmmc1_dat0_py7",
+   "sdmmc1_cmd_pz1";
+   nvidia,function = "sdmmc1";
+   nvidia,pull = ;
+   nvidia,tristate = ;
+   nvidia,enable-input = ;
+   };
+
+   /* SDMMC3 

[PATCH v2 2/4] board: wexler: qc750: add WEXLER Tab 7t support

2024-06-18 Thread Svyatoslav Ryhel
WEXLER Tab 7t is a mini tablet computer developed by WEXLER that
runs the Android operating system. The device features a 7.0-inch
(180 mm) HD display, an Nvidia Tegra 3 quad-core chip, 1 GB of RAM,
8, 16 or 32 GB of storage that can be supplemented with a microSDXC
card giving up to 64 GB of additional storage and a full size USB
port.

Tested-by: Maksim Kurnosenko 
Signed-off-by: Svyatoslav Ryhel 
---
 arch/arm/dts/Makefile |1 +
 arch/arm/dts/tegra30-wexler-qc750.dts | 1106 +
 arch/arm/mach-tegra/tegra30/Kconfig   |5 +
 board/wexler/qc750/Kconfig|   12 +
 board/wexler/qc750/MAINTAINERS|7 +
 board/wexler/qc750/Makefile   |   11 +
 board/wexler/qc750/qc750-spl.c|   45 +
 board/wexler/qc750/qc750.c|   21 +
 configs/qc750_defconfig   |   81 ++
 doc/board/index.rst   |1 +
 doc/board/wexler/index.rst|9 +
 doc/board/wexler/qc750.rst|  125 +++
 include/configs/qc750.h   |   65 ++
 13 files changed, 1489 insertions(+)
 create mode 100644 arch/arm/dts/tegra30-wexler-qc750.dts
 create mode 100644 board/wexler/qc750/Kconfig
 create mode 100644 board/wexler/qc750/MAINTAINERS
 create mode 100644 board/wexler/qc750/Makefile
 create mode 100644 board/wexler/qc750/qc750-spl.c
 create mode 100644 board/wexler/qc750/qc750.c
 create mode 100644 configs/qc750_defconfig
 create mode 100644 doc/board/wexler/index.rst
 create mode 100644 doc/board/wexler/qc750.rst
 create mode 100644 include/configs/qc750.h

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 3a66c6d012..8ca10c307f 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -133,6 +133,7 @@ dtb-$(CONFIG_ARCH_TEGRA) += \
tegra30-lg-p880.dtb \
tegra30-lg-p895.dtb \
tegra30-tec-ng.dtb \
+   tegra30-wexler-qc750.dtb \
tegra114-dalmore.dtb \
tegra124-apalis.dtb \
tegra124-jetson-tk1.dtb \
diff --git a/arch/arm/dts/tegra30-wexler-qc750.dts 
b/arch/arm/dts/tegra30-wexler-qc750.dts
new file mode 100644
index 00..87c2a4072e
--- /dev/null
+++ b/arch/arm/dts/tegra30-wexler-qc750.dts
@@ -0,0 +1,1106 @@
+// SPDX-License-Identifier: GPL-2.0
+/dts-v1/;
+
+/* CPU Speedo ID 7, Soc Speedo ID 1, CPU Process: 4, Core Process: 0 */
+
+#include 
+#include 
+
+#include "tegra30.dtsi"
+
+/ {
+   model = "Wexler Tab 7t";
+   compatible = "wexler,qc750", "nvidia,tegra30";
+
+   chosen {
+   stdout-path = &uartd;
+   };
+
+   aliases {
+   i2c0 = &pwr_i2c;
+
+   mmc0 = &sdmmc4; /* eMMC */
+   mmc1 = &sdmmc1; /* uSD slot */
+
+   rtc0 = &pmic;
+   rtc1 = "/rtc@7000e000";
+
+   usb0 = µ_usb;
+   usb1 = &usb3; /* Full size USB */
+   };
+
+   memory {
+   device_type = "memory";
+   reg = <0x8000 0x4000>;
+   };
+
+   host1x@5000 {
+   dc@5420 {
+   rgb {
+   status = "okay";
+
+   nvidia,panel = <&panel>;
+   };
+   };
+   };
+
+   pinmux@7868 {
+   pinctrl-names = "default";
+   pinctrl-0 = <&state_default>;
+
+   state_default: pinmux {
+   /* SDMMC1 pinmux */
+   sdmmc1-clk {
+   nvidia,pins = "sdmmc1_clk_pz0";
+   nvidia,function = "sdmmc1";
+   nvidia,pull = ;
+   nvidia,tristate = ;
+   nvidia,enable-input = ;
+   };
+   sdmmc1-cmd {
+   nvidia,pins = "sdmmc1_dat3_py4",
+   "sdmmc1_dat2_py5",
+   "sdmmc1_dat1_py6",
+   "sdmmc1_dat0_py7",
+   "sdmmc1_cmd_pz1";
+   nvidia,function = "sdmmc1";
+   nvidia,pull = ;
+   nvidia,tristate = ;
+   nvidia,enable-input = ;
+   };
+   sdmmc1-cd {
+   nvidia,pins = "gmi_iordy_pi5";
+   nvidia,function = "rsvd1";
+   nvidia,pull = ;
+   nvidia,tristate = ;
+   nvidia,enable-input = ;
+   };
+
+ 

[PATCH v2 1/4] board: asus: transformer: add ASUS Transformer T20 family support

2024-06-18 Thread Svyatoslav Ryhel
The Asus Eee Pad Transformer family are 2-in-1 detachable/slider
tablets developed by Asus that run the Android operating system.
The Eee Pad Transformers feature a 10.1-inch (260 mm) display,
an Nvidia Tegra 2 dual-core chip, 1 GB of RAM, and 16/32 GB of storage.
Transformers board derives from Nvidia Ventana development board.

This patch brings support for all 3 known T20 Transformers:
- Asus Eee Pad Transformer TF101
- Asus Eee Pad Transformer TF101G
- Asus Eee Pad Slider SL101

Tested-by: Robert Eckelmann  # ASUS TF101
Tested-by: Antoni Aloy Torrens  # ASUS TF101
Signed-off-by: Svyatoslav Ryhel 
---
 arch/arm/dts/Makefile |   6 +-
 arch/arm/dts/tegra20-asus-sl101.dts   |   9 +
 arch/arm/dts/tegra20-asus-tf101.dts   |   9 +
 arch/arm/dts/tegra20-asus-tf101g.dts  |   9 +
 arch/arm/dts/tegra20-asus-transformer.dtsi| 545 ++
 arch/arm/mach-tegra/tegra20/Kconfig   |   5 +
 board/asus/transformer-t20/Kconfig|  12 +
 board/asus/transformer-t20/MAINTAINERS|   8 +
 board/asus/transformer-t20/Makefile   |   9 +
 .../asus/transformer-t20/configs/sl101.config |   1 +
 .../asus/transformer-t20/configs/tf101.config |   1 +
 .../transformer-t20/configs/tf101g.config |   1 +
 board/asus/transformer-t20/transformer-t20.c  |  57 ++
 configs/transformer_t20_defconfig |  82 +++
 doc/board/asus/index.rst  |   1 +
 doc/board/asus/transformer_t20.rst| 129 +
 include/configs/transformer-t20.h |  21 +
 17 files changed, 904 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/tegra20-asus-sl101.dts
 create mode 100644 arch/arm/dts/tegra20-asus-tf101.dts
 create mode 100644 arch/arm/dts/tegra20-asus-tf101g.dts
 create mode 100644 arch/arm/dts/tegra20-asus-transformer.dtsi
 create mode 100644 board/asus/transformer-t20/Kconfig
 create mode 100644 board/asus/transformer-t20/MAINTAINERS
 create mode 100644 board/asus/transformer-t20/Makefile
 create mode 100644 board/asus/transformer-t20/configs/sl101.config
 create mode 100644 board/asus/transformer-t20/configs/tf101.config
 create mode 100644 board/asus/transformer-t20/configs/tf101g.config
 create mode 100644 board/asus/transformer-t20/transformer-t20.c
 create mode 100644 configs/transformer_t20_defconfig
 create mode 100644 doc/board/asus/transformer_t20.rst
 create mode 100644 include/configs/transformer-t20.h

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 8fb6a8a1f1..3a66c6d012 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -102,7 +102,11 @@ dtb-$(CONFIG_ARCH_S5P4418) += \
 dtb-$(CONFIG_ARCH_MESON) += \
meson-a1-ad401.dtb
 
-dtb-$(CONFIG_ARCH_TEGRA) += tegra20-harmony.dtb \
+dtb-$(CONFIG_ARCH_TEGRA) += \
+   tegra20-asus-sl101.dtb \
+   tegra20-asus-tf101.dtb \
+   tegra20-asus-tf101g.dtb \
+   tegra20-harmony.dtb \
tegra20-medcom-wide.dtb \
tegra20-paz00.dtb \
tegra20-plutux.dtb \
diff --git a/arch/arm/dts/tegra20-asus-sl101.dts 
b/arch/arm/dts/tegra20-asus-sl101.dts
new file mode 100644
index 00..b4709c3e9a
--- /dev/null
+++ b/arch/arm/dts/tegra20-asus-sl101.dts
@@ -0,0 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0
+/dts-v1/;
+
+#include "tegra20-asus-transformer.dtsi"
+
+/ {
+   model = "ASUS EeePad Slider SL101";
+   compatible = "asus,sl101", "nvidia,tegra20";
+};
diff --git a/arch/arm/dts/tegra20-asus-tf101.dts 
b/arch/arm/dts/tegra20-asus-tf101.dts
new file mode 100644
index 00..7c734fb5b1
--- /dev/null
+++ b/arch/arm/dts/tegra20-asus-tf101.dts
@@ -0,0 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0
+/dts-v1/;
+
+#include "tegra20-asus-transformer.dtsi"
+
+/ {
+   model = "ASUS EeePad Transformer TF101";
+   compatible = "asus,tf101", "nvidia,tegra20";
+};
diff --git a/arch/arm/dts/tegra20-asus-tf101g.dts 
b/arch/arm/dts/tegra20-asus-tf101g.dts
new file mode 100644
index 00..f49a358a26
--- /dev/null
+++ b/arch/arm/dts/tegra20-asus-tf101g.dts
@@ -0,0 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0
+/dts-v1/;
+
+#include "tegra20-asus-transformer.dtsi"
+
+/ {
+   model = "ASUS EeePad Transformer TF101G";
+   compatible = "asus,tf101g", "nvidia,tegra20";
+};
diff --git a/arch/arm/dts/tegra20-asus-transformer.dtsi 
b/arch/arm/dts/tegra20-asus-transformer.dtsi
new file mode 100644
index 00..49efabbfd9
--- /dev/null
+++ b/arch/arm/dts/tegra20-asus-transformer.dtsi
@@ -0,0 +1,545 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include 
+#include "tegra20.dtsi"
+
+/ {
+   chosen {
+   stdout-path = &uartd;
+   };
+
+   aliases {
+   i2c0 = &pwr_i2c;
+
+   mmc0 = &sdmmc4; /* eMMC */
+   mmc1 = &sdmmc3; /* MicroSD */
+
+   rtc0 = &

[PATCH v2 0/4] Initial support for new Tegra 2/3 devices

2024-06-18 Thread Svyatoslav Ryhel
Patchset includes initial support bringup for 4 new Tegra 2 and
Tegra 3 devices which include Asus Transformers with Tegra 2,
Microfost Surface RT, Lenovo Ideapad Yoga 11 and Wexler Tab 7t.
All setups are tested on real hardware and pass buildman and CI.

---
Changes from v1:
- removed  inclusion
---

Jonas Schwöbel (2):
  board: microsoft: surface-rt: add Microsoft Surface RT support
  board: lenovo: ideapad-yoga-11: Lenovo Ideapad Yoga 11

Svyatoslav Ryhel (2):
  board: asus: transformer: add ASUS Transformer T20 family support
  board: wexler: qc750: add WEXLER Tab 7t support

 arch/arm/dts/Makefile |9 +-
 arch/arm/dts/tegra20-asus-sl101.dts   |9 +
 arch/arm/dts/tegra20-asus-tf101.dts   |9 +
 arch/arm/dts/tegra20-asus-tf101g.dts  |9 +
 arch/arm/dts/tegra20-asus-transformer.dtsi|  545 +++
 .../dts/tegra30-lenovo-ideapad-yoga-11.dts| 1266 +
 arch/arm/dts/tegra30-microsoft-surface-rt.dts | 1083 ++
 arch/arm/dts/tegra30-wexler-qc750.dts | 1106 ++
 arch/arm/mach-tegra/tegra20/Kconfig   |5 +
 arch/arm/mach-tegra/tegra30/Kconfig   |   15 +
 board/asus/transformer-t20/Kconfig|   12 +
 board/asus/transformer-t20/MAINTAINERS|8 +
 board/asus/transformer-t20/Makefile   |9 +
 .../asus/transformer-t20/configs/sl101.config |1 +
 .../asus/transformer-t20/configs/tf101.config |1 +
 .../transformer-t20/configs/tf101g.config |1 +
 board/asus/transformer-t20/transformer-t20.c  |   57 +
 board/lenovo/ideapad-yoga-11/Kconfig  |   12 +
 board/lenovo/ideapad-yoga-11/MAINTAINERS  |7 +
 board/lenovo/ideapad-yoga-11/Makefile |6 +
 .../ideapad-yoga-11/ideapad-yoga-11-spl.c |   41 +
 board/microsoft/surface-rt/Kconfig|   12 +
 board/microsoft/surface-rt/MAINTAINERS|7 +
 board/microsoft/surface-rt/Makefile   |6 +
 board/microsoft/surface-rt/surface-rt-spl.c   |   41 +
 board/wexler/qc750/Kconfig|   12 +
 board/wexler/qc750/MAINTAINERS|7 +
 board/wexler/qc750/Makefile   |   11 +
 board/wexler/qc750/qc750-spl.c|   45 +
 board/wexler/qc750/qc750.c|   21 +
 configs/ideapad-yoga-11_defconfig |   84 ++
 configs/qc750_defconfig   |   81 ++
 configs/surface-rt_defconfig  |   80 ++
 configs/transformer_t20_defconfig |   82 ++
 doc/board/asus/index.rst  |1 +
 doc/board/asus/transformer_t20.rst|  129 ++
 doc/board/index.rst   |3 +
 doc/board/lenovo/ideapad-yoga-11.rst  |   41 +
 doc/board/lenovo/index.rst|9 +
 doc/board/microsoft/index.rst |9 +
 doc/board/microsoft/surface-rt.rst|   41 +
 doc/board/wexler/index.rst|9 +
 doc/board/wexler/qc750.rst|  125 ++
 include/configs/ideapad-yoga-11.h |   77 +
 include/configs/qc750.h   |   65 +
 include/configs/surface-rt.h  |   39 +
 include/configs/transformer-t20.h |   21 +
 47 files changed, 5268 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/tegra20-asus-sl101.dts
 create mode 100644 arch/arm/dts/tegra20-asus-tf101.dts
 create mode 100644 arch/arm/dts/tegra20-asus-tf101g.dts
 create mode 100644 arch/arm/dts/tegra20-asus-transformer.dtsi
 create mode 100644 arch/arm/dts/tegra30-lenovo-ideapad-yoga-11.dts
 create mode 100644 arch/arm/dts/tegra30-microsoft-surface-rt.dts
 create mode 100644 arch/arm/dts/tegra30-wexler-qc750.dts
 create mode 100644 board/asus/transformer-t20/Kconfig
 create mode 100644 board/asus/transformer-t20/MAINTAINERS
 create mode 100644 board/asus/transformer-t20/Makefile
 create mode 100644 board/asus/transformer-t20/configs/sl101.config
 create mode 100644 board/asus/transformer-t20/configs/tf101.config
 create mode 100644 board/asus/transformer-t20/configs/tf101g.config
 create mode 100644 board/asus/transformer-t20/transformer-t20.c
 create mode 100644 board/lenovo/ideapad-yoga-11/Kconfig
 create mode 100644 board/lenovo/ideapad-yoga-11/MAINTAINERS
 create mode 100644 board/lenovo/ideapad-yoga-11/Makefile
 create mode 100644 board/lenovo/ideapad-yoga-11/ideapad-yoga-11-spl.c
 create mode 100644 board/microsoft/surface-rt/Kconfig
 create mode 100644 board/microsoft/surface-rt/MAINTAINERS
 create mode 100644 board/microsoft/surface-rt/Makefile
 create mode 100644 board/microsoft/surface-rt/surface-rt-spl.c
 create mode 100644 board/wexler/qc750/Kconfig
 create mode 100644 board/wexler/qc750/MAINTAINERS
 create mode 100644 board/wexler/qc750/Makefile
 create mode 100644 board/wexler/qc750/qc750-spl.c
 create mode 100644 board/wexler/qc750/qc750.c
 create mode 100644 configs/ideapad-yoga-11_defconfig
 create mode 100644 configs

[PATCH v1 4/4] board: lenovo: ideapad-yoga-11: Lenovo Ideapad Yoga 11

2024-06-15 Thread Svyatoslav Ryhel
From: Jonas Schwöbel 

The Lenovo IdeaPad Yoga 11 is a hybrid laptop/tablet Windows RT-based
computer released in late 2012. The device uses a 1.3 GHz quad-core
Nvidia Tegra 3 chipset with 2 GB of RAM, features a 11.6 inch 1366x768
screen and 32/64 GB of internal memory that can be supplemented with
a microSDXC card slot, full size SD card slot and 2 full size USB 2.0
ports.

Signed-off-by: Jonas Schwöbel 
Signed-off-by: Svyatoslav Ryhel 
---
 arch/arm/dts/Makefile |1 +
 .../dts/tegra30-lenovo-ideapad-yoga-11.dts| 1266 +
 arch/arm/mach-tegra/tegra30/Kconfig   |5 +
 board/lenovo/ideapad-yoga-11/Kconfig  |   12 +
 board/lenovo/ideapad-yoga-11/MAINTAINERS  |7 +
 board/lenovo/ideapad-yoga-11/Makefile |6 +
 .../ideapad-yoga-11/ideapad-yoga-11-spl.c |   41 +
 configs/ideapad-yoga-11_defconfig |   84 ++
 doc/board/index.rst   |1 +
 doc/board/lenovo/ideapad-yoga-11.rst  |   41 +
 doc/board/lenovo/index.rst|9 +
 include/configs/ideapad-yoga-11.h |   79 +
 12 files changed, 1552 insertions(+)
 create mode 100644 arch/arm/dts/tegra30-lenovo-ideapad-yoga-11.dts
 create mode 100644 board/lenovo/ideapad-yoga-11/Kconfig
 create mode 100644 board/lenovo/ideapad-yoga-11/MAINTAINERS
 create mode 100644 board/lenovo/ideapad-yoga-11/Makefile
 create mode 100644 board/lenovo/ideapad-yoga-11/ideapad-yoga-11-spl.c
 create mode 100644 configs/ideapad-yoga-11_defconfig
 create mode 100644 doc/board/lenovo/ideapad-yoga-11.rst
 create mode 100644 doc/board/lenovo/index.rst
 create mode 100644 include/configs/ideapad-yoga-11.h

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 8041faa228..4a63243fae 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -130,6 +130,7 @@ dtb-$(CONFIG_ARCH_TEGRA) += \
tegra30-cardhu.dtb \
tegra30-colibri.dtb \
tegra30-htc-endeavoru.dtb \
+   tegra30-lenovo-ideapad-yoga-11.dtb \
tegra30-lg-p880.dtb \
tegra30-lg-p895.dtb \
tegra30-microsoft-surface-rt.dtb \
diff --git a/arch/arm/dts/tegra30-lenovo-ideapad-yoga-11.dts 
b/arch/arm/dts/tegra30-lenovo-ideapad-yoga-11.dts
new file mode 100644
index 00..9a1e8c0601
--- /dev/null
+++ b/arch/arm/dts/tegra30-lenovo-ideapad-yoga-11.dts
@@ -0,0 +1,1266 @@
+// SPDX-License-Identifier: GPL-2.0
+/dts-v1/;
+
+#include 
+#include "tegra30.dtsi"
+
+/ {
+   model = "Lenovo Ideapad Yoga 11 Slate";
+   compatible = "lenovo,ideapad-yoga-11", "nvidia,tegra30";
+
+   chosen {
+   stdout-path = &uarta;
+   };
+
+   aliases {
+   i2c0 = &pwr_i2c;
+   i2c1 = &gen2_i2c;
+
+   mmc0 = &sdmmc4; /* eMMC */
+   mmc1 = &sdmmc1; /* uSD slot */
+
+   rtc0 = &pmic;
+   rtc1 = "/rtc@7000e000";
+
+   spi0 = &spi4;
+
+   usb0 = &usb1;
+   usb1 = &usb3;
+   };
+
+   memory {
+   device_type = "memory";
+   reg = <0x8000 0x8000>;
+   };
+
+   host1x@5000 {
+   dc@5420 {
+   rgb {
+   status = "okay";
+
+   nvidia,panel = <&bridge>;
+   };
+   };
+   };
+
+   pinmux@7868 {
+   pinctrl-names = "default";
+   pinctrl-0 = <&state_default>;
+
+   state_default: pinmux {
+   /* SDMMC1 pinmux */
+   sdmmc1-clk {
+   nvidia,pins = "sdmmc1_clk_pz0";
+   nvidia,function = "sdmmc1";
+   nvidia,pull = ;
+   nvidia,tristate = ;
+   nvidia,enable-input = ;
+   };
+   sdmmc1-cmd {
+   nvidia,pins = "sdmmc1_dat3_py4",
+   "sdmmc1_dat2_py5",
+   "sdmmc1_dat1_py6",
+   "sdmmc1_dat0_py7",
+   "sdmmc1_cmd_pz1";
+   nvidia,function = "sdmmc1";
+   nvidia,pull = ;
+   nvidia,tristate = ;
+   nvidia,enable-input = ;
+   };
+
+   /* SDMMC3 pinmux */
+   sdmmc3-clk {
+   nvidia,pins = "sdmmc3_clk_pa6";
+   nvidia,functi

[PATCH v1 3/4] board: microsoft: surface-rt: add Microsoft Surface RT support

2024-06-15 Thread Svyatoslav Ryhel
From: Jonas Schwöbel 

Surface RT is a hybrid tablet computer developed and manufactured
by Microsoft and shipped with Windows RT. The tablet uses a 1.3 GHz
quad-core Nvidia Tegra 3 chipset with 2 GB of RAM, features 10.8
inch 1366x768 screen and 32/64 GB of internal memory that can be
supplemented with a microSDXC card giving up to 200 GB of
additional storage.

Signed-off-by: Jonas Schwöbel 
Signed-off-by: Svyatoslav Ryhel 
---
 arch/arm/dts/Makefile |1 +
 arch/arm/dts/tegra30-microsoft-surface-rt.dts | 1083 +
 arch/arm/mach-tegra/tegra30/Kconfig   |5 +
 board/microsoft/surface-rt/Kconfig|   12 +
 board/microsoft/surface-rt/MAINTAINERS|7 +
 board/microsoft/surface-rt/Makefile   |6 +
 board/microsoft/surface-rt/surface-rt-spl.c   |   41 +
 configs/surface-rt_defconfig  |   80 ++
 doc/board/index.rst   |1 +
 doc/board/microsoft/index.rst |9 +
 doc/board/microsoft/surface-rt.rst|   41 +
 include/configs/surface-rt.h  |   41 +
 12 files changed, 1327 insertions(+)
 create mode 100644 arch/arm/dts/tegra30-microsoft-surface-rt.dts
 create mode 100644 board/microsoft/surface-rt/Kconfig
 create mode 100644 board/microsoft/surface-rt/MAINTAINERS
 create mode 100644 board/microsoft/surface-rt/Makefile
 create mode 100644 board/microsoft/surface-rt/surface-rt-spl.c
 create mode 100644 configs/surface-rt_defconfig
 create mode 100644 doc/board/microsoft/index.rst
 create mode 100644 doc/board/microsoft/surface-rt.rst
 create mode 100644 include/configs/surface-rt.h

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 8ca10c307f..8041faa228 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -132,6 +132,7 @@ dtb-$(CONFIG_ARCH_TEGRA) += \
tegra30-htc-endeavoru.dtb \
tegra30-lg-p880.dtb \
tegra30-lg-p895.dtb \
+   tegra30-microsoft-surface-rt.dtb \
tegra30-tec-ng.dtb \
tegra30-wexler-qc750.dtb \
tegra114-dalmore.dtb \
diff --git a/arch/arm/dts/tegra30-microsoft-surface-rt.dts 
b/arch/arm/dts/tegra30-microsoft-surface-rt.dts
new file mode 100644
index 00..6810350a90
--- /dev/null
+++ b/arch/arm/dts/tegra30-microsoft-surface-rt.dts
@@ -0,0 +1,1083 @@
+// SPDX-License-Identifier: GPL-2.0
+/dts-v1/;
+
+#include 
+#include "tegra30.dtsi"
+
+/ {
+   model = "Microsoft Surface RT Tablet";
+   compatible = "microsoft,surface-rt", "nvidia,tegra30";
+
+   chosen {
+   stdout-path = &uarta;
+   };
+
+   aliases {
+   i2c0 = &pwr_i2c;
+
+   mmc0 = &sdmmc4; /* eMMC */
+   mmc1 = &sdmmc1; /* uSD slot */
+
+   rtc0 = &pmic;
+   rtc1 = "/rtc@7000e000";
+
+   spi0 = &spi4;
+
+   usb0 = &usb1;
+   };
+
+   memory {
+   device_type = "memory";
+   reg = <0x8000 0x8000>;
+   };
+
+   host1x@5000 {
+   dc@5420 {
+   rgb {
+   status = "okay";
+
+   nvidia,panel = <&panel>;
+   };
+   };
+   };
+
+   gpio@6000d000 {
+   /* in case usb vbus is on for some reason */
+   usb-vbus-hog {
+   gpio-hog;
+   gpios = ;
+   output-low;
+   };
+   };
+
+   pinmux@7868 {
+   pinctrl-names = "default";
+   pinctrl-0 = <&state_default>;
+
+   state_default: pinmux {
+   /* SDMMC1 pinmux */
+   sdmmc1-clk {
+   nvidia,pins = "sdmmc1_clk_pz0";
+   nvidia,function = "sdmmc1";
+   nvidia,pull = ;
+   nvidia,tristate = ;
+   nvidia,enable-input = ;
+   };
+   sdmmc1-cmd {
+   nvidia,pins = "sdmmc1_dat3_py4",
+   "sdmmc1_dat2_py5",
+   "sdmmc1_dat1_py6",
+   "sdmmc1_dat0_py7",
+   "sdmmc1_cmd_pz1";
+   nvidia,function = "sdmmc1";
+   nvidia,pull = ;
+   nvidia,tristate = ;
+   nvidia,enable-input = ;
+   };
+
+   /* SDMMC3 pinmux */
+   sdmmc3-clk {
+

[PATCH v1 2/4] board: wexler: qc750: add WEXLER Tab 7t support

2024-06-15 Thread Svyatoslav Ryhel
WEXLER Tab 7t is a mini tablet computer developed by WEXLER that
runs the Android operating system. The device features a 7.0-inch
(180 mm) HD display, an Nvidia Tegra 3 quad-core chip, 1 GB of RAM,
8, 16 or 32 GB of storage that can be supplemented with a microSDXC
card giving up to 64 GB of additional storage and a full size USB
port.

Tested-by: Maksim Kurnosenko 
Signed-off-by: Svyatoslav Ryhel 
---
 arch/arm/dts/Makefile |1 +
 arch/arm/dts/tegra30-wexler-qc750.dts | 1106 +
 arch/arm/mach-tegra/tegra30/Kconfig   |5 +
 board/wexler/qc750/Kconfig|   12 +
 board/wexler/qc750/MAINTAINERS|7 +
 board/wexler/qc750/Makefile   |   11 +
 board/wexler/qc750/qc750-spl.c|   45 +
 board/wexler/qc750/qc750.c|   21 +
 configs/qc750_defconfig   |   81 ++
 doc/board/index.rst   |1 +
 doc/board/wexler/index.rst|9 +
 doc/board/wexler/qc750.rst|  125 +++
 include/configs/qc750.h   |   67 ++
 13 files changed, 1491 insertions(+)
 create mode 100644 arch/arm/dts/tegra30-wexler-qc750.dts
 create mode 100644 board/wexler/qc750/Kconfig
 create mode 100644 board/wexler/qc750/MAINTAINERS
 create mode 100644 board/wexler/qc750/Makefile
 create mode 100644 board/wexler/qc750/qc750-spl.c
 create mode 100644 board/wexler/qc750/qc750.c
 create mode 100644 configs/qc750_defconfig
 create mode 100644 doc/board/wexler/index.rst
 create mode 100644 doc/board/wexler/qc750.rst
 create mode 100644 include/configs/qc750.h

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 3a66c6d012..8ca10c307f 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -133,6 +133,7 @@ dtb-$(CONFIG_ARCH_TEGRA) += \
tegra30-lg-p880.dtb \
tegra30-lg-p895.dtb \
tegra30-tec-ng.dtb \
+   tegra30-wexler-qc750.dtb \
tegra114-dalmore.dtb \
tegra124-apalis.dtb \
tegra124-jetson-tk1.dtb \
diff --git a/arch/arm/dts/tegra30-wexler-qc750.dts 
b/arch/arm/dts/tegra30-wexler-qc750.dts
new file mode 100644
index 00..87c2a4072e
--- /dev/null
+++ b/arch/arm/dts/tegra30-wexler-qc750.dts
@@ -0,0 +1,1106 @@
+// SPDX-License-Identifier: GPL-2.0
+/dts-v1/;
+
+/* CPU Speedo ID 7, Soc Speedo ID 1, CPU Process: 4, Core Process: 0 */
+
+#include 
+#include 
+
+#include "tegra30.dtsi"
+
+/ {
+   model = "Wexler Tab 7t";
+   compatible = "wexler,qc750", "nvidia,tegra30";
+
+   chosen {
+   stdout-path = &uartd;
+   };
+
+   aliases {
+   i2c0 = &pwr_i2c;
+
+   mmc0 = &sdmmc4; /* eMMC */
+   mmc1 = &sdmmc1; /* uSD slot */
+
+   rtc0 = &pmic;
+   rtc1 = "/rtc@7000e000";
+
+   usb0 = µ_usb;
+   usb1 = &usb3; /* Full size USB */
+   };
+
+   memory {
+   device_type = "memory";
+   reg = <0x8000 0x4000>;
+   };
+
+   host1x@5000 {
+   dc@5420 {
+   rgb {
+   status = "okay";
+
+   nvidia,panel = <&panel>;
+   };
+   };
+   };
+
+   pinmux@7868 {
+   pinctrl-names = "default";
+   pinctrl-0 = <&state_default>;
+
+   state_default: pinmux {
+   /* SDMMC1 pinmux */
+   sdmmc1-clk {
+   nvidia,pins = "sdmmc1_clk_pz0";
+   nvidia,function = "sdmmc1";
+   nvidia,pull = ;
+   nvidia,tristate = ;
+   nvidia,enable-input = ;
+   };
+   sdmmc1-cmd {
+   nvidia,pins = "sdmmc1_dat3_py4",
+   "sdmmc1_dat2_py5",
+   "sdmmc1_dat1_py6",
+   "sdmmc1_dat0_py7",
+   "sdmmc1_cmd_pz1";
+   nvidia,function = "sdmmc1";
+   nvidia,pull = ;
+   nvidia,tristate = ;
+   nvidia,enable-input = ;
+   };
+   sdmmc1-cd {
+   nvidia,pins = "gmi_iordy_pi5";
+   nvidia,function = "rsvd1";
+   nvidia,pull = ;
+   nvidia,tristate = ;
+   nvidia,enable-input = ;
+   };
+
+ 

[PATCH v1 1/4] board: asus: transformer: add ASUS Transformer T20 family support

2024-06-15 Thread Svyatoslav Ryhel
The Asus Eee Pad Transformer family are 2-in-1 detachable/slider
tablets developed by Asus that run the Android operating system.
The Eee Pad Transformers feature a 10.1-inch (260 mm) display,
an Nvidia Tegra 2 dual-core chip, 1 GB of RAM, and 16/32 GB of storage.
Transformers board derives from Nvidia Ventana development board.

This patch brings support for all 3 known T20 Transformers:
- Asus Eee Pad Transformer TF101
- Asus Eee Pad Transformer TF101G
- Asus Eee Pad Slider SL101

Tested-by: Robert Eckelmann  # ASUS TF101
Tested-by: Antoni Aloy Torrens  # ASUS TF101
Signed-off-by: Svyatoslav Ryhel 
---
 arch/arm/dts/Makefile |   6 +-
 arch/arm/dts/tegra20-asus-sl101.dts   |   9 +
 arch/arm/dts/tegra20-asus-tf101.dts   |   9 +
 arch/arm/dts/tegra20-asus-tf101g.dts  |   9 +
 arch/arm/dts/tegra20-asus-transformer.dtsi| 545 ++
 arch/arm/mach-tegra/tegra20/Kconfig   |   5 +
 board/asus/transformer-t20/Kconfig|  12 +
 board/asus/transformer-t20/MAINTAINERS|   8 +
 board/asus/transformer-t20/Makefile   |   9 +
 .../asus/transformer-t20/configs/sl101.config |   1 +
 .../asus/transformer-t20/configs/tf101.config |   1 +
 .../transformer-t20/configs/tf101g.config |   1 +
 board/asus/transformer-t20/transformer-t20.c  |  57 ++
 configs/transformer_t20_defconfig |  82 +++
 doc/board/asus/index.rst  |   1 +
 doc/board/asus/transformer_t20.rst| 129 +
 include/configs/transformer-t20.h |  23 +
 17 files changed, 906 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/tegra20-asus-sl101.dts
 create mode 100644 arch/arm/dts/tegra20-asus-tf101.dts
 create mode 100644 arch/arm/dts/tegra20-asus-tf101g.dts
 create mode 100644 arch/arm/dts/tegra20-asus-transformer.dtsi
 create mode 100644 board/asus/transformer-t20/Kconfig
 create mode 100644 board/asus/transformer-t20/MAINTAINERS
 create mode 100644 board/asus/transformer-t20/Makefile
 create mode 100644 board/asus/transformer-t20/configs/sl101.config
 create mode 100644 board/asus/transformer-t20/configs/tf101.config
 create mode 100644 board/asus/transformer-t20/configs/tf101g.config
 create mode 100644 board/asus/transformer-t20/transformer-t20.c
 create mode 100644 configs/transformer_t20_defconfig
 create mode 100644 doc/board/asus/transformer_t20.rst
 create mode 100644 include/configs/transformer-t20.h

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 8fb6a8a1f1..3a66c6d012 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -102,7 +102,11 @@ dtb-$(CONFIG_ARCH_S5P4418) += \
 dtb-$(CONFIG_ARCH_MESON) += \
meson-a1-ad401.dtb
 
-dtb-$(CONFIG_ARCH_TEGRA) += tegra20-harmony.dtb \
+dtb-$(CONFIG_ARCH_TEGRA) += \
+   tegra20-asus-sl101.dtb \
+   tegra20-asus-tf101.dtb \
+   tegra20-asus-tf101g.dtb \
+   tegra20-harmony.dtb \
tegra20-medcom-wide.dtb \
tegra20-paz00.dtb \
tegra20-plutux.dtb \
diff --git a/arch/arm/dts/tegra20-asus-sl101.dts 
b/arch/arm/dts/tegra20-asus-sl101.dts
new file mode 100644
index 00..b4709c3e9a
--- /dev/null
+++ b/arch/arm/dts/tegra20-asus-sl101.dts
@@ -0,0 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0
+/dts-v1/;
+
+#include "tegra20-asus-transformer.dtsi"
+
+/ {
+   model = "ASUS EeePad Slider SL101";
+   compatible = "asus,sl101", "nvidia,tegra20";
+};
diff --git a/arch/arm/dts/tegra20-asus-tf101.dts 
b/arch/arm/dts/tegra20-asus-tf101.dts
new file mode 100644
index 00..7c734fb5b1
--- /dev/null
+++ b/arch/arm/dts/tegra20-asus-tf101.dts
@@ -0,0 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0
+/dts-v1/;
+
+#include "tegra20-asus-transformer.dtsi"
+
+/ {
+   model = "ASUS EeePad Transformer TF101";
+   compatible = "asus,tf101", "nvidia,tegra20";
+};
diff --git a/arch/arm/dts/tegra20-asus-tf101g.dts 
b/arch/arm/dts/tegra20-asus-tf101g.dts
new file mode 100644
index 00..f49a358a26
--- /dev/null
+++ b/arch/arm/dts/tegra20-asus-tf101g.dts
@@ -0,0 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0
+/dts-v1/;
+
+#include "tegra20-asus-transformer.dtsi"
+
+/ {
+   model = "ASUS EeePad Transformer TF101G";
+   compatible = "asus,tf101g", "nvidia,tegra20";
+};
diff --git a/arch/arm/dts/tegra20-asus-transformer.dtsi 
b/arch/arm/dts/tegra20-asus-transformer.dtsi
new file mode 100644
index 00..49efabbfd9
--- /dev/null
+++ b/arch/arm/dts/tegra20-asus-transformer.dtsi
@@ -0,0 +1,545 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include 
+#include "tegra20.dtsi"
+
+/ {
+   chosen {
+   stdout-path = &uartd;
+   };
+
+   aliases {
+   i2c0 = &pwr_i2c;
+
+   mmc0 = &sdmmc4; /* eMMC */
+   mmc1 = &sdmmc3; /* MicroSD */
+
+   rtc0 = &

[PATCH v1 0/4] Initial support for new Tegra 2/3 devices

2024-06-15 Thread Svyatoslav Ryhel
Patchset includes initial support bringup for 4 new Tegra 2 and
Tegra 3 devices which include Asus Transformers with Tegra 2,
Microfost Surface RT, Lenovo Ideapad Yoga 11 and Wexler Tab 7t.
All setups are tested on real hardware and pass buildman.

Jonas Schwöbel (2):
  board: microsoft: surface-rt: add Microsoft Surface RT support
  board: lenovo: ideapad-yoga-11: Lenovo Ideapad Yoga 11

Svyatoslav Ryhel (2):
  board: asus: transformer: add ASUS Transformer T20 family support
  board: wexler: qc750: add WEXLER Tab 7t support

 arch/arm/dts/Makefile |9 +-
 arch/arm/dts/tegra20-asus-sl101.dts   |9 +
 arch/arm/dts/tegra20-asus-tf101.dts   |9 +
 arch/arm/dts/tegra20-asus-tf101g.dts  |9 +
 arch/arm/dts/tegra20-asus-transformer.dtsi|  545 +++
 .../dts/tegra30-lenovo-ideapad-yoga-11.dts| 1266 +
 arch/arm/dts/tegra30-microsoft-surface-rt.dts | 1083 ++
 arch/arm/dts/tegra30-wexler-qc750.dts | 1106 ++
 arch/arm/mach-tegra/tegra20/Kconfig   |5 +
 arch/arm/mach-tegra/tegra30/Kconfig   |   15 +
 board/asus/transformer-t20/Kconfig|   12 +
 board/asus/transformer-t20/MAINTAINERS|8 +
 board/asus/transformer-t20/Makefile   |9 +
 .../asus/transformer-t20/configs/sl101.config |1 +
 .../asus/transformer-t20/configs/tf101.config |1 +
 .../transformer-t20/configs/tf101g.config |1 +
 board/asus/transformer-t20/transformer-t20.c  |   57 +
 board/lenovo/ideapad-yoga-11/Kconfig  |   12 +
 board/lenovo/ideapad-yoga-11/MAINTAINERS  |7 +
 board/lenovo/ideapad-yoga-11/Makefile |6 +
 .../ideapad-yoga-11/ideapad-yoga-11-spl.c |   41 +
 board/microsoft/surface-rt/Kconfig|   12 +
 board/microsoft/surface-rt/MAINTAINERS|7 +
 board/microsoft/surface-rt/Makefile   |6 +
 board/microsoft/surface-rt/surface-rt-spl.c   |   41 +
 board/wexler/qc750/Kconfig|   12 +
 board/wexler/qc750/MAINTAINERS|7 +
 board/wexler/qc750/Makefile   |   11 +
 board/wexler/qc750/qc750-spl.c|   45 +
 board/wexler/qc750/qc750.c|   21 +
 configs/ideapad-yoga-11_defconfig |   84 ++
 configs/qc750_defconfig   |   81 ++
 configs/surface-rt_defconfig  |   80 ++
 configs/transformer_t20_defconfig |   82 ++
 doc/board/asus/index.rst  |1 +
 doc/board/asus/transformer_t20.rst|  129 ++
 doc/board/index.rst   |3 +
 doc/board/lenovo/ideapad-yoga-11.rst  |   41 +
 doc/board/lenovo/index.rst|9 +
 doc/board/microsoft/index.rst |9 +
 doc/board/microsoft/surface-rt.rst|   41 +
 doc/board/wexler/index.rst|9 +
 doc/board/wexler/qc750.rst|  125 ++
 include/configs/ideapad-yoga-11.h |   79 +
 include/configs/qc750.h   |   67 +
 include/configs/surface-rt.h  |   41 +
 include/configs/transformer-t20.h |   23 +
 47 files changed, 5276 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/tegra20-asus-sl101.dts
 create mode 100644 arch/arm/dts/tegra20-asus-tf101.dts
 create mode 100644 arch/arm/dts/tegra20-asus-tf101g.dts
 create mode 100644 arch/arm/dts/tegra20-asus-transformer.dtsi
 create mode 100644 arch/arm/dts/tegra30-lenovo-ideapad-yoga-11.dts
 create mode 100644 arch/arm/dts/tegra30-microsoft-surface-rt.dts
 create mode 100644 arch/arm/dts/tegra30-wexler-qc750.dts
 create mode 100644 board/asus/transformer-t20/Kconfig
 create mode 100644 board/asus/transformer-t20/MAINTAINERS
 create mode 100644 board/asus/transformer-t20/Makefile
 create mode 100644 board/asus/transformer-t20/configs/sl101.config
 create mode 100644 board/asus/transformer-t20/configs/tf101.config
 create mode 100644 board/asus/transformer-t20/configs/tf101g.config
 create mode 100644 board/asus/transformer-t20/transformer-t20.c
 create mode 100644 board/lenovo/ideapad-yoga-11/Kconfig
 create mode 100644 board/lenovo/ideapad-yoga-11/MAINTAINERS
 create mode 100644 board/lenovo/ideapad-yoga-11/Makefile
 create mode 100644 board/lenovo/ideapad-yoga-11/ideapad-yoga-11-spl.c
 create mode 100644 board/microsoft/surface-rt/Kconfig
 create mode 100644 board/microsoft/surface-rt/MAINTAINERS
 create mode 100644 board/microsoft/surface-rt/Makefile
 create mode 100644 board/microsoft/surface-rt/surface-rt-spl.c
 create mode 100644 board/wexler/qc750/Kconfig
 create mode 100644 board/wexler/qc750/MAINTAINERS
 create mode 100644 board/wexler/qc750/Makefile
 create mode 100644 board/wexler/qc750/qc750-spl.c
 create mode 100644 board/wexler/qc750/qc750.c
 create mode 100644 configs/ideapad-yoga-11_defconfig
 create mode 100644 configs/qc750_defconfig
 create mode 100644 configs/surface

Please pull u-boot-tegra staging

2024-04-22 Thread Svyatoslav Ryhel
Dear Tom,

The following changes since commit 1dd659fd626204bb6a6b4f330c27b11a7823bbb0:

  Merge tag 'video-20240421' of 
https://source.denx.de/u-boot/custodians/u-boot-video (2024-04-21 08:54:20 
-0600)

are available in the Git repository at:

  https://source.denx.de/u-boot/custodians/u-boot-tegra.git staging

for you to fetch changes up to 6898cc823413ff01661e7db74ad764da58b682d9:

  board: tegra30: switch to button cmd (2024-04-22 12:17:21 +0300)


Jonas Schwöbel (2):
  board: asus: lg_x3: endeavoru: remove CONFIG_SYS_L2CACHE_OFF
  ARM: tegra: Enable UART-E for T20 and T30

Svyatoslav Ryhel (12):
  ARM: dts: paz00: remove display-timings node
  ARM: tegra: move to standard boot
  board: tegra30: switch to standard boot
  board: asus: tf600t: configure SPI pinmux
  board: asus: tf600t: adjust LV pinmux
  board: asus: transformer-t30: set the correct pinmux lock and io-reset
  board: asus: tf600t: enable TEGRA20_SLINK only for TF600T
  board: asus: transformer-t30: enable I2C_MUX only for TF700T
  board: asus: tf700t: bind tc358768 bridge and panel
  ARM: tegra: grouper: bind Hall sensor
  ARM: tegra: transformer-t30: bind Hall sensor
  board: tegra30: switch to button cmd

 arch/arm/Kconfig  |   2 +-
 arch/arm/dts/tegra20-paz00.dts|  16 
 arch/arm/dts/tegra30-asus-grouper-common.dtsi |   6 ++
 arch/arm/dts/tegra30-asus-p1801-t.dts |  28 +++---
 arch/arm/dts/tegra30-asus-tf600t.dts  | 101 +++--
 arch/arm/dts/tegra30-asus-tf700t.dts  | 102 +-
 arch/arm/dts/tegra30-asus-transformer.dtsi|  36 +---
 arch/arm/mach-tegra/Kconfig   |   4 +
 board/asus/transformer-t30/configs/p1801-t.config |   1 +
 board/asus/transformer-t30/configs/tf201.config   |   1 +
 board/asus/transformer-t30/configs/tf300t.config  |   1 +
 board/asus/transformer-t30/configs/tf300tg.config |   1 +
 board/asus/transformer-t30/configs/tf300tl.config |   1 +
 board/asus/transformer-t30/configs/tf600t.config  |   2 +
 board/asus/transformer-t30/configs/tf700t.config  |   2 +
 configs/endeavoru_defconfig   |   4 +-
 configs/grouper_common_defconfig  |   4 +-
 configs/paz00_defconfig   |   1 +
 configs/transformer_t30_defconfig |   5 +-
 configs/x3_t30_defconfig  |   4 +-
 include/configs/endeavoru.h   |   3 +-
 include/configs/grouper.h |   5 +-
 include/configs/tegra-common-post.h   |  30 +--
 include/configs/transformer-common.h  |  12 +--
 include/configs/x3-t30.h  |   3 +-
 25 files changed, 255 insertions(+), 120 deletions(-)

Branch contains minor internal improvemets for endeavoru, lg_x3, grouper,
transformers and paz00 as well as migration to standard boot.

All commits passed U-Boot checks and buildman for tegra.

Thanks,
Svyatoslav Ryhel.


Re: [PATCH v6 01/18] video: tegra20: dc: diverge DC per-SOC

2024-04-19 Thread Svyatoslav Ryhel
пт, 19 квіт. 2024 р. о 19:26 Thierry Reding  пише:
>
> On Tue Jan 23, 2024 at 6:16 PM CET, Svyatoslav Ryhel wrote:
> [...]
> > diff --git a/arch/arm/include/asm/arch-tegra114/display.h 
> > b/arch/arm/include/asm/arch-tegra114/display.h
> > new file mode 100644
> > index 00..9411525799
> > --- /dev/null
> > +++ b/arch/arm/include/asm/arch-tegra114/display.h
> > @@ -0,0 +1,28 @@
> > +/* SPDX-License-Identifier: GPL-2.0+ */
> > +/*
> > + *  (C) Copyright 2010
> > + *  NVIDIA Corporation 
> > + */
> > +
> > +#ifndef __ASM_ARCH_TEGRA_DISPLAY_H
> > +#define __ASM_ARCH_TEGRA_DISPLAY_H
> > +
> > +#include 
> > +
> > +/* This holds information about a window which can be displayed */
> > +struct disp_ctl_win {
> > + enum win_color_depth_id fmt;/* Color depth/format */
> > + unsigned intbpp;/* Bits per pixel */
> > + phys_addr_t phys_addr;  /* Physical address in memory */
> > + unsigned intx;  /* Horizontal address offset (bytes) 
> > */
> > + unsigned inty;  /* Veritical address offset (bytes) */
> > + unsigned intw;  /* Width of source window */
> > + unsigned inth;  /* Height of source window */
> > + unsigned intstride; /* Number of bytes per line */
> > + unsigned intout_x;  /* Left edge of output window (col) */
> > + unsigned intout_y;  /* Top edge of output window (row) */
> > + unsigned intout_w;  /* Width of output window in pixels */
> > + unsigned intout_h;  /* Height of output window in pixels 
> > */
> > +};
> > +
> > +#endif /*__ASM_ARCH_TEGRA_DISPLAY_H*/
>
> One of the earlier patches in the series gets rid of this per-SoC header
> file in favor of a common one. Did this end up here by mistake? It
> doesn't seem to be used.
>
> > diff --git a/drivers/video/tegra20/tegra-dc.c 
> > b/drivers/video/tegra20/tegra-dc.c
> > index f53ad46397..7605e77bc1 100644
> > --- a/drivers/video/tegra20/tegra-dc.c
> > +++ b/drivers/video/tegra20/tegra-dc.c
> > @@ -3,7 +3,6 @@
> >   * Copyright (c) 2011 The Chromium OS Authors.
> >   */
> >
> > -#include 
> >  #include 
> >  #include 
> >  #include 
> > @@ -23,10 +22,15 @@
> >  #include 
> >  #include 
> >  #include 
> > -#include 
> >
> >  DECLARE_GLOBAL_DATA_PTR;
> >
> > +/* Holder of Tegra per-SOC DC differences */
> > +struct tegra_dc_soc_info {
> > + bool has_timer;
> > + bool has_rgb;
> > +};
> > +
> >  /* Information about the display controller */
> >  struct tegra_lcd_priv {
> >   int width;  /* width in pixels */
> > @@ -35,6 +39,7 @@ struct tegra_lcd_priv {
> >   struct display_timing timing;
> >   struct udevice *panel;
> >   struct dc_ctlr *dc; /* Display controller regmap */
> > + const struct tegra_dc_soc_info *soc;
> >   fdt_addr_t frame_buffer;/* Address of frame buffer */
> >   unsigned pixel_clock;   /* Pixel clock in Hz */
> >   int dc_clk[2];  /* Contains clk and its parent */
> > @@ -43,8 +48,8 @@ struct tegra_lcd_priv {
> >
> >  enum {
> >   /* Maximum LCD size we support */
> > - LCD_MAX_WIDTH   = 1920,
> > - LCD_MAX_HEIGHT  = 1200,
> > + LCD_MAX_WIDTH   = 2560,
> > + LCD_MAX_HEIGHT  = 1600,
> >   LCD_MAX_LOG2_BPP= VIDEO_BPP16,
> >  };
> >
> > @@ -110,9 +115,9 @@ static void update_window(struct tegra_lcd_priv *priv,
> >   writel(val, &dc->cmd.state_ctrl);
> >  }
> >
> > -static int update_display_mode(struct dc_disp_reg *disp,
> > -struct tegra_lcd_priv *priv)
> > +static int update_display_mode(struct tegra_lcd_priv *priv)
> >  {
> > + struct dc_disp_reg *disp = &priv->dc->disp;
> >   struct display_timing *dt = &priv->timing;
> >   unsigned long val;
> >   unsigned long rate;
> > @@ -128,14 +133,16 @@ static int update_display_mode(struct dc_disp_reg 
> > *disp,
> >  &disp->front_porch);
> >   writel(dt->hactive.typ | (dt->vactive.typ << 16), &disp->disp_active);
> >
> > - val = DE_SELECT_ACTIVE << DE_SELECT_SHIFT;
> > - val |= DE_CONTROL_NORMAL << DE_CONTROL_SHIFT;
> >

Re: [PATCH v6 04/18] video: tegra20: dc: pass DC id to internal devices

2024-04-19 Thread Svyatoslav Ryhel
пт, 19 квіт. 2024 р. о 19:58 Thierry Reding  пише:
>
> On Fri Apr 19, 2024 at 6:44 PM CEST, Svyatoslav Ryhel wrote:
> > пт, 19 квіт. 2024 р. о 19:38 Thierry Reding  пише:
> > >
> > > On Tue Jan 23, 2024 at 6:16 PM CET, Svyatoslav Ryhel wrote:
> > > > Tegra SoC has 2 independent display controllers called DC_A and
> > > > DC_B, they are handled differently by internal video devices like
> > > > DSI and HDMI controllers so it is important for last to know
> > > > which display controller is used to properly set up registers.
> > > > To achieve this, a pipe field was added to pdata to pass display
> > > > controller id to internal Tegra SoC devices.
> > > >
> > > > Tested-by: Agneli  # Toshiba AC100 T20
> > > > Tested-by: Robert Eckelmann  # ASUS TF101
> > > > Tested-by: Andreas Westman Dorcsak  # ASUS Grouper 
> > > > E1565
> > > > Tested-by: Ion Agorria  # HTC One X
> > > > Tested-by: Svyatoslav Ryhel  # Nvidia Tegratab T114
> > > > Signed-off-by: Svyatoslav Ryhel 
> > > > ---
> > > >  drivers/video/tegra20/tegra-dc.c | 6 ++
> > > >  drivers/video/tegra20/tegra-dc.h | 3 +++
> > > >  2 files changed, 9 insertions(+)
> > > >
> > > > diff --git a/drivers/video/tegra20/tegra-dc.c 
> > > > b/drivers/video/tegra20/tegra-dc.c
> > > > index 5d8874f323..0e94e665ef 100644
> > > > --- a/drivers/video/tegra20/tegra-dc.c
> > > > +++ b/drivers/video/tegra20/tegra-dc.c
> > > > @@ -45,6 +45,7 @@ struct tegra_lcd_priv {
> > > >   unsigned pixel_clock;   /* Pixel clock in Hz */
> > > >   int dc_clk[2];  /* Contains clk and its parent */
> > > >   bool rotation;  /* 180 degree panel turn */
> > > > + bool pipe;  /* DC controller: 0 for A, 1 for 
> > > > B */
> > >
> > > Bool is a poor choice, even if there's only two of them. This is a
> > > proper index, so it should be some sort of integer.
> > >
> > > Also, the device tree bindings for the display controller specify a
> > > "nvidia,head" property that can be used to identify these. If you add
> > > that to the U-Boot DT you can avoid looking up by name to map this
> > > value.
> > >
> >
> > Thanks for pointing to this property. May we apply this patch set as is
> > since it is well tested and confirmed to work and I will prepare a follow
> > up patches to adjust device tree relations? Would what be ok?
>
> Well, there's a few other things that I think should be addressed, but
> if you'd like to keep this one patch as-is and clean this up later, I
> guess that's fine.

May you send me a list of stuff which you think may be improved?
I would gladly adjust whatever I can in follow up.

> Thierry


Re: [PATCH v6 06/18] video: tegra20: dc: add reset support

2024-04-19 Thread Svyatoslav Ryhel
пт, 19 квіт. 2024 р. о 19:46 Thierry Reding  пише:
>
> On Fri Apr 19, 2024 at 6:37 PM CEST, Svyatoslav Ryhel wrote:
> > пт, 19 квіт. 2024 р. о 19:05 Thierry Reding  пише:
> > >
> > > On Tue Jan 23, 2024 at 6:16 PM CET, Svyatoslav Ryhel wrote:
> > > > Implement reset use to discard any changes which could have been
> > > > applied to DC before and can interfere with current configuration.
> > > >
> > > > Tested-by: Agneli  # Toshiba AC100 T20
> > > > Tested-by: Robert Eckelmann  # ASUS TF101
> > > > Tested-by: Andreas Westman Dorcsak  # ASUS Grouper 
> > > > E1565
> > > > Tested-by: Ion Agorria  # HTC One X
> > > > Tested-by: Svyatoslav Ryhel  # Nvidia Tegratab T114
> > > > Signed-off-by: Svyatoslav Ryhel 
> > > > ---
> > > >  drivers/video/tegra20/tegra-dc.c | 17 +
> > > >  1 file changed, 17 insertions(+)
> > > >
> > > > diff --git a/drivers/video/tegra20/tegra-dc.c 
> > > > b/drivers/video/tegra20/tegra-dc.c
> > > > index 56a23b3c97..35abb6fe46 100644
> > > > --- a/drivers/video/tegra20/tegra-dc.c
> > > > +++ b/drivers/video/tegra20/tegra-dc.c
> > > > @@ -10,7 +10,9 @@
> > > >  #include 
> > > >  #include 
> > > >  #include 
> > > > +#include 
> > > >  #include 
> > > > +#include 
> > > >  #include 
> > > >  #include 
> > > >  #include 
> > > > @@ -342,6 +344,7 @@ static int tegra_lcd_probe(struct udevice *dev)
> > > >   struct video_uc_plat *plat = dev_get_uclass_plat(dev);
> > > >   struct video_priv *uc_priv = dev_get_uclass_priv(dev);
> > > >   struct tegra_lcd_priv *priv = dev_get_priv(dev);
> > > > + struct reset_ctl reset_ctl;
> > > >   int ret;
> > > >
> > > >   /* Initialize the Tegra display controller */
> > > > @@ -349,6 +352,20 @@ static int tegra_lcd_probe(struct udevice *dev)
> > > >   funcmux_select(PERIPH_ID_DISP1, FUNCMUX_DEFAULT);
> > > >  #endif
> > > >
> > > > + ret = reset_get_by_name(dev, "dc", &reset_ctl);
> > > > + if (ret) {
> > > > + log_err("reset_get_by_name() failed: %d\n", ret);
> > > > + return ret;
> > > > + }
> > > > +
> > > > + clock_disable(priv->dc_clk[0]);
> > > > +
> > > > + /* Reset everything set before */
> > > > + reset_assert(&reset_ctl);
> > > > + mdelay(4);
> > > > + reset_deassert(&reset_ctl);
> > > > + mdelay(4);
> > >
> > > Are you sure this works as intended? It's been a long time since I
> > > worked on this, but I seem to recall that most of these resets are
> > > actually synchronous, so in order for them to do what they're supposed
> > > to the clock needs to be kept running.
> > >
> > > The Linux driver certainly does this differently.
> >
> > You have point, but I have tried to mostly adapt Linux tegra dc driver,
> > which has same logic in probe. Maybe I have not understood it properly.
> > Testing on T20, T30 and T114 passed without issues so far.
>
> Maybe look again. What it does is (basically):
>
> clock_enable();
> mdelay(4);
> reset_assert();
> mdelay(4);
> clock_disable();
>
> That should ensure that it's completely reset at that point. Now before
> any subsequent register accesses happen it will do this:
>
> clock_enable();
> reset_deassert();
>
> to take it out of reset again. Perhaps that's something you want to keep
> doing in probe() in U-Boot. In that case maybe you want something like
> this instead:
>
> clock_enable();
> mdelay(4);
> reset_assert();
> mdelay(4);
> reset_deassert();
>

You are correct. I assume This patch may be dropped entirely. Thanks.

> Thierry


Re: [PATCH v6 04/18] video: tegra20: dc: pass DC id to internal devices

2024-04-19 Thread Svyatoslav Ryhel
пт, 19 квіт. 2024 р. о 19:38 Thierry Reding  пише:
>
> On Tue Jan 23, 2024 at 6:16 PM CET, Svyatoslav Ryhel wrote:
> > Tegra SoC has 2 independent display controllers called DC_A and
> > DC_B, they are handled differently by internal video devices like
> > DSI and HDMI controllers so it is important for last to know
> > which display controller is used to properly set up registers.
> > To achieve this, a pipe field was added to pdata to pass display
> > controller id to internal Tegra SoC devices.
> >
> > Tested-by: Agneli  # Toshiba AC100 T20
> > Tested-by: Robert Eckelmann  # ASUS TF101
> > Tested-by: Andreas Westman Dorcsak  # ASUS Grouper E1565
> > Tested-by: Ion Agorria  # HTC One X
> > Tested-by: Svyatoslav Ryhel  # Nvidia Tegratab T114
> > Signed-off-by: Svyatoslav Ryhel 
> > ---
> >  drivers/video/tegra20/tegra-dc.c | 6 ++
> >  drivers/video/tegra20/tegra-dc.h | 3 +++
> >  2 files changed, 9 insertions(+)
> >
> > diff --git a/drivers/video/tegra20/tegra-dc.c 
> > b/drivers/video/tegra20/tegra-dc.c
> > index 5d8874f323..0e94e665ef 100644
> > --- a/drivers/video/tegra20/tegra-dc.c
> > +++ b/drivers/video/tegra20/tegra-dc.c
> > @@ -45,6 +45,7 @@ struct tegra_lcd_priv {
> >   unsigned pixel_clock;   /* Pixel clock in Hz */
> >   int dc_clk[2];  /* Contains clk and its parent */
> >   bool rotation;  /* 180 degree panel turn */
> > + bool pipe;  /* DC controller: 0 for A, 1 for B */
>
> Bool is a poor choice, even if there's only two of them. This is a
> proper index, so it should be some sort of integer.
>
> Also, the device tree bindings for the display controller specify a
> "nvidia,head" property that can be used to identify these. If you add
> that to the U-Boot DT you can avoid looking up by name to map this
> value.
>

Thanks for pointing to this property. May we apply this patch set as is
since it is well tested and confirmed to work and I will prepare a follow
up patches to adjust device tree relations? Would what be ok?

> Thierry


Re: [PATCH v6 06/18] video: tegra20: dc: add reset support

2024-04-19 Thread Svyatoslav Ryhel
пт, 19 квіт. 2024 р. о 19:05 Thierry Reding  пише:
>
> On Tue Jan 23, 2024 at 6:16 PM CET, Svyatoslav Ryhel wrote:
> > Implement reset use to discard any changes which could have been
> > applied to DC before and can interfere with current configuration.
> >
> > Tested-by: Agneli  # Toshiba AC100 T20
> > Tested-by: Robert Eckelmann  # ASUS TF101
> > Tested-by: Andreas Westman Dorcsak  # ASUS Grouper E1565
> > Tested-by: Ion Agorria  # HTC One X
> > Tested-by: Svyatoslav Ryhel  # Nvidia Tegratab T114
> > Signed-off-by: Svyatoslav Ryhel 
> > ---
> >  drivers/video/tegra20/tegra-dc.c | 17 +
> >  1 file changed, 17 insertions(+)
> >
> > diff --git a/drivers/video/tegra20/tegra-dc.c 
> > b/drivers/video/tegra20/tegra-dc.c
> > index 56a23b3c97..35abb6fe46 100644
> > --- a/drivers/video/tegra20/tegra-dc.c
> > +++ b/drivers/video/tegra20/tegra-dc.c
> > @@ -10,7 +10,9 @@
> >  #include 
> >  #include 
> >  #include 
> > +#include 
> >  #include 
> > +#include 
> >  #include 
> >  #include 
> >  #include 
> > @@ -342,6 +344,7 @@ static int tegra_lcd_probe(struct udevice *dev)
> >   struct video_uc_plat *plat = dev_get_uclass_plat(dev);
> >   struct video_priv *uc_priv = dev_get_uclass_priv(dev);
> >   struct tegra_lcd_priv *priv = dev_get_priv(dev);
> > + struct reset_ctl reset_ctl;
> >   int ret;
> >
> >   /* Initialize the Tegra display controller */
> > @@ -349,6 +352,20 @@ static int tegra_lcd_probe(struct udevice *dev)
> >   funcmux_select(PERIPH_ID_DISP1, FUNCMUX_DEFAULT);
> >  #endif
> >
> > + ret = reset_get_by_name(dev, "dc", &reset_ctl);
> > + if (ret) {
> > + log_err("reset_get_by_name() failed: %d\n", ret);
> > + return ret;
> > + }
> > +
> > + clock_disable(priv->dc_clk[0]);
> > +
> > + /* Reset everything set before */
> > + reset_assert(&reset_ctl);
> > + mdelay(4);
> > + reset_deassert(&reset_ctl);
> > + mdelay(4);
>
> Are you sure this works as intended? It's been a long time since I
> worked on this, but I seem to recall that most of these resets are
> actually synchronous, so in order for them to do what they're supposed
> to the clock needs to be kept running.
>
> The Linux driver certainly does this differently.

You have point, but I have tried to mostly adapt Linux tegra dc driver,
which has same logic in probe. Maybe I have not understood it properly.
Testing on T20, T30 and T114 passed without issues so far.

> Thierry


Re: [PATCH v6 00/18] Add T114 video support

2024-04-19 Thread Svyatoslav Ryhel
Hello Tom! This patch set is hanging in patchwork for 3 month
without any comments. If no one has anything to say, may you
pick it into master?

Best regards,
Svyatoslav R.

вт, 23 січ. 2024 р. о 19:17 Svyatoslav Ryhel  пише:
>
> T114 is not that different from T30 and all T30 drivers will work
> on T114 as well with some adjustments.
>
> Patches propose general improvements for existing Tegra DC and DSI
> drivers as well Tegra 114 video support (experimentl).
>
> Commits pass buildman for tegra.
>
> ---
> Changes from v5:
>  - backlight enable moved to the last step of setup for DSI
>  - parameterized V- and H-sync polarities
>  - added framebuffer clearing on probe to avoid glitches
>  - backlight enable moved after DC is fully configured
>  - fixed printing framebuffer pointer instead of address
>  - moved scdiv calculation to tegra DSI if it is used
>
> Changes from v4:
>  - fixed typo in max rate to be divided (400KHz > 400MHz)
>
> Changes from v3:
>  - fixed the clock divider calculation if PLLD/D2 is used
>  - removed unnecessary pre-configuration
>  - set correct video FIFO depth for DSI
>
> Changes from v2:
>  - fixed image distortion on devices with 180deg rotation
>
> Changes from v1:
>  - reworked patchset entirely
>  - diverged DC configuration per-SOC
>  - consolidated dc headers from different SOC gen
>  - initial support of DC detection (tegra has 2 DC)
>  - added PLLD2 support, resets and powergating
>  - added T114+ MIPI calibration
>  - added DSI detection (tegra has 2 DSI) and resets
> ---
>
> Jonas Schwöbel (6):
>   video: tegra20: dc: fix printing of framebuffer address
>   video: tegra20: dc: enable backlight after DC is configured
>   video: tegra20: dc: clean framebuffer memory block
>   video: tegra20: dsi: remove pre-configuration
>   video: tegra20: dsi: set correct fifo depth
>   video: tegra20: dsi: use set_backlight for backlight only
>
> Svyatoslav Ryhel (12):
>   video: tegra20: dc: diverge DC per-SOC
>   video: tegra20: dc: fix image shift on rotated panels
>   video: tegra20: consolidate DC header
>   video: tegra20: dc: pass DC id to internal devices
>   video: tegra20: dc: add PLLD2 parent support
>   video: tegra20: dc: add reset support
>   video: tegra20: dc: add powergate
>   video: tegra20: dc: configure behavior if PLLD/D2 is used
>   video: tegra20: dc: parameterize V- and H-sync polarities
>   video: tegra20: add MIPI calibration driver
>   video: tegra20: dsi: add T114 support
>   video: tegra20: dsi: add reset support
>
>  arch/arm/dts/tegra114-u-boot.dtsi |  13 +
>  arch/arm/dts/tegra114.dtsi|   4 +-
>  arch/arm/dts/tegra30-u-boot.dtsi  |   4 +
>  arch/arm/dts/tegra30.dtsi |   2 +-
>  arch/arm/include/asm/arch-tegra/dc.h  |  13 +-
>  arch/arm/include/asm/arch-tegra114/pwm.h  |  13 +
>  arch/arm/include/asm/arch-tegra20/display.h   |  28 --
>  arch/arm/include/asm/arch-tegra30/display.h   |  28 --
>  drivers/video/tegra20/Makefile|   2 +-
>  drivers/video/tegra20/tegra-dc.c  | 239 +-
>  drivers/video/tegra20/tegra-dc.h  |  45 
>  drivers/video/tegra20/tegra-dsi.c | 122 -
>  .../video/tegra20/tegra-dsi.h |  24 +-
>  drivers/video/tegra20/tegra-mipi.c| 188 ++
>  drivers/video/tegra20/tegra-pwm-backlight.c   |   3 +-
>  15 files changed, 583 insertions(+), 145 deletions(-)
>  create mode 100644 arch/arm/include/asm/arch-tegra114/pwm.h
>  delete mode 100644 arch/arm/include/asm/arch-tegra20/display.h
>  delete mode 100644 arch/arm/include/asm/arch-tegra30/display.h
>  create mode 100644 drivers/video/tegra20/tegra-dc.h
>  rename arch/arm/include/asm/arch-tegra30/dsi.h => 
> drivers/video/tegra20/tegra-dsi.h (90%)
>  create mode 100644 drivers/video/tegra20/tegra-mipi.c
>
> --
> 2.40.1
>


Re: [PATCH v2 0/7] Tegra panel improvements

2024-04-19 Thread Svyatoslav Ryhel
Hello Tom! This patch set is hanging in patchwork for 3 month
without any comments. If no one has anything to say, may you
pick it into master?

Best regards,
Svyatoslav R.

ср, 31 січ. 2024 р. о 08:57 Svyatoslav Ryhel  пише:
>
> The current patch set improves the logic of existing panels and
> bridge used by Tegra 3 devices and brings support for additional
> DSI panels used by Tegra 4 devices.
>
> New and existing drivers are fully reusable, contain no device
> specific parts, and are written according to existing datasheets.
>
> ---
> Changes from v1:
> - improved ssd2825 code style
> - added TC358768 RGB to DSI bridge bringup commit (used by TF700T)
> - added Parade DP501 transmitter bringup (used by Lenovo Ideapad Yoga 11)
> ---
>
> Anton Bambura (1):
>   video: panel: add Samsung LTL106HL02 MIPI DSI panel driver
>
> Jonas Schwöbel (1):
>   video: bridge: add basic support for the Parade DP501 transmitter
>
> Svyatoslav Ryhel (5):
>   video: panel: add LG LG070WX3 MIPI DSI panel driver
>   video: bridge: add Toshiba TC358768 RGB to DSI bridge support
>   video: endeavoru-panel: shift the init sequence by one step earlier
>   video: bridge: ssd2825: shift the init sequence by one step earlier
>   video: renesas: shift the init sequence by one step earlier
>
>  drivers/video/Kconfig  |  17 +
>  drivers/video/Makefile |   2 +
>  drivers/video/bridge/Kconfig   |  19 +
>  drivers/video/bridge/Makefile  |   2 +
>  drivers/video/bridge/dp501.c   | 579 +
>  drivers/video/bridge/ssd2825.c |  86 +--
>  drivers/video/bridge/tc358768.c| 985 +
>  drivers/video/endeavoru-panel.c| 128 ++--
>  drivers/video/lg-ld070wx3.c| 186 ++
>  drivers/video/renesas-r61307.c |  93 +--
>  drivers/video/renesas-r69328.c |  81 +--
>  drivers/video/samsung-ltl106hl02.c | 157 +
>  12 files changed, 2155 insertions(+), 180 deletions(-)
>  create mode 100644 drivers/video/bridge/dp501.c
>  create mode 100644 drivers/video/bridge/tc358768.c
>  create mode 100644 drivers/video/lg-ld070wx3.c
>  create mode 100644 drivers/video/samsung-ltl106hl02.c
>
> --
> 2.40.1
>


Re: [PATCH v2 0/1] Fix booting kernels with ATAGS and extlinux

2024-02-29 Thread Svyatoslav Ryhel
чт, 25 січ. 2024 р. о 22:17 Svyatoslav Ryhel  пише:
>
> Currently, if boot with extlinux.conf and do not set the fdt
> U-Boot will provide its own device tree. This behavior is
> beneficial if the U-Boot device tree is in sync with Linux,
> but it totally halts the booting of pre-dtb kernels (3.4 for
> example) since it uses ATAGs. To fix this, pass `-` in the
> fdt extlinux field as a signal that no tree should be used.
>
> Tested with 3.4 legacy kernel and mainline 6.7 kernel on
> P895 (lg_x3 board).
>
> ---
> Changes form v1
>  - Added CONFIG guards
>  - Clarified documentation
> ---
>
> Svyatoslav Ryhel (1):
>   boot: pxe_utils: skip fdt setup in case legacy kernel is booted
>
>  boot/pxe_utils.c   | 27 ++-
>  doc/develop/distro.rst |  6 ++
>  2 files changed, 28 insertions(+), 5 deletions(-)
>
> --
> 2.40.1
>

Hello, Tom! A month passed since v2 was pushed without any actions,
should I re-send it or maybe some adjustments are needed?


Re: [PATCH v1 5/7] toradex: common: Add sysinfo driver

2024-02-20 Thread Svyatoslav Ryhel
вт, 20 лют. 2024 р. о 20:29 Francesco Dolcini  пише:
>
> From: Emanuele Ghidoli 
>
> This commit introduces support for the Toradex sysinfo driver in U-Boot,
> which uses information from Toradex config block to print correct
> board model.
> In case the Toradex config block is not present sysinfo prints the model
> of the board provided by device tree removing per board specific prints.
>
> Signed-off-by: Emanuele Ghidoli 
> Signed-off-by: Francesco Dolcini 
> ---
>  arch/arm/dts/fsl-imx8qm-apalis-u-boot.dtsi|  6 +++
>  arch/arm/dts/fsl-imx8qxp-colibri-u-boot.dtsi  |  6 +++
>  .../dts/imx6dl-colibri-eval-v3-u-boot.dtsi|  4 ++
>  arch/arm/dts/imx6q-apalis-eval-u-boot.dtsi|  4 ++
>  .../dts/imx6ull-colibri-eval-v3-u-boot.dtsi   |  4 ++
>  .../arm/dts/imx7d-colibri-eval-v3-u-boot.dtsi |  4 ++
>  .../dts/imx8mm-verdin-wifi-dev-u-boot.dtsi|  4 ++
>  .../dts/imx8mp-verdin-wifi-dev-u-boot.dtsi|  4 ++
>  .../dts/k3-am625-verdin-wifi-dev-u-boot.dtsi  |  4 ++
>  arch/arm/dts/tegra124-apalis-u-boot.dtsi  | 12 +
>  arch/arm/dts/tegra20-colibri-u-boot.dtsi  | 12 +
>  arch/arm/dts/tegra30-apalis-u-boot.dtsi   | 12 +
>  arch/arm/dts/tegra30-colibri-u-boot.dtsi  | 12 +
>  .../arm/dts/vf610-colibri-eval-v3-u-boot.dtsi |  4 ++
>  board/toradex/common/Kconfig  |  1 +
>  board/toradex/common/tdx-common.c | 50 ---
>  16 files changed, 136 insertions(+), 7 deletions(-)
>  create mode 100644 arch/arm/dts/tegra124-apalis-u-boot.dtsi
>  create mode 100644 arch/arm/dts/tegra20-colibri-u-boot.dtsi
>  create mode 100644 arch/arm/dts/tegra30-apalis-u-boot.dtsi
>  create mode 100644 arch/arm/dts/tegra30-colibri-u-boot.dtsi
>

Greetings! Thank you for contribution but may you at split patches
according to SoC vendor at least? For imx, tegra and ti since it
would be hard to both review and pick them to correct custodian
trees.

> diff --git a/arch/arm/dts/fsl-imx8qm-apalis-u-boot.dtsi 
> b/arch/arm/dts/fsl-imx8qm-apalis-u-boot.dtsi
> index c54a59e89c5d..d73be74d2112 100644
> --- a/arch/arm/dts/fsl-imx8qm-apalis-u-boot.dtsi
> +++ b/arch/arm/dts/fsl-imx8qm-apalis-u-boot.dtsi
> @@ -3,6 +3,12 @@
>   * Copyright 2019 Toradex AG
>   */
>
> +/ {
> +   sysinfo {
> +   compatible = "toradex,sysinfo";
> +   };
> +};
> +
>  &mu {
> bootph-some-ram;
>  };
> diff --git a/arch/arm/dts/fsl-imx8qxp-colibri-u-boot.dtsi 
> b/arch/arm/dts/fsl-imx8qxp-colibri-u-boot.dtsi
> index 6ab6b1f9ee69..60c4cd6fc01f 100644
> --- a/arch/arm/dts/fsl-imx8qxp-colibri-u-boot.dtsi
> +++ b/arch/arm/dts/fsl-imx8qxp-colibri-u-boot.dtsi
> @@ -3,6 +3,12 @@
>   * Copyright 2019 Toradex AG
>   */
>
> +/ {
> +   sysinfo {
> +   compatible = "toradex,sysinfo";
> +   };
> +};
> +
>  &{/imx8qx-pm} {
>
> bootph-some-ram;
> diff --git a/arch/arm/dts/imx6dl-colibri-eval-v3-u-boot.dtsi 
> b/arch/arm/dts/imx6dl-colibri-eval-v3-u-boot.dtsi
> index 0eea4d1862ae..5a91d0aca204 100644
> --- a/arch/arm/dts/imx6dl-colibri-eval-v3-u-boot.dtsi
> +++ b/arch/arm/dts/imx6dl-colibri-eval-v3-u-boot.dtsi
> @@ -16,6 +16,10 @@
> mmc0 = &usdhc3;
> mmc1 = &usdhc1;
> };
> +
> +   sysinfo {
> +   compatible = "toradex,sysinfo";
> +   };
>  };
>
>  &wdog1 {
> diff --git a/arch/arm/dts/imx6q-apalis-eval-u-boot.dtsi 
> b/arch/arm/dts/imx6q-apalis-eval-u-boot.dtsi
> index 3c6e503d043b..59412635420a 100644
> --- a/arch/arm/dts/imx6q-apalis-eval-u-boot.dtsi
> +++ b/arch/arm/dts/imx6q-apalis-eval-u-boot.dtsi
> @@ -19,6 +19,10 @@
> mmc1 = &usdhc1;
> mmc2 = &usdhc2;
> };
> +
> +   sysinfo {
> +   compatible = "toradex,sysinfo";
> +   };
>  };
>
>  &wdog1 {
> diff --git a/arch/arm/dts/imx6ull-colibri-eval-v3-u-boot.dtsi 
> b/arch/arm/dts/imx6ull-colibri-eval-v3-u-boot.dtsi
> index 6823b42d4514..731814216e1f 100644
> --- a/arch/arm/dts/imx6ull-colibri-eval-v3-u-boot.dtsi
> +++ b/arch/arm/dts/imx6ull-colibri-eval-v3-u-boot.dtsi
> @@ -9,6 +9,10 @@
> usb0 = &usbotg1; /* required for ums */
> display0 = &lcdif;
> };
> +
> +   sysinfo {
> +   compatible = "toradex,sysinfo";
> +   };
>  };
>
>  &pinctrl_uart1 {
> diff --git a/arch/arm/dts/imx7d-colibri-eval-v3-u-boot.dtsi 
> b/arch/arm/dts/imx7d-colibri-eval-v3-u-boot.dtsi
> index b2c12a413daf..68142769d360 100644
> --- a/arch/arm/dts/imx7d-colibri-eval-v3-u-boot.dtsi
> +++ b/arch/arm/dts/imx7d-colibri-eval-v3-u-boot.dtsi
> @@ -11,6 +11,10 @@
> mmc0 = &usdhc3;
> mmc1 = &usdhc1;
> };
> +
> +   sysinfo {
> +   compatible = "toradex,sysinfo";
> +   };
>  };
>
>  &lcdif {
> diff --git a/arch/arm/dts/imx8mm-verdin-wifi-dev-u-boot.dtsi 
> b/arch/arm/dts/imx8mm-verdin-wifi-dev-u-boot.dtsi
> index 515f195ab759..38db56059d69 100644
> --- a/arch/arm/dts/imx8mm-verdin-wifi-dev-u-boot.dtsi
> +++ b/arch/

[PATCH v2 7/7] video: renesas: shift the init sequence by one step earlier

2024-01-30 Thread Svyatoslav Ryhel
Shift all setup stages one step earlier to better fit the
existing uclass.

Signed-off-by: Svyatoslav Ryhel 
---
 drivers/video/renesas-r61307.c | 93 +++---
 drivers/video/renesas-r69328.c | 81 +++--
 2 files changed, 95 insertions(+), 79 deletions(-)

diff --git a/drivers/video/renesas-r61307.c b/drivers/video/renesas-r61307.c
index 426fdc6224..1eccaf6b1b 100644
--- a/drivers/video/renesas-r61307.c
+++ b/drivers/video/renesas-r61307.c
@@ -118,42 +118,6 @@ static struct display_timing default_timing = {
 };
 
 static int renesas_r61307_enable_backlight(struct udevice *dev)
-{
-   struct renesas_r61307_priv *priv = dev_get_priv(dev);
-   int ret;
-
-   ret = regulator_set_enable_if_allowed(priv->vcc, 1);
-   if (ret) {
-   log_err("enabling vcc-supply failed (%d)\n", ret);
-   return ret;
-   }
-   mdelay(5);
-
-   ret = regulator_set_enable_if_allowed(priv->iovcc, 1);
-   if (ret) {
-   log_err("enabling iovcc-supply failed (%d)\n", ret);
-   return ret;
-   }
-
-   ret = dm_gpio_set_value(&priv->reset_gpio, 0);
-   if (ret) {
-   log_err("changing reset-gpio failed (%d)\n", ret);
-   return ret;
-   }
-   mdelay(5);
-
-   ret = dm_gpio_set_value(&priv->reset_gpio, 1);
-   if (ret) {
-   log_err("changing reset-gpio failed (%d)\n", ret);
-   return ret;
-   }
-
-   mdelay(5);
-
-   return 0;
-}
-
-static int renesas_r61307_set_backlight(struct udevice *dev, int percent)
 {
struct renesas_r61307_priv *priv = dev_get_priv(dev);
struct mipi_dsi_panel_plat *plat = dev_get_plat(dev);
@@ -205,18 +169,23 @@ static int renesas_r61307_set_backlight(struct udevice 
*dev, int percent)
log_err("failed to set display on: %d\n", ret);
return ret;
}
-
mdelay(50);
 
+   return 0;
+}
+
+static int renesas_r61307_set_backlight(struct udevice *dev, int percent)
+{
+   struct renesas_r61307_priv *priv = dev_get_priv(dev);
+   int ret;
+
ret = backlight_enable(priv->backlight);
if (ret)
return ret;
 
-   ret = backlight_set_brightness(priv->backlight, percent);
-   if (ret)
-   return ret;
+   mdelay(5);
 
-   return 0;
+   return backlight_set_brightness(priv->backlight, percent);
 }
 
 static int renesas_r61307_timings(struct udevice *dev,
@@ -266,6 +235,46 @@ static int renesas_r61307_of_to_plat(struct udevice *dev)
return 0;
 }
 
+static int renesas_r61307_hw_init(struct udevice *dev)
+{
+   struct renesas_r61307_priv *priv = dev_get_priv(dev);
+   int ret;
+
+   ret = regulator_set_enable_if_allowed(priv->vcc, 1);
+   if (ret) {
+   log_debug("%s: enabling vcc-supply failed (%d)\n",
+ __func__, ret);
+   return ret;
+   }
+   mdelay(5);
+
+   ret = regulator_set_enable_if_allowed(priv->iovcc, 1);
+   if (ret) {
+   log_debug("%s: enabling iovcc-supply failed (%d)\n",
+ __func__, ret);
+   return ret;
+   }
+
+   ret = dm_gpio_set_value(&priv->reset_gpio, 0);
+   if (ret) {
+   log_debug("%s: changing reset-gpio failed (%d)\n",
+ __func__, ret);
+   return ret;
+   }
+   mdelay(5);
+
+   ret = dm_gpio_set_value(&priv->reset_gpio, 1);
+   if (ret) {
+   log_debug("%s: changing reset-gpio failed (%d)\n",
+ __func__, ret);
+   return ret;
+   }
+
+   mdelay(5);
+
+   return 0;
+}
+
 static int renesas_r61307_probe(struct udevice *dev)
 {
struct mipi_dsi_panel_plat *plat = dev_get_plat(dev);
@@ -275,7 +284,7 @@ static int renesas_r61307_probe(struct udevice *dev)
plat->format = MIPI_DSI_FMT_RGB888;
plat->mode_flags = MIPI_DSI_MODE_VIDEO;
 
-   return 0;
+   return renesas_r61307_hw_init(dev);
 }
 
 static const struct panel_ops renesas_r61307_ops = {
diff --git a/drivers/video/renesas-r69328.c b/drivers/video/renesas-r69328.c
index d2f7169468..ecf89ec021 100644
--- a/drivers/video/renesas-r69328.c
+++ b/drivers/video/renesas-r69328.c
@@ -65,37 +65,6 @@ static struct display_timing default_timing = {
 
 static int renesas_r69328_enable_backlight(struct udevice *dev)
 {
-   struct renesas_r69328_priv *priv = dev_get_priv(dev);
-   int ret;
-
-   ret = dm_gpio_set_value(&priv->enable_gpio, 1);
-   if (ret) {
-   log_err("error changing enable-gpios (%d)\n", ret);
-   return ret;
-   }
-   mdelay(5);
-
-   ret = dm_gpio_set_value(&priv->reset_gpio, 0);
-  

[PATCH v2 6/7] video: bridge: ssd2825: shift the init sequence by one step earlier

2024-01-30 Thread Svyatoslav Ryhel
Shift all setup stages one step earlier to better fit the
existing uclass.

Signed-off-by: Svyatoslav Ryhel 
---
 drivers/video/bridge/ssd2825.c | 86 ++
 1 file changed, 45 insertions(+), 41 deletions(-)

diff --git a/drivers/video/bridge/ssd2825.c b/drivers/video/bridge/ssd2825.c
index cea20dcffa..f0ef3dafb9 100644
--- a/drivers/video/bridge/ssd2825.c
+++ b/drivers/video/bridge/ssd2825.c
@@ -349,39 +349,6 @@ static int ssd2825_bridge_enable_panel(struct udevice *dev)
struct ssd2825_bridge_priv *priv = dev_get_priv(dev);
struct mipi_dsi_device *device = &priv->device;
struct display_timing *dt = &priv->timing;
-   int ret;
-
-   ret = clk_prepare_enable(priv->tx_clk);
-   if (ret) {
-   log_err("error enabling tx_clk (%d)\n", ret);
-   return ret;
-   }
-
-   ret = dm_gpio_set_value(&priv->power_gpio, 1);
-   if (ret) {
-   log_err("error changing power-gpios (%d)\n", ret);
-   return ret;
-   }
-   mdelay(10);
-
-   ret = dm_gpio_set_value(&priv->reset_gpio, 0);
-   if (ret) {
-   log_err("error changing reset-gpios (%d)\n", ret);
-   return ret;
-   }
-   mdelay(10);
-
-   ret = dm_gpio_set_value(&priv->reset_gpio, 1);
-   if (ret) {
-   log_err("error changing reset-gpios (%d)\n", ret);
-   return ret;
-   }
-   mdelay(10);
-
-   /* Perform panel HW setup */
-   ret = panel_enable_backlight(priv->panel);
-   if (ret)
-   return ret;
 
/* Perform SW reset */
ssd2825_write_register(dev, SSD2825_OPERATION_CTRL_REG, 0x0100);
@@ -417,17 +384,15 @@ static int ssd2825_bridge_enable_panel(struct udevice 
*dev)
   SSD2825_CONF_REG_ECD | SSD2825_CONF_REG_EOT);
ssd2825_write_register(dev, SSD2825_VC_CTRL_REG, 0x);
 
-   /* Set up SW panel configuration */
-   ret = panel_set_backlight(priv->panel, BACKLIGHT_DEFAULT);
-   if (ret)
-   return ret;
-
-   return 0;
+   /* Perform panel setup */
+   return panel_enable_backlight(priv->panel);
 }
 
 static int ssd2825_bridge_set_panel(struct udevice *dev, int percent)
 {
-   return 0;
+   struct ssd2825_bridge_priv *priv = dev_get_priv(dev);
+
+   return panel_set_backlight(priv->panel, percent);
 }
 
 static int ssd2825_bridge_panel_timings(struct udevice *dev,
@@ -440,6 +405,45 @@ static int ssd2825_bridge_panel_timings(struct udevice 
*dev,
return 0;
 }
 
+static int ssd2825_bridge_hw_init(struct udevice *dev)
+{
+   struct ssd2825_bridge_priv *priv = dev_get_priv(dev);
+   int ret;
+
+   ret = clk_prepare_enable(priv->tx_clk);
+   if (ret) {
+   log_debug("%s: error enabling tx_clk (%d)\n",
+ __func__, ret);
+   return ret;
+   }
+
+   ret = dm_gpio_set_value(&priv->power_gpio, 1);
+   if (ret) {
+   log_debug("%s: error changing power-gpios (%d)\n",
+ __func__, ret);
+   return ret;
+   }
+   mdelay(10);
+
+   ret = dm_gpio_set_value(&priv->reset_gpio, 0);
+   if (ret) {
+   log_debug("%s: error changing reset-gpios (%d)\n",
+ __func__, ret);
+   return ret;
+   }
+   mdelay(10);
+
+   ret = dm_gpio_set_value(&priv->reset_gpio, 1);
+   if (ret) {
+   log_debug("%s: error changing reset-gpios (%d)\n",
+ __func__, ret);
+   return ret;
+   }
+   mdelay(10);
+
+   return 0;
+}
+
 static int ssd2825_bridge_probe(struct udevice *dev)
 {
struct ssd2825_bridge_priv *priv = dev_get_priv(dev);
@@ -496,7 +500,7 @@ static int ssd2825_bridge_probe(struct udevice *dev)
return PTR_ERR(priv->tx_clk);
}
 
-   return 0;
+   return ssd2825_bridge_hw_init(dev);
 }
 
 static const struct panel_ops ssd2825_bridge_ops = {
-- 
2.40.1



[PATCH v2 5/7] video: endeavoru-panel: shift the init sequence by one step earlier

2024-01-30 Thread Svyatoslav Ryhel
Shift all setup stages one step earlier to better fit the
existing uclass.

Signed-off-by: Svyatoslav Ryhel 
---
 drivers/video/endeavoru-panel.c | 128 +---
 1 file changed, 68 insertions(+), 60 deletions(-)

diff --git a/drivers/video/endeavoru-panel.c b/drivers/video/endeavoru-panel.c
index 79a272128b..1bff641434 100644
--- a/drivers/video/endeavoru-panel.c
+++ b/drivers/video/endeavoru-panel.c
@@ -57,61 +57,8 @@ static void dcs_write_one(struct mipi_dsi_device *dsi, u8 
cmd, u8 data)
 
 static int endeavoru_panel_enable_backlight(struct udevice *dev)
 {
-   struct endeavoru_panel_priv *priv = dev_get_priv(dev);
-   int ret;
-
-   ret = dm_gpio_set_value(&priv->reset_gpio, 1);
-   if (ret) {
-   log_err("error changing reset-gpios (%d)\n", ret);
-   return ret;
-   }
-   mdelay(5);
-
-   ret = regulator_set_enable_if_allowed(priv->vddio, 1);
-   if (ret) {
-   log_err("error enabling iovcc-supply (%d)\n", ret);
-   return ret;
-   }
-   mdelay(1);
-
-   ret = regulator_set_enable_if_allowed(priv->vdd, 1);
-   if (ret) {
-   log_err("error enabling vcc-supply (%d)\n", ret);
-   return ret;
-   }
-   mdelay(20);
-
-   ret = dm_gpio_set_value(&priv->reset_gpio, 0);
-   if (ret) {
-   log_err("error changing reset-gpios (%d)\n", ret);
-   return ret;
-   }
-   mdelay(2);
-
-   /* Reset panel */
-   ret = dm_gpio_set_value(&priv->reset_gpio, 1);
-   if (ret) {
-   log_err("error changing reset-gpios (%d)\n", ret);
-   return ret;
-   }
-   mdelay(1);
-
-   ret = dm_gpio_set_value(&priv->reset_gpio, 0);
-   if (ret) {
-   log_err("error changing reset-gpios (%d)\n", ret);
-   return ret;
-   }
-   mdelay(25);
-
-   return 0;
-}
-
-static int endeavoru_panel_set_backlight(struct udevice *dev, int percent)
-{
-   struct endeavoru_panel_priv *priv = dev_get_priv(dev);
struct mipi_dsi_panel_plat *plat = dev_get_plat(dev);
struct mipi_dsi_device *dsi = plat->device;
-   int ret;
 
dcs_write_one(dsi, 0xc2, 0x08);
 
@@ -160,18 +107,22 @@ static int endeavoru_panel_set_backlight(struct udevice 
*dev, int percent)
dcs_write_one(dsi, 0x55, 0x80);
dcs_write_one(dsi, 0x5e, 0x06);
 
-   ret = backlight_enable(priv->backlight);
-   if (ret)
-   return ret;
-
/* Set backlight */
dcs_write_one(dsi, 0x51, 0x96);
 
-   ret = backlight_set_brightness(priv->backlight, percent);
+   return 0;
+}
+
+static int endeavoru_panel_set_backlight(struct udevice *dev, int percent)
+{
+   struct endeavoru_panel_priv *priv = dev_get_priv(dev);
+   int ret;
+
+   ret = backlight_enable(priv->backlight);
if (ret)
return ret;
 
-   return 0;
+   return backlight_set_brightness(priv->backlight, percent);
 }
 
 static int endeavoru_panel_timings(struct udevice *dev,
@@ -217,6 +168,63 @@ static int endeavoru_panel_of_to_plat(struct udevice *dev)
return 0;
 }
 
+static int endeavoru_panel_hw_init(struct udevice *dev)
+{
+   struct endeavoru_panel_priv *priv = dev_get_priv(dev);
+   int ret;
+
+   ret = dm_gpio_set_value(&priv->reset_gpio, 1);
+   if (ret) {
+   log_debug("%s: error changing reset-gpios (%d)\n",
+ __func__, ret);
+   return ret;
+   }
+   mdelay(5);
+
+   ret = regulator_set_enable_if_allowed(priv->vddio, 1);
+   if (ret) {
+   log_debug("%s: error enabling iovcc-supply (%d)\n",
+ __func__, ret);
+   return ret;
+   }
+   mdelay(1);
+
+   ret = regulator_set_enable_if_allowed(priv->vdd, 1);
+   if (ret) {
+   log_debug("%s: error enabling vcc-supply (%d)\n",
+ __func__, ret);
+   return ret;
+   }
+   mdelay(20);
+
+   ret = dm_gpio_set_value(&priv->reset_gpio, 0);
+   if (ret) {
+   log_debug("%s: error changing reset-gpios (%d)\n",
+ __func__, ret);
+   return ret;
+   }
+   mdelay(2);
+
+   /* Reset panel */
+   ret = dm_gpio_set_value(&priv->reset_gpio, 1);
+   if (ret) {
+   log_debug("%s: error changing reset-gpios (%d)\n",
+ __func__, ret);
+   return ret;
+   }
+   mdelay(1);
+
+   ret = dm_gpio_set_value(&priv->reset_gpio, 0);
+   if (ret) {
+   log_debug("%s: error changing reset-gpios (%d)\n",
+ __func__, ret);
+   

[PATCH v2 3/7] video: bridge: add Toshiba TC358768 RGB to DSI bridge support

2024-01-30 Thread Svyatoslav Ryhel
Add initial support for the Toshiba TC358768 RGB to DSI bridge.

The driver is based on the mainline Linux Toshiba TC358768
bridge driver and implements the same set of features.

Tested-by: Andreas Westman Dorcsak  # ASUS TF700T
Signed-off-by: Svyatoslav Ryhel 
---
 drivers/video/bridge/Kconfig|   9 +
 drivers/video/bridge/Makefile   |   1 +
 drivers/video/bridge/tc358768.c | 985 
 3 files changed, 995 insertions(+)
 create mode 100644 drivers/video/bridge/tc358768.c

diff --git a/drivers/video/bridge/Kconfig b/drivers/video/bridge/Kconfig
index 2311ca2d1a..6a9e7c1454 100644
--- a/drivers/video/bridge/Kconfig
+++ b/drivers/video/bridge/Kconfig
@@ -40,3 +40,12 @@ config VIDEO_BRIDGE_SOLOMON_SSD2825
select VIDEO_MIPI_DSI
help
  Solomon SSD2824 SPI RGB-DSI bridge driver wrapped into panel uClass.
+
+config VIDEO_BRIDGE_TOSHIBA_TC358768
+   bool "Support Toshiba TC358768 MIPI DSI bridge"
+   depends on PANEL && DM_GPIO
+   select VIDEO_MIPI_DSI
+   select DM_I2C
+   help
+ Toshiba TC358768AXBG/TC358778XBG DSI bridge chip driver.
+ Found in Asus Transformer Infinity TF700T.
diff --git a/drivers/video/bridge/Makefile b/drivers/video/bridge/Makefile
index 22625c8bc6..ed3e7e9ce1 100644
--- a/drivers/video/bridge/Makefile
+++ b/drivers/video/bridge/Makefile
@@ -8,3 +8,4 @@ obj-$(CONFIG_VIDEO_BRIDGE_PARADE_PS862X) += ps862x.o
 obj-$(CONFIG_VIDEO_BRIDGE_NXP_PTN3460) += ptn3460.o
 obj-$(CONFIG_VIDEO_BRIDGE_ANALOGIX_ANX6345) += anx6345.o
 obj-$(CONFIG_VIDEO_BRIDGE_SOLOMON_SSD2825) += ssd2825.o
+obj-$(CONFIG_VIDEO_BRIDGE_TOSHIBA_TC358768) += tc358768.o
diff --git a/drivers/video/bridge/tc358768.c b/drivers/video/bridge/tc358768.c
new file mode 100644
index 00..19b6ca29d3
--- /dev/null
+++ b/drivers/video/bridge/tc358768.c
@@ -0,0 +1,985 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2020 Texas Instruments Incorporated
+ * Copyright (C) 2022 Svyatoslav Ryhel 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+/* Global (16-bit addressable) */
+#define TC358768_CHIPID0x
+#define TC358768_SYSCTL0x0002
+#define TC358768_CONFCTL   0x0004
+#define TC358768_VSDLY 0x0006
+#define TC358768_DATAFMT   0x0008
+#define TC358768_GPIOEN0x000E
+#define TC358768_GPIODIR   0x0010
+#define TC358768_GPIOIN0x0012
+#define TC358768_GPIOOUT   0x0014
+#define TC358768_PLLCTL0   0x0016
+#define TC358768_PLLCTL1   0x0018
+#define TC358768_CMDBYTE   0x0022
+#define TC358768_PP_MISC   0x0032
+#define TC358768_DSITX_DT  0x0050
+#define TC358768_FIFOSTATUS0x00F8
+
+/* Debug (16-bit addressable) */
+#define TC358768_VBUFCTRL  0x00E0
+#define TC358768_DBG_WIDTH 0x00E2
+#define TC358768_DBG_VBLANK0x00E4
+#define TC358768_DBG_DATA  0x00E8
+
+/* TX PHY (32-bit addressable) */
+#define TC358768_CLW_DPHYCONTTX0x0100
+#define TC358768_D0W_DPHYCONTTX0x0104
+#define TC358768_D1W_DPHYCONTTX0x0108
+#define TC358768_D2W_DPHYCONTTX0x010C
+#define TC358768_D3W_DPHYCONTTX0x0110
+#define TC358768_CLW_CNTRL 0x0140
+#define TC358768_D0W_CNTRL 0x0144
+#define TC358768_D1W_CNTRL 0x0148
+#define TC358768_D2W_CNTRL 0x014C
+#define TC358768_D3W_CNTRL 0x0150
+
+/* TX PPI (32-bit addressable) */
+#define TC358768_STARTCNTRL0x0204
+#define TC358768_DSITXSTATUS   0x0208
+#define TC358768_LINEINITCNT   0x0210
+#define TC358768_LPTXTIMECNT   0x0214
+#define TC358768_TCLK_HEADERCNT0x0218
+#define TC358768_TCLK_TRAILCNT 0x021C
+#define TC358768_THS_HEADERCNT 0x0220
+#define TC358768_TWAKEUP   0x0224
+#define TC358768_TCLK_POSTCNT  0x0228
+#define TC358768_THS_TRAILCNT  0x022C
+#define TC358768_HSTXVREGCNT   0x0230
+#define TC358768_HSTXVREGEN0x0234
+#define TC358768_TXOPTIONCNTRL 0x0238
+#define TC358768_BTACNTRL1 0x023C
+
+/* TX CTRL (32-bit addressable) */
+#define TC358768_DSI_CONTROL   0x040C
+#define TC358768_DSI_STATUS0x0410
+#define TC358768_DSI_INT   0x0414
+#define TC358768_DSI_INT_ENA   0x0418
+#define TC358768_DSICMD_RDFIFO 0x0430
+#define TC358768_DSI_ACKERR0x0434
+#define TC358768_DSI_ACKERR_INTENA 0x0438
+#define TC358768_DSI_ACKERR_HALT   0x043c
+#define TC358768_DSI_RXERR 0x0440
+#define TC358768_DSI_RXERR_INTENA  0x0444
+#define TC358768_DSI_RXERR_HALT0x0448
+#defin

[PATCH v2 4/7] video: bridge: add basic support for the Parade DP501 transmitter

2024-01-30 Thread Svyatoslav Ryhel
From: Jonas Schwöbel 

The Parade DP501 is a DP & DVI/HDMI dual-mode transmitter. It
enables an RGB/Parallel SOC output to be converted, packed and
serialized into either DP or TMDS output device. Only DisplayPort
functionality of this transmitter has been implemented and tested.

Signed-off-by: Jonas Schwöbel 
Signed-off-by: Svyatoslav Ryhel 
---
 drivers/video/bridge/Kconfig  |  10 +
 drivers/video/bridge/Makefile |   1 +
 drivers/video/bridge/dp501.c  | 579 ++
 3 files changed, 590 insertions(+)
 create mode 100644 drivers/video/bridge/dp501.c

diff --git a/drivers/video/bridge/Kconfig b/drivers/video/bridge/Kconfig
index 6a9e7c1454..ab91727372 100644
--- a/drivers/video/bridge/Kconfig
+++ b/drivers/video/bridge/Kconfig
@@ -7,6 +7,16 @@ config VIDEO_BRIDGE
  requires LVDS, an eDP->LVDS bridge chip can be used to provide the
  necessary conversion. This option enables support for these devices.
 
+config VIDEO_BRIDGE_PARADE_DP501
+   bool "Support Parade DP501 DP & DVI/HDMI dual mode transmitter"
+   depends on PANEL && DM_GPIO
+   select DM_I2C
+   help
+ The Parade DP501 is a DP & DVI/HDMI dual-mode transmitter. It
+ enables an RGB/Parallel SOC output to be converted, packed and
+ serialized into either DP or TMDS output device. Only DisplayPort
+ functionality of this transmitter has been implemented and tested.
+
 config VIDEO_BRIDGE_PARADE_PS862X
bool "Support Parade PS862X DP->LVDS bridge"
depends on VIDEO_BRIDGE
diff --git a/drivers/video/bridge/Makefile b/drivers/video/bridge/Makefile
index ed3e7e9ce1..58697e3cbe 100644
--- a/drivers/video/bridge/Makefile
+++ b/drivers/video/bridge/Makefile
@@ -4,6 +4,7 @@
 #  Written by Simon Glass 
 
 obj-$(CONFIG_VIDEO_BRIDGE) += video-bridge-uclass.o
+obj-$(CONFIG_VIDEO_BRIDGE_PARADE_DP501) += dp501.o
 obj-$(CONFIG_VIDEO_BRIDGE_PARADE_PS862X) += ps862x.o
 obj-$(CONFIG_VIDEO_BRIDGE_NXP_PTN3460) += ptn3460.o
 obj-$(CONFIG_VIDEO_BRIDGE_ANALOGIX_ANX6345) += anx6345.o
diff --git a/drivers/video/bridge/dp501.c b/drivers/video/bridge/dp501.c
new file mode 100644
index 00..095e3e71fe
--- /dev/null
+++ b/drivers/video/bridge/dp501.c
@@ -0,0 +1,579 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2024 Jonas Schwöbel 
+ * Copyright (C) 2024 Svyatoslav Ryhel 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+/* TOP */
+#define TOPCFG00x00
+#define ROMI2C_PRESCALE0x01
+#define HDCPI2C_PRESCALE   0x02
+#define GPIO   0x03
+#define GPIO_OUT_ENB   0x04
+#define TESTI2C_CTL0x05
+#define I2CMTIMEOUT0x06
+#define TOPCFG10x07
+#define TOPCFG20x08
+#define TOPCFG30x09
+#define TOPCFG40x0A
+#define CLKSWRST   0x0B
+#define CADETB_CTL 0x0C
+
+/* Video Attribute */
+#define HTOTAL_L   0x10
+#define HTOTAL_H   0x11
+#define HSTART_L   0x12
+#define HSTART_H   0x13
+#define HWIDTH_L   0x14
+#define HWIDTH_H   0x15
+#define VTOTAL_L   0x16
+#define VTOTAL_H   0x17
+#define VSTART_L   0x18
+#define VSTART_H   0x19
+#define VHEIGHT_L  0x1A
+#define VHEIGHT_H  0x1B
+#define HSPHSW_L   0x1C
+#define HSPHSW_H   0x1D
+#define VSPVSW_L   0x1E
+#define VSPVSW_H   0x1F
+#define MISC0  0x20
+#define MISC1  0x21
+
+/* Video Capture */
+#define VCAPCTRL0  0x24
+#define VCAPCTRL1  0x25
+#define VCAPCTRL2  0x26
+#define VCAPCTRL3  0x27
+#define VCAPCTRL4  0x28
+#define VCAP_MEASURE   0x29
+
+/* Main Link Control */
+#define NVID_L 0x2C
+#define NVID_M 0x2D
+#define NVID_H 0x2E
+#define LINK_CTRL0 0x2F
+#define LINK_CTRL1 0x30
+#define LINK_DEBUG 0x31
+#define ERR_POS0x32
+#define ERR_PAT0x33
+#define LINK_DEB_SEL   0x34
+#define IDLE_PATTERN   0x35
+#define TU_SIZE0x36
+#define CRC_CTRL   0x37
+#define CRC_OUT0x38
+
+/* AVI-2 InfoFrame */
+#define SD_CTRL0   0x3A
+#define SD_CTRL1   0x3B
+#define SD_HB0 0x3C
+#define SD_HB1 0x3D
+#define SD_HB2 0x3E
+#define SD_HB3 0x3F
+#define SD_DB0 0x40
+#define SD_DB1 0x41
+#define SD_DB2 0x42
+#define SD_DB3 0x43
+#define SD_DB4 0x44
+#define SD_DB5

[PATCH v2 2/7] video: panel: add Samsung LTL106HL02 MIPI DSI panel driver

2024-01-30 Thread Svyatoslav Ryhel
From: Anton Bambura 

LTL106HL02 is a color active matrix TFT (Thin Film Transistor)
liquid crystal display (LCD) that uses amorphous silicon TFT as
switching devices. This model is composed of a TFT LCD panel, a
driver circuit and a backlight unit. The resolution of a 10.6"
contains 1920 x 1080 pixels and can display up to 16,8M color
with wide viewing angle.

Co-developed-by: Jonas Schwöbel 
Signed-off-by: Jonas Schwöbel 
Co-developed-by: Svyatoslav Ryhel 
Signed-off-by: Svyatoslav Ryhel 
Signed-off-by: Anton Bambura 
---
 drivers/video/Kconfig  |   9 ++
 drivers/video/Makefile |   1 +
 drivers/video/samsung-ltl106hl02.c | 157 +
 3 files changed, 167 insertions(+)
 create mode 100644 drivers/video/samsung-ltl106hl02.c

diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 05567a0095..52b515197d 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -555,6 +555,15 @@ config VIDEO_LCD_RENESAS_R69328
  IPS-LCD module with Renesas R69328 IC. The panel has a 720x1280
  resolution and uses 24 bit RGB per pixel.
 
+config VIDEO_LCD_SAMSUNG_LTL106HL02
+   tristate "Samsung LTL106HL02 1920x1080 DSI video mode panel"
+   depends on PANEL && BACKLIGHT
+   select VIDEO_MIPI_DSI
+   help
+ Say Y here if you want to enable support for Samsung LTL106HL02
+ LCD module found in Microsoft Surface 2. The panel has a FullHD
+ resolution (1920x1080).
+
 config VIDEO_LCD_SSD2828
bool "SSD2828 bridge chip"
---help---
diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index bb6d9b74b9..f3f70cd04a 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -63,6 +63,7 @@ obj-$(CONFIG_VIDEO_LCD_ORISETECH_OTM8009A) += 
orisetech_otm8009a.o
 obj-$(CONFIG_VIDEO_LCD_RAYDIUM_RM68200) += raydium-rm68200.o
 obj-$(CONFIG_VIDEO_LCD_RENESAS_R61307) += renesas-r61307.o
 obj-$(CONFIG_VIDEO_LCD_RENESAS_R69328) += renesas-r69328.o
+obj-$(CONFIG_VIDEO_LCD_SAMSUNG_LTL106HL02) += samsung-ltl106hl02.o
 obj-$(CONFIG_VIDEO_LCD_SSD2828) += ssd2828.o
 obj-$(CONFIG_VIDEO_LCD_TDO_TL070WSH30) += tdo-tl070wsh30.o
 obj-$(CONFIG_VIDEO_MCDE_SIMPLE) += mcde_simple.o
diff --git a/drivers/video/samsung-ltl106hl02.c 
b/drivers/video/samsung-ltl106hl02.c
new file mode 100644
index 00..5e6c11c4be
--- /dev/null
+++ b/drivers/video/samsung-ltl106hl02.c
@@ -0,0 +1,157 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Samsung LTL106HL02-001 DSI panel driver
+ *
+ * Copyright (c) 2020 Anton Bambura 
+ * Copyright (c) 2023 Svyatoslav Ryhel 
+ * Copyright (c) 2024 Jonas Schwöbel 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+struct samsung_ltl106hl02_priv {
+   struct udevice *vdd;
+   struct udevice *backlight;
+
+   struct gpio_desc reset_gpio;
+};
+
+static struct display_timing default_timing = {
+   .pixelclock.typ = 13700,
+   .hactive.typ= 1920,
+   .hfront_porch.typ   = 32,
+   .hback_porch.typ= 64,
+   .hsync_len.typ  = 32,
+   .vactive.typ= 1080,
+   .vfront_porch.typ   = 2,
+   .vback_porch.typ= 26,
+   .vsync_len.typ  = 3,
+};
+
+static int samsung_ltl106hl02_enable_backlight(struct udevice *dev)
+{
+   struct mipi_dsi_panel_plat *plat = dev_get_plat(dev);
+   struct mipi_dsi_device *dsi = plat->device;
+   int ret;
+
+   ret = mipi_dsi_dcs_exit_sleep_mode(dsi);
+   if (ret < 0) {
+   log_debug("%s: failed to exit sleep mode: %d\n",
+ __func__, ret);
+   return ret;
+   }
+   mdelay(70);
+
+   ret = mipi_dsi_dcs_set_display_on(dsi);
+   if (ret < 0) {
+   log_debug("%s: failed to enable display: %d\n",
+ __func__, ret);
+   return ret;
+   }
+   mdelay(5);
+
+   return 0;
+}
+
+static int samsung_ltl106hl02_set_backlight(struct udevice *dev, int percent)
+{
+   struct samsung_ltl106hl02_priv *priv = dev_get_priv(dev);
+   int ret;
+
+   ret = backlight_enable(priv->backlight);
+   if (ret)
+   return ret;
+
+   return backlight_set_brightness(priv->backlight, percent);
+}
+
+static int samsung_ltl106hl02_timings(struct udevice *dev,
+ struct display_timing *timing)
+{
+   memcpy(timing, &default_timing, sizeof(*timing));
+   return 0;
+}
+
+static int samsung_ltl106hl02_of_to_plat(struct udevice *dev)
+{
+   struct samsung_ltl106hl02_priv *priv = dev_get_priv(dev);
+   int ret;
+
+   ret = uclass_get_device_by_phandle(UCLASS_PANEL_BACKLIGHT, dev,
+  "backlight", &priv->backlight);
+   if (ret) {
+   log_debug("%s: cannot ge

[PATCH v2 1/7] video: panel: add LG LG070WX3 MIPI DSI panel driver

2024-01-30 Thread Svyatoslav Ryhel
The LD070WX3 is a Color Active Matrix Liquid Crystal Display with
an integral Light Emitting Diode (LED) backlight system. The
matrix employs a-Si Thin Film Transistor as the active element. It
is a transmissive type display operating in the normally Black
mode. This TFT-LCD has 7.0 inches diagonally measured active
display area with WXGA resolution (800 by 1280 pixel array).

Signed-off-by: Svyatoslav Ryhel 
---
 drivers/video/Kconfig   |   8 ++
 drivers/video/Makefile  |   1 +
 drivers/video/lg-ld070wx3.c | 186 
 3 files changed, 195 insertions(+)
 create mode 100644 drivers/video/lg-ld070wx3.c

diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index e2016d73d1..05567a0095 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -522,6 +522,14 @@ config VIDEO_LCD_ORISETECH_OTM8009A
Say Y here if you want to enable support for Orise Technology
otm8009a 480x800 dsi 2dl panel.
 
+config VIDEO_LCD_LG_LD070WX3
+   bool "LD070WX3 DSI LCD panel support"
+   depends on PANEL && BACKLIGHT
+   select VIDEO_MIPI_DSI
+   help
+ Say Y here if you want to enable support for LG LD070WX3
+ 800x1280 DSI video mode panel.
+
 config VIDEO_LCD_RAYDIUM_RM68200
bool "RM68200 DSI LCD panel support"
select VIDEO_MIPI_DSI
diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index fdc2937632..bb6d9b74b9 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -58,6 +58,7 @@ obj-$(CONFIG_VIDEO_LCD_ANX9804) += anx9804.o
 obj-$(CONFIG_VIDEO_LCD_ENDEAVORU) += endeavoru-panel.o
 obj-$(CONFIG_VIDEO_LCD_HIMAX_HX8394) += himax-hx8394.o
 obj-$(CONFIG_VIDEO_LCD_HITACHI_TX18D42VM) += hitachi_tx18d42vm_lcd.o
+obj-$(CONFIG_VIDEO_LCD_LG_LD070WX3) += lg-ld070wx3.o
 obj-$(CONFIG_VIDEO_LCD_ORISETECH_OTM8009A) += orisetech_otm8009a.o
 obj-$(CONFIG_VIDEO_LCD_RAYDIUM_RM68200) += raydium-rm68200.o
 obj-$(CONFIG_VIDEO_LCD_RENESAS_R61307) += renesas-r61307.o
diff --git a/drivers/video/lg-ld070wx3.c b/drivers/video/lg-ld070wx3.c
new file mode 100644
index 00..610a06ffe7
--- /dev/null
+++ b/drivers/video/lg-ld070wx3.c
@@ -0,0 +1,186 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * LG LD070WX3-SL01 DSI panel driver
+ *
+ * Copyright (c) 2023 Svyatoslav Ryhel 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+struct lg_ld070wx3_priv {
+   struct udevice *vdd;
+   struct udevice *vcc;
+
+   struct udevice *backlight;
+};
+
+static struct display_timing default_timing = {
+   .pixelclock.typ = 7000,
+   .hactive.typ= 800,
+   .hfront_porch.typ   = 32,
+   .hback_porch.typ= 48,
+   .hsync_len.typ  = 8,
+   .vactive.typ= 1280,
+   .vfront_porch.typ   = 5,
+   .vback_porch.typ= 3,
+   .vsync_len.typ  = 1,
+};
+
+static void dcs_write_one(struct mipi_dsi_device *dsi, u8 cmd, u8 data)
+{
+   mipi_dsi_dcs_write(dsi, cmd, &data, 1);
+}
+
+static int lg_ld070wx3_enable_backlight(struct udevice *dev)
+{
+   struct mipi_dsi_panel_plat *plat = dev_get_plat(dev);
+   struct mipi_dsi_device *dsi = plat->device;
+   int ret;
+
+   ret = mipi_dsi_dcs_soft_reset(dsi);
+   if (ret < 0) {
+   log_debug("%s: failed to soft reset panel: %d\n",
+ __func__, ret);
+   return ret;
+   }
+
+   /* Delay before sending new command after soft reset */
+   mdelay(20);
+
+   /* Differential input impedance selection */
+   dcs_write_one(dsi, 0xAE, 0x0B);
+
+   /* Enter test mode 1 and 2*/
+   dcs_write_one(dsi, 0xEE, 0xEA);
+   dcs_write_one(dsi, 0xEF, 0x5F);
+
+   /* Increased MIPI CLK driving ability */
+   dcs_write_one(dsi, 0xF2, 0x68);
+
+   /* Exit test mode 1 and 2 */
+   dcs_write_one(dsi, 0xEE, 0x00);
+   dcs_write_one(dsi, 0xEF, 0x00);
+
+   return 0;
+}
+
+static int lg_ld070wx3_set_backlight(struct udevice *dev, int percent)
+{
+   struct lg_ld070wx3_priv *priv = dev_get_priv(dev);
+   int ret;
+
+   ret = backlight_enable(priv->backlight);
+   if (ret)
+   return ret;
+
+   return backlight_set_brightness(priv->backlight, percent);
+}
+
+static int lg_ld070wx3_timings(struct udevice *dev,
+  struct display_timing *timing)
+{
+   memcpy(timing, &default_timing, sizeof(*timing));
+   return 0;
+}
+
+static int lg_ld070wx3_of_to_plat(struct udevice *dev)
+{
+   struct lg_ld070wx3_priv *priv = dev_get_priv(dev);
+   int ret;
+
+   ret = uclass_get_device_by_phandle(UCLASS_PANEL_BACKLIGHT, dev,
+  "backlight", &priv->backlight);
+   if (ret) {
+   log_debug("%s: cannot get backlight: ret = %d\n",
+   

[PATCH v2 0/7] Tegra panel improvements

2024-01-30 Thread Svyatoslav Ryhel
The current patch set improves the logic of existing panels and
bridge used by Tegra 3 devices and brings support for additional
DSI panels used by Tegra 4 devices.

New and existing drivers are fully reusable, contain no device
specific parts, and are written according to existing datasheets.

---
Changes from v1:
- improved ssd2825 code style
- added TC358768 RGB to DSI bridge bringup commit (used by TF700T)
- added Parade DP501 transmitter bringup (used by Lenovo Ideapad Yoga 11)
---

Anton Bambura (1):
  video: panel: add Samsung LTL106HL02 MIPI DSI panel driver

Jonas Schwöbel (1):
  video: bridge: add basic support for the Parade DP501 transmitter

Svyatoslav Ryhel (5):
  video: panel: add LG LG070WX3 MIPI DSI panel driver
  video: bridge: add Toshiba TC358768 RGB to DSI bridge support
  video: endeavoru-panel: shift the init sequence by one step earlier
  video: bridge: ssd2825: shift the init sequence by one step earlier
  video: renesas: shift the init sequence by one step earlier

 drivers/video/Kconfig  |  17 +
 drivers/video/Makefile |   2 +
 drivers/video/bridge/Kconfig   |  19 +
 drivers/video/bridge/Makefile  |   2 +
 drivers/video/bridge/dp501.c   | 579 +
 drivers/video/bridge/ssd2825.c |  86 +--
 drivers/video/bridge/tc358768.c| 985 +
 drivers/video/endeavoru-panel.c| 128 ++--
 drivers/video/lg-ld070wx3.c| 186 ++
 drivers/video/renesas-r61307.c |  93 +--
 drivers/video/renesas-r69328.c |  81 +--
 drivers/video/samsung-ltl106hl02.c | 157 +
 12 files changed, 2155 insertions(+), 180 deletions(-)
 create mode 100644 drivers/video/bridge/dp501.c
 create mode 100644 drivers/video/bridge/tc358768.c
 create mode 100644 drivers/video/lg-ld070wx3.c
 create mode 100644 drivers/video/samsung-ltl106hl02.c

-- 
2.40.1



[PATCH v2 1/1] boot: pxe_utils: skip fdt setup in case legacy kernel is booted

2024-01-25 Thread Svyatoslav Ryhel
Currently, if boot with extlinux.conf and do not set the fdt
U-Boot will provide its own device tree. This behavior is
beneficial if the U-Boot device tree is in sync with Linux,
but it totally halts the booting of pre-dtb kernels (3.4 for
example) since it uses ATAGs. To fix this, pass `-` in the
fdt extlinux field as a signal that no tree should be used.

Suggested-by: Jonas Schwöbel 
Tested-by: Jethro Bull 
Signed-off-by: Svyatoslav Ryhel 
---
 boot/pxe_utils.c   | 27 ++-
 doc/develop/distro.rst |  6 ++
 2 files changed, 28 insertions(+), 5 deletions(-)

diff --git a/boot/pxe_utils.c b/boot/pxe_utils.c
index 83bc167785..9620562675 100644
--- a/boot/pxe_utils.c
+++ b/boot/pxe_utils.c
@@ -634,7 +634,12 @@ static int label_boot(struct pxe_context *ctx, struct 
pxe_label *label)
char *fdtfilefree = NULL;
 
if (label->fdt) {
-   fdtfile = label->fdt;
+   if (IS_ENABLED(CONFIG_SUPPORT_PASSING_ATAGS)) {
+   if (strcmp("-", label->fdt))
+   fdtfile = label->fdt;
+   } else {
+   fdtfile = label->fdt;
+   }
} else if (label->fdtdir) {
char *f1, *f2, *f3, *f4, *slash;
 
@@ -731,14 +736,26 @@ static int label_boot(struct pxe_context *ctx, struct 
pxe_label *label)
zboot_argc = 5;
}
 
-   if (!bootm_argv[3])
-   bootm_argv[3] = env_get("fdt_addr");
+   if (!bootm_argv[3]) {
+   if (IS_ENABLED(CONFIG_SUPPORT_PASSING_ATAGS)) {
+   if (strcmp("-", label->fdt))
+   bootm_argv[3] = env_get("fdt_addr");
+   } else {
+   bootm_argv[3] = env_get("fdt_addr");
+   }
+   }
 
kernel_addr_r = genimg_get_kernel_addr(kernel_addr);
buf = map_sysmem(kernel_addr_r, 0);
 
-   if (!bootm_argv[3] && genimg_get_format(buf) != IMAGE_FORMAT_FIT)
-   bootm_argv[3] = env_get("fdtcontroladdr");
+   if (!bootm_argv[3] && genimg_get_format(buf) != IMAGE_FORMAT_FIT) {
+   if (IS_ENABLED(CONFIG_SUPPORT_PASSING_ATAGS)) {
+   if (strcmp("-", label->fdt))
+   bootm_argv[3] = env_get("fdtcontroladdr");
+   } else {
+   bootm_argv[3] = env_get("fdtcontroladdr");
+   }
+   }
 
if (bootm_argv[3]) {
if (!bootm_argv[2])
diff --git a/doc/develop/distro.rst b/doc/develop/distro.rst
index 8016acad09..9e715b23eb 100644
--- a/doc/develop/distro.rst
+++ b/doc/develop/distro.rst
@@ -81,6 +81,12 @@ as specified at `Boot Loader Specification`_:
 * Does not document the fdtdir option, which automatically selects the DTB to
   pass to the kernel.
 
+* If no fdt/fdtdir is provided, the U-Boot will pass its own currently used
+  device tree.
+
+* If ``-`` is passed as fdt argument and ``CONFIG_SUPPORT_PASSING_ATAGS`` is
+  enabled, then no device tree will be used (legacy booting / pre-dtb kernel).
+
 See also doc/README.pxe under 'pxe file format'.
 
 One example extlinux.conf generated by the Fedora installer is::
-- 
2.40.1



[PATCH v2 0/1] Fix booting kernels with ATAGS and extlinux

2024-01-25 Thread Svyatoslav Ryhel
Currently, if boot with extlinux.conf and do not set the fdt
U-Boot will provide its own device tree. This behavior is
beneficial if the U-Boot device tree is in sync with Linux,
but it totally halts the booting of pre-dtb kernels (3.4 for
example) since it uses ATAGs. To fix this, pass `-` in the
fdt extlinux field as a signal that no tree should be used.

Tested with 3.4 legacy kernel and mainline 6.7 kernel on
P895 (lg_x3 board).

---
Changes form v1
 - Added CONFIG guards
 - Clarified documentation
---

Svyatoslav Ryhel (1):
  boot: pxe_utils: skip fdt setup in case legacy kernel is booted

 boot/pxe_utils.c   | 27 ++-
 doc/develop/distro.rst |  6 ++
 2 files changed, 28 insertions(+), 5 deletions(-)

-- 
2.40.1



Re: [PATCH v1 0/1] Fix booting kernels with ATAGS and extlinux

2024-01-25 Thread Svyatoslav



25 січня 2024 р. 16:47:48 GMT+02:00, Tom Rini  написав(-ла):
>On Thu, Jan 25, 2024 at 04:34:41PM +0200, Svyatoslav wrote:
>> 
>> 
>> 25 січня 2024 р. 16:17:34 GMT+02:00, Tom Rini  
>> написав(-ла):
>> >On Thu, Jan 25, 2024 at 04:16:11PM +0200, Svyatoslav wrote:
>> >> 
>> >> 
>> >> 25 січня 2024 р. 16:12:36 GMT+02:00, Tom Rini  
>> >> написав(-ла):
>> >> >On Thu, Jan 25, 2024 at 08:51:09AM +0200, Svyatoslav wrote:
>> >> >> 
>> >> >> 
>> >> >> 25 січня 2024 р. 08:29:54 GMT+02:00, Dan Carpenter 
>> >> >>  написав(-ла):
>> >> >> >On Wed, Jan 24, 2024 at 10:27:30PM +0200, Svyatoslav Ryhel wrote:
>> >> >> >> Currently, if boot with extlinux.conf and do not set the fdt
>> >> >> >> U-Boot will provide its own device tree. This behavior is
>> >> >> >> beneficial if the U-Boot device tree is in sync with Linux,
>> >> >> >> but it totally halts the booting of pre-dtb kernels (3.4 for
>> >> >> >> example) since it uses ATAGs. To fix this, pass `-` in the
>> >> >> >> fdt extlinux field as a signal that no tree should be used.
>> >> >> >
>> >> >> >Passing - doesn't seem like the most intuitive thing...  Is there a
>> >> >> >different argument we could use?
>> >> >> >
>> >> >> 
>> >> >> I agree that `-` is not the most intuitive argument,
>> >> >> but this is a way to implement a fix with the least
>> >> >> code posssible. To make this less obscure I have
>> >> >> adjusted documentation. 
>> >> >
>> >> >It's also how historically we do similar things. eg, "bootm
>> >> >$kernel_addr_r - $fdt_addr_r". My question is can we re-work this,
>> >> >cleanly, with guards around SUPPORT_PASSING_ATAGS to not increase size
>> >> >anywhere that doesn't need this legacy case.
>> >> >
>> >> 
>> >> Which behavior you propose?
>> >
>> >Well, using the IS_ENABLED macro with the new tests around "-".
>> >
>> 
>> So using "-" for booting with extlinux with ATAGs is fine for you?
>> Guards, sure, I will handle this. Which tests you are interested in?
>> Maybe you can point to an example? Thanks.
>
>Sorry, I meant tests in terms of writing the code, not unit tests as no,
>we don't have enough unit tests around booting a kernel as it stands and
>I don't see how to just add a test for extlinux + legacy kernel.
>

Alright then, thanks!


Re: [PATCH v1 0/1] Fix booting kernels with ATAGS and extlinux

2024-01-25 Thread Svyatoslav



25 січня 2024 р. 16:17:34 GMT+02:00, Tom Rini  написав(-ла):
>On Thu, Jan 25, 2024 at 04:16:11PM +0200, Svyatoslav wrote:
>> 
>> 
>> 25 січня 2024 р. 16:12:36 GMT+02:00, Tom Rini  
>> написав(-ла):
>> >On Thu, Jan 25, 2024 at 08:51:09AM +0200, Svyatoslav wrote:
>> >> 
>> >> 
>> >> 25 січня 2024 р. 08:29:54 GMT+02:00, Dan Carpenter 
>> >>  написав(-ла):
>> >> >On Wed, Jan 24, 2024 at 10:27:30PM +0200, Svyatoslav Ryhel wrote:
>> >> >> Currently, if boot with extlinux.conf and do not set the fdt
>> >> >> U-Boot will provide its own device tree. This behavior is
>> >> >> beneficial if the U-Boot device tree is in sync with Linux,
>> >> >> but it totally halts the booting of pre-dtb kernels (3.4 for
>> >> >> example) since it uses ATAGs. To fix this, pass `-` in the
>> >> >> fdt extlinux field as a signal that no tree should be used.
>> >> >
>> >> >Passing - doesn't seem like the most intuitive thing...  Is there a
>> >> >different argument we could use?
>> >> >
>> >> 
>> >> I agree that `-` is not the most intuitive argument,
>> >> but this is a way to implement a fix with the least
>> >> code posssible. To make this less obscure I have
>> >> adjusted documentation. 
>> >
>> >It's also how historically we do similar things. eg, "bootm
>> >$kernel_addr_r - $fdt_addr_r". My question is can we re-work this,
>> >cleanly, with guards around SUPPORT_PASSING_ATAGS to not increase size
>> >anywhere that doesn't need this legacy case.
>> >
>> 
>> Which behavior you propose?
>
>Well, using the IS_ENABLED macro with the new tests around "-".
>

So using "-" for booting with extlinux with ATAGs is fine for you? Guards, 
sure, I will handle this. Which tests you are interested in? Maybe you can 
point to an example? Thanks.


Re: [PATCH v1 0/1] Fix booting kernels with ATAGS and extlinux

2024-01-25 Thread Svyatoslav



25 січня 2024 р. 16:12:36 GMT+02:00, Tom Rini  написав(-ла):
>On Thu, Jan 25, 2024 at 08:51:09AM +0200, Svyatoslav wrote:
>> 
>> 
>> 25 січня 2024 р. 08:29:54 GMT+02:00, Dan Carpenter 
>>  написав(-ла):
>> >On Wed, Jan 24, 2024 at 10:27:30PM +0200, Svyatoslav Ryhel wrote:
>> >> Currently, if boot with extlinux.conf and do not set the fdt
>> >> U-Boot will provide its own device tree. This behavior is
>> >> beneficial if the U-Boot device tree is in sync with Linux,
>> >> but it totally halts the booting of pre-dtb kernels (3.4 for
>> >> example) since it uses ATAGs. To fix this, pass `-` in the
>> >> fdt extlinux field as a signal that no tree should be used.
>> >
>> >Passing - doesn't seem like the most intuitive thing...  Is there a
>> >different argument we could use?
>> >
>> 
>> I agree that `-` is not the most intuitive argument,
>> but this is a way to implement a fix with the least
>> code posssible. To make this less obscure I have
>> adjusted documentation. 
>
>It's also how historically we do similar things. eg, "bootm
>$kernel_addr_r - $fdt_addr_r". My question is can we re-work this,
>cleanly, with guards around SUPPORT_PASSING_ATAGS to not increase size
>anywhere that doesn't need this legacy case.
>

Which behavior you propose?


Re: [PATCH v1 0/1] Fix booting kernels with ATAGS and extlinux

2024-01-24 Thread Svyatoslav



25 січня 2024 р. 08:29:54 GMT+02:00, Dan Carpenter  
написав(-ла):
>On Wed, Jan 24, 2024 at 10:27:30PM +0200, Svyatoslav Ryhel wrote:
>> Currently, if boot with extlinux.conf and do not set the fdt
>> U-Boot will provide its own device tree. This behavior is
>> beneficial if the U-Boot device tree is in sync with Linux,
>> but it totally halts the booting of pre-dtb kernels (3.4 for
>> example) since it uses ATAGs. To fix this, pass `-` in the
>> fdt extlinux field as a signal that no tree should be used.
>
>Passing - doesn't seem like the most intuitive thing...  Is there a
>different argument we could use?
>

I agree that `-` is not the most intuitive argument,
but this is a way to implement a fix with the least
code posssible. To make this less obscure I have
adjusted documentation. 

Currently if no fdt is specified u-boot will pass its
own device tree and if leave fdt field blank u-boot
will fail with the wrong name for the device tree.
So there is NO way to boot ATAGs based kernel
if u-boot has an appended tree and fdt support 
built in.

>regards,
>dan carpenter
>


[PATCH v1 1/1] boot: pxe_utils: skip fdt setup in case legacy kernel is booted

2024-01-24 Thread Svyatoslav Ryhel
Currently, if boot with extlinux.conf and do not set the fdt
U-Boot will provide its own device tree. This behavior is
beneficial if the U-Boot device tree is in sync with Linux,
but it totally halts the booting of pre-dtb kernels (3.4 for
example) since it uses ATAGs. To fix this, pass `-` in the
fdt extlinux field as a signal that no tree should be used.

Suggested-by: Jonas Schwöbel 
Tested-by: Jethro Bull 
Signed-off-by: Svyatoslav Ryhel 
---
 boot/pxe_utils.c   | 8 +---
 doc/develop/distro.rst | 3 +++
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/boot/pxe_utils.c b/boot/pxe_utils.c
index 83bc167785..6a2c881965 100644
--- a/boot/pxe_utils.c
+++ b/boot/pxe_utils.c
@@ -634,7 +634,8 @@ static int label_boot(struct pxe_context *ctx, struct 
pxe_label *label)
char *fdtfilefree = NULL;
 
if (label->fdt) {
-   fdtfile = label->fdt;
+   if (strcmp("-", label->fdt))
+   fdtfile = label->fdt;
} else if (label->fdtdir) {
char *f1, *f2, *f3, *f4, *slash;
 
@@ -731,13 +732,14 @@ static int label_boot(struct pxe_context *ctx, struct 
pxe_label *label)
zboot_argc = 5;
}
 
-   if (!bootm_argv[3])
+   if (!bootm_argv[3] && strcmp("-", label->fdt))
bootm_argv[3] = env_get("fdt_addr");
 
kernel_addr_r = genimg_get_kernel_addr(kernel_addr);
buf = map_sysmem(kernel_addr_r, 0);
 
-   if (!bootm_argv[3] && genimg_get_format(buf) != IMAGE_FORMAT_FIT)
+   if (!bootm_argv[3] && genimg_get_format(buf) != IMAGE_FORMAT_FIT &&
+   strcmp("-", label->fdt))
bootm_argv[3] = env_get("fdtcontroladdr");
 
if (bootm_argv[3]) {
diff --git a/doc/develop/distro.rst b/doc/develop/distro.rst
index 8016acad09..c81da8a0fd 100644
--- a/doc/develop/distro.rst
+++ b/doc/develop/distro.rst
@@ -81,6 +81,9 @@ as specified at `Boot Loader Specification`_:
 * Does not document the fdtdir option, which automatically selects the DTB to
   pass to the kernel.
 
+* If no fdt/fdtdir is provided, the U-Boot will pass its own device tree, and
+  if fdt is passed with ``-``, then device tree will not be used (legacy 
booting).
+
 See also doc/README.pxe under 'pxe file format'.
 
 One example extlinux.conf generated by the Fedora installer is::
-- 
2.40.1



[PATCH v1 0/1] Fix booting kernels with ATAGS and extlinux

2024-01-24 Thread Svyatoslav Ryhel
Currently, if boot with extlinux.conf and do not set the fdt
U-Boot will provide its own device tree. This behavior is
beneficial if the U-Boot device tree is in sync with Linux,
but it totally halts the booting of pre-dtb kernels (3.4 for
example) since it uses ATAGs. To fix this, pass `-` in the
fdt extlinux field as a signal that no tree should be used.

Tested with 3.4 legacy kernel and mainline 6.7 kernel on
P895 (lg_x3 board).

Svyatoslav Ryhel (1):
  boot: pxe_utils: skip fdt setup in case legacy kernel is booted

 boot/pxe_utils.c   | 8 +---
 doc/develop/distro.rst | 3 +++
 2 files changed, 8 insertions(+), 3 deletions(-)

-- 
2.40.1



[PATCH v1 5/5] video: renesas: shift the init sequence by one step earlier

2024-01-23 Thread Svyatoslav Ryhel
Shift all setup stages one step earlier to better fit the
existing uclass.

Signed-off-by: Svyatoslav Ryhel 
---
 drivers/video/renesas-r61307.c | 93 +++---
 drivers/video/renesas-r69328.c | 81 +++--
 2 files changed, 95 insertions(+), 79 deletions(-)

diff --git a/drivers/video/renesas-r61307.c b/drivers/video/renesas-r61307.c
index 426fdc6224..1eccaf6b1b 100644
--- a/drivers/video/renesas-r61307.c
+++ b/drivers/video/renesas-r61307.c
@@ -118,42 +118,6 @@ static struct display_timing default_timing = {
 };
 
 static int renesas_r61307_enable_backlight(struct udevice *dev)
-{
-   struct renesas_r61307_priv *priv = dev_get_priv(dev);
-   int ret;
-
-   ret = regulator_set_enable_if_allowed(priv->vcc, 1);
-   if (ret) {
-   log_err("enabling vcc-supply failed (%d)\n", ret);
-   return ret;
-   }
-   mdelay(5);
-
-   ret = regulator_set_enable_if_allowed(priv->iovcc, 1);
-   if (ret) {
-   log_err("enabling iovcc-supply failed (%d)\n", ret);
-   return ret;
-   }
-
-   ret = dm_gpio_set_value(&priv->reset_gpio, 0);
-   if (ret) {
-   log_err("changing reset-gpio failed (%d)\n", ret);
-   return ret;
-   }
-   mdelay(5);
-
-   ret = dm_gpio_set_value(&priv->reset_gpio, 1);
-   if (ret) {
-   log_err("changing reset-gpio failed (%d)\n", ret);
-   return ret;
-   }
-
-   mdelay(5);
-
-   return 0;
-}
-
-static int renesas_r61307_set_backlight(struct udevice *dev, int percent)
 {
struct renesas_r61307_priv *priv = dev_get_priv(dev);
struct mipi_dsi_panel_plat *plat = dev_get_plat(dev);
@@ -205,18 +169,23 @@ static int renesas_r61307_set_backlight(struct udevice 
*dev, int percent)
log_err("failed to set display on: %d\n", ret);
return ret;
}
-
mdelay(50);
 
+   return 0;
+}
+
+static int renesas_r61307_set_backlight(struct udevice *dev, int percent)
+{
+   struct renesas_r61307_priv *priv = dev_get_priv(dev);
+   int ret;
+
ret = backlight_enable(priv->backlight);
if (ret)
return ret;
 
-   ret = backlight_set_brightness(priv->backlight, percent);
-   if (ret)
-   return ret;
+   mdelay(5);
 
-   return 0;
+   return backlight_set_brightness(priv->backlight, percent);
 }
 
 static int renesas_r61307_timings(struct udevice *dev,
@@ -266,6 +235,46 @@ static int renesas_r61307_of_to_plat(struct udevice *dev)
return 0;
 }
 
+static int renesas_r61307_hw_init(struct udevice *dev)
+{
+   struct renesas_r61307_priv *priv = dev_get_priv(dev);
+   int ret;
+
+   ret = regulator_set_enable_if_allowed(priv->vcc, 1);
+   if (ret) {
+   log_debug("%s: enabling vcc-supply failed (%d)\n",
+ __func__, ret);
+   return ret;
+   }
+   mdelay(5);
+
+   ret = regulator_set_enable_if_allowed(priv->iovcc, 1);
+   if (ret) {
+   log_debug("%s: enabling iovcc-supply failed (%d)\n",
+ __func__, ret);
+   return ret;
+   }
+
+   ret = dm_gpio_set_value(&priv->reset_gpio, 0);
+   if (ret) {
+   log_debug("%s: changing reset-gpio failed (%d)\n",
+ __func__, ret);
+   return ret;
+   }
+   mdelay(5);
+
+   ret = dm_gpio_set_value(&priv->reset_gpio, 1);
+   if (ret) {
+   log_debug("%s: changing reset-gpio failed (%d)\n",
+ __func__, ret);
+   return ret;
+   }
+
+   mdelay(5);
+
+   return 0;
+}
+
 static int renesas_r61307_probe(struct udevice *dev)
 {
struct mipi_dsi_panel_plat *plat = dev_get_plat(dev);
@@ -275,7 +284,7 @@ static int renesas_r61307_probe(struct udevice *dev)
plat->format = MIPI_DSI_FMT_RGB888;
plat->mode_flags = MIPI_DSI_MODE_VIDEO;
 
-   return 0;
+   return renesas_r61307_hw_init(dev);
 }
 
 static const struct panel_ops renesas_r61307_ops = {
diff --git a/drivers/video/renesas-r69328.c b/drivers/video/renesas-r69328.c
index d2f7169468..ecf89ec021 100644
--- a/drivers/video/renesas-r69328.c
+++ b/drivers/video/renesas-r69328.c
@@ -65,37 +65,6 @@ static struct display_timing default_timing = {
 
 static int renesas_r69328_enable_backlight(struct udevice *dev)
 {
-   struct renesas_r69328_priv *priv = dev_get_priv(dev);
-   int ret;
-
-   ret = dm_gpio_set_value(&priv->enable_gpio, 1);
-   if (ret) {
-   log_err("error changing enable-gpios (%d)\n", ret);
-   return ret;
-   }
-   mdelay(5);
-
-   ret = dm_gpio_set_value(&priv->reset_gpio, 0);
-  

[PATCH v1 4/5] video: bridge: ssd2825: shift the init sequence by one step earlier

2024-01-23 Thread Svyatoslav Ryhel
Shift all setup stages one step earlier to better fit the
existing uclass.

Signed-off-by: Svyatoslav Ryhel 
---
 drivers/video/bridge/ssd2825.c | 82 +++---
 1 file changed, 46 insertions(+), 36 deletions(-)

diff --git a/drivers/video/bridge/ssd2825.c b/drivers/video/bridge/ssd2825.c
index cea20dcffa..9783e9e05a 100644
--- a/drivers/video/bridge/ssd2825.c
+++ b/drivers/video/bridge/ssd2825.c
@@ -351,38 +351,6 @@ static int ssd2825_bridge_enable_panel(struct udevice *dev)
struct display_timing *dt = &priv->timing;
int ret;
 
-   ret = clk_prepare_enable(priv->tx_clk);
-   if (ret) {
-   log_err("error enabling tx_clk (%d)\n", ret);
-   return ret;
-   }
-
-   ret = dm_gpio_set_value(&priv->power_gpio, 1);
-   if (ret) {
-   log_err("error changing power-gpios (%d)\n", ret);
-   return ret;
-   }
-   mdelay(10);
-
-   ret = dm_gpio_set_value(&priv->reset_gpio, 0);
-   if (ret) {
-   log_err("error changing reset-gpios (%d)\n", ret);
-   return ret;
-   }
-   mdelay(10);
-
-   ret = dm_gpio_set_value(&priv->reset_gpio, 1);
-   if (ret) {
-   log_err("error changing reset-gpios (%d)\n", ret);
-   return ret;
-   }
-   mdelay(10);
-
-   /* Perform panel HW setup */
-   ret = panel_enable_backlight(priv->panel);
-   if (ret)
-   return ret;
-
/* Perform SW reset */
ssd2825_write_register(dev, SSD2825_OPERATION_CTRL_REG, 0x0100);
 
@@ -417,8 +385,8 @@ static int ssd2825_bridge_enable_panel(struct udevice *dev)
   SSD2825_CONF_REG_ECD | SSD2825_CONF_REG_EOT);
ssd2825_write_register(dev, SSD2825_VC_CTRL_REG, 0x);
 
-   /* Set up SW panel configuration */
-   ret = panel_set_backlight(priv->panel, BACKLIGHT_DEFAULT);
+   /* Perform panel setup */
+   ret = panel_enable_backlight(priv->panel);
if (ret)
return ret;
 
@@ -427,7 +395,10 @@ static int ssd2825_bridge_enable_panel(struct udevice *dev)
 
 static int ssd2825_bridge_set_panel(struct udevice *dev, int percent)
 {
-   return 0;
+   struct ssd2825_bridge_priv *priv = dev_get_priv(dev);
+
+   /* Set up SW panel configuration */
+   return panel_set_backlight(priv->panel, percent);
 }
 
 static int ssd2825_bridge_panel_timings(struct udevice *dev,
@@ -440,6 +411,45 @@ static int ssd2825_bridge_panel_timings(struct udevice 
*dev,
return 0;
 }
 
+static int ssd2825_bridge_hw_init(struct udevice *dev)
+{
+   struct ssd2825_bridge_priv *priv = dev_get_priv(dev);
+   int ret;
+
+   ret = clk_prepare_enable(priv->tx_clk);
+   if (ret) {
+   log_debug("%s: error enabling tx_clk (%d)\n",
+ __func__, ret);
+   return ret;
+   }
+
+   ret = dm_gpio_set_value(&priv->power_gpio, 1);
+   if (ret) {
+   log_debug("%s: error changing power-gpios (%d)\n",
+ __func__, ret);
+   return ret;
+   }
+   mdelay(10);
+
+   ret = dm_gpio_set_value(&priv->reset_gpio, 0);
+   if (ret) {
+   log_debug("%s: error changing reset-gpios (%d)\n",
+ __func__, ret);
+   return ret;
+   }
+   mdelay(10);
+
+   ret = dm_gpio_set_value(&priv->reset_gpio, 1);
+   if (ret) {
+   log_debug("%s: error changing reset-gpios (%d)\n",
+ __func__, ret);
+   return ret;
+   }
+   mdelay(10);
+
+   return 0;
+}
+
 static int ssd2825_bridge_probe(struct udevice *dev)
 {
struct ssd2825_bridge_priv *priv = dev_get_priv(dev);
@@ -496,7 +506,7 @@ static int ssd2825_bridge_probe(struct udevice *dev)
return PTR_ERR(priv->tx_clk);
}
 
-   return 0;
+   return ssd2825_bridge_hw_init(dev);
 }
 
 static const struct panel_ops ssd2825_bridge_ops = {
-- 
2.40.1



[PATCH v1 3/5] video: endeavoru-panel: shift the init sequence by one step earlier

2024-01-23 Thread Svyatoslav Ryhel
Shift all setup stages one step earlier to better fit the
existing uclass.

Signed-off-by: Svyatoslav Ryhel 
---
 drivers/video/endeavoru-panel.c | 128 +---
 1 file changed, 68 insertions(+), 60 deletions(-)

diff --git a/drivers/video/endeavoru-panel.c b/drivers/video/endeavoru-panel.c
index 79a272128b..1bff641434 100644
--- a/drivers/video/endeavoru-panel.c
+++ b/drivers/video/endeavoru-panel.c
@@ -57,61 +57,8 @@ static void dcs_write_one(struct mipi_dsi_device *dsi, u8 
cmd, u8 data)
 
 static int endeavoru_panel_enable_backlight(struct udevice *dev)
 {
-   struct endeavoru_panel_priv *priv = dev_get_priv(dev);
-   int ret;
-
-   ret = dm_gpio_set_value(&priv->reset_gpio, 1);
-   if (ret) {
-   log_err("error changing reset-gpios (%d)\n", ret);
-   return ret;
-   }
-   mdelay(5);
-
-   ret = regulator_set_enable_if_allowed(priv->vddio, 1);
-   if (ret) {
-   log_err("error enabling iovcc-supply (%d)\n", ret);
-   return ret;
-   }
-   mdelay(1);
-
-   ret = regulator_set_enable_if_allowed(priv->vdd, 1);
-   if (ret) {
-   log_err("error enabling vcc-supply (%d)\n", ret);
-   return ret;
-   }
-   mdelay(20);
-
-   ret = dm_gpio_set_value(&priv->reset_gpio, 0);
-   if (ret) {
-   log_err("error changing reset-gpios (%d)\n", ret);
-   return ret;
-   }
-   mdelay(2);
-
-   /* Reset panel */
-   ret = dm_gpio_set_value(&priv->reset_gpio, 1);
-   if (ret) {
-   log_err("error changing reset-gpios (%d)\n", ret);
-   return ret;
-   }
-   mdelay(1);
-
-   ret = dm_gpio_set_value(&priv->reset_gpio, 0);
-   if (ret) {
-   log_err("error changing reset-gpios (%d)\n", ret);
-   return ret;
-   }
-   mdelay(25);
-
-   return 0;
-}
-
-static int endeavoru_panel_set_backlight(struct udevice *dev, int percent)
-{
-   struct endeavoru_panel_priv *priv = dev_get_priv(dev);
struct mipi_dsi_panel_plat *plat = dev_get_plat(dev);
struct mipi_dsi_device *dsi = plat->device;
-   int ret;
 
dcs_write_one(dsi, 0xc2, 0x08);
 
@@ -160,18 +107,22 @@ static int endeavoru_panel_set_backlight(struct udevice 
*dev, int percent)
dcs_write_one(dsi, 0x55, 0x80);
dcs_write_one(dsi, 0x5e, 0x06);
 
-   ret = backlight_enable(priv->backlight);
-   if (ret)
-   return ret;
-
/* Set backlight */
dcs_write_one(dsi, 0x51, 0x96);
 
-   ret = backlight_set_brightness(priv->backlight, percent);
+   return 0;
+}
+
+static int endeavoru_panel_set_backlight(struct udevice *dev, int percent)
+{
+   struct endeavoru_panel_priv *priv = dev_get_priv(dev);
+   int ret;
+
+   ret = backlight_enable(priv->backlight);
if (ret)
return ret;
 
-   return 0;
+   return backlight_set_brightness(priv->backlight, percent);
 }
 
 static int endeavoru_panel_timings(struct udevice *dev,
@@ -217,6 +168,63 @@ static int endeavoru_panel_of_to_plat(struct udevice *dev)
return 0;
 }
 
+static int endeavoru_panel_hw_init(struct udevice *dev)
+{
+   struct endeavoru_panel_priv *priv = dev_get_priv(dev);
+   int ret;
+
+   ret = dm_gpio_set_value(&priv->reset_gpio, 1);
+   if (ret) {
+   log_debug("%s: error changing reset-gpios (%d)\n",
+ __func__, ret);
+   return ret;
+   }
+   mdelay(5);
+
+   ret = regulator_set_enable_if_allowed(priv->vddio, 1);
+   if (ret) {
+   log_debug("%s: error enabling iovcc-supply (%d)\n",
+ __func__, ret);
+   return ret;
+   }
+   mdelay(1);
+
+   ret = regulator_set_enable_if_allowed(priv->vdd, 1);
+   if (ret) {
+   log_debug("%s: error enabling vcc-supply (%d)\n",
+ __func__, ret);
+   return ret;
+   }
+   mdelay(20);
+
+   ret = dm_gpio_set_value(&priv->reset_gpio, 0);
+   if (ret) {
+   log_debug("%s: error changing reset-gpios (%d)\n",
+ __func__, ret);
+   return ret;
+   }
+   mdelay(2);
+
+   /* Reset panel */
+   ret = dm_gpio_set_value(&priv->reset_gpio, 1);
+   if (ret) {
+   log_debug("%s: error changing reset-gpios (%d)\n",
+ __func__, ret);
+   return ret;
+   }
+   mdelay(1);
+
+   ret = dm_gpio_set_value(&priv->reset_gpio, 0);
+   if (ret) {
+   log_debug("%s: error changing reset-gpios (%d)\n",
+ __func__, ret);
+   

[PATCH v1 2/5] video: panel: add Samsung LTL106HL02 MIPI DSI panel driver

2024-01-23 Thread Svyatoslav Ryhel
From: Anton Bambura 

LTL106HL02 is a color active matrix TFT (Thin Film Transistor)
liquid crystal display (LCD) that uses amorphous silicon TFT as
switching devices. This model is composed of a TFT LCD panel, a
driver circuit and a backlight unit. The resolution of a 10.6"
contains 1920 x 1080 pixels and can display up to 16,8M color
with wide viewing angle.

Co-developed-by: Jonas Schwöbel 
Signed-off-by: Jonas Schwöbel 
Co-developed-by: Svyatoslav Ryhel 
Signed-off-by: Svyatoslav Ryhel 
Signed-off-by: Anton Bambura 
---
 drivers/video/Kconfig  |   9 ++
 drivers/video/Makefile |   1 +
 drivers/video/samsung-ltl106hl02.c | 157 +
 3 files changed, 167 insertions(+)
 create mode 100644 drivers/video/samsung-ltl106hl02.c

diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 05567a0095..52b515197d 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -555,6 +555,15 @@ config VIDEO_LCD_RENESAS_R69328
  IPS-LCD module with Renesas R69328 IC. The panel has a 720x1280
  resolution and uses 24 bit RGB per pixel.
 
+config VIDEO_LCD_SAMSUNG_LTL106HL02
+   tristate "Samsung LTL106HL02 1920x1080 DSI video mode panel"
+   depends on PANEL && BACKLIGHT
+   select VIDEO_MIPI_DSI
+   help
+ Say Y here if you want to enable support for Samsung LTL106HL02
+ LCD module found in Microsoft Surface 2. The panel has a FullHD
+ resolution (1920x1080).
+
 config VIDEO_LCD_SSD2828
bool "SSD2828 bridge chip"
---help---
diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index bb6d9b74b9..f3f70cd04a 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -63,6 +63,7 @@ obj-$(CONFIG_VIDEO_LCD_ORISETECH_OTM8009A) += 
orisetech_otm8009a.o
 obj-$(CONFIG_VIDEO_LCD_RAYDIUM_RM68200) += raydium-rm68200.o
 obj-$(CONFIG_VIDEO_LCD_RENESAS_R61307) += renesas-r61307.o
 obj-$(CONFIG_VIDEO_LCD_RENESAS_R69328) += renesas-r69328.o
+obj-$(CONFIG_VIDEO_LCD_SAMSUNG_LTL106HL02) += samsung-ltl106hl02.o
 obj-$(CONFIG_VIDEO_LCD_SSD2828) += ssd2828.o
 obj-$(CONFIG_VIDEO_LCD_TDO_TL070WSH30) += tdo-tl070wsh30.o
 obj-$(CONFIG_VIDEO_MCDE_SIMPLE) += mcde_simple.o
diff --git a/drivers/video/samsung-ltl106hl02.c 
b/drivers/video/samsung-ltl106hl02.c
new file mode 100644
index 00..5e6c11c4be
--- /dev/null
+++ b/drivers/video/samsung-ltl106hl02.c
@@ -0,0 +1,157 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Samsung LTL106HL02-001 DSI panel driver
+ *
+ * Copyright (c) 2020 Anton Bambura 
+ * Copyright (c) 2023 Svyatoslav Ryhel 
+ * Copyright (c) 2024 Jonas Schwöbel 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+struct samsung_ltl106hl02_priv {
+   struct udevice *vdd;
+   struct udevice *backlight;
+
+   struct gpio_desc reset_gpio;
+};
+
+static struct display_timing default_timing = {
+   .pixelclock.typ = 13700,
+   .hactive.typ= 1920,
+   .hfront_porch.typ   = 32,
+   .hback_porch.typ= 64,
+   .hsync_len.typ  = 32,
+   .vactive.typ= 1080,
+   .vfront_porch.typ   = 2,
+   .vback_porch.typ= 26,
+   .vsync_len.typ  = 3,
+};
+
+static int samsung_ltl106hl02_enable_backlight(struct udevice *dev)
+{
+   struct mipi_dsi_panel_plat *plat = dev_get_plat(dev);
+   struct mipi_dsi_device *dsi = plat->device;
+   int ret;
+
+   ret = mipi_dsi_dcs_exit_sleep_mode(dsi);
+   if (ret < 0) {
+   log_debug("%s: failed to exit sleep mode: %d\n",
+ __func__, ret);
+   return ret;
+   }
+   mdelay(70);
+
+   ret = mipi_dsi_dcs_set_display_on(dsi);
+   if (ret < 0) {
+   log_debug("%s: failed to enable display: %d\n",
+ __func__, ret);
+   return ret;
+   }
+   mdelay(5);
+
+   return 0;
+}
+
+static int samsung_ltl106hl02_set_backlight(struct udevice *dev, int percent)
+{
+   struct samsung_ltl106hl02_priv *priv = dev_get_priv(dev);
+   int ret;
+
+   ret = backlight_enable(priv->backlight);
+   if (ret)
+   return ret;
+
+   return backlight_set_brightness(priv->backlight, percent);
+}
+
+static int samsung_ltl106hl02_timings(struct udevice *dev,
+ struct display_timing *timing)
+{
+   memcpy(timing, &default_timing, sizeof(*timing));
+   return 0;
+}
+
+static int samsung_ltl106hl02_of_to_plat(struct udevice *dev)
+{
+   struct samsung_ltl106hl02_priv *priv = dev_get_priv(dev);
+   int ret;
+
+   ret = uclass_get_device_by_phandle(UCLASS_PANEL_BACKLIGHT, dev,
+  "backlight", &priv->backlight);
+   if (ret) {
+   log_debug("%s: cannot ge

[PATCH v1 1/5] video: panel: add LG LG070WX3 MIPI DSI panel driver

2024-01-23 Thread Svyatoslav Ryhel
The LD070WX3 is a Color Active Matrix Liquid Crystal Display with
an integral Light Emitting Diode (LED) backlight system. The
matrix employs a-Si Thin Film Transistor as the active element. It
is a transmissive type display operating in the normally Black
mode. This TFT-LCD has 7.0 inches diagonally measured active
display area with WXGA resolution (800 by 1280 pixel array).

Signed-off-by: Svyatoslav Ryhel 
---
 drivers/video/Kconfig   |   8 ++
 drivers/video/Makefile  |   1 +
 drivers/video/lg-ld070wx3.c | 186 
 3 files changed, 195 insertions(+)
 create mode 100644 drivers/video/lg-ld070wx3.c

diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index e2016d73d1..05567a0095 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -522,6 +522,14 @@ config VIDEO_LCD_ORISETECH_OTM8009A
Say Y here if you want to enable support for Orise Technology
otm8009a 480x800 dsi 2dl panel.
 
+config VIDEO_LCD_LG_LD070WX3
+   bool "LD070WX3 DSI LCD panel support"
+   depends on PANEL && BACKLIGHT
+   select VIDEO_MIPI_DSI
+   help
+ Say Y here if you want to enable support for LG LD070WX3
+ 800x1280 DSI video mode panel.
+
 config VIDEO_LCD_RAYDIUM_RM68200
bool "RM68200 DSI LCD panel support"
select VIDEO_MIPI_DSI
diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index fdc2937632..bb6d9b74b9 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -58,6 +58,7 @@ obj-$(CONFIG_VIDEO_LCD_ANX9804) += anx9804.o
 obj-$(CONFIG_VIDEO_LCD_ENDEAVORU) += endeavoru-panel.o
 obj-$(CONFIG_VIDEO_LCD_HIMAX_HX8394) += himax-hx8394.o
 obj-$(CONFIG_VIDEO_LCD_HITACHI_TX18D42VM) += hitachi_tx18d42vm_lcd.o
+obj-$(CONFIG_VIDEO_LCD_LG_LD070WX3) += lg-ld070wx3.o
 obj-$(CONFIG_VIDEO_LCD_ORISETECH_OTM8009A) += orisetech_otm8009a.o
 obj-$(CONFIG_VIDEO_LCD_RAYDIUM_RM68200) += raydium-rm68200.o
 obj-$(CONFIG_VIDEO_LCD_RENESAS_R61307) += renesas-r61307.o
diff --git a/drivers/video/lg-ld070wx3.c b/drivers/video/lg-ld070wx3.c
new file mode 100644
index 00..610a06ffe7
--- /dev/null
+++ b/drivers/video/lg-ld070wx3.c
@@ -0,0 +1,186 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * LG LD070WX3-SL01 DSI panel driver
+ *
+ * Copyright (c) 2023 Svyatoslav Ryhel 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+struct lg_ld070wx3_priv {
+   struct udevice *vdd;
+   struct udevice *vcc;
+
+   struct udevice *backlight;
+};
+
+static struct display_timing default_timing = {
+   .pixelclock.typ = 7000,
+   .hactive.typ= 800,
+   .hfront_porch.typ   = 32,
+   .hback_porch.typ= 48,
+   .hsync_len.typ  = 8,
+   .vactive.typ= 1280,
+   .vfront_porch.typ   = 5,
+   .vback_porch.typ= 3,
+   .vsync_len.typ  = 1,
+};
+
+static void dcs_write_one(struct mipi_dsi_device *dsi, u8 cmd, u8 data)
+{
+   mipi_dsi_dcs_write(dsi, cmd, &data, 1);
+}
+
+static int lg_ld070wx3_enable_backlight(struct udevice *dev)
+{
+   struct mipi_dsi_panel_plat *plat = dev_get_plat(dev);
+   struct mipi_dsi_device *dsi = plat->device;
+   int ret;
+
+   ret = mipi_dsi_dcs_soft_reset(dsi);
+   if (ret < 0) {
+   log_debug("%s: failed to soft reset panel: %d\n",
+ __func__, ret);
+   return ret;
+   }
+
+   /* Delay before sending new command after soft reset */
+   mdelay(20);
+
+   /* Differential input impedance selection */
+   dcs_write_one(dsi, 0xAE, 0x0B);
+
+   /* Enter test mode 1 and 2*/
+   dcs_write_one(dsi, 0xEE, 0xEA);
+   dcs_write_one(dsi, 0xEF, 0x5F);
+
+   /* Increased MIPI CLK driving ability */
+   dcs_write_one(dsi, 0xF2, 0x68);
+
+   /* Exit test mode 1 and 2 */
+   dcs_write_one(dsi, 0xEE, 0x00);
+   dcs_write_one(dsi, 0xEF, 0x00);
+
+   return 0;
+}
+
+static int lg_ld070wx3_set_backlight(struct udevice *dev, int percent)
+{
+   struct lg_ld070wx3_priv *priv = dev_get_priv(dev);
+   int ret;
+
+   ret = backlight_enable(priv->backlight);
+   if (ret)
+   return ret;
+
+   return backlight_set_brightness(priv->backlight, percent);
+}
+
+static int lg_ld070wx3_timings(struct udevice *dev,
+  struct display_timing *timing)
+{
+   memcpy(timing, &default_timing, sizeof(*timing));
+   return 0;
+}
+
+static int lg_ld070wx3_of_to_plat(struct udevice *dev)
+{
+   struct lg_ld070wx3_priv *priv = dev_get_priv(dev);
+   int ret;
+
+   ret = uclass_get_device_by_phandle(UCLASS_PANEL_BACKLIGHT, dev,
+  "backlight", &priv->backlight);
+   if (ret) {
+   log_debug("%s: cannot get backlight: ret = %d\n",
+   

[PATCH v1 0/5] Tegra panel improvements

2024-01-23 Thread Svyatoslav Ryhel
The current patch set improves the logic of existing panels and
bridge used by Tegra 3 devices and brings support for additional
DSI panels used by Tegra 4 devices.

New and existing drivers are fully reusable, contain no device
specific parts, and are written according to existing datasheets.

Anton Bambura (1):
  video: panel: add Samsung LTL106HL02 MIPI DSI panel driver

Svyatoslav Ryhel (4):
  video: panel: add LG LG070WX3 MIPI DSI panel driver
  video: endeavoru-panel: shift the init sequence by one step earlier
  video: bridge: ssd2825: shift the init sequence by one step earlier
  video: renesas: shift the init sequence by one step earlier

 drivers/video/Kconfig  |  17 +++
 drivers/video/Makefile |   2 +
 drivers/video/bridge/ssd2825.c |  82 +++--
 drivers/video/endeavoru-panel.c| 128 ++--
 drivers/video/lg-ld070wx3.c| 186 +
 drivers/video/renesas-r61307.c |  93 ---
 drivers/video/renesas-r69328.c |  81 +++--
 drivers/video/samsung-ltl106hl02.c | 157 
 8 files changed, 571 insertions(+), 175 deletions(-)
 create mode 100644 drivers/video/lg-ld070wx3.c
 create mode 100644 drivers/video/samsung-ltl106hl02.c

-- 
2.40.1



[PATCH v6 17/18] video: tegra20: dsi: set correct fifo depth

2024-01-23 Thread Svyatoslav Ryhel
From: Jonas Schwöbel 

According to Thierry Reding's commit in the linux kernel

976cebc35bed0456a42bf96073a26f251d23b264
"drm/tegra: dsi: Make FIFO depths host parameters"

correct depth of the video FIFO is 1920 *words* no *bytes*

Tested-by: Ion Agorria  # HTC One X
Tested-by: Svyatoslav Ryhel  # Nvidia Tegratab T114
Signed-off-by: Jonas Schwöbel 
Signed-off-by: Svyatoslav Ryhel 
---
 drivers/video/tegra20/tegra-dsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/tegra20/tegra-dsi.c 
b/drivers/video/tegra20/tegra-dsi.c
index ddd74540f2..7d63557d1b 100644
--- a/drivers/video/tegra20/tegra-dsi.c
+++ b/drivers/video/tegra20/tegra-dsi.c
@@ -873,7 +873,7 @@ static int tegra_dsi_bridge_probe(struct udevice *dev)
return -EINVAL;
}
 
-   priv->video_fifo_depth = 480;
+   priv->video_fifo_depth = 1920;
priv->host_fifo_depth = 64;
 
ret = reset_get_by_name(dev, "dsi", &reset_ctl);
-- 
2.40.1



[PATCH v6 18/18] video: tegra20: dsi: use set_backlight for backlight only

2024-01-23 Thread Svyatoslav Ryhel
From: Jonas Schwöbel 

Shift the backlight set further to prevent visual glitches on
panel init.

Signed-off-by: Jonas Schwöbel 
Signed-off-by: Svyatoslav Ryhel 
---
 drivers/video/tegra20/tegra-dsi.c | 10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/video/tegra20/tegra-dsi.c 
b/drivers/video/tegra20/tegra-dsi.c
index 7d63557d1b..13dae37806 100644
--- a/drivers/video/tegra20/tegra-dsi.c
+++ b/drivers/video/tegra20/tegra-dsi.c
@@ -766,10 +766,6 @@ static int tegra_dsi_encoder_enable(struct udevice *dev)
if (ret)
return ret;
 
-   ret = panel_set_backlight(priv->panel, BACKLIGHT_DEFAULT);
-   if (ret)
-   return ret;
-
tegra_dsi_configure(dev, device->mode_flags);
 
tegra_dc_enable_controller(dev);
@@ -784,8 +780,10 @@ static int tegra_dsi_encoder_enable(struct udevice *dev)
 
 static int tegra_dsi_bridge_set_panel(struct udevice *dev, int percent)
 {
-   /* Is not used in tegra dc */
-   return 0;
+   struct tegra_dsi_priv *priv = dev_get_priv(dev);
+
+   /* Turn on/off backlight */
+   return panel_set_backlight(priv->panel, percent);
 }
 
 static int tegra_dsi_panel_timings(struct udevice *dev,
-- 
2.40.1



[PATCH v6 16/18] video: tegra20: dsi: remove pre-configuration

2024-01-23 Thread Svyatoslav Ryhel
From: Jonas Schwöbel 

Configuration for DC driver command mode is not required for
every panel. Removed.

Tested-by: Ion Agorria  # HTC One X
Tested-by: Svyatoslav Ryhel  # Nvidia Tegratab T114
Signed-off-by: Jonas Schwöbel 
Signed-off-by: Svyatoslav Ryhel 
---
 drivers/video/tegra20/tegra-dsi.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/video/tegra20/tegra-dsi.c 
b/drivers/video/tegra20/tegra-dsi.c
index fc9ca1310a..ddd74540f2 100644
--- a/drivers/video/tegra20/tegra-dsi.c
+++ b/drivers/video/tegra20/tegra-dsi.c
@@ -766,8 +766,6 @@ static int tegra_dsi_encoder_enable(struct udevice *dev)
if (ret)
return ret;
 
-   tegra_dsi_configure(dev, 0);
-
ret = panel_set_backlight(priv->panel, BACKLIGHT_DEFAULT);
if (ret)
return ret;
-- 
2.40.1



[PATCH v6 15/18] video: tegra20: dsi: add reset support

2024-01-23 Thread Svyatoslav Ryhel
Implement reset use to discard any changes which could have been
applied to DSI before and can interfere with current configuration.

Tested-by: Ion Agorria  # HTC One X
Tested-by: Svyatoslav Ryhel  # Nvidia Tegratab T114
Signed-off-by: Svyatoslav Ryhel 
---
 drivers/video/tegra20/tegra-dsi.c | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/drivers/video/tegra20/tegra-dsi.c 
b/drivers/video/tegra20/tegra-dsi.c
index 25a629535e..fc9ca1310a 100644
--- a/drivers/video/tegra20/tegra-dsi.c
+++ b/drivers/video/tegra20/tegra-dsi.c
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -863,6 +864,7 @@ static int tegra_dsi_bridge_probe(struct udevice *dev)
struct tegra_dsi_priv *priv = dev_get_priv(dev);
struct mipi_dsi_device *device = &priv->device;
struct mipi_dsi_panel_plat *mipi_plat;
+   struct reset_ctl reset_ctl;
int ret;
 
priv->version = dev_get_driver_data(dev);
@@ -876,6 +878,13 @@ static int tegra_dsi_bridge_probe(struct udevice *dev)
priv->video_fifo_depth = 480;
priv->host_fifo_depth = 64;
 
+   ret = reset_get_by_name(dev, "dsi", &reset_ctl);
+   if (ret) {
+   log_debug("%s: reset_get_by_name() failed: %d\n",
+ __func__, ret);
+   return ret;
+   }
+
ret = uclass_get_device_by_phandle(UCLASS_REGULATOR, dev,
   "avdd-dsi-csi-supply", &priv->avdd);
if (ret)
@@ -914,12 +923,17 @@ static int tegra_dsi_bridge_probe(struct udevice *dev)
 
tegra_dsi_get_format(device->format, &priv->format);
 
+   reset_assert(&reset_ctl);
+
ret = regulator_set_enable_if_allowed(priv->avdd, true);
if (ret && ret != -ENOSYS)
return ret;
 
tegra_dsi_init_clocks(dev);
 
+   mdelay(2);
+   reset_deassert(&reset_ctl);
+
return 0;
 }
 
-- 
2.40.1



[PATCH v6 14/18] video: tegra20: dsi: add T114 support

2024-01-23 Thread Svyatoslav Ryhel
Existing Tegra DSI driver mostly fits T114 apart MIPI calibration
which on T114 has dedicated driver. To resolve this MIPI calibration
logic was split for pre-T114 and T114+ devices.

Tested-by: Ion Agorria  # HTC One X
Tested-by: Svyatoslav Ryhel  # Nvidia Tegratab T114
Signed-off-by: Svyatoslav Ryhel 
---
 drivers/video/tegra20/tegra-dsi.c | 78 ++-
 .../video/tegra20/tegra-dsi.h | 24 +-
 2 files changed, 96 insertions(+), 6 deletions(-)
 rename arch/arm/include/asm/arch-tegra30/dsi.h => 
drivers/video/tegra20/tegra-dsi.h (90%)

diff --git a/drivers/video/tegra20/tegra-dsi.c 
b/drivers/video/tegra20/tegra-dsi.c
index de225ed376..25a629535e 100644
--- a/drivers/video/tegra20/tegra-dsi.c
+++ b/drivers/video/tegra20/tegra-dsi.c
@@ -20,17 +20,24 @@
 #include 
 #include 
 #include 
-#include 
 
 #include "tegra-dc.h"
+#include "tegra-dsi.h"
 #include "mipi-phy.h"
 
+/* List of supported DSI bridges */
+enum {
+   DSI_V0,
+   DSI_V1,
+};
+
 struct tegra_dsi_priv {
struct mipi_dsi_host host;
struct mipi_dsi_device device;
struct mipi_dphy_timing dphy_timing;
 
struct udevice *panel;
+   struct udevice *mipi;
struct display_timing timing;
 
struct dsi_ctlr *dsi;
@@ -41,6 +48,8 @@ struct tegra_dsi_priv {
int dsi_clk;
int video_fifo_depth;
int host_fifo_depth;
+
+   u32 version;
 };
 
 static void tegra_dc_enable_controller(struct udevice *dev)
@@ -501,6 +510,41 @@ static void tegra_dsi_pad_calibrate(struct 
dsi_pad_ctrl_reg *pad)
writel(value, TEGRA_VI_BASE + (CSI_CIL_PAD_CONFIG << 2));
 }
 
+static void tegra_dsi_mipi_calibrate(struct tegra_dsi_priv *priv)
+{
+   struct dsi_pad_ctrl_reg *pad = &priv->dsi->pad;
+   u32 value;
+   int ret;
+
+   ret = misc_set_enabled(priv->mipi, true);
+   if (ret)
+   log_debug("%s: failed to enable MIPI calibration: %d\n",
+ __func__, ret);
+
+   writel(0, &pad->pad_ctrl);
+   writel(0, &pad->pad_ctrl_1);
+   writel(0, &pad->pad_ctrl_2);
+   writel(0, &pad->pad_ctrl_3);
+   writel(0, &pad->pad_ctrl_4);
+
+   /* DSI pad enable */
+   value = DSI_PAD_CONTROL_VS1_PULLDN(0) | DSI_PAD_CONTROL_VS1_PDIO(0);
+   writel(value, &pad->pad_ctrl);
+
+   value = DSI_PAD_SLEW_UP(0x7) | DSI_PAD_SLEW_DN(0x7) |
+   DSI_PAD_LP_UP(0x1) | DSI_PAD_LP_DN(0x1) |
+   DSI_PAD_OUT_CLK(0x0);
+   writel(value, &pad->pad_ctrl_2);
+
+   value = DSI_PAD_PREEMP_PD_CLK(0x3) | DSI_PAD_PREEMP_PU_CLK(0x3) |
+   DSI_PAD_PREEMP_PD(0x03) | DSI_PAD_PREEMP_PU(0x3);
+   writel(value, &pad->pad_ctrl_3);
+
+   ret = misc_write(priv->mipi, 0, NULL, 0);
+   if (ret)
+   log_debug("%s: MIPI calibration failed %d\n", __func__, ret);
+}
+
 static void tegra_dsi_set_timeout(struct dsi_timeout_reg *rtimeout,
  unsigned long bclk,
  unsigned int vrefresh)
@@ -664,10 +708,25 @@ static int tegra_dsi_encoder_enable(struct udevice *dev)
u32 value;
int ret;
 
+   /* If for some reasone DSI is enabled then it needs to
+* be disabled in order for the panel initialization
+* commands to be properly sent.
+*/
+   value = readl(&misc->dsi_pwr_ctrl);
+
+   if (value & DSI_POWER_CONTROL_ENABLE) {
+   value = readl(&misc->dsi_pwr_ctrl);
+   value &= ~DSI_POWER_CONTROL_ENABLE;
+   writel(value, &misc->dsi_pwr_ctrl);
+   }
+
/* Disable interrupt */
writel(0, &misc->int_enable);
 
-   tegra_dsi_pad_calibrate(&priv->dsi->pad);
+   if (priv->version)
+   tegra_dsi_mipi_calibrate(priv);
+   else
+   tegra_dsi_pad_calibrate(&priv->dsi->pad);
 
tegra_dsi_get_muldiv(device->format, &mul, &div);
 
@@ -806,6 +865,8 @@ static int tegra_dsi_bridge_probe(struct udevice *dev)
struct mipi_dsi_panel_plat *mipi_plat;
int ret;
 
+   priv->version = dev_get_driver_data(dev);
+
priv->dsi = (struct dsi_ctlr *)dev_read_addr_ptr(dev);
if (!priv->dsi) {
printf("%s: No display controller address\n", __func__);
@@ -828,6 +889,16 @@ static int tegra_dsi_bridge_probe(struct udevice *dev)
return log_ret(ret);
}
 
+   if (priv->version) {
+   ret = uclass_get_device_by_phandle(UCLASS_MISC, dev,
+  "nvidia,mipi-calibrate",
+  &priv->mipi);
+   if (ret) {
+   log_debug("%s: cannot get MIPI: error %d\n&

[PATCH v6 13/18] video: tegra20: add MIPI calibration driver

2024-01-23 Thread Svyatoslav Ryhel
Dedicated MIPI calibration driver is used on T114 and newer. Before
T114 MIPI calibration registers were part of VI and CSI.

Tested-by: Svyatoslav Ryhel  # Nvidia Tegratab T114
Signed-off-by: Svyatoslav Ryhel 
---
 drivers/video/tegra20/Makefile |   2 +-
 drivers/video/tegra20/tegra-mipi.c | 188 +
 2 files changed, 189 insertions(+), 1 deletion(-)
 create mode 100644 drivers/video/tegra20/tegra-mipi.c

diff --git a/drivers/video/tegra20/Makefile b/drivers/video/tegra20/Makefile
index f0b534c579..a75aea2a87 100644
--- a/drivers/video/tegra20/Makefile
+++ b/drivers/video/tegra20/Makefile
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0+
 
 obj-$(CONFIG_VIDEO_TEGRA20) += tegra-dc.o
-obj-$(CONFIG_VIDEO_DSI_TEGRA30) += tegra-dsi.o mipi-phy.o
+obj-$(CONFIG_VIDEO_DSI_TEGRA30) += tegra-dsi.o tegra-mipi.o mipi-phy.o
 obj-$(CONFIG_TEGRA_BACKLIGHT_PWM) += tegra-pwm-backlight.o
diff --git a/drivers/video/tegra20/tegra-mipi.c 
b/drivers/video/tegra20/tegra-mipi.c
new file mode 100644
index 00..2df3c1a994
--- /dev/null
+++ b/drivers/video/tegra20/tegra-mipi.c
@@ -0,0 +1,188 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2013 NVIDIA Corporation
+ * Copyright (c) 2023 Svyatoslav Ryhel 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+/* MIPI control registers 0x00 ~ 0x60 */
+struct mipi_ctlr {
+   uint mipi_cal_ctrl;
+   uint mipi_cal_autocal_ctrl;
+   uint mipi_cal_status;
+
+   uint unused1[2];
+
+   uint mipi_cal_config_csia;
+   uint mipi_cal_config_csib;
+   uint mipi_cal_config_csic;
+   uint mipi_cal_config_csid;
+   uint mipi_cal_config_csie;
+
+   uint unused2[4];
+
+   uint mipi_cal_config_dsia;
+   uint mipi_cal_config_dsib;
+   uint mipi_cal_config_dsic;
+   uint mipi_cal_config_dsid;
+
+   uint unused3[4];
+
+   uint mipi_cal_bias_pad_cfg0;
+   uint mipi_cal_bias_pad_cfg1;
+   uint mipi_cal_bias_pad_cfg2;
+};
+
+#define MIPI_CAL_CTRL_NOISE_FILTER(x)  (((x) & 0xf) << 26)
+#define MIPI_CAL_CTRL_PRESCALE(x)  (((x) & 0x3) << 24)
+#define MIPI_CAL_CTRL_CLKEN_OVRBIT(4)
+#define MIPI_CAL_CTRL_STARTBIT(0)
+
+#define MIPI_CAL_STATUS_DONE   BIT(16)
+#define MIPI_CAL_STATUS_ACTIVE BIT(0)
+
+#define MIPI_CAL_OVERIDE(x)(((x) & 0x1) << 30)
+#define MIPI_CAL_SEL(x)(((x) & 0x1) << 21)
+#define MIPI_CAL_HSPDOS(x) (((x) & 0x1f) << 16)
+#define MIPI_CAL_HSPUOS(x) (((x) & 0x1f) << 8)
+#define MIPI_CAL_TERMOS(x) (((x) & 0x1f) << 0)
+
+#define MIPI_CAL_BIAS_PAD_PDVCLAMP BIT(1)
+#define MIPI_CAL_BIAS_PAD_E_VCLAMP_REF BIT(0)
+
+#define MIPI_CAL_BIAS_PAD_DRV_DN_REF(x) (((x) & 0x7) << 16)
+#define MIPI_CAL_BIAS_PAD_DRV_UP_REF(x) (((x) & 0x7) << 8)
+
+#define MIPI_CAL_BIAS_PAD_VCLAMP(x)(((x) & 0x7) << 16)
+#define MIPI_CAL_BIAS_PAD_VAUXP(x) (((x) & 0x7) << 4)
+#define MIPI_CAL_BIAS_PAD_PDVREG   BIT(1)
+
+struct tegra_mipi_priv {
+   struct mipi_ctlr*mipi;
+   struct clk  *mipi_cal;
+};
+
+static int tegra_mipi_calibrate(struct udevice *dev, int offset, const void 
*buf,
+   int size)
+{
+   struct tegra_mipi_priv *priv = dev_get_priv(dev);
+   u32 value;
+
+   value = MIPI_CAL_BIAS_PAD_DRV_DN_REF(0x2) |
+   MIPI_CAL_BIAS_PAD_DRV_UP_REF(0x0);
+   writel(value, &priv->mipi->mipi_cal_bias_pad_cfg1);
+
+   value = readl(&priv->mipi->mipi_cal_bias_pad_cfg2);
+   value &= ~MIPI_CAL_BIAS_PAD_VCLAMP(0x7);
+   value &= ~MIPI_CAL_BIAS_PAD_VAUXP(0x7);
+   writel(value, &priv->mipi->mipi_cal_bias_pad_cfg2);
+
+   value = MIPI_CAL_OVERIDE(0x0) | MIPI_CAL_SEL(0x1) |
+   MIPI_CAL_HSPDOS(0x0) | MIPI_CAL_HSPUOS(0x4) |
+   MIPI_CAL_TERMOS(0x5);
+   writel(value, &priv->mipi->mipi_cal_config_dsia);
+   writel(value, &priv->mipi->mipi_cal_config_dsib);
+
+   /* Deselect PAD C */
+   value = readl(&priv->mipi->mipi_cal_config_dsic);
+   value &= ~(MIPI_CAL_SEL(0x1));
+   writel(value, &priv->mipi->mipi_cal_config_dsic);
+
+   /* Deselect PAD D */
+   value = readl(&priv->mipi->mipi_cal_config_dsid);
+   value &= ~(MIPI_CAL_SEL(0x1));
+   writel(value, &priv->mipi->mipi_cal_config_dsid);
+
+   value = readl(&priv->mipi->mipi_cal_ctrl);
+   value &= ~MIPI_CAL_CTRL_NOISE_FILTER(0xf);
+   value &= ~MIPI_CAL_CTRL_PRESCALE(0x3);
+   value |= MIPI_CAL_CTRL_NOISE_FILTER(0xa) |
+MIPI_CAL_CTRL_PRESCALE(0x2) |
+MIPI_CAL_CTRL_CLKEN_OVR;
+   writel(value, &priv->mipi->mipi_cal_ctrl);
+
+   /* clear any pending s

[PATCH v6 12/18] video: tegra20: dc: parameterize V- and H-sync polarities

2024-01-23 Thread Svyatoslav Ryhel
Based on Thierry Reding's Linux commit:

'commit 1716b1891e1de05e2c20ccafa9f58550f3539717
("drm/tegra: rgb: Parameterize V- and H-sync polarities")'

Signed-off-by: Svyatoslav Ryhel 
---
 arch/arm/include/asm/arch-tegra/dc.h |  5 +
 drivers/video/tegra20/tegra-dc.c | 22 --
 2 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/arch/arm/include/asm/arch-tegra/dc.h 
b/arch/arm/include/asm/arch-tegra/dc.h
index 6444af2993..ca3718411a 100644
--- a/arch/arm/include/asm/arch-tegra/dc.h
+++ b/arch/arm/include/asm/arch-tegra/dc.h
@@ -443,6 +443,11 @@ enum win_color_depth_id {
 #defineWINDOW_D_SELECT BIT(7)
 #defineWINDOW_H_SELECT BIT(8)
 
+/* DC_COM_PIN_OUTPUT_POLARITY1 0x307 */
+#define LHS_OUTPUT_POLARITY_LOWBIT(30)
+#define LVS_OUTPUT_POLARITY_LOWBIT(28)
+#define LSC0_OUTPUT_POLARITY_LOW   BIT(24)
+
 /* DC_DISP_DISP_WIN_OPTIONS 0x402 */
 #defineCURSOR_ENABLE   BIT(16)
 #defineSOR_ENABLE  BIT(25)
diff --git a/drivers/video/tegra20/tegra-dc.c b/drivers/video/tegra20/tegra-dc.c
index caeec94468..ffa81eeac3 100644
--- a/drivers/video/tegra20/tegra-dc.c
+++ b/drivers/video/tegra20/tegra-dc.c
@@ -220,8 +220,11 @@ static const u32 rgb_sel_tab[PIN_OUTPUT_SEL_COUNT] = {
0x0002,
 };
 
-static void rgb_enable(struct dc_com_reg *com)
+static void rgb_enable(struct tegra_lcd_priv *priv)
 {
+   struct dc_com_reg *com = &priv->dc->com;
+   struct display_timing *dt = &priv->timing;
+   u32 value;
int i;
 
for (i = 0; i < PIN_REG_COUNT; i++) {
@@ -230,6 +233,21 @@ static void rgb_enable(struct dc_com_reg *com)
writel(rgb_data_tab[i], &com->pin_output_data[i]);
}
 
+   /* configure H- and V-sync signal polarities */
+   value = readl(&com->pin_output_polarity[1]);
+
+   if (dt->flags & DISPLAY_FLAGS_HSYNC_LOW)
+   value |= LHS_OUTPUT_POLARITY_LOW;
+   else
+   value &= ~LHS_OUTPUT_POLARITY_LOW;
+
+   if (dt->flags & DISPLAY_FLAGS_VSYNC_LOW)
+   value |= LVS_OUTPUT_POLARITY_LOW;
+   else
+   value &= ~LVS_OUTPUT_POLARITY_LOW;
+
+   writel(value, &com->pin_output_polarity[1]);
+
for (i = 0; i < PIN_OUTPUT_SEL_COUNT; i++)
writel(rgb_sel_tab[i], &com->pin_output_sel[i]);
 }
@@ -329,7 +347,7 @@ static int tegra_display_probe(struct tegra_lcd_priv *priv,
basic_init_timer(&priv->dc->disp);
 
if (priv->soc->has_rgb)
-   rgb_enable(&priv->dc->com);
+   rgb_enable(priv);
 
if (priv->pixel_clock)
update_display_mode(priv);
-- 
2.40.1



[PATCH v6 11/18] video: tegra20: dc: clean framebuffer memory block

2024-01-23 Thread Svyatoslav Ryhel
From: Jonas Schwöbel 

Fill the framebuffer memory with zeros to avoid visual glitches.

Signed-off-by: Jonas Schwöbel 
Signed-off-by: Svyatoslav Ryhel 
---
 drivers/video/tegra20/tegra-dc.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/video/tegra20/tegra-dc.c b/drivers/video/tegra20/tegra-dc.c
index ac6833229a..caeec94468 100644
--- a/drivers/video/tegra20/tegra-dc.c
+++ b/drivers/video/tegra20/tegra-dc.c
@@ -4,6 +4,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -398,6 +399,10 @@ static int tegra_lcd_probe(struct udevice *dev)
priv->scdiv = dc_plat->scdiv;
}
 
+   /* Clean the framebuffer area */
+   memset((u8 *)plat->base, 0, plat->size);
+   flush_dcache_all();
+
if (tegra_display_probe(priv, (void *)plat->base)) {
debug("%s: Failed to probe display driver\n", __func__);
return -1;
-- 
2.40.1



  1   2   3   4   5   6   7   8   9   >