aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb
diff options
context:
space:
mode:
authorFrank Li <Frank.Li@nxp.com>2020-04-29 10:35:11 +0800
committerStefano Babic <sbabic@denx.de>2020-05-03 15:31:34 +0200
commit8f95c0105f77dfc4f42babcdb725a55902a371f8 (patch)
tree3e48ff65b4ac15e5e933b3734e6990a4d84d89e0 /drivers/usb
parent62597d25514e3e36e891c626620624755d8cb56d (diff)
downloadu-boot-8f95c0105f77dfc4f42babcdb725a55902a371f8.zip
u-boot-8f95c0105f77dfc4f42babcdb725a55902a371f8.tar.gz
u-boot-8f95c0105f77dfc4f42babcdb725a55902a371f8.tar.bz2
usb: gadget: sdp: use CONFIG_SDP_LOADADDR as default load address
If SDP_WRITE and SDP_JUMP addr is zero, use CONFIG_SDP_LOADADDR as default address Signed-off-by: Frank Li <Frank.Li@nxp.com> Signed-off-by: Peng Fan <peng.fan@nxp.com>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/gadget/Kconfig4
-rw-r--r--drivers/usb/gadget/f_sdp.c4
2 files changed, 6 insertions, 2 deletions
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
index 58ca82d..46aa3fe 100644
--- a/drivers/usb/gadget/Kconfig
+++ b/drivers/usb/gadget/Kconfig
@@ -122,6 +122,10 @@ config USB_GADGET_VBUS_DRAW
This value will be used except for system-specific gadget
drivers that have more specific information.
+config SDP_LOADADDR
+ hex "Default load address at SDP_WRITE and SDP_JUMP"
+ default 0
+
# Selected by UDC drivers that support high-speed operation.
config USB_GADGET_DUALSPEED
bool
diff --git a/drivers/usb/gadget/f_sdp.c b/drivers/usb/gadget/f_sdp.c
index 50836db..1732a3a 100644
--- a/drivers/usb/gadget/f_sdp.c
+++ b/drivers/usb/gadget/f_sdp.c
@@ -276,7 +276,7 @@ static void sdp_rx_command_complete(struct usb_ep *ep, struct usb_request *req)
sdp->error_status = SDP_WRITE_FILE_COMPLETE;
sdp->state = SDP_STATE_RX_FILE_DATA;
- sdp->dnl_address = be32_to_cpu(cmd->addr);
+ sdp->dnl_address = cmd->addr ? be32_to_cpu(cmd->addr) : CONFIG_SDP_LOADADDR;
sdp->dnl_bytes_remaining = be32_to_cpu(cmd->cnt);
sdp->dnl_bytes = sdp->dnl_bytes_remaining;
sdp->next_state = SDP_STATE_IDLE;
@@ -304,7 +304,7 @@ static void sdp_rx_command_complete(struct usb_ep *ep, struct usb_request *req)
sdp->always_send_status = false;
sdp->error_status = 0;
- sdp->jmp_address = be32_to_cpu(cmd->addr);
+ sdp->jmp_address = cmd->addr ? be32_to_cpu(cmd->addr) : CONFIG_SDP_LOADADDR;
sdp->state = SDP_STATE_TX_SEC_CONF;
sdp->next_state = SDP_STATE_JUMP;
break;