Skip to content

Conversation

@MCHP-MPU-Solutions-SHA
Copy link
Contributor

Add driver support for Sama7g5 USB UDC (UDPHS).

Many thanks.
Xing.

USB packets system data bursts will be locked for
maximum optimization of the bus bandwidth usage.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea what this really means. From code it seems that you set some bit. Is it essentially affecting DMA operation/memory access arbitrage?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, this is a chip related feature, for more details please refer to the datasheet, see bit BURST_LCK in register UDPHS_DMACONTROL.
This will allow the UDPHS DMA channel has max burst length when accessing the bus.

And I made a switch for this feature in the Kconfig, customer can enable it for higher USB bandwidth under heavy system load.

@MCHP-MPU-Solutions-SHA MCHP-MPU-Solutions-SHA force-pushed the sama7g5_udphs branch 2 times, most recently from 347563c to 5a56317 Compare November 20, 2025 07:08
@nandojve nandojve added this to the v4.4.0 milestone Nov 20, 2025
Copy link
Member

@nandojve nandojve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a report from sample/subsys/usb/testusb HS. FS is it should work like that too.
A full report usually tests from 0 up to 29.

};
};

udphsa: usbd@200000 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Convention is order by address.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The devices in sama7g5.dtsi have been listed in alphabetical order, so I put the udphs device at the end of it.
Do you still need me order the udphs devices by space address?


compatible: "microchip,sam-udphs"

include: [usb-ep.yaml, pinctrl-device.yaml]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

include:
- name: ethernet-controller.yaml
- name: pinctrl-device.yaml

-include: [usb-ep.yaml, pinctrl-device.yaml]
+include:
+    - name: usb-ep.yaml
+    - name: pinctrl-device.yaml

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

(MMU_REGION_FLAT_ENTRY("pwm", PWM_BASE_ADDRESS, 0x500,
MT_STRONGLY_ORDERED | MPERM_R | MPERM_W),))

MMU_REGION_FLAT_ENTRY("rstc", RSTC_BASE_ADDRESS, 0x10,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

by convention we are enabling this before devicetree binding. Move this commit to 2nd position.

Note: Adjust the commit message body to be close to the 72 character per line.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commits order has been adjusted.
Commit message body has been adjusted.


config UDC_MCHP_SAM_BURST_LOCK
bool "Lock bus access for maximum bandwidth"
default n
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the default n can be dropped because it is the default. See redundant-defaults. Drop all redundant defaults.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All redundant defaults have been removed.

#define SZ_1024 10 /* 1 << 10 */
};

static const struct udphs_ep_desc sam_ep_desc[UDPHS_EPT_NUMBER] = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By this table the driver will only expose HS, no FS. Is that right ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this table exposed all endpoints for HS and FS.
These endpoints can be used in HS mode and FS mode.

Add api function to check the setup stage, which means the control
transfer's stages are completed and back to the default stage.

Signed-off-by: CHEN Xing <xing.chen@microchip.com>
Update mmu region for udphsa and udphsb, add usb phy clock configuration

Signed-off-by: CHEN Xing <xing.chen@microchip.com>
Add udphsa udphsb udc devices to sama7g5

Signed-off-by: CHEN Xing <xing.chen@microchip.com>
Add driver for sama7g5 UDPHS

Signed-off-by: CHEN Xing <xing.chen@microchip.com>
Add udphs udc devices and enable udphsa

Signed-off-by: CHEN Xing <xing.chen@microchip.com>
@sonarqubecloud
Copy link

@MCHP-MPU-Solutions-SHA
Copy link
Contributor Author

MCHP-MPU-Solutions-SHA commented Nov 24, 2025

Add a report from sample/subsys/usb/testusb HS. FS is it should work like that too. A full report usually tests from 0 up to 29.

Hi Gerson,
It looks like I have find a driver bug via testusb tool (in test 10), so I just remove the previous comment.
I will fix it and updated here.

Many thanks.
Xing.

@nandojve
Copy link
Member

Add a report from sample/subsys/usb/testusb HS. FS is it should work like that too. A full report usually tests from 0 up to 29.

Hi Gerson, It looks like I have find a driver bug via testusb tool (in test 10), so I just remove the previous comment. I will fix it and updated here.

Many thanks. Xing.

If I'm not mistake, 10 is about data out in control EP. The below could give you some hints.
Make sure you have the correct EP size too.
68b57ea

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: Boards/SoCs area: Devicetree Bindings area: USB Universal Serial Bus platform: Microchip MEC Microchip MEC Platform platform: Microchip SAM Microchip SAM Platform (formerly Atmel SAM)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants