Skip to content

Commit 36815a4

Browse files
rmsilvagregkh
authored andcommitted
usb: isp1760: write to status and address register
We were already writing directly the port status register to trigger changes in isp1763. The same is needed in other IP from the family, including also to setup the read address before reading from device. Reported-by: Dietmar Eggemann <[email protected]> Tested-by: Dietmar Eggemann <[email protected]> Signed-off-by: Rui Miguel Silva <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent cbfa3ef commit 36815a4

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

drivers/usb/isp1760/isp1760-hcd.c

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ struct urb_listitem {
182182
struct urb *urb;
183183
};
184184

185-
static const u32 isp1763_hc_portsc1_fields[] = {
185+
static const u32 isp176x_hc_portsc1_fields[] = {
186186
[PORT_OWNER] = BIT(13),
187187
[PORT_POWER] = BIT(12),
188188
[PORT_LSTATUS] = BIT(10),
@@ -205,27 +205,28 @@ static u32 isp1760_hcd_read(struct usb_hcd *hcd, u32 field)
205205
}
206206

207207
/*
208-
* We need, in isp1763, to write directly the values to the portsc1
208+
* We need, in isp176x, to write directly the values to the portsc1
209209
* register so it will make the other values to trigger.
210210
*/
211211
static void isp1760_hcd_portsc1_set_clear(struct isp1760_hcd *priv, u32 field,
212212
u32 val)
213213
{
214-
u32 bit = isp1763_hc_portsc1_fields[field];
215-
u32 port_status = readl(priv->base + ISP1763_HC_PORTSC1);
214+
u32 bit = isp176x_hc_portsc1_fields[field];
215+
u16 portsc1_reg = priv->is_isp1763 ? ISP1763_HC_PORTSC1 :
216+
ISP176x_HC_PORTSC1;
217+
u32 port_status = readl(priv->base + portsc1_reg);
216218

217219
if (val)
218-
writel(port_status | bit, priv->base + ISP1763_HC_PORTSC1);
220+
writel(port_status | bit, priv->base + portsc1_reg);
219221
else
220-
writel(port_status & ~bit, priv->base + ISP1763_HC_PORTSC1);
222+
writel(port_status & ~bit, priv->base + portsc1_reg);
221223
}
222224

223225
static void isp1760_hcd_write(struct usb_hcd *hcd, u32 field, u32 val)
224226
{
225227
struct isp1760_hcd *priv = hcd_to_priv(hcd);
226228

227-
if (unlikely(priv->is_isp1763 &&
228-
(field >= PORT_OWNER && field <= PORT_CONNECT)))
229+
if (unlikely((field >= PORT_OWNER && field <= PORT_CONNECT)))
229230
return isp1760_hcd_portsc1_set_clear(priv, field, val);
230231

231232
isp1760_field_write(priv->fields, field, val);
@@ -367,8 +368,7 @@ static void isp1760_mem_read(struct usb_hcd *hcd, u32 src_offset, void *dst,
367368
{
368369
struct isp1760_hcd *priv = hcd_to_priv(hcd);
369370

370-
isp1760_hcd_write(hcd, MEM_BANK_SEL, ISP_BANK_0);
371-
isp1760_hcd_write(hcd, MEM_START_ADDR, src_offset);
371+
isp1760_reg_write(priv->regs, ISP176x_HC_MEMORY, src_offset);
372372
ndelay(100);
373373

374374
bank_reads8(priv->base, src_offset, ISP_BANK_0, dst, bytes);
@@ -496,8 +496,7 @@ static void isp1760_ptd_read(struct usb_hcd *hcd, u32 ptd_offset, u32 slot,
496496
u16 src_offset = ptd_offset + slot * sizeof(*ptd);
497497
struct isp1760_hcd *priv = hcd_to_priv(hcd);
498498

499-
isp1760_hcd_write(hcd, MEM_BANK_SEL, ISP_BANK_0);
500-
isp1760_hcd_write(hcd, MEM_START_ADDR, src_offset);
499+
isp1760_reg_write(priv->regs, ISP176x_HC_MEMORY, src_offset);
501500
ndelay(90);
502501

503502
bank_reads8(priv->base, src_offset, ISP_BANK_0, (void *)ptd,

0 commit comments

Comments
 (0)