Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: isp1760: use dr_mode binding

There is already a binding to describe the dual role mode (dr_mode),
use that instead of defining a new one (port1-otg).

Update driver code and devicetree files that use that port1-otg
binding.

Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Link: https://lore.kernel.org/r/20210513084717.2487366-7-rui.silva@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Rui Miguel Silva and committed by
Greg Kroah-Hartman
3eb96e04 a74f639c

+11 -11
+1 -1
arch/arm/boot/dts/arm-realview-eb.dtsi
··· 148 148 usb: usb@4f000000 { 149 149 compatible = "nxp,usb-isp1761"; 150 150 reg = <0x4f000000 0x20000>; 151 - port1-otg; 151 + dr_mode = "peripheral"; 152 152 }; 153 153 154 154 bridge {
+1 -1
arch/arm/boot/dts/arm-realview-pb1176.dts
··· 166 166 reg = <0x3b000000 0x20000>; 167 167 interrupt-parent = <&intc_fpga1176>; 168 168 interrupts = <0 11 IRQ_TYPE_LEVEL_HIGH>; 169 - port1-otg; 169 + dr_mode = "peripheral"; 170 170 }; 171 171 172 172 bridge {
+1 -1
arch/arm/boot/dts/arm-realview-pb11mp.dts
··· 712 712 reg = <0x4f000000 0x20000>; 713 713 interrupt-parent = <&intc_tc11mp>; 714 714 interrupts = <0 3 IRQ_TYPE_LEVEL_HIGH>; 715 - port1-otg; 715 + dr_mode = "peripheral"; 716 716 }; 717 717 }; 718 718 };
+1 -1
arch/arm/boot/dts/arm-realview-pbx.dtsi
··· 164 164 usb: usb@4f000000 { 165 165 compatible = "nxp,usb-isp1761"; 166 166 reg = <0x4f000000 0x20000>; 167 - port1-otg; 167 + dr_mode = "peripheral"; 168 168 }; 169 169 170 170 bridge {
+1 -1
arch/arm/boot/dts/vexpress-v2m-rs1.dtsi
··· 144 144 compatible = "nxp,usb-isp1761"; 145 145 reg = <2 0x03000000 0x20000>; 146 146 interrupts = <16>; 147 - port1-otg; 147 + dr_mode = "peripheral"; 148 148 }; 149 149 150 150 iofpga-bus@300000000 {
+1 -1
arch/arm/boot/dts/vexpress-v2m.dtsi
··· 62 62 compatible = "nxp,usb-isp1761"; 63 63 reg = <3 0x03000000 0x20000>; 64 64 interrupts = <16>; 65 - port1-otg; 65 + dr_mode = "peripheral"; 66 66 }; 67 67 68 68 iofpga@7,00000000 {
+1 -2
drivers/usb/isp1760/isp1760-core.c
··· 73 73 * on ISP1761. 74 74 * 75 75 * TODO: Really support OTG. For now we configure port 1 in device mode 76 - * when OTG is requested. 77 76 */ 78 77 if ((isp->devflags & ISP1760_FLAG_ISP1761) && 79 - (isp->devflags & ISP1760_FLAG_OTG_EN)) { 78 + (isp->devflags & ISP1760_FLAG_PERIPHERAL_EN)) { 80 79 isp1760_field_set(hcd->fields, HW_DM_PULLDOWN); 81 80 isp1760_field_set(hcd->fields, HW_DP_PULLDOWN); 82 81 isp1760_field_set(hcd->fields, HW_OTG_DISABLE);
+1 -1
drivers/usb/isp1760/isp1760-core.h
··· 28 28 * a sane default configuration. 29 29 */ 30 30 #define ISP1760_FLAG_BUS_WIDTH_16 0x00000002 /* 16-bit data bus width */ 31 - #define ISP1760_FLAG_OTG_EN 0x00000004 /* Port 1 supports OTG */ 31 + #define ISP1760_FLAG_PERIPHERAL_EN 0x00000004 /* Port 1 supports Peripheral mode*/ 32 32 #define ISP1760_FLAG_ANALOG_OC 0x00000008 /* Analog overcurrent */ 33 33 #define ISP1760_FLAG_DACK_POL_HIGH 0x00000010 /* DACK active high */ 34 34 #define ISP1760_FLAG_DREQ_POL_HIGH 0x00000020 /* DREQ active high */
+3 -2
drivers/usb/isp1760/isp1760-if.c
··· 17 17 #include <linux/platform_device.h> 18 18 #include <linux/slab.h> 19 19 #include <linux/usb/hcd.h> 20 + #include <linux/usb/otg.h> 20 21 21 22 #include "isp1760-core.h" 22 23 #include "isp1760-regs.h" ··· 214 213 if (bus_width == 16) 215 214 devflags |= ISP1760_FLAG_BUS_WIDTH_16; 216 215 217 - if (of_property_read_bool(dp, "port1-otg")) 218 - devflags |= ISP1760_FLAG_OTG_EN; 216 + if (usb_get_dr_mode(&pdev->dev) == USB_DR_MODE_PERIPHERAL) 217 + devflags |= ISP1760_FLAG_PERIPHERAL_EN; 219 218 220 219 if (of_property_read_bool(dp, "analog-oc")) 221 220 devflags |= ISP1760_FLAG_ANALOG_OC;