@@ -805,15 +805,24 @@ static int ulpi_phy_power_off(struct tegra_usb_phy *phy)
805805
806806static int tegra_usb_phy_power_on (struct tegra_usb_phy * phy )
807807{
808- int err ;
808+ int err = 0 ;
809809
810810 if (phy -> powered_on )
811811 return 0 ;
812812
813- if (phy -> is_ulpi_phy )
814- err = ulpi_phy_power_on (phy );
815- else
813+ switch (phy -> phy_type ) {
814+ case USBPHY_INTERFACE_MODE_UTMI :
816815 err = utmi_phy_power_on (phy );
816+ break ;
817+
818+ case USBPHY_INTERFACE_MODE_ULPI :
819+ err = ulpi_phy_power_on (phy );
820+ break ;
821+
822+ default :
823+ break ;
824+ }
825+
817826 if (err )
818827 return err ;
819828
@@ -827,15 +836,24 @@ static int tegra_usb_phy_power_on(struct tegra_usb_phy *phy)
827836
828837static int tegra_usb_phy_power_off (struct tegra_usb_phy * phy )
829838{
830- int err ;
839+ int err = 0 ;
831840
832841 if (!phy -> powered_on )
833842 return 0 ;
834843
835- if (phy -> is_ulpi_phy )
836- err = ulpi_phy_power_off (phy );
837- else
844+ switch (phy -> phy_type ) {
845+ case USBPHY_INTERFACE_MODE_UTMI :
838846 err = utmi_phy_power_off (phy );
847+ break ;
848+
849+ case USBPHY_INTERFACE_MODE_ULPI :
850+ err = ulpi_phy_power_off (phy );
851+ break ;
852+
853+ default :
854+ break ;
855+ }
856+
839857 if (err )
840858 return err ;
841859
@@ -854,7 +872,7 @@ static void tegra_usb_phy_shutdown(struct usb_phy *u_phy)
854872 usb_phy_set_wakeup (u_phy , false);
855873 tegra_usb_phy_power_off (phy );
856874
857- if (! phy -> is_ulpi_phy )
875+ if (phy -> phy_type == USBPHY_INTERFACE_MODE_UTMI )
858876 utmip_pad_close (phy );
859877
860878 regulator_disable (phy -> vbus );
@@ -1040,7 +1058,7 @@ static int tegra_usb_phy_init(struct usb_phy *u_phy)
10401058 goto disable_clk ;
10411059 }
10421060
1043- if (! phy -> is_ulpi_phy ) {
1061+ if (phy -> phy_type == USBPHY_INTERFACE_MODE_UTMI ) {
10441062 err = utmip_pad_open (phy );
10451063 if (err )
10461064 goto disable_vbus ;
@@ -1057,7 +1075,7 @@ static int tegra_usb_phy_init(struct usb_phy *u_phy)
10571075 return 0 ;
10581076
10591077close_phy :
1060- if (! phy -> is_ulpi_phy )
1078+ if (phy -> phy_type == USBPHY_INTERFACE_MODE_UTMI )
10611079 utmip_pad_close (phy );
10621080
10631081disable_vbus :
@@ -1095,8 +1113,6 @@ static int utmi_phy_probe(struct tegra_usb_phy *tegra_phy,
10951113 struct resource * res ;
10961114 int err ;
10971115
1098- tegra_phy -> is_ulpi_phy = false;
1099-
11001116 res = platform_get_resource (pdev , IORESOURCE_MEM , 1 );
11011117 if (!res ) {
11021118 dev_err (& pdev -> dev , "Failed to get UTMI pad regs\n" );
@@ -1252,7 +1268,6 @@ static int tegra_usb_phy_probe(struct platform_device *pdev)
12521268{
12531269 struct device_node * np = pdev -> dev .of_node ;
12541270 struct tegra_usb_phy * tegra_phy ;
1255- enum usb_phy_interface phy_type ;
12561271 struct reset_control * reset ;
12571272 struct gpio_desc * gpiod ;
12581273 struct resource * res ;
@@ -1314,8 +1329,8 @@ static int tegra_usb_phy_probe(struct platform_device *pdev)
13141329 return err ;
13151330 }
13161331
1317- phy_type = of_usb_get_phy_mode (np );
1318- switch (phy_type ) {
1332+ tegra_phy -> phy_type = of_usb_get_phy_mode (np );
1333+ switch (tegra_phy -> phy_type ) {
13191334 case USBPHY_INTERFACE_MODE_UTMI :
13201335 err = utmi_phy_probe (tegra_phy , pdev );
13211336 if (err )
@@ -1341,8 +1356,6 @@ static int tegra_usb_phy_probe(struct platform_device *pdev)
13411356 break ;
13421357
13431358 case USBPHY_INTERFACE_MODE_ULPI :
1344- tegra_phy -> is_ulpi_phy = true;
1345-
13461359 tegra_phy -> clk = devm_clk_get (& pdev -> dev , "ulpi-link" );
13471360 err = PTR_ERR_OR_ZERO (tegra_phy -> clk );
13481361 if (err ) {
@@ -1382,7 +1395,7 @@ static int tegra_usb_phy_probe(struct platform_device *pdev)
13821395
13831396 default :
13841397 dev_err (& pdev -> dev , "phy_type %u is invalid or unsupported\n" ,
1385- phy_type );
1398+ tegra_phy -> phy_type );
13861399 return - EINVAL ;
13871400 }
13881401
0 commit comments