Skip to content

Commit

Permalink
Remove hardware based disconnection detect
Browse files Browse the repository at this point in the history
  • Loading branch information
lekernel committed Sep 25, 2010
1 parent 983ace4 commit c46d7fb
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 59 deletions.
47 changes: 0 additions & 47 deletions cores/softusb/rtl/softusb_phy.v
Expand Up @@ -31,9 +31,6 @@ module softusb_phy(
inout usbb_vp,
inout usbb_vm,

output usba_discon,
output usbb_discon,

output [1:0] line_state_a,
output [1:0] line_state_b,

Expand Down Expand Up @@ -162,50 +159,6 @@ assign usbb_oe_n = ~txoe_b;
assign usbb_vp = txoe_b ? (generate_reset[1] ? 1'b0 : txp) : 1'bz;
assign usbb_vm = txoe_b ? (generate_reset[1] ? 1'b0 : txm) : 1'bz;

/* Assert USB disconnect if we see SE0 for at least 2.5us */

reg txoe_a_r0;
reg txoe_b_r0;
reg txoe_a_r1;
reg txoe_b_r1;
reg txoe_a_r2;
reg txoe_b_r2;

always @(posedge usb_clk) begin
txoe_a_r0 <= txoe_a;
txoe_b_r0 <= txoe_b;
txoe_a_r1 <= txoe_a_r0;
txoe_b_r1 <= txoe_b_r0;
txoe_a_r2 <= txoe_a_r1;
txoe_b_r2 <= txoe_b_r1;
end

reg [6:0] usba_discon_cnt;
assign usba_discon = (usba_discon_cnt == 7'd127);
always @(posedge usb_clk) begin
if(usb_rst)
usba_discon_cnt <= 7'd0;
else if(~txoe_a & ~txoe_a_r0 & ~txoe_a_r1 & ~txoe_a_r2) begin
if(line_state_a != 2'h0)
usba_discon_cnt <= 7'd0;
else if(~usba_discon)
usba_discon_cnt <= usba_discon_cnt + 7'd1;
end
end

reg [6:0] usbb_discon_cnt;
assign usbb_discon = (usbb_discon_cnt == 7'd127);
always @(posedge usb_clk) begin
if(usb_rst)
usbb_discon_cnt <= 7'd0;
else if(~txoe_b & ~txoe_b_r0 & ~txoe_b_r1 & ~txoe_b_r2) begin
if(line_state_b != 2'h0)
usbb_discon_cnt <= 7'd0;
else if(~usbb_discon)
usbb_discon_cnt <= usbb_discon_cnt + 7'd1;
end
end

assign usba_spd = ~low_speed[0];
assign usbb_spd = ~low_speed[1];

Expand Down
10 changes: 2 additions & 8 deletions cores/softusb/rtl/softusb_sie.v
Expand Up @@ -41,9 +41,6 @@ module softusb_sie(
wire [1:0] line_state_a;
wire [1:0] line_state_b;

wire discon_a;
wire discon_b;

reg port_sel_rx;
reg [1:0] port_sel_tx;

Expand Down Expand Up @@ -81,8 +78,8 @@ always @(posedge usb_clk) begin
case(io_a)
6'h00: io_do <= line_state_a;
6'h01: io_do <= line_state_b;
6'h02: io_do <= discon_a;
6'h03: io_do <= discon_b;
// 6'h02: free
// 6'h03: free

6'h04: io_do <= port_sel_rx;
6'h05: io_do <= port_sel_tx;
Expand Down Expand Up @@ -150,9 +147,6 @@ softusb_phy phy(
.usbb_vp(usbb_vp),
.usbb_vm(usbb_vm),

.usba_discon(discon_a),
.usbb_discon(discon_b),

.line_state_a(line_state_a),
.line_state_b(line_state_b),

Expand Down
4 changes: 2 additions & 2 deletions softusb-input/main.c
Expand Up @@ -282,9 +282,9 @@ static void check_discon(struct port_status *p, char name)
char discon;

if(name == 'A')
discon = rio8(SIE_DISCON_A);
discon = rio8(SIE_LINE_STATUS_A) == 0x00;
else
discon = rio8(SIE_DISCON_B);
discon = rio8(SIE_LINE_STATUS_B) == 0x00;
if(discon) {
print_string(disconnect); print_char(name); print_char('\n');
p->state = PORT_STATE_DISCONNECTED;
Expand Down
2 changes: 0 additions & 2 deletions softusb-input/sie.h
Expand Up @@ -22,8 +22,6 @@

#define SIE_LINE_STATUS_A 0x00
#define SIE_LINE_STATUS_B 0x01
#define SIE_DISCON_A 0x02
#define SIE_DISCON_B 0x03

#define SIE_SEL_RX 0x04
#define SIE_SEL_TX 0x05
Expand Down

0 comments on commit c46d7fb

Please sign in to comment.