@@ -30,6 +30,7 @@ static int isp1760_init_core(struct isp1760_device *isp)
30
30
{
31
31
struct isp1760_hcd * hcd = & isp -> hcd ;
32
32
struct isp1760_udc * udc = & isp -> udc ;
33
+ u32 otg_ctrl ;
33
34
34
35
/* Low-level chip reset */
35
36
if (isp -> rst_gpio ) {
@@ -83,16 +84,17 @@ static int isp1760_init_core(struct isp1760_device *isp)
83
84
*
84
85
* TODO: Really support OTG. For now we configure port 1 in device mode
85
86
*/
86
- if (((isp -> devflags & ISP1760_FLAG_ISP1761 ) ||
87
- (isp -> devflags & ISP1760_FLAG_ISP1763 )) &&
88
- (isp -> devflags & ISP1760_FLAG_PERIPHERAL_EN )) {
89
- isp1760_field_set (hcd -> fields , HW_DM_PULLDOWN );
90
- isp1760_field_set (hcd -> fields , HW_DP_PULLDOWN );
91
- isp1760_field_set (hcd -> fields , HW_OTG_DISABLE );
92
- } else {
93
- isp1760_field_set (hcd -> fields , HW_SW_SEL_HC_DC );
94
- isp1760_field_set (hcd -> fields , HW_VBUS_DRV );
95
- isp1760_field_set (hcd -> fields , HW_SEL_CP_EXT );
87
+ if (isp -> devflags & ISP1760_FLAG_ISP1761 ) {
88
+ if (isp -> devflags & ISP1760_FLAG_PERIPHERAL_EN ) {
89
+ otg_ctrl = (ISP176x_HW_DM_PULLDOWN_CLEAR |
90
+ ISP176x_HW_DP_PULLDOWN_CLEAR |
91
+ ISP176x_HW_OTG_DISABLE );
92
+ } else {
93
+ otg_ctrl = (ISP176x_HW_SW_SEL_HC_DC_CLEAR |
94
+ ISP176x_HW_VBUS_DRV |
95
+ ISP176x_HW_SEL_CP_EXT );
96
+ }
97
+ isp1760_reg_write (hcd -> regs , ISP176x_HC_OTG_CTRL , otg_ctrl );
96
98
}
97
99
98
100
dev_info (isp -> dev , "%s bus width: %u, oc: %s\n" ,
@@ -235,20 +237,20 @@ static const struct reg_field isp1760_hc_reg_fields[] = {
235
237
[HC_ISO_IRQ_MASK_AND ] = REG_FIELD (ISP176x_HC_ISO_IRQ_MASK_AND , 0 , 31 ),
236
238
[HC_INT_IRQ_MASK_AND ] = REG_FIELD (ISP176x_HC_INT_IRQ_MASK_AND , 0 , 31 ),
237
239
[HC_ATL_IRQ_MASK_AND ] = REG_FIELD (ISP176x_HC_ATL_IRQ_MASK_AND , 0 , 31 ),
238
- [HW_OTG_DISABLE ] = REG_FIELD (ISP176x_HC_OTG_CTRL_SET , 10 , 10 ),
239
- [HW_SW_SEL_HC_DC ] = REG_FIELD (ISP176x_HC_OTG_CTRL_SET , 7 , 7 ),
240
- [HW_VBUS_DRV ] = REG_FIELD (ISP176x_HC_OTG_CTRL_SET , 4 , 4 ),
241
- [HW_SEL_CP_EXT ] = REG_FIELD (ISP176x_HC_OTG_CTRL_SET , 3 , 3 ),
242
- [HW_DM_PULLDOWN ] = REG_FIELD (ISP176x_HC_OTG_CTRL_SET , 2 , 2 ),
243
- [HW_DP_PULLDOWN ] = REG_FIELD (ISP176x_HC_OTG_CTRL_SET , 1 , 1 ),
244
- [HW_DP_PULLUP ] = REG_FIELD (ISP176x_HC_OTG_CTRL_SET , 0 , 0 ),
245
- [HW_OTG_DISABLE_CLEAR ] = REG_FIELD (ISP176x_HC_OTG_CTRL_CLEAR , 10 , 10 ),
246
- [HW_SW_SEL_HC_DC_CLEAR ] = REG_FIELD (ISP176x_HC_OTG_CTRL_CLEAR , 7 , 7 ),
247
- [HW_VBUS_DRV_CLEAR ] = REG_FIELD (ISP176x_HC_OTG_CTRL_CLEAR , 4 , 4 ),
248
- [HW_SEL_CP_EXT_CLEAR ] = REG_FIELD (ISP176x_HC_OTG_CTRL_CLEAR , 3 , 3 ),
249
- [HW_DM_PULLDOWN_CLEAR ] = REG_FIELD (ISP176x_HC_OTG_CTRL_CLEAR , 2 , 2 ),
250
- [HW_DP_PULLDOWN_CLEAR ] = REG_FIELD (ISP176x_HC_OTG_CTRL_CLEAR , 1 , 1 ),
251
- [HW_DP_PULLUP_CLEAR ] = REG_FIELD (ISP176x_HC_OTG_CTRL_CLEAR , 0 , 0 ),
240
+ [HW_OTG_DISABLE_CLEAR ] = REG_FIELD (ISP176x_HC_OTG_CTRL , 26 , 26 ),
241
+ [HW_SW_SEL_HC_DC_CLEAR ] = REG_FIELD (ISP176x_HC_OTG_CTRL , 23 , 23 ),
242
+ [HW_VBUS_DRV_CLEAR ] = REG_FIELD (ISP176x_HC_OTG_CTRL , 20 , 20 ),
243
+ [HW_SEL_CP_EXT_CLEAR ] = REG_FIELD (ISP176x_HC_OTG_CTRL , 19 , 19 ),
244
+ [HW_DM_PULLDOWN_CLEAR ] = REG_FIELD (ISP176x_HC_OTG_CTRL , 18 , 18 ),
245
+ [HW_DP_PULLDOWN_CLEAR ] = REG_FIELD (ISP176x_HC_OTG_CTRL , 17 , 17 ),
246
+ [HW_DP_PULLUP_CLEAR ] = REG_FIELD (ISP176x_HC_OTG_CTRL , 16 , 16 ),
247
+ [HW_OTG_DISABLE ] = REG_FIELD (ISP176x_HC_OTG_CTRL , 10 , 10 ),
248
+ [HW_SW_SEL_HC_DC ] = REG_FIELD (ISP176x_HC_OTG_CTRL , 7 , 7 ),
249
+ [HW_VBUS_DRV ] = REG_FIELD (ISP176x_HC_OTG_CTRL , 4 , 4 ),
250
+ [HW_SEL_CP_EXT ] = REG_FIELD (ISP176x_HC_OTG_CTRL , 3 , 3 ),
251
+ [HW_DM_PULLDOWN ] = REG_FIELD (ISP176x_HC_OTG_CTRL , 2 , 2 ),
252
+ [HW_DP_PULLDOWN ] = REG_FIELD (ISP176x_HC_OTG_CTRL , 1 , 1 ),
253
+ [HW_DP_PULLUP ] = REG_FIELD (ISP176x_HC_OTG_CTRL , 0 , 0 ),
252
254
};
253
255
254
256
static const struct reg_field isp1763_hc_reg_fields [] = {
0 commit comments