forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-31 f70575805708cabdedea7498aaa3f710fde4d920
kernel/drivers/usb/host/ohci-nxp.c
....@@ -29,10 +29,7 @@
2929
3030 #include "ohci.h"
3131
32
-#include <mach/hardware.h>
33
-
3432 #define USB_CONFIG_BASE 0x31020000
35
-#define USB_OTG_STAT_CONTROL IO_ADDRESS(USB_CONFIG_BASE + 0x110)
3633
3734 /* USB_OTG_STAT_CONTROL bit defines */
3835 #define TRANSPARENT_I2C_EN (1 << 7)
....@@ -122,24 +119,38 @@
122119
123120 static void ohci_nxp_start_hc(void)
124121 {
125
- unsigned long tmp = __raw_readl(USB_OTG_STAT_CONTROL) | HOST_EN;
122
+ void __iomem *usb_otg_stat_control = ioremap(USB_CONFIG_BASE + 0x110, 4);
123
+ unsigned long tmp;
126124
127
- __raw_writel(tmp, USB_OTG_STAT_CONTROL);
125
+ if (WARN_ON(!usb_otg_stat_control))
126
+ return;
127
+
128
+ tmp = __raw_readl(usb_otg_stat_control) | HOST_EN;
129
+
130
+ __raw_writel(tmp, usb_otg_stat_control);
128131 isp1301_vbus_on();
132
+
133
+ iounmap(usb_otg_stat_control);
129134 }
130135
131136 static void ohci_nxp_stop_hc(void)
132137 {
138
+ void __iomem *usb_otg_stat_control = ioremap(USB_CONFIG_BASE + 0x110, 4);
133139 unsigned long tmp;
134140
141
+ if (WARN_ON(!usb_otg_stat_control))
142
+ return;
143
+
135144 isp1301_vbus_off();
136
- tmp = __raw_readl(USB_OTG_STAT_CONTROL) & ~HOST_EN;
137
- __raw_writel(tmp, USB_OTG_STAT_CONTROL);
145
+ tmp = __raw_readl(usb_otg_stat_control) & ~HOST_EN;
146
+ __raw_writel(tmp, usb_otg_stat_control);
147
+
148
+ iounmap(usb_otg_stat_control);
138149 }
139150
140151 static int ohci_hcd_nxp_probe(struct platform_device *pdev)
141152 {
142
- struct usb_hcd *hcd = 0;
153
+ struct usb_hcd *hcd = NULL;
143154 const struct hc_driver *driver = &ohci_nxp_hc_driver;
144155 struct resource *res;
145156 int ret = 0, irq;
....@@ -153,6 +164,7 @@
153164 }
154165
155166 isp1301_i2c_client = isp1301_get_client(isp1301_node);
167
+ of_node_put(isp1301_node);
156168 if (!isp1301_i2c_client)
157169 return -EPROBE_DEFER;
158170