2 * USB host driver for BCM2835
3 * Synopsis DesignWare Core USB 2.0 OTG controller
5 * Device register definitions
8 typedef unsigned int Reg;
9 typedef struct Dwcregs Dwcregs;
10 typedef struct Hostchan Hostchan;
13 Maxchans = 16, /* actual number of channels in ghwcfg2 */
17 /* Core global registers 0x000-0x140 */
18 Reg gotgctl; /* OTG Control and Status */
19 Reg gotgint; /* OTG Interrupt */
20 Reg gahbcfg; /* Core AHB Configuration */
21 Reg gusbcfg; /* Core USB Configuration */
22 Reg grstctl; /* Core Reset */
23 Reg gintsts; /* Core Interrupt */
24 Reg gintmsk; /* Core Interrupt Mask */
25 Reg grxstsr; /* Receive Status Queue Read (RO) */
26 Reg grxstsp; /* Receive Status Queue Read & POP (RO) */
27 Reg grxfsiz; /* Receive FIFO Size */
28 Reg gnptxfsiz; /* Non Periodic Transmit FIFO Size */
29 Reg gnptxsts; /* Non Periodic Transmit FIFO/Queue Status (RO) */
30 Reg gi2cctl; /* I2C Access */
31 Reg gpvndctl; /* PHY Vendor Control */
32 Reg ggpio; /* General Purpose Input/Output */
33 Reg guid; /* User ID */
34 Reg gsnpsid; /* Synopsys ID (RO) */
35 Reg ghwcfg1; /* User HW Config1 (RO) (DEVICE) */
36 Reg ghwcfg2; /* User HW Config2 (RO) */
37 Reg ghwcfg3; /* User HW Config3 (RO) */
38 Reg ghwcfg4; /* User HW Config4 (RO)*/
39 Reg glpmcfg; /* Core LPM Configuration */
40 Reg gpwrdn; /* Global PowerDn */
41 Reg gdfifocfg; /* Global DFIFO SW Config (DEVICE?) */
42 Reg adpctl; /* ADP Control */
44 Reg hptxfsiz; /* Host Periodic Transmit FIFO Size */
45 Reg dtxfsiz[15]; /* Device Periodic Transmit FIFOs (DEVICE) */
46 char pad0[0x400-0x140];
48 /* Host global registers 0x400-0x420 */
49 Reg hcfg; /* Configuration */
50 Reg hfir; /* Frame Interval */
51 Reg hfnum; /* Frame Number / Frame Remaining (RO) */
53 Reg hptxsts; /* Periodic Transmit FIFO / Queue Status */
54 Reg haint; /* All Channels Interrupt */
55 Reg haintmsk; /* All Channels Interrupt Mask */
56 Reg hflbaddr; /* Frame List Base Address */
57 char pad1[0x440-0x420];
59 /* Host port register 0x440 */
60 Reg hport0; /* Host Port 0 Control and Status */
61 char pad2[0x500-0x444];
63 /* Host channel specific registers 0x500-0x700 */
65 Reg hcchar; /* Characteristic */
66 Reg hcsplt; /* Split Control */
67 Reg hcint; /* Interrupt */
68 Reg hcintmsk; /* Interrupt Mask */
69 Reg hctsiz; /* Transfer Size */
70 Reg hcdma; /* DMA Address */
72 Reg hcdmab; /* DMA Buffer Address */
74 char pad3[0xE00-0x700];
76 /* Power & clock gating control register 0xE00 */
99 Multvalidbc = 0x1F<<22,
104 Sesreqsucstschng= 1<<8,
105 Hstnegsucstschng= 1<<9,
107 Adevtoutchng = 1<<18,
113 /* bits 1:4 redefined for BCM2835 */
114 Axiburstlen = 0x3<<1,
119 Axiwaitwrites = 1<<4,
122 NPTX_HALFEMPTY = 0<<7,
125 PTX_HALFEMPTY = 0<<8,
128 Notialldmawrit = 1<<22,
134 Ulpi_utmi_sel = 1<<4,
146 Phylpwrclksel = 1<<15,
147 Otgutmifssel = 1<<16,
149 Ulpi_auto_res = 1<<18,
150 Ulpi_clk_sus_m = 1<<19,
151 Ulpi_ext_vbus_drv= 1<<20,
152 Ulpi_int_vbus_indicator= 1<<21,
153 Term_sel_dl_pulse= 1<<22,
154 Indicator_complement= 1<<23,
155 Indicator_pass_through= 1<<24,
156 Ulpi_int_prot_dis= 1<<25,
158 Ic_traffic_pull_remove= 1<<27,
159 Tx_end_delay = 1<<28,
160 Force_host_mode = 1<<29,
161 Force_dev_mode = 1<<30,
175 /* gintsts, gintmsk */
198 Incomplisoin = 1<<20,
199 Incomplisoout = 1<<21,
206 Conidstschng = 1<<28,
217 PKTSTS_IN_XFER_COMP = 3<<17,
218 PKTSTS_DATA_TOGGLE_ERR = 5<<17,
219 PKTSTS_CH_HALTED = 7<<17,
221 /* hptxfsiz, gnptxfsiz */
222 Startaddr = 0xffff<<0,
227 Nptxfspcavail = 0xffff<<0,
228 Nptxqspcavail = 0xff<<16,
229 Nptxqtop_terminate= 1<<24,
230 Nptxqtop_token = 0x3<<25,
231 Nptxqtop_chnep = 0xf<<27,
236 Regaddr16_21 = 0x3f<<16,
249 HNP_SRP_CAPABLE_OTG = 0<<0,
250 SRP_ONLY_CAPABLE_OTG = 1<<0,
251 NO_HNP_SRP_CAPABLE = 2<<0,
252 SRP_CAPABLE_DEVICE = 3<<0,
253 NO_SRP_CAPABLE_DEVICE = 4<<0,
254 SRP_CAPABLE_HOST = 5<<0,
255 NO_SRP_CAPABLE_HOST = 6<<0,
256 Architecture = 0x3<<3,
261 Hs_phy_type = 0x3<<6,
262 PHY_NOT_SUPPORTED = 0<<6,
265 PHY_UTMI_ULPI = 3<<6,
266 Fs_phy_type = 0x3<<8,
267 Num_dev_ep = 0xf<<10,
268 Num_host_chan = 0xf<<14,
270 Perio_ep_supported= 1<<18,
271 Dynamic_fifo = 1<<19,
272 Nonperio_tx_q_depth= 0x3<<22,
273 Host_perio_tx_q_depth= 0x3<<24,
274 Dev_token_q_depth= 0x1f<<26,
275 Otg_enable_ic_usb= 1<<31,
278 Xfer_size_cntr_width = 0xf<<0,
279 Packet_size_cntr_width = 0x7<<4,
282 Vendor_ctrl_if = 1<<9,
283 Optional_features = 1<<10,
284 Synch_reset_type = 1<<11,
286 Otg_enable_hsic = 1<<13,
289 Dfifo_depth = 0xffff<<16,
293 Num_dev_perio_in_ep = 0xf<<0,
294 Power_optimiz = 1<<4,
298 Utmi_phy_data_width = 0x3<<14,
299 Num_dev_mode_ctrl_ep = 0xf<<16,
300 Iddig_filt_en = 1<<20,
301 Vbus_valid_filt_en = 1<<21,
302 A_valid_filt_en = 1<<22,
303 B_valid_filt_en = 1<<23,
304 Session_end_filt_en = 1<<24,
306 Num_in_eps = 0xf<<26,
308 Desc_dma_dyn = 1<<31,
315 En_utmi_sleep = 1<<7,
316 Hird_thres = 0x1f<<8,
318 Prt_sleep_sts = 1<<15,
319 Sleep_state_resumeok= 1<<16,
320 Lpm_chan_index = 0xf<<17,
321 Retry_count = 0x7<<21,
323 Retry_count_sts = 0x7<<25,
324 Hsic_connect = 1<<30,
325 Inv_sel_hsic = 1<<31,
340 Disconn_det_msk = 1<<12,
342 Connect_det_msk = 1<<14,
346 Sts_chngint_msk = 1<<18,
351 Mult_val_id_bc = 0x1f<<24,
354 Gdfifocfg = 0xffff<<0,
355 Epinfobase = 0xffff<<16,
368 Adp_tmout_int = 1<<23,
369 Adp_prb_int_msk = 1<<24,
370 Adp_sns_int_msk = 1<<25,
371 Adp_tmout_int_msk= 1<<26,
375 Fslspclksel = 0x3<<0,
376 HCFG_30_60_MHZ = 0<<0,
392 MAX_FRNUM = 0x3FFF<<0,
396 Ptxfspcavail = 0xffff<<0,
397 Ptxqspcavail = 0xff<<16,
398 Ptxqtop_terminate= 1<<24,
399 Ptxqtop_token = 0x3<<25,
400 Ptxqtop_chnum = 0xf<<27,
403 /* haint, haintmsk */
404 #define CHANINT(n) (1<<(n))
407 Prtconnsts = 1<<0, /* connect status (RO) */
408 Prtconndet = 1<<1, /* connect detected R/W1C) */
409 Prtena = 1<<2, /* enable (R/W1C) */
410 Prtenchng = 1<<3, /* enable/disable change (R/W1C) */
411 Prtovrcurract = 1<<4, /* overcurrent active (RO) */
412 Prtovrcurrchng = 1<<5, /* overcurrent change (R/W1C) */
413 Prtres = 1<<6, /* resume */
414 Prtsusp = 1<<7, /* suspend */
415 Prtrst = 1<<8, /* reset */
416 Prtlnsts = 0x3<<10, /* line state {D+,D-} (RO) */
417 Prtpwr = 1<<12, /* power on */
418 Prttstctl = 0xf<<13, /* test */
419 Prtspd = 0x3<<17, /* speed (RO) */
425 Mps = 0x7ff<<0, /* endpoint maximum packet size */
426 Epnum = 0xf<<11, /* endpoint number */
428 Epdir = 1<<15, /* endpoint direction */
431 Lspddev = 1<<17, /* device is lowspeed */
432 Eptype = 0x3<<18, /* endpoint type */
437 Multicnt = 0x3<<20, /* transactions per μframe or retries */
438 /* per periodic split */
440 Devaddr = 0x7f<<22, /* device address */
442 Oddfrm = 1<<29, /* xfer in odd frame (iso/interrupt) */
443 Chdis = 1<<30, /* channel disable (write 1 only) */
444 Chen = 1<<31, /* channel enable (write 1 only) */
447 Prtaddr = 0x7f<<0, /* port address of recipient */
448 /* transaction translator */
449 Hubaddr = 0x7f<<7, /* dev address of transaction */
450 /* translator's hub */
452 Xactpos = 0x3<<14, /* payload's position within transaction */
456 POS_ALL = 3<<14, /* all of data (<= 188 bytes) */
457 Compsplt = 1<<16, /* do complete split */
458 Spltena = 1<<31, /* channel enabled to do splits */
460 /* hcint, hcintmsk */
461 Xfercomp = 1<<0, /* transfer completed without error */
462 Chhltd = 1<<1, /* channel halted */
463 Ahberr = 1<<2, /* AHB dma error */
468 Xacterr = 1<<7, /* transaction error (crc, t/o, bit stuff, eop) */
474 Frm_list_roll = 1<<13,
477 Xfersize = 0x7ffff<<0, /* expected total bytes */
478 Pktcnt = 0x3ff<<19, /* expected number of packets */
480 Pid = 0x3<<29, /* packet id for initial transaction */
482 DATA1 = 2<<29, /* sic */
483 DATA2 = 1<<29, /* sic */
484 MDATA = 3<<29, /* (non-ctl ep) */
485 SETUP = 3<<29, /* (ctl ep) */
486 Dopng = 1<<31, /* do PING protocol */
492 Rstpdwnmodule = 1<<3,
493 Enbl_sleep_gating = 1<<5,
498 Enbl_extnd_hiber = 1<<10,
499 Extnd_hiber_pwrclmp = 1<<11,
500 Extnd_hiber_switch = 1<<12,
501 Ess_reg_restored = 1<<13,
502 Prt_clk_sel = 0x3<<14,
504 Max_xcvrselect = 0x3<<17,
506 Mac_dev_addr = 0x7f<<20,
507 P2hd_dev_enum_spd = 0x3<<27,
508 P2hd_prt_spd = 0x3<<29,