Commit 42416cc81f4990ad8d425b41a0fc8cd985eb5fa5
Committed by
Greg Kroah-Hartman
1 parent
1f9230713a
Exists in
smarc-imx_3.14.28_1.0.0_ga
and in
1 other branch
usb: misc: Fix swapped properties in usb3503 DT parsing
The intn and connect GPIO properties are swapped in the code which will cause failures at runtime if these are connected, fix the code. There are currently no in-tree users of this device to check or update. Signed-off-by: Mark Brown <broonie@linaro.org> Acked-by: Olof Johansson <olof@lixom.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Showing 1 changed file with 2 additions and 2 deletions Inline Diff
drivers/usb/misc/usb3503.c
1 | /* | 1 | /* |
2 | * Driver for SMSC USB3503 USB 2.0 hub controller driver | 2 | * Driver for SMSC USB3503 USB 2.0 hub controller driver |
3 | * | 3 | * |
4 | * Copyright (c) 2012-2013 Dongjin Kim (tobetter@gmail.com) | 4 | * Copyright (c) 2012-2013 Dongjin Kim (tobetter@gmail.com) |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License as published by |
8 | * the Free Software Foundation; either version 2 of the License, or | 8 | * the Free Software Foundation; either version 2 of the License, or |
9 | * (at your option) any later version. | 9 | * (at your option) any later version. |
10 | * | 10 | * |
11 | * This program is distributed in the hope that it will be useful, | 11 | * This program is distributed in the hope that it will be useful, |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | * GNU General Public License for more details. | 14 | * GNU General Public License for more details. |
15 | * | 15 | * |
16 | * You should have received a copy of the GNU General Public License | 16 | * You should have received a copy of the GNU General Public License |
17 | * along with this program; if not, write to the Free Software | 17 | * along with this program; if not, write to the Free Software |
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <linux/i2c.h> | 21 | #include <linux/i2c.h> |
22 | #include <linux/gpio.h> | 22 | #include <linux/gpio.h> |
23 | #include <linux/delay.h> | 23 | #include <linux/delay.h> |
24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
25 | #include <linux/module.h> | 25 | #include <linux/module.h> |
26 | #include <linux/of_gpio.h> | 26 | #include <linux/of_gpio.h> |
27 | #include <linux/platform_device.h> | 27 | #include <linux/platform_device.h> |
28 | #include <linux/platform_data/usb3503.h> | 28 | #include <linux/platform_data/usb3503.h> |
29 | 29 | ||
30 | #define USB3503_VIDL 0x00 | 30 | #define USB3503_VIDL 0x00 |
31 | #define USB3503_VIDM 0x01 | 31 | #define USB3503_VIDM 0x01 |
32 | #define USB3503_PIDL 0x02 | 32 | #define USB3503_PIDL 0x02 |
33 | #define USB3503_PIDM 0x03 | 33 | #define USB3503_PIDM 0x03 |
34 | #define USB3503_DIDL 0x04 | 34 | #define USB3503_DIDL 0x04 |
35 | #define USB3503_DIDM 0x05 | 35 | #define USB3503_DIDM 0x05 |
36 | 36 | ||
37 | #define USB3503_CFG1 0x06 | 37 | #define USB3503_CFG1 0x06 |
38 | #define USB3503_SELF_BUS_PWR (1 << 7) | 38 | #define USB3503_SELF_BUS_PWR (1 << 7) |
39 | 39 | ||
40 | #define USB3503_CFG2 0x07 | 40 | #define USB3503_CFG2 0x07 |
41 | #define USB3503_CFG3 0x08 | 41 | #define USB3503_CFG3 0x08 |
42 | #define USB3503_NRD 0x09 | 42 | #define USB3503_NRD 0x09 |
43 | 43 | ||
44 | #define USB3503_PDS 0x0a | 44 | #define USB3503_PDS 0x0a |
45 | 45 | ||
46 | #define USB3503_SP_ILOCK 0xe7 | 46 | #define USB3503_SP_ILOCK 0xe7 |
47 | #define USB3503_SPILOCK_CONNECT (1 << 1) | 47 | #define USB3503_SPILOCK_CONNECT (1 << 1) |
48 | #define USB3503_SPILOCK_CONFIG (1 << 0) | 48 | #define USB3503_SPILOCK_CONFIG (1 << 0) |
49 | 49 | ||
50 | #define USB3503_CFGP 0xee | 50 | #define USB3503_CFGP 0xee |
51 | #define USB3503_CLKSUSP (1 << 7) | 51 | #define USB3503_CLKSUSP (1 << 7) |
52 | 52 | ||
53 | struct usb3503 { | 53 | struct usb3503 { |
54 | enum usb3503_mode mode; | 54 | enum usb3503_mode mode; |
55 | struct i2c_client *client; | 55 | struct i2c_client *client; |
56 | u8 port_off_mask; | 56 | u8 port_off_mask; |
57 | int gpio_intn; | 57 | int gpio_intn; |
58 | int gpio_reset; | 58 | int gpio_reset; |
59 | int gpio_connect; | 59 | int gpio_connect; |
60 | }; | 60 | }; |
61 | 61 | ||
62 | static int usb3503_write_register(struct i2c_client *client, | 62 | static int usb3503_write_register(struct i2c_client *client, |
63 | char reg, char data) | 63 | char reg, char data) |
64 | { | 64 | { |
65 | return i2c_smbus_write_byte_data(client, reg, data); | 65 | return i2c_smbus_write_byte_data(client, reg, data); |
66 | } | 66 | } |
67 | 67 | ||
68 | static int usb3503_read_register(struct i2c_client *client, char reg) | 68 | static int usb3503_read_register(struct i2c_client *client, char reg) |
69 | { | 69 | { |
70 | return i2c_smbus_read_byte_data(client, reg); | 70 | return i2c_smbus_read_byte_data(client, reg); |
71 | } | 71 | } |
72 | 72 | ||
73 | static int usb3503_set_bits(struct i2c_client *client, char reg, char req) | 73 | static int usb3503_set_bits(struct i2c_client *client, char reg, char req) |
74 | { | 74 | { |
75 | int err; | 75 | int err; |
76 | 76 | ||
77 | err = usb3503_read_register(client, reg); | 77 | err = usb3503_read_register(client, reg); |
78 | if (err < 0) | 78 | if (err < 0) |
79 | return err; | 79 | return err; |
80 | 80 | ||
81 | err = usb3503_write_register(client, reg, err | req); | 81 | err = usb3503_write_register(client, reg, err | req); |
82 | if (err < 0) | 82 | if (err < 0) |
83 | return err; | 83 | return err; |
84 | 84 | ||
85 | return 0; | 85 | return 0; |
86 | } | 86 | } |
87 | 87 | ||
88 | static int usb3503_clear_bits(struct i2c_client *client, char reg, char req) | 88 | static int usb3503_clear_bits(struct i2c_client *client, char reg, char req) |
89 | { | 89 | { |
90 | int err; | 90 | int err; |
91 | 91 | ||
92 | err = usb3503_read_register(client, reg); | 92 | err = usb3503_read_register(client, reg); |
93 | if (err < 0) | 93 | if (err < 0) |
94 | return err; | 94 | return err; |
95 | 95 | ||
96 | err = usb3503_write_register(client, reg, err & ~req); | 96 | err = usb3503_write_register(client, reg, err & ~req); |
97 | if (err < 0) | 97 | if (err < 0) |
98 | return err; | 98 | return err; |
99 | 99 | ||
100 | return 0; | 100 | return 0; |
101 | } | 101 | } |
102 | 102 | ||
103 | static int usb3503_reset(int gpio_reset, int state) | 103 | static int usb3503_reset(int gpio_reset, int state) |
104 | { | 104 | { |
105 | if (gpio_is_valid(gpio_reset)) | 105 | if (gpio_is_valid(gpio_reset)) |
106 | gpio_set_value(gpio_reset, state); | 106 | gpio_set_value(gpio_reset, state); |
107 | 107 | ||
108 | /* Wait T_HUBINIT == 4ms for hub logic to stabilize */ | 108 | /* Wait T_HUBINIT == 4ms for hub logic to stabilize */ |
109 | if (state) | 109 | if (state) |
110 | usleep_range(4000, 10000); | 110 | usleep_range(4000, 10000); |
111 | 111 | ||
112 | return 0; | 112 | return 0; |
113 | } | 113 | } |
114 | 114 | ||
115 | static int usb3503_switch_mode(struct usb3503 *hub, enum usb3503_mode mode) | 115 | static int usb3503_switch_mode(struct usb3503 *hub, enum usb3503_mode mode) |
116 | { | 116 | { |
117 | struct i2c_client *i2c = hub->client; | 117 | struct i2c_client *i2c = hub->client; |
118 | int err = 0; | 118 | int err = 0; |
119 | 119 | ||
120 | switch (mode) { | 120 | switch (mode) { |
121 | case USB3503_MODE_HUB: | 121 | case USB3503_MODE_HUB: |
122 | usb3503_reset(hub->gpio_reset, 1); | 122 | usb3503_reset(hub->gpio_reset, 1); |
123 | 123 | ||
124 | /* SP_ILOCK: set connect_n, config_n for config */ | 124 | /* SP_ILOCK: set connect_n, config_n for config */ |
125 | err = usb3503_write_register(i2c, USB3503_SP_ILOCK, | 125 | err = usb3503_write_register(i2c, USB3503_SP_ILOCK, |
126 | (USB3503_SPILOCK_CONNECT | 126 | (USB3503_SPILOCK_CONNECT |
127 | | USB3503_SPILOCK_CONFIG)); | 127 | | USB3503_SPILOCK_CONFIG)); |
128 | if (err < 0) { | 128 | if (err < 0) { |
129 | dev_err(&i2c->dev, "SP_ILOCK failed (%d)\n", err); | 129 | dev_err(&i2c->dev, "SP_ILOCK failed (%d)\n", err); |
130 | goto err_hubmode; | 130 | goto err_hubmode; |
131 | } | 131 | } |
132 | 132 | ||
133 | /* PDS : Disable For Self Powered Operation */ | 133 | /* PDS : Disable For Self Powered Operation */ |
134 | if (hub->port_off_mask) { | 134 | if (hub->port_off_mask) { |
135 | err = usb3503_set_bits(i2c, USB3503_PDS, | 135 | err = usb3503_set_bits(i2c, USB3503_PDS, |
136 | hub->port_off_mask); | 136 | hub->port_off_mask); |
137 | if (err < 0) { | 137 | if (err < 0) { |
138 | dev_err(&i2c->dev, "PDS failed (%d)\n", err); | 138 | dev_err(&i2c->dev, "PDS failed (%d)\n", err); |
139 | goto err_hubmode; | 139 | goto err_hubmode; |
140 | } | 140 | } |
141 | } | 141 | } |
142 | 142 | ||
143 | /* CFG1 : SELF_BUS_PWR -> Self-Powerd operation */ | 143 | /* CFG1 : SELF_BUS_PWR -> Self-Powerd operation */ |
144 | err = usb3503_set_bits(i2c, USB3503_CFG1, USB3503_SELF_BUS_PWR); | 144 | err = usb3503_set_bits(i2c, USB3503_CFG1, USB3503_SELF_BUS_PWR); |
145 | if (err < 0) { | 145 | if (err < 0) { |
146 | dev_err(&i2c->dev, "CFG1 failed (%d)\n", err); | 146 | dev_err(&i2c->dev, "CFG1 failed (%d)\n", err); |
147 | goto err_hubmode; | 147 | goto err_hubmode; |
148 | } | 148 | } |
149 | 149 | ||
150 | /* SP_LOCK: clear connect_n, config_n for hub connect */ | 150 | /* SP_LOCK: clear connect_n, config_n for hub connect */ |
151 | err = usb3503_clear_bits(i2c, USB3503_SP_ILOCK, | 151 | err = usb3503_clear_bits(i2c, USB3503_SP_ILOCK, |
152 | (USB3503_SPILOCK_CONNECT | 152 | (USB3503_SPILOCK_CONNECT |
153 | | USB3503_SPILOCK_CONFIG)); | 153 | | USB3503_SPILOCK_CONFIG)); |
154 | if (err < 0) { | 154 | if (err < 0) { |
155 | dev_err(&i2c->dev, "SP_ILOCK failed (%d)\n", err); | 155 | dev_err(&i2c->dev, "SP_ILOCK failed (%d)\n", err); |
156 | goto err_hubmode; | 156 | goto err_hubmode; |
157 | } | 157 | } |
158 | 158 | ||
159 | hub->mode = mode; | 159 | hub->mode = mode; |
160 | dev_info(&i2c->dev, "switched to HUB mode\n"); | 160 | dev_info(&i2c->dev, "switched to HUB mode\n"); |
161 | break; | 161 | break; |
162 | 162 | ||
163 | case USB3503_MODE_STANDBY: | 163 | case USB3503_MODE_STANDBY: |
164 | usb3503_reset(hub->gpio_reset, 0); | 164 | usb3503_reset(hub->gpio_reset, 0); |
165 | 165 | ||
166 | hub->mode = mode; | 166 | hub->mode = mode; |
167 | dev_info(&i2c->dev, "switched to STANDBY mode\n"); | 167 | dev_info(&i2c->dev, "switched to STANDBY mode\n"); |
168 | break; | 168 | break; |
169 | 169 | ||
170 | default: | 170 | default: |
171 | dev_err(&i2c->dev, "unknown mode is request\n"); | 171 | dev_err(&i2c->dev, "unknown mode is request\n"); |
172 | err = -EINVAL; | 172 | err = -EINVAL; |
173 | break; | 173 | break; |
174 | } | 174 | } |
175 | 175 | ||
176 | err_hubmode: | 176 | err_hubmode: |
177 | return err; | 177 | return err; |
178 | } | 178 | } |
179 | 179 | ||
180 | static int usb3503_probe(struct i2c_client *i2c, const struct i2c_device_id *id) | 180 | static int usb3503_probe(struct i2c_client *i2c, const struct i2c_device_id *id) |
181 | { | 181 | { |
182 | struct usb3503_platform_data *pdata = dev_get_platdata(&i2c->dev); | 182 | struct usb3503_platform_data *pdata = dev_get_platdata(&i2c->dev); |
183 | struct device_node *np = i2c->dev.of_node; | 183 | struct device_node *np = i2c->dev.of_node; |
184 | struct usb3503 *hub; | 184 | struct usb3503 *hub; |
185 | int err = -ENOMEM; | 185 | int err = -ENOMEM; |
186 | u32 mode = USB3503_MODE_UNKNOWN; | 186 | u32 mode = USB3503_MODE_UNKNOWN; |
187 | const u32 *property; | 187 | const u32 *property; |
188 | int len; | 188 | int len; |
189 | 189 | ||
190 | hub = kzalloc(sizeof(struct usb3503), GFP_KERNEL); | 190 | hub = kzalloc(sizeof(struct usb3503), GFP_KERNEL); |
191 | if (!hub) { | 191 | if (!hub) { |
192 | dev_err(&i2c->dev, "private data alloc fail\n"); | 192 | dev_err(&i2c->dev, "private data alloc fail\n"); |
193 | return err; | 193 | return err; |
194 | } | 194 | } |
195 | 195 | ||
196 | i2c_set_clientdata(i2c, hub); | 196 | i2c_set_clientdata(i2c, hub); |
197 | hub->client = i2c; | 197 | hub->client = i2c; |
198 | 198 | ||
199 | if (pdata) { | 199 | if (pdata) { |
200 | hub->port_off_mask = pdata->port_off_mask; | 200 | hub->port_off_mask = pdata->port_off_mask; |
201 | hub->gpio_intn = pdata->gpio_intn; | 201 | hub->gpio_intn = pdata->gpio_intn; |
202 | hub->gpio_connect = pdata->gpio_connect; | 202 | hub->gpio_connect = pdata->gpio_connect; |
203 | hub->gpio_reset = pdata->gpio_reset; | 203 | hub->gpio_reset = pdata->gpio_reset; |
204 | hub->mode = pdata->initial_mode; | 204 | hub->mode = pdata->initial_mode; |
205 | } else if (np) { | 205 | } else if (np) { |
206 | hub->port_off_mask = 0; | 206 | hub->port_off_mask = 0; |
207 | 207 | ||
208 | property = of_get_property(np, "disabled-ports", &len); | 208 | property = of_get_property(np, "disabled-ports", &len); |
209 | if (property && (len / sizeof(u32)) > 0) { | 209 | if (property && (len / sizeof(u32)) > 0) { |
210 | int i; | 210 | int i; |
211 | for (i = 0; i < len / sizeof(u32); i++) { | 211 | for (i = 0; i < len / sizeof(u32); i++) { |
212 | u32 port = be32_to_cpu(property[i]); | 212 | u32 port = be32_to_cpu(property[i]); |
213 | if ((1 <= port) && (port <= 3)) | 213 | if ((1 <= port) && (port <= 3)) |
214 | hub->port_off_mask |= (1 << port); | 214 | hub->port_off_mask |= (1 << port); |
215 | } | 215 | } |
216 | } | 216 | } |
217 | 217 | ||
218 | hub->gpio_intn = of_get_named_gpio(np, "connect-gpios", 0); | 218 | hub->gpio_intn = of_get_named_gpio(np, "intn-gpios", 0); |
219 | if (hub->gpio_intn == -EPROBE_DEFER) | 219 | if (hub->gpio_intn == -EPROBE_DEFER) |
220 | return -EPROBE_DEFER; | 220 | return -EPROBE_DEFER; |
221 | hub->gpio_connect = of_get_named_gpio(np, "intn-gpios", 0); | 221 | hub->gpio_connect = of_get_named_gpio(np, "connect-gpios", 0); |
222 | if (hub->gpio_connect == -EPROBE_DEFER) | 222 | if (hub->gpio_connect == -EPROBE_DEFER) |
223 | return -EPROBE_DEFER; | 223 | return -EPROBE_DEFER; |
224 | hub->gpio_reset = of_get_named_gpio(np, "reset-gpios", 0); | 224 | hub->gpio_reset = of_get_named_gpio(np, "reset-gpios", 0); |
225 | if (hub->gpio_reset == -EPROBE_DEFER) | 225 | if (hub->gpio_reset == -EPROBE_DEFER) |
226 | return -EPROBE_DEFER; | 226 | return -EPROBE_DEFER; |
227 | of_property_read_u32(np, "initial-mode", &mode); | 227 | of_property_read_u32(np, "initial-mode", &mode); |
228 | hub->mode = mode; | 228 | hub->mode = mode; |
229 | } | 229 | } |
230 | 230 | ||
231 | if (gpio_is_valid(hub->gpio_intn)) { | 231 | if (gpio_is_valid(hub->gpio_intn)) { |
232 | err = gpio_request_one(hub->gpio_intn, | 232 | err = gpio_request_one(hub->gpio_intn, |
233 | GPIOF_OUT_INIT_HIGH, "usb3503 intn"); | 233 | GPIOF_OUT_INIT_HIGH, "usb3503 intn"); |
234 | if (err) { | 234 | if (err) { |
235 | dev_err(&i2c->dev, | 235 | dev_err(&i2c->dev, |
236 | "unable to request GPIO %d as connect pin (%d)\n", | 236 | "unable to request GPIO %d as connect pin (%d)\n", |
237 | hub->gpio_intn, err); | 237 | hub->gpio_intn, err); |
238 | goto err_out; | 238 | goto err_out; |
239 | } | 239 | } |
240 | } | 240 | } |
241 | 241 | ||
242 | if (gpio_is_valid(hub->gpio_connect)) { | 242 | if (gpio_is_valid(hub->gpio_connect)) { |
243 | err = gpio_request_one(hub->gpio_connect, | 243 | err = gpio_request_one(hub->gpio_connect, |
244 | GPIOF_OUT_INIT_HIGH, "usb3503 connect"); | 244 | GPIOF_OUT_INIT_HIGH, "usb3503 connect"); |
245 | if (err) { | 245 | if (err) { |
246 | dev_err(&i2c->dev, | 246 | dev_err(&i2c->dev, |
247 | "unable to request GPIO %d as connect pin (%d)\n", | 247 | "unable to request GPIO %d as connect pin (%d)\n", |
248 | hub->gpio_connect, err); | 248 | hub->gpio_connect, err); |
249 | goto err_gpio_connect; | 249 | goto err_gpio_connect; |
250 | } | 250 | } |
251 | } | 251 | } |
252 | 252 | ||
253 | if (gpio_is_valid(hub->gpio_reset)) { | 253 | if (gpio_is_valid(hub->gpio_reset)) { |
254 | err = gpio_request_one(hub->gpio_reset, | 254 | err = gpio_request_one(hub->gpio_reset, |
255 | GPIOF_OUT_INIT_LOW, "usb3503 reset"); | 255 | GPIOF_OUT_INIT_LOW, "usb3503 reset"); |
256 | if (err) { | 256 | if (err) { |
257 | dev_err(&i2c->dev, | 257 | dev_err(&i2c->dev, |
258 | "unable to request GPIO %d as reset pin (%d)\n", | 258 | "unable to request GPIO %d as reset pin (%d)\n", |
259 | hub->gpio_reset, err); | 259 | hub->gpio_reset, err); |
260 | goto err_gpio_reset; | 260 | goto err_gpio_reset; |
261 | } | 261 | } |
262 | } | 262 | } |
263 | 263 | ||
264 | usb3503_switch_mode(hub, hub->mode); | 264 | usb3503_switch_mode(hub, hub->mode); |
265 | 265 | ||
266 | dev_info(&i2c->dev, "%s: probed on %s mode\n", __func__, | 266 | dev_info(&i2c->dev, "%s: probed on %s mode\n", __func__, |
267 | (hub->mode == USB3503_MODE_HUB) ? "hub" : "standby"); | 267 | (hub->mode == USB3503_MODE_HUB) ? "hub" : "standby"); |
268 | 268 | ||
269 | return 0; | 269 | return 0; |
270 | 270 | ||
271 | err_gpio_reset: | 271 | err_gpio_reset: |
272 | if (gpio_is_valid(hub->gpio_connect)) | 272 | if (gpio_is_valid(hub->gpio_connect)) |
273 | gpio_free(hub->gpio_connect); | 273 | gpio_free(hub->gpio_connect); |
274 | err_gpio_connect: | 274 | err_gpio_connect: |
275 | if (gpio_is_valid(hub->gpio_intn)) | 275 | if (gpio_is_valid(hub->gpio_intn)) |
276 | gpio_free(hub->gpio_intn); | 276 | gpio_free(hub->gpio_intn); |
277 | err_out: | 277 | err_out: |
278 | kfree(hub); | 278 | kfree(hub); |
279 | 279 | ||
280 | return err; | 280 | return err; |
281 | } | 281 | } |
282 | 282 | ||
283 | static int usb3503_remove(struct i2c_client *i2c) | 283 | static int usb3503_remove(struct i2c_client *i2c) |
284 | { | 284 | { |
285 | struct usb3503 *hub = i2c_get_clientdata(i2c); | 285 | struct usb3503 *hub = i2c_get_clientdata(i2c); |
286 | 286 | ||
287 | if (gpio_is_valid(hub->gpio_intn)) | 287 | if (gpio_is_valid(hub->gpio_intn)) |
288 | gpio_free(hub->gpio_intn); | 288 | gpio_free(hub->gpio_intn); |
289 | if (gpio_is_valid(hub->gpio_connect)) | 289 | if (gpio_is_valid(hub->gpio_connect)) |
290 | gpio_free(hub->gpio_connect); | 290 | gpio_free(hub->gpio_connect); |
291 | if (gpio_is_valid(hub->gpio_reset)) | 291 | if (gpio_is_valid(hub->gpio_reset)) |
292 | gpio_free(hub->gpio_reset); | 292 | gpio_free(hub->gpio_reset); |
293 | 293 | ||
294 | kfree(hub); | 294 | kfree(hub); |
295 | 295 | ||
296 | return 0; | 296 | return 0; |
297 | } | 297 | } |
298 | 298 | ||
299 | static const struct i2c_device_id usb3503_id[] = { | 299 | static const struct i2c_device_id usb3503_id[] = { |
300 | { USB3503_I2C_NAME, 0 }, | 300 | { USB3503_I2C_NAME, 0 }, |
301 | { } | 301 | { } |
302 | }; | 302 | }; |
303 | MODULE_DEVICE_TABLE(i2c, usb3503_id); | 303 | MODULE_DEVICE_TABLE(i2c, usb3503_id); |
304 | 304 | ||
305 | #ifdef CONFIG_OF | 305 | #ifdef CONFIG_OF |
306 | static const struct of_device_id usb3503_of_match[] = { | 306 | static const struct of_device_id usb3503_of_match[] = { |
307 | { .compatible = "smsc,usb3503", }, | 307 | { .compatible = "smsc,usb3503", }, |
308 | {}, | 308 | {}, |
309 | }; | 309 | }; |
310 | MODULE_DEVICE_TABLE(of, usb3503_of_match); | 310 | MODULE_DEVICE_TABLE(of, usb3503_of_match); |
311 | #endif | 311 | #endif |
312 | 312 | ||
313 | static struct i2c_driver usb3503_driver = { | 313 | static struct i2c_driver usb3503_driver = { |
314 | .driver = { | 314 | .driver = { |
315 | .name = USB3503_I2C_NAME, | 315 | .name = USB3503_I2C_NAME, |
316 | .of_match_table = of_match_ptr(usb3503_of_match), | 316 | .of_match_table = of_match_ptr(usb3503_of_match), |
317 | }, | 317 | }, |
318 | .probe = usb3503_probe, | 318 | .probe = usb3503_probe, |
319 | .remove = usb3503_remove, | 319 | .remove = usb3503_remove, |
320 | .id_table = usb3503_id, | 320 | .id_table = usb3503_id, |
321 | }; | 321 | }; |
322 | 322 | ||
323 | module_i2c_driver(usb3503_driver); | 323 | module_i2c_driver(usb3503_driver); |
324 | 324 | ||
325 | MODULE_AUTHOR("Dongjin Kim <tobetter@gmail.com>"); | 325 | MODULE_AUTHOR("Dongjin Kim <tobetter@gmail.com>"); |
326 | MODULE_DESCRIPTION("USB3503 USB HUB driver"); | 326 | MODULE_DESCRIPTION("USB3503 USB HUB driver"); |
327 | MODULE_LICENSE("GPL"); | 327 | MODULE_LICENSE("GPL"); |
328 | 328 |