atmel_sdhci: SDMMC_CD pin still needed for card detection despite EMMC set to non-removable

2023-04-27 Thread Zixun Li
Hardware: SAMA5D27 customized board, EMMC connected to SDMMC0. SDMMC0_CD pin pulled-down for BootROM card detection, once booted it used as LED output. Software: u-boot-at91 76f7f55 Issue: U-Boot can't detect EMMC despite it set to non-removable in DT, unless SDMMC0_CD pin is used (so this pin

RE: atmel_sdhci: SDMMC_CD pin still needed for card detection despite EMMC set to non-removable

2023-05-01 Thread Zixun Li
Hi, > Can you find some place to set this bit in the atmel sdhci driver, and not in > the core? > The MC1R register is specific to at91 device. I've overridden get_cd of the driver, below is the patch: From e186af71297e9ae6ce241a85bff64683949f0e1b Mon Sep 17 00:00:00 2001 From:

RE: atmel_sdhci: SDMMC_CD pin still needed for card detection despite EMMC set to non-removable

2023-05-04 Thread Zixun Li
IO line. https://github.com/linux4sam/linux-at91/blob/068eaa6b4b087b3a86fc4624d0f4083844e93f1c/drivers/mmc/host/sdhci-of-at91.c#L551 I've refactored the code, setting FCD bit after sdhci_probe() with a separate function to make the purpose more clear. From 90177e7af8226b88dfbfc08639f768881562a

[PATCH v2] atmel_sdhci: Force card-detect if MMC_CAP_NONREMOVABLE.

2023-05-15 Thread Zixun LI
Signed-off-by: Zixun LI --- drivers/mmc/atmel_sdhci.c | 40 +-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/atmel_sdhci.c b/drivers/mmc/atmel_sdhci.c index 37b0beeed4..ae56266f57 100644 --- a/drivers/mmc/atmel_sdhci.c +++ b

[PATCH v2] atmel_sdhci: Force card-detect if MMC_CAP_NONREMOVABLE.

2023-05-17 Thread Zixun LI
If the device attached to the MMC bus is not removable, set force card-detect bit to bypass card detection procedure, so card detection pin can be used for other purposes. It's also a workaround for SAMA5D2 who doesn't drive CMD if using GPIO for card detection. Signed-off-by

[PATCH] mtd: nand: raw: atmel: Use ONFI ECC params if available

2024-07-09 Thread Zixun Li
When ECC parameters are not specified in DT, first try ONFI ECC parameters before fallback to maximum strength. To be inline with kernel driver behavior. Signed-off-by: Zixun LI --- drivers/mtd/nand/raw/atmel/nand-controller.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/mtd

RE: [PATCH] mtd: nand: raw: atmel: Use ONFI ECC params if available

2024-07-18 Thread Zixun Li
for the format issue. Is there any comment from maintainers ? I'll push a v2 if this patch is considered. -- Zixun LI

[PATCH RFC] usb: gadget: atmel: Add DM_USB_GADGET support

2024-07-19 Thread Zixun Li
included as they are not supported by the driver yet. Signed-off-by: Zixun LI --- drivers/usb/gadget/atmel_usba_udc.c | 196 1 file changed, 169 insertions(+), 27 deletions(-) diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c index

usb gadget driver initialization issue

2024-07-20 Thread Zixun Li
usb1-port1: attempt power cycle I think it's better to leave the device in disconnected state while probing and connect it once a gadget function is invoked. I see recently there are many DM related reworking, please forgive me if it's already on the Todo list. -- Zixun LI

[PATCH v2] mtd: nand: raw: atmel: Use ONFI ECC params if available

2024-07-22 Thread Zixun LI
ds and chip->ecc_step_ds became nanddev_get_ecc_requirements(). U-Boot didn't follow the refactor and always use these 2 fields. v2: Fix formatting, add upstream commit hash. Signed-off-by: Zixun LI --- drivers/mtd/nand/raw/atmel/nand-controller.c | 4 1 file changed, 4 insertions(+) diff

RE: usb gadget driver initialization issue

2024-07-22 Thread Zixun Li
> -Original Message- > From: Marek Vasut > Sent: Saturday, July 20, 2024 22:12 > > Can you please send an RFC patch ? > > > I see recently there are many DM related reworking, please forgive me > > if it's already on the Todo list. > > It is not on the ToDo list, no. > > +CC Mattijs H

[PATCH v2 0/4] usb: gadget: atmel: Code refactor and DM_USB_GADGET support

2024-07-23 Thread Zixun LI
the refactoring to a preparatory patch. Zixun LI (4): usb: gadget: atmel: Code refactor part 1 usb: gadget: atmel: Code refactor part 2 usb: gadget: atmel: Add attach/detach support usb: gadget: atmel: Add DM_USB_GADGET support drivers/usb/gadget/atmel_usba_udc.c | 214

[PATCH v2 3/4] usb: gadget: atmel: Add attach/detach support

2024-07-23 Thread Zixun LI
Add controller attach/detach support by using usb_gadget_ops.pullup() method. Signed-off-by: Zixun LI --- drivers/usb/gadget/atmel_usba_udc.c | 18 ++ 1 file changed, 18 insertions(+) diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c index

[PATCH v2 1/4] usb: gadget: atmel: Code refactor part 1

2024-07-23 Thread Zixun LI
- Sort includes - Forward declare controller structures Signed-off-by: Zixun LI --- drivers/usb/gadget/atmel_usba_udc.c | 59 +++-- 1 file changed, 30 insertions(+), 29 deletions(-) diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c

[PATCH v2 2/4] usb: gadget: atmel: Code refactor part 2

2024-07-23 Thread Zixun LI
- Rename atmel_usba_start() / atmel_usba_stop() to usba_udc_enable() / usba_udc_disable(), remove atmel_ prefix to be inline with other functions. Also avoid confusion with DM start() / stop() functions. - Replace printf() by log_err() - Spelling paramter -> parameter Signed-off-by: Zixun

[PATCH v2 4/4] usb: gadget: atmel: Add DM_USB_GADGET support

2024-07-23 Thread Zixun LI
when DM_USB_GADGET is enabled. Disable legacy usba_udc_probe() to avoid conflict with DM when it's enabled. Compared to Linux driver only supported devices' DT bindings are included (sorted as Linux driver) Signed-off-by: Zixun LI --- drivers/usb/gadget/atmel_usba_u

[PATCH v3 0/7] usb: gadget: atmel: Code refactor and DM_USB_GADGET support

2024-07-23 Thread Zixun LI
] usb: gadget: atmel: Add DM_USB_GADGET support: https://lists.denx.de/pipermail/u-boot/2024-July/559503.html - Addressed comments, moved the refactoring to a preparatory patch. Zixun LI (7): usb: gadget: atmel: Sort includes usb: gadget: atmel: Replace printf() and pr_err() by log_err() usb

[PATCH v3 1/7] usb: gadget: atmel: Sort includes

2024-07-23 Thread Zixun LI
Sort includes in alphabetical order. Signed-off-by: Zixun LI --- drivers/usb/gadget/atmel_usba_udc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c index f99553df8d..5f78251fdb 100644 --- a

[PATCH v3 3/7] usb: gadget: atmel: Fix typo in usb_gadget_register_driver()

2024-07-23 Thread Zixun LI
Replace "paramter" by "parameter". Signed-off-by: Zixun LI --- drivers/usb/gadget/atmel_usba_udc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c index 83fdc36870..2e3d8f36a2 1006

[PATCH v3 2/7] usb: gadget: atmel: Replace printf() and pr_err() by log_err()

2024-07-23 Thread Zixun LI
To have a uniform printing function, also drop linux/printk.h as no longer used. Signed-off-by: Zixun LI --- drivers/usb/gadget/atmel_usba_udc.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget

[PATCH v3 4/7] usb: gadget: atmel: Move usba_udc_pdata() with other static functions

2024-07-23 Thread Zixun LI
To make all static functions in the top, no functional change. Signed-off-by: Zixun LI --- drivers/usb/gadget/atmel_usba_udc.c | 80 ++--- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget

[PATCH v3 5/7] usb: gadget: atmel: Rename atmel_usba_start()/_stop() to usba_udc_enable()/_disable()

2024-07-23 Thread Zixun LI
Rename atmel_usba_start() / atmel_usba_stop() to usba_udc_enable() / usba_udc_disable(), remove atmel_ prefix to be inline with other functions. Also avoid confusion with DM start() / stop() functions. Signed-off-by: Zixun LI --- drivers/usb/gadget/atmel_usba_udc.c | 8 1 file changed

[PATCH v3 6/7] usb: gadget: atmel: Add attach/detach support

2024-07-23 Thread Zixun LI
Add controller attach/detach support by using usb_gadget_ops.pullup() method. Signed-off-by: Zixun LI --- drivers/usb/gadget/atmel_usba_udc.c | 18 ++ 1 file changed, 18 insertions(+) diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c index

[PATCH v3 7/7] usb: gadget: atmel: Add DM_USB_GADGET support

2024-07-23 Thread Zixun LI
e included (sorted as Linux driver) Signed-off-by: Zixun LI --- drivers/usb/gadget/atmel_usba_udc.c | 138 drivers/usb/gadget/atmel_usba_udc.h | 3 + include/linux/usb/atmel_usba_udc.h | 2 + 3 files changed, 143 insertions(+) diff --git a/drivers/usb/gadget/atmel_usb

RE: usb gadget driver initialization issue

2024-07-23 Thread Zixun Li
> -Original Message- > From: Zixun Li > Sent: Monday, July 22, 2024 17:53 > To: 'Marek Vasut' ; Lukasz Majewski ; > open list ; Mattijs Korpershoek > > Subject: RE: usb gadget driver initialization issue > > Hi, this issue only affects usb_ether,

[PATCH v4 0/7] usb: gadget: atmel: Code refactor and DM_USB_GADGET support

2024-07-25 Thread Zixun LI
unbinding - Separate code refactor into 2 parts - Remove dead code Changes in v1: - Based on [PATCH RFC] usb: gadget: atmel: Add DM_USB_GADGET support: https://lists.denx.de/pipermail/u-boot/2024-July/559503.html - Addressed comments, moved the refactoring to a preparatory patch. Zixun LI (7

[PATCH v4 1/7] usb: gadget: atmel: Sort includes

2024-07-25 Thread Zixun LI
Sort includes in alphabetical order. Signed-off-by: Zixun LI --- drivers/usb/gadget/atmel_usba_udc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c index f99553df8d..5f78251fdb 100644 --- a

[PATCH v4 2/7] usb: gadget: atmel: Replace printf() and pr_err() by log_err()

2024-07-25 Thread Zixun LI
To have a uniform printing function, also drop linux/printk.h as no longer used. Signed-off-by: Zixun LI --- drivers/usb/gadget/atmel_usba_udc.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget

[PATCH v4 3/7] usb: gadget: atmel: Fix typo in usb gadget driver register and unregister

2024-07-25 Thread Zixun LI
Replace "paramter" by "parameter". Signed-off-by: Zixun LI --- drivers/usb/gadget/atmel_usba_udc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c index 4641638412..2e3d8f36a2

[PATCH v4 4/7] usb: gadget: atmel: Move usba_udc_pdata() with other static functions

2024-07-25 Thread Zixun LI
To make all static functions in the top, no functional change. Signed-off-by: Zixun LI --- drivers/usb/gadget/atmel_usba_udc.c | 80 ++--- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget

[PATCH v4 5/7] usb: gadget: atmel: Rename atmel_usba_start()/_stop() to usba_udc_enable()/_disable()

2024-07-25 Thread Zixun LI
Rename atmel_usba_start() / atmel_usba_stop() to usba_udc_enable() / usba_udc_disable(), remove atmel_ prefix to be inline with other functions. Also avoid confusion with DM start() / stop() functions. Signed-off-by: Zixun LI --- drivers/usb/gadget/atmel_usba_udc.c | 8 1 file changed

[PATCH v4 6/7] usb: gadget: atmel: Add attach/detach support

2024-07-25 Thread Zixun LI
Add controller attach/detach support by using usb_gadget_ops.pullup() function. Signed-off-by: Zixun LI --- drivers/usb/gadget/atmel_usba_udc.c | 18 ++ 1 file changed, 18 insertions(+) diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c

[PATCH v4 7/7] usb: gadget: atmel: Add DM_USB_GADGET support

2024-07-25 Thread Zixun LI
e included (sorted as Linux driver) Signed-off-by: Zixun LI --- drivers/usb/gadget/atmel_usba_udc.c | 144 drivers/usb/gadget/atmel_usba_udc.h | 3 + include/linux/usb/atmel_usba_udc.h | 2 + 3 files changed, 149 insertions(+) diff --git a/drivers/usb/gadget/atmel_usb

Re: [PATCH v4 0/7] usb: gadget: atmel: Code refactor and DM_USB_GADGET support

2024-07-25 Thread Zixun LI
On Thu, Jul 25, 2024 at 8:24 PM Marek Vasut wrote: > > On 7/25/24 5:31 PM, Zixun LI wrote: > > Changes in v4: > > - Release clocks if probe failed > > - Add missing endpoint data free > > - Addressed comments > > Please collect any AB/RB/TB tags that were pr

[PATCH] usb: gadget: ether: Handle gadget driver registration in start and stop

2024-07-26 Thread Zixun LI
, so the host won't see an unresponsive device. Signed-off-by: Zixun LI --- drivers/usb/gadget/ether.c | 15 +-- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c index b7b7bacb00..ed55f12662 100644 --- a/

cmd: bind/unbind by class index doesn't work with usb gadget

2024-07-26 Thread Zixun LI
Bind/unbind a gadget function driver to a USB gadget device doesn't work with class index, while using node path is ok. For example: U-Boot> dm tree Class Index Probed DriverName --- root 0 [ + ] root_driv

[RFC PATCH 1/4] dm: core: Add a way to specify an alt name for alias sequence numbering

2024-07-31 Thread Zixun LI
patch it's now possible to rename these classes without break the existing alias function. Signed-off-by: Zixun LI --- drivers/core/device.c | 3 ++- drivers/core/read.c | 7 ++- drivers/core/uclass.c | 11 +-- include/dm/read.h | 9 - include/dm/uclass.h | 2 ++ 5

[RFC PATCH 0/4] dm: Duplicate uclass name fix and alias improvements

2024-07-31 Thread Zixun LI
which is not convered by this patch set, for example in drivers/net/sandbox.c, uclass_get_device() is used which is based on uclass index, while in the comments it says "index - The alias index (also DM seq number)" Zixun LI (4): dm: core: Add a way to specify an alt name for alias sequen

[RFC PATCH 2/4] dm: core: Show device sequence instead in dm_dump_tree()

2024-07-31 Thread Zixun LI
Currently uclass index is shown in DM tree dump which ignores alias sequence numbering. The result could be confusing since these 2 numbers could be different. Show device sequence number instead. Signed-off-by: Zixun LI --- drivers/core/dump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion

[RFC PATCH 3/4] cmd: bind: Use device sequence instead for driver bind/unbind

2024-07-31 Thread Zixun LI
Currently uclass index is used for bind/unbind which ignores alias sequence numbering. Use device sequence number instead as it's the number explicitly set in the DT. Signed-off-by: Zixun LI --- cmd/bind.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/bind.c

[RFC PATCH 4/4] usb: gadget: udc: Fix duplicate uclass name

2024-07-31 Thread Zixun LI
Currently both USB host uclass and USB gadget uclass are using the same name "usb" which break uclass functions like uclass_get_by_name(). Rename the uclass to "usb_gadget" while using "usb" as sequence alias naming to keep the alias function working. Signed-off-

Re: [RFC PATCH 0/4] dm: Duplicate uclass name fix and alias improvements

2024-08-01 Thread Zixun LI
nse to show the seq instead of the index, but > please update the header for the table to say 'Seq' Will do. > I assume no tests need updating, but please do add a note to > doc/usage/cmd/bind.rst Will do. Regards, Zixun LI

[PATCH] usb: gadget: udc: Fix duplicate uclass name

2024-08-02 Thread Zixun LI
ng "usb" as DT alias sequence numbering which needs a fix afterwards. Signed-off-by: Zixun LI --- drivers/usb/gadget/udc/udc-uclass.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/gadget/udc/udc-uclass.c b/drivers/usb/gadget/udc/udc-uclass.c index fbe62

[PATCH] dm: core: Show device sequence instead in dm_dump_tree()

2024-08-02 Thread Zixun LI
Currently uclass index is shown in DM tree dump which ignores alias sequence numbering. The result could be confusing since these 2 numbers could be different. Show device sequence number instead as it's more meaningful. Also update documentation to use sequence number. Signed-off-by: Zix

[PATCH] cmd: bind: Use device sequence instead for driver bind/unbind

2024-08-02 Thread Zixun LI
Currently uclass index is used for bind/unbind which ignores alias sequence numbering. Use device sequence number instead as it's the number explicitly set in the DT. Also update documentation to use sequence number. Signed-off-by: Zixun LI --- cmd/bind.c

Re: [PATCH] usb: gadget: ether: Handle gadget driver registration in start and stop

2024-08-07 Thread Zixun LI
Hi Mattijs, On Tue, Aug 6, 2024 at 4:00 PM Mattijs Korpershoek wrote: > > I'd like to test this on my end as well. Could you please give some > details on how this has been tested? > > A sequence of U-Boot commands would be helpful, for example. My tests are done on a custom ATMEL SAM9G25 board

Re: [PATCH] usb: gadget: udc: Fix duplicate uclass name

2024-08-07 Thread Zixun LI
Hi Mattijs, On Wed, Aug 7, 2024 at 9:07 AM Mattijs Korpershoek wrote: > > > Have you identified boards which use the DT alias that will break > with this patch? > > Maybe we can detail the required fix in the commit message a bit as well? > Or, if you know of a board that uses "usb" as DT alias s

Re: [PATCH] usb: gadget: udc: Fix duplicate uclass name

2024-08-13 Thread Zixun LI
Hi Mattijs, On Tue, Aug 13, 2024 at 10:28 AM Mattijs Korpershoek wrote: > > Thank you for giving some board examples. I am still a bit unclear on > the meaning of: > > """ > This breaks the capacity of using "usb" as DT alias sequence numbering > which needs a fix afterwards. > """ > > I have add

[PATCH 1/1] usb: gadget: ether: Disable USB pullup in eth probe

2024-08-21 Thread Zixun LI
-110 usb usb1-port1: attempt power cycle Disable USB pullup to prevent unwanted enumeration attempt. Signed-off-by: Zixun LI --- drivers/usb/gadget/ether.c | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c ind

Re: [PATCH 1/1] usb: gadget: ether: Disable USB pullup in eth probe

2024-08-21 Thread Zixun LI
Hi Marek, On Wed, Aug 21, 2024 at 11:43 PM Marek Vasut wrote: > > Wouldn't it be better if usb_gadget_register_driver() started in > disconnected state right away ? That's what I did initially. But since g_dnl doesn't do connection after register (I explained in cover letter) doing so will keep

Re: [PATCH 1/1] usb: gadget: ether: Disable USB pullup in eth probe

2024-08-22 Thread Zixun LI
Hi, On Thu, Aug 22, 2024 at 1:26 AM Marek Vasut wrote: > > Would it be possible to fix up the g_dnl ? g_dnl's interface is pretty different from usb_ether, I can't find a way to access usb_gadget struct in g_dnl_register(). Meanwhile it can be fixed in udc core, by doing gadget_driver bind afte

Re: [PATCH 1/1] usb: gadget: ether: Disable USB pullup in eth probe

2024-08-22 Thread Zixun LI
On Thu, Aug 22, 2024 at 5:24 PM Marek Vasut wrote: > > Can you change the g_dnl_register() prototype and pass he structure in ? > I suspect it should be available in the commands which register g_dnl ? > There are many places where g_dnl_register() is called, like fastboot, dfu, ums, etc, need to

Re: [PATCH 1/1] usb: gadget: ether: Disable USB pullup in eth probe

2024-08-23 Thread Zixun LI
On Fri, Aug 23, 2024 at 4:54 AM Marek Vasut wrote: > > I think udc_bind_to_driver() should not call usb_gadget_connect() , that > connect should likely be called by at some later point. Yes it's more logical, to keep it in disconnected state you prefer modify controllers drivers init (I can do us

Re: [PATCH 1/1] usb: gadget: ether: Disable USB pullup in eth probe

2024-08-26 Thread Zixun LI
On Sun, Aug 25, 2024 at 2:13 AM Marek Vasut wrote: > > > > > I am looking at the usb_add_gadget_udc_release() and > > usb_gadget_probe_driver() and I am thinking, sigh, all that code is > > ready to be replaced by something cleaner which does not use this > > special struct usb_udc and udc_list, b

Re: [PATCH v2] mtd: nand: raw: atmel: Use ONFI ECC params if available

2024-10-09 Thread Zixun LI
Hi, sorry to bother, it seems like the patch is not picked up yet ? Zixun

[PATCH 3/3] gpio: at91: Implement ops get_flags

2024-10-18 Thread Zixun LI
Add ops get_dir_flags() to read status from GPIO registers. Signed-off-by: Zixun LI --- drivers/gpio/at91_gpio.c | 45 1 file changed, 45 insertions(+) diff --git a/drivers/gpio/at91_gpio.c b/drivers/gpio/at91_gpio.c index 7828f9b447..c986007716 100644

[PATCH 1/3] gpio: at91: Implement GPIOF_FUNC in get_function()

2024-10-18 Thread Zixun LI
This patch adds support for determining whether a gpio pin is mapped as peripheral function. Signed-off-by: Zixun LI --- drivers/gpio/at91_gpio.c | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/gpio/at91_gpio.c b/drivers/gpio/at91_gpio.c index

[PATCH 2/3] gpio: at91: Implement ops set_flags

2024-10-18 Thread Zixun LI
Support GPIO configuration with following flags: - in, out, out_active - open_drain, pull_up Signed-off-by: Zixun LI --- drivers/gpio/at91_gpio.c | 41 1 file changed, 41 insertions(+) diff --git a/drivers/gpio/at91_gpio.c b/drivers/gpio/at91_gpio.c

[PATCH v2 3/3] gpio: at91: Implement ops get_flags

2024-10-18 Thread Zixun LI
Add ops get_dir_flags() to read status from GPIO registers. Signed-off-by: Zixun LI --- Changes in v2: - Fix pullup read polarity --- drivers/gpio/at91_gpio.c | 45 1 file changed, 45 insertions(+) diff --git a/drivers/gpio/at91_gpio.c b/drivers/gpio

[PATCH] dm: gpio: Return error when pull up/down is requested but set_flags ops is not implmentated

2024-10-21 Thread Zixun LI
Currently in _dm_gpio_set_flags() when set_flags ops is not implemented direction_output()/_input() is used, but pull up/down is not supported by these ops. Signed-off-by: Zixun LI --- We have updated our AT91 BSP to use DM, on field testing few boards went into a failed state due to gpio pullup

env: ENV_WRITEABLE_LIST with ".flags" variable

2024-10-30 Thread Zixun LI
Hello, I read the code about environment variable protection and an old discussion: https://lists.denx.de/pipermail/u-boot/2021-April/446247.html but I still have a question. In env_flags_init() we have: if (first_call) { #ifdef CONFIG_ENV_WRITEABLE_LIST flags_list = ENV_FLAGS_LIST_ST

Re: [PATCH 1/3] gpio: at91: Implement GPIOF_FUNC in get_function()

2024-11-12 Thread Zixun LI
Hello, On Tue, Nov 12, 2024 at 2:13 PM Eugen Hristev wrote: > > > > +static bool at91_get_port_pio(struct at91_port *at91_port, int offset) > > The name get_port_pio is a bit confusing, can you rename it to something > more meaningful, like maybe is_periph_func or something ? How about at91_is_

Re: [PATCH 2/3] gpio: at91: Implement ops set_flags

2024-11-12 Thread Zixun LI
Hi, On Tue, Nov 12, 2024 at 2:21 PM Eugen Hristev wrote: > > Does this change the current behavior? there is no set_flag ops > implemented, previously it would use a default that would just return > success regardless of the given flags parameters ? > Btw maybe ENOTSUPP ? > Currently without .se

Re: [PATCH 1/3] gpio: at91: Implement GPIOF_FUNC in get_function()

2024-11-12 Thread Zixun LI
On Tue, Nov 12, 2024 at 4:59 PM Eugen Hristev wrote: > > > > On 11/12/24 17:57, Zixun LI wrote: > > Hello, > > > > > > On Tue, Nov 12, 2024 at 2:13 PM Eugen Hristev > > wrote: > >> > >> > >>> +static bool at91_get_port_pio(

Re: [PATCH v2 3/3] gpio: at91: Implement ops get_flags

2024-11-12 Thread Zixun LI
Hi, On Tue, Nov 12, 2024 at 2:27 PM Eugen Hristev wrote: > > Use clamp (!!) to turn this into a bool. > Should I also fix the existing function at91_get_port_output() ?

[PATCH v2 1/3] gpio: at91: Implement GPIOF_FUNC in get_function()

2024-11-13 Thread Zixun LI
This patch adds support for determining whether a gpio pin is mapped as peripheral function. Signed-off-by: Zixun LI --- Changes in v2: - Rename function --- drivers/gpio/at91_gpio.c | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/gpio/at91_gpio.c b

[PATCH v2 2/3] gpio: at91: Implement ops set_flags

2024-11-13 Thread Zixun LI
Support GPIO configuration with following flags: - in, out, out_active - open_drain, pull_up Signed-off-by: Zixun LI --- Changes in v2: - Return ENOTSUPP if flag is unsupported. - Inline port output variable. --- drivers/gpio/at91_gpio.c | 39 +++ 1 file

[PATCH v3 3/3] gpio: at91: Implement ops get_flags

2024-11-13 Thread Zixun LI
Add ops get_dir_flags() to read status from GPIO registers. Signed-off-by: Zixun LI --- Changes in v2: - Fix pullup read polarity Changes in v3: - Use clamp (!!) to turn return value into a bool --- drivers/gpio/at91_gpio.c | 45 1 file changed, 45

[PATCH] usb: gadget: atmel: Add SAM9X60 support

2025-03-23 Thread Zixun LI
s commands. Signed-off-by: Zixun LI --- arch/arm/dts/sam9x60.dtsi| 14 ++ arch/arm/mach-at91/include/mach/atmel_usba_udc.h | 2 +- drivers/usb/gadget/atmel_usba_udc.c | 1 + 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/arch/arm/d

Re: usb:composite: data abort on second ums launch

2025-03-24 Thread Zixun LI
On Mon, Mar 24, 2025 at 3:12 PM Marek Vasut wrote: > Can you reproduce this on u-boot/master too ? Yes I can reproduce it on master 2025.04-244e61f, since fsg init/deinit code are the same.

Re: usb:composite: data abort on second ums launch

2025-03-24 Thread Zixun LI
On Mon, Mar 24, 2025 at 6:21 PM Mattijs Korpershoek wrote: > I've tried to reproduce this on master (2025.04-rc4-g244e61fbb7f5) and I > don't reproduce this with the VIM3 board using > khadas-vim3_android_ab_defconfig: > > I'll try to understand why it's behaving differently between the > sam9x60

usb:composite: data abort on second ums launch

2025-03-24 Thread Zixun LI
Hi, I encountered a data abort on the 2nd "ums 0 mmc 0" command on u-boot-at91 2024.07 with sam9x60-curiosity board. U-Boot> ums 0 mmc 0 UMS: LUN 0, dev mmc 0, hwpart 0, sector 0x0, count 0x1d29000 CTRL+C - Operation aborted U-Boot> ums 0 mmc 0 UMS: LUN 0, dev mmc 0, hwpart 0, sector 0x0, count 0

Re: [PATCH 0/4] usb: gadget: f_mass_storage: Fix crashes on low memory devices

2025-03-28 Thread Zixun LI
On Fri, Mar 28, 2025 at 9:15 AM Mattijs Korpershoek wrote: > This series fixes the above mentioned crash by introducing proper error > handling and freeing the buffers in the unbind callback. Hi Mattijs, Thank you for the quick fix, I've tested on SAM9X60 with multiple ums commands and it works.

Re: [PATCH] usb: gadget: atmel: Add SAM9X60 support

2025-03-31 Thread Zixun LI
On Mon, Mar 31, 2025 at 11:39 AM Mattijs Korpershoek wrote: > > Hi Eugen, > > On lun., mars 31, 2025 at 12:26, Eugen Hristev > wrote: > > > On 3/31/25 12:05, Mattijs Korpershoek wrote: > >> Hi Eugen, Zixun, > >> > >> On lun., mars 24, 2025 at 11:23, Eugen Hristev > >> wrote: > > If there is a

[PATCH v2 3/3] ARM: dts: at91: sam9x60-curiosity: Enable USB gadget node

2025-03-31 Thread Zixun LI
Enable USB gadget usb0 node support. Signed-off-by: Zixun LI --- arch/arm/dts/at91-sam9x60_curiosity.dts | 4 1 file changed, 4 insertions(+) diff --git a/arch/arm/dts/at91-sam9x60_curiosity.dts b/arch/arm/dts/at91-sam9x60_curiosity.dts index 99867d2bf8e..08480df88c6 100644 --- a/arch

[PATCH 0/7] watchdog: at91sam9_wdt driver enhancement

2025-04-02 Thread Zixun LI
, some bitfields bof MR register shifted their position, a new register is added for timer value. 4. Add DT node to SAM9X60-Currently board It has been tested on SAM9X60-Currently board: - Start & stop - Set timeout from DT node - Reset kick in with a while(1) loop Zixun LI (7): arm: at91:

[PATCH v2 1/3] usb: gadget: atmel: Add SAM9X60 support

2025-04-04 Thread Zixun LI
Compared to SAM9X5 the only difference is the DPRAM memory from the USB High Speed Device Port (UDPHS) hardware block was increased, so we can reuse the same endpoint data. Also add compatible "microchip,sam9x60-udc". Signed-off-by: Zixun LI --- arch/arm/mach-at91/include/mach/atmel_

[PATCH 6/7] ARM: dts: sam9x60: Add watchdog DT node.

2025-04-04 Thread Zixun LI
Add the watchdog timer node for the sam9x60 SoC's. Signed-off-by: Zixun LI --- arch/arm/dts/sam9x60.dtsi | 7 +++ 1 file changed, 7 insertions(+) diff --git a/arch/arm/dts/sam9x60.dtsi b/arch/arm/dts/sam9x60.dtsi index 3b684fc63d5..f32d51eb231 100644 --- a/arch/arm/dts/sam9x60.dtsi

[PATCH 3/7] watchdog: at91sam9_wdt: Rename priv to wdt

2025-03-31 Thread Zixun LI
"wdt" is a better name for watchdog rather than generic "priv". Signed-off-by: Zixun LI --- drivers/watchdog/at91sam9_wdt.c | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/watchdog/at91sam9_wdt.c b/drivers/watchdog/

[PATCH 4/7] arm: at91: wdt: Add SAM9X60 register definition

2025-03-31 Thread Zixun LI
SAM9X60 has different watchdog register definition. Signed-off-by: Zixun LI --- arch/arm/mach-at91/include/mach/at91_wdt.h | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-at91/include/mach/at91_wdt.h b/arch/arm/mach-at91/include/mach/at91_wdt.h

[PATCH v2 2/3] ARM: dts: sam9x60: Add USB gadget DT node.

2025-03-31 Thread Zixun LI
Add the USB gadget DT node for the sam9x60 SoC's. Signed-off-by: Zixun LI --- arch/arm/dts/sam9x60.dtsi | 13 + 1 file changed, 13 insertions(+) diff --git a/arch/arm/dts/sam9x60.dtsi b/arch/arm/dts/sam9x60.dtsi index 3b684fc63d5..ea2647e5fc9 100644 --- a/arch/arm/dts/sam9x60

Re: [PATCH 0/4] usb: gadget: f_mass_storage: Fix crashes on low memory devices

2025-03-30 Thread Zixun LI
e but did end up with the right document you linked ;) Tested-by: Zixun LI # on SAM9X60 Zixun

[PATCH 1/7] arm: at91: wdt: Remove unused at91_wdt struct

2025-03-31 Thread Zixun LI
at91_wdt struct is not used by anyone, let's remove it. Signed-off-by: Zixun LI --- arch/arm/mach-at91/include/mach/at91_wdt.h | 6 -- 1 file changed, 6 deletions(-) diff --git a/arch/arm/mach-at91/include/mach/at91_wdt.h b/arch/arm/mach-at91/include/mach/at91_wdt.h index 8ef8e0

[PATCH 5/7] watchdog: at91sam9_wdt: Add SAM9X60 support

2025-03-31 Thread Zixun LI
SAM9X60 has a slightly different watchdog implementation: - Timer value moved into a new register WLR - Some MR register fields have their position changed This patch add SAM9X60 support, also adds a compatible for SAMA5D4 who is the same as existing SAM9260. Signed-off-by: Zixun LI --- arch

[PATCH 7/7] ARM: dts: at91: sam9x60-curiosity: Enable watchdog node

2025-04-05 Thread Zixun LI
Enable watchdog node on SAM9X60-Curiosity board. Signed-off-by: Zixun LI --- arch/arm/dts/at91-sam9x60_curiosity.dts | 5 + 1 file changed, 5 insertions(+) diff --git a/arch/arm/dts/at91-sam9x60_curiosity.dts b/arch/arm/dts/at91-sam9x60_curiosity.dts index 99867d2bf8e..cdb782e28ff 100644

[PATCH 2/7] arm: at91: wdt: Rename regval in priv data to mr

2025-04-04 Thread Zixun LI
Use the name "mr" since we are referring to timer mode register. Signed-off-by: Zixun LI --- arch/arm/mach-at91/include/mach/at91_wdt.h | 2 +- drivers/watchdog/at91sam9_wdt.c| 8 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/arm/mach-at91/in

Re: [PATCH 1/7] arm: at91: wdt: Remove unused at91_wdt struct

2025-04-10 Thread Zixun LI
On Thu, Apr 10, 2025 at 12:28 PM Eugen Hristev wrote: > > This breaks sama5d2_xplained_mmc_defconfig for example. > > In file included from arch/arm/mach-at91/spl.c:8: > arch/arm/mach-at91/spl.c: In function ‘at91_disable_wdt’: > arch/arm/mach-at91/spl.c:19:39: error: invalid use of undefined type