From c46d7fbb91be97818da7920bc77d67fd052a1953 Mon Sep 17 00:00:00 2001 From: lekernel Date: Sat, 25 Sep 2010 18:00:09 +0200 Subject: [PATCH] Remove hardware based disconnection detect --- cores/softusb/rtl/softusb_phy.v | 47 --------------------------------- cores/softusb/rtl/softusb_sie.v | 10 ++----- softusb-input/main.c | 4 +-- softusb-input/sie.h | 2 -- 4 files changed, 4 insertions(+), 59 deletions(-) diff --git a/cores/softusb/rtl/softusb_phy.v b/cores/softusb/rtl/softusb_phy.v index cb6ff214..0cd1c32c 100644 --- a/cores/softusb/rtl/softusb_phy.v +++ b/cores/softusb/rtl/softusb_phy.v @@ -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, @@ -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]; diff --git a/cores/softusb/rtl/softusb_sie.v b/cores/softusb/rtl/softusb_sie.v index 1cce4c57..65f3675d 100644 --- a/cores/softusb/rtl/softusb_sie.v +++ b/cores/softusb/rtl/softusb_sie.v @@ -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; @@ -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; @@ -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), diff --git a/softusb-input/main.c b/softusb-input/main.c index 43343388..06776735 100644 --- a/softusb-input/main.c +++ b/softusb-input/main.c @@ -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; diff --git a/softusb-input/sie.h b/softusb-input/sie.h index 45716f1b..baa39669 100644 --- a/softusb-input/sie.h +++ b/softusb-input/sie.h @@ -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