diff options
Diffstat (limited to 'drivers/usb/phy/phy-ab8500-usb.c')
| -rw-r--r-- | drivers/usb/phy/phy-ab8500-usb.c | 846 |
1 files changed, 726 insertions, 120 deletions
diff --git a/drivers/usb/phy/phy-ab8500-usb.c b/drivers/usb/phy/phy-ab8500-usb.c index e5eb1b5a04eb..087402350b6d 100644 --- a/drivers/usb/phy/phy-ab8500-usb.c +++ b/drivers/usb/phy/phy-ab8500-usb.c | |||
| @@ -1,10 +1,12 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * drivers/usb/otg/ab8500_usb.c | 2 | * drivers/usb/otg/ab8500_usb.c |
| 3 | * | 3 | * |
| 4 | * USB transceiver driver for AB8500 chip | 4 | * USB transceiver driver for AB8500 family chips |
| 5 | * | 5 | * |
| 6 | * Copyright (C) 2010 ST-Ericsson AB | 6 | * Copyright (C) 2010-2013 ST-Ericsson AB |
| 7 | * Mian Yousaf Kaukab <mian.yousaf.kaukab@stericsson.com> | 7 | * Mian Yousaf Kaukab <mian.yousaf.kaukab@stericsson.com> |
| 8 | * Avinash Kumar <avinash.kumar@stericsson.com> | ||
| 9 | * Thirupathi Chippakurthy <thirupathi.chippakurthy@stericsson.com> | ||
| 8 | * | 10 | * |
| 9 | * This program is free software; you can redistribute it and/or modify | 11 | * This program is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of the GNU General Public License as published by | 12 | * it under the terms of the GNU General Public License as published by |
| @@ -29,6 +31,8 @@ | |||
| 29 | #include <linux/notifier.h> | 31 | #include <linux/notifier.h> |
| 30 | #include <linux/interrupt.h> | 32 | #include <linux/interrupt.h> |
| 31 | #include <linux/delay.h> | 33 | #include <linux/delay.h> |
| 34 | #include <linux/clk.h> | ||
| 35 | #include <linux/err.h> | ||
| 32 | #include <linux/mfd/abx500.h> | 36 | #include <linux/mfd/abx500.h> |
| 33 | #include <linux/mfd/abx500/ab8500.h> | 37 | #include <linux/mfd/abx500/ab8500.h> |
| 34 | #include <linux/usb/musb-ux500.h> | 38 | #include <linux/usb/musb-ux500.h> |
| @@ -41,21 +45,34 @@ | |||
| 41 | /* Bank AB8500_USB */ | 45 | /* Bank AB8500_USB */ |
| 42 | #define AB8500_USB_LINE_STAT_REG 0x80 | 46 | #define AB8500_USB_LINE_STAT_REG 0x80 |
| 43 | #define AB8505_USB_LINE_STAT_REG 0x94 | 47 | #define AB8505_USB_LINE_STAT_REG 0x94 |
| 48 | #define AB8540_USB_LINK_STAT_REG 0x94 | ||
| 49 | #define AB9540_USB_LINK_STAT_REG 0x94 | ||
| 50 | #define AB8540_USB_OTG_CTL_REG 0x87 | ||
| 44 | #define AB8500_USB_PHY_CTRL_REG 0x8A | 51 | #define AB8500_USB_PHY_CTRL_REG 0x8A |
| 52 | #define AB8540_VBUS_CTRL_REG 0x82 | ||
| 45 | 53 | ||
| 46 | /* Bank AB8500_DEVELOPMENT */ | 54 | /* Bank AB8500_DEVELOPMENT */ |
| 47 | #define AB8500_BANK12_ACCESS 0x00 | 55 | #define AB8500_BANK12_ACCESS 0x00 |
| 48 | 56 | ||
| 49 | /* Bank AB8500_DEBUG */ | 57 | /* Bank AB8500_DEBUG */ |
| 58 | #define AB8540_DEBUG 0x32 | ||
| 50 | #define AB8500_USB_PHY_TUNE1 0x05 | 59 | #define AB8500_USB_PHY_TUNE1 0x05 |
| 51 | #define AB8500_USB_PHY_TUNE2 0x06 | 60 | #define AB8500_USB_PHY_TUNE2 0x06 |
| 52 | #define AB8500_USB_PHY_TUNE3 0x07 | 61 | #define AB8500_USB_PHY_TUNE3 0x07 |
| 53 | 62 | ||
| 63 | /* Bank AB8500_INTERRUPT */ | ||
| 64 | #define AB8500_IT_SOURCE2_REG 0x01 | ||
| 65 | |||
| 54 | #define AB8500_BIT_OTG_STAT_ID (1 << 0) | 66 | #define AB8500_BIT_OTG_STAT_ID (1 << 0) |
| 55 | #define AB8500_BIT_PHY_CTRL_HOST_EN (1 << 0) | 67 | #define AB8500_BIT_PHY_CTRL_HOST_EN (1 << 0) |
| 56 | #define AB8500_BIT_PHY_CTRL_DEVICE_EN (1 << 1) | 68 | #define AB8500_BIT_PHY_CTRL_DEVICE_EN (1 << 1) |
| 57 | #define AB8500_BIT_WD_CTRL_ENABLE (1 << 0) | 69 | #define AB8500_BIT_WD_CTRL_ENABLE (1 << 0) |
| 58 | #define AB8500_BIT_WD_CTRL_KICK (1 << 1) | 70 | #define AB8500_BIT_WD_CTRL_KICK (1 << 1) |
| 71 | #define AB8500_BIT_SOURCE2_VBUSDET (1 << 7) | ||
| 72 | #define AB8540_BIT_OTG_CTL_VBUS_VALID_ENA (1 << 0) | ||
| 73 | #define AB8540_BIT_OTG_CTL_ID_HOST_ENA (1 << 1) | ||
| 74 | #define AB8540_BIT_OTG_CTL_ID_DEV_ENA (1 << 5) | ||
| 75 | #define AB8540_BIT_VBUS_CTRL_CHARG_DET_ENA (1 << 0) | ||
| 59 | 76 | ||
| 60 | #define AB8500_WD_KICK_DELAY_US 100 /* usec */ | 77 | #define AB8500_WD_KICK_DELAY_US 100 /* usec */ |
| 61 | #define AB8500_WD_V11_DISABLE_DELAY_US 100 /* usec */ | 78 | #define AB8500_WD_V11_DISABLE_DELAY_US 100 /* usec */ |
| @@ -112,6 +129,68 @@ enum ab8505_usb_link_status { | |||
| 112 | USB_LINK_MOTOROLA_FACTORY_CBL_PHY_EN_8505, | 129 | USB_LINK_MOTOROLA_FACTORY_CBL_PHY_EN_8505, |
| 113 | }; | 130 | }; |
| 114 | 131 | ||
| 132 | enum ab8540_usb_link_status { | ||
| 133 | USB_LINK_NOT_CONFIGURED_8540 = 0, | ||
| 134 | USB_LINK_STD_HOST_NC_8540, | ||
| 135 | USB_LINK_STD_HOST_C_NS_8540, | ||
| 136 | USB_LINK_STD_HOST_C_S_8540, | ||
| 137 | USB_LINK_CDP_8540, | ||
| 138 | USB_LINK_RESERVED0_8540, | ||
| 139 | USB_LINK_RESERVED1_8540, | ||
| 140 | USB_LINK_DEDICATED_CHG_8540, | ||
| 141 | USB_LINK_ACA_RID_A_8540, | ||
| 142 | USB_LINK_ACA_RID_B_8540, | ||
| 143 | USB_LINK_ACA_RID_C_NM_8540, | ||
| 144 | USB_LINK_RESERVED2_8540, | ||
| 145 | USB_LINK_RESERVED3_8540, | ||
| 146 | USB_LINK_HM_IDGND_8540, | ||
| 147 | USB_LINK_CHARGERPORT_NOT_OK_8540, | ||
| 148 | USB_LINK_CHARGER_DM_HIGH_8540, | ||
| 149 | USB_LINK_PHYEN_NO_VBUS_NO_IDGND_8540, | ||
| 150 | USB_LINK_STD_UPSTREAM_NO_IDGNG_VBUS_8540, | ||
| 151 | USB_LINK_STD_UPSTREAM_8540, | ||
| 152 | USB_LINK_CHARGER_SE1_8540, | ||
| 153 | USB_LINK_CARKIT_CHGR_1_8540, | ||
| 154 | USB_LINK_CARKIT_CHGR_2_8540, | ||
| 155 | USB_LINK_ACA_DOCK_CHGR_8540, | ||
| 156 | USB_LINK_SAMSUNG_BOOT_CBL_PHY_EN_8540, | ||
| 157 | USB_LINK_SAMSUNG_BOOT_CBL_PHY_DISB_8540, | ||
| 158 | USB_LINK_SAMSUNG_UART_CBL_PHY_EN_8540, | ||
| 159 | USB_LINK_SAMSUNG_UART_CBL_PHY_DISB_8540, | ||
| 160 | USB_LINK_MOTOROLA_FACTORY_CBL_PHY_EN_8540 | ||
| 161 | }; | ||
| 162 | |||
| 163 | enum ab9540_usb_link_status { | ||
| 164 | USB_LINK_NOT_CONFIGURED_9540 = 0, | ||
| 165 | USB_LINK_STD_HOST_NC_9540, | ||
| 166 | USB_LINK_STD_HOST_C_NS_9540, | ||
| 167 | USB_LINK_STD_HOST_C_S_9540, | ||
| 168 | USB_LINK_CDP_9540, | ||
| 169 | USB_LINK_RESERVED0_9540, | ||
| 170 | USB_LINK_RESERVED1_9540, | ||
| 171 | USB_LINK_DEDICATED_CHG_9540, | ||
| 172 | USB_LINK_ACA_RID_A_9540, | ||
| 173 | USB_LINK_ACA_RID_B_9540, | ||
| 174 | USB_LINK_ACA_RID_C_NM_9540, | ||
| 175 | USB_LINK_RESERVED2_9540, | ||
| 176 | USB_LINK_RESERVED3_9540, | ||
| 177 | USB_LINK_HM_IDGND_9540, | ||
| 178 | USB_LINK_CHARGERPORT_NOT_OK_9540, | ||
| 179 | USB_LINK_CHARGER_DM_HIGH_9540, | ||
| 180 | USB_LINK_PHYEN_NO_VBUS_NO_IDGND_9540, | ||
| 181 | USB_LINK_STD_UPSTREAM_NO_IDGNG_VBUS_9540, | ||
| 182 | USB_LINK_STD_UPSTREAM_9540, | ||
| 183 | USB_LINK_CHARGER_SE1_9540, | ||
| 184 | USB_LINK_CARKIT_CHGR_1_9540, | ||
| 185 | USB_LINK_CARKIT_CHGR_2_9540, | ||
| 186 | USB_LINK_ACA_DOCK_CHGR_9540, | ||
| 187 | USB_LINK_SAMSUNG_BOOT_CBL_PHY_EN_9540, | ||
| 188 | USB_LINK_SAMSUNG_BOOT_CBL_PHY_DISB_9540, | ||
| 189 | USB_LINK_SAMSUNG_UART_CBL_PHY_EN_9540, | ||
| 190 | USB_LINK_SAMSUNG_UART_CBL_PHY_DISB_9540, | ||
| 191 | USB_LINK_MOTOROLA_FACTORY_CBL_PHY_EN_9540 | ||
| 192 | }; | ||
| 193 | |||
| 115 | enum ab8500_usb_mode { | 194 | enum ab8500_usb_mode { |
| 116 | USB_IDLE = 0, | 195 | USB_IDLE = 0, |
| 117 | USB_PERIPHERAL, | 196 | USB_PERIPHERAL, |
| @@ -119,13 +198,30 @@ enum ab8500_usb_mode { | |||
| 119 | USB_DEDICATED_CHG | 198 | USB_DEDICATED_CHG |
| 120 | }; | 199 | }; |
| 121 | 200 | ||
| 201 | /* Register USB_LINK_STATUS interrupt */ | ||
| 202 | #define AB8500_USB_FLAG_USE_LINK_STATUS_IRQ (1 << 0) | ||
| 203 | /* Register ID_WAKEUP_F interrupt */ | ||
| 204 | #define AB8500_USB_FLAG_USE_ID_WAKEUP_IRQ (1 << 1) | ||
| 205 | /* Register VBUS_DET_F interrupt */ | ||
| 206 | #define AB8500_USB_FLAG_USE_VBUS_DET_IRQ (1 << 2) | ||
| 207 | /* Driver is using the ab-iddet driver*/ | ||
| 208 | #define AB8500_USB_FLAG_USE_AB_IDDET (1 << 3) | ||
| 209 | /* Enable setting regulators voltage */ | ||
| 210 | #define AB8500_USB_FLAG_REGULATOR_SET_VOLTAGE (1 << 4) | ||
| 211 | /* Enable the check_vbus_status workaround */ | ||
| 212 | #define AB8500_USB_FLAG_USE_CHECK_VBUS_STATUS (1 << 5) | ||
| 213 | /* Enable the vbus host workaround */ | ||
| 214 | #define AB8500_USB_FLAG_USE_VBUS_HOST_QUIRK (1 << 6) | ||
| 215 | |||
| 122 | struct ab8500_usb { | 216 | struct ab8500_usb { |
| 123 | struct usb_phy phy; | 217 | struct usb_phy phy; |
| 124 | struct device *dev; | 218 | struct device *dev; |
| 125 | struct ab8500 *ab8500; | 219 | struct ab8500 *ab8500; |
| 126 | unsigned vbus_draw; | 220 | unsigned vbus_draw; |
| 127 | struct work_struct phy_dis_work; | 221 | struct work_struct phy_dis_work; |
| 222 | struct work_struct vbus_event_work; | ||
| 128 | enum ab8500_usb_mode mode; | 223 | enum ab8500_usb_mode mode; |
| 224 | struct clk *sysclk; | ||
| 129 | struct regulator *v_ape; | 225 | struct regulator *v_ape; |
| 130 | struct regulator *v_musb; | 226 | struct regulator *v_musb; |
| 131 | struct regulator *v_ulpi; | 227 | struct regulator *v_ulpi; |
| @@ -133,6 +229,8 @@ struct ab8500_usb { | |||
| 133 | int previous_link_status_state; | 229 | int previous_link_status_state; |
| 134 | struct pinctrl *pinctrl; | 230 | struct pinctrl *pinctrl; |
| 135 | struct pinctrl_state *pins_sleep; | 231 | struct pinctrl_state *pins_sleep; |
| 232 | bool enabled_charging_detection; | ||
| 233 | unsigned int flags; | ||
| 136 | }; | 234 | }; |
| 137 | 235 | ||
| 138 | static inline struct ab8500_usb *phy_to_ab(struct usb_phy *x) | 236 | static inline struct ab8500_usb *phy_to_ab(struct usb_phy *x) |
| @@ -171,7 +269,7 @@ static void ab8500_usb_regulator_enable(struct ab8500_usb *ab) | |||
| 171 | if (ret) | 269 | if (ret) |
| 172 | dev_err(ab->dev, "Failed to enable v-ape\n"); | 270 | dev_err(ab->dev, "Failed to enable v-ape\n"); |
| 173 | 271 | ||
| 174 | if (!is_ab8500_2p0_or_earlier(ab->ab8500)) { | 272 | if (ab->flags & AB8500_USB_FLAG_REGULATOR_SET_VOLTAGE) { |
| 175 | ab->saved_v_ulpi = regulator_get_voltage(ab->v_ulpi); | 273 | ab->saved_v_ulpi = regulator_get_voltage(ab->v_ulpi); |
| 176 | if (ab->saved_v_ulpi < 0) | 274 | if (ab->saved_v_ulpi < 0) |
| 177 | dev_err(ab->dev, "Failed to get v_ulpi voltage\n"); | 275 | dev_err(ab->dev, "Failed to get v_ulpi voltage\n"); |
| @@ -191,7 +289,7 @@ static void ab8500_usb_regulator_enable(struct ab8500_usb *ab) | |||
| 191 | if (ret) | 289 | if (ret) |
| 192 | dev_err(ab->dev, "Failed to enable vddulpivio18\n"); | 290 | dev_err(ab->dev, "Failed to enable vddulpivio18\n"); |
| 193 | 291 | ||
| 194 | if (!is_ab8500_2p0_or_earlier(ab->ab8500)) { | 292 | if (ab->flags & AB8500_USB_FLAG_REGULATOR_SET_VOLTAGE) { |
| 195 | volt = regulator_get_voltage(ab->v_ulpi); | 293 | volt = regulator_get_voltage(ab->v_ulpi); |
| 196 | if ((volt != 1300000) && (volt != 1350000)) | 294 | if ((volt != 1300000) && (volt != 1350000)) |
| 197 | dev_err(ab->dev, "Vintcore is not set to 1.3V volt=%d\n", | 295 | dev_err(ab->dev, "Vintcore is not set to 1.3V volt=%d\n", |
| @@ -212,7 +310,7 @@ static void ab8500_usb_regulator_disable(struct ab8500_usb *ab) | |||
| 212 | regulator_disable(ab->v_ulpi); | 310 | regulator_disable(ab->v_ulpi); |
| 213 | 311 | ||
| 214 | /* USB is not the only consumer of Vintcore, restore old settings */ | 312 | /* USB is not the only consumer of Vintcore, restore old settings */ |
| 215 | if (!is_ab8500_2p0_or_earlier(ab->ab8500)) { | 313 | if (ab->flags & AB8500_USB_FLAG_REGULATOR_SET_VOLTAGE) { |
| 216 | if (ab->saved_v_ulpi > 0) { | 314 | if (ab->saved_v_ulpi > 0) { |
| 217 | ret = regulator_set_voltage(ab->v_ulpi, | 315 | ret = regulator_set_voltage(ab->v_ulpi, |
| 218 | ab->saved_v_ulpi, ab->saved_v_ulpi); | 316 | ab->saved_v_ulpi, ab->saved_v_ulpi); |
| @@ -252,11 +350,23 @@ static void ab8500_usb_phy_enable(struct ab8500_usb *ab, bool sel_host) | |||
| 252 | if (IS_ERR(ab->pinctrl)) | 350 | if (IS_ERR(ab->pinctrl)) |
| 253 | dev_err(ab->dev, "could not get/set default pinstate\n"); | 351 | dev_err(ab->dev, "could not get/set default pinstate\n"); |
| 254 | 352 | ||
| 353 | if (clk_prepare_enable(ab->sysclk)) | ||
| 354 | dev_err(ab->dev, "can't prepare/enable clock\n"); | ||
| 355 | |||
| 255 | ab8500_usb_regulator_enable(ab); | 356 | ab8500_usb_regulator_enable(ab); |
| 256 | 357 | ||
| 257 | abx500_mask_and_set_register_interruptible(ab->dev, | 358 | abx500_mask_and_set_register_interruptible(ab->dev, |
| 258 | AB8500_USB, AB8500_USB_PHY_CTRL_REG, | 359 | AB8500_USB, AB8500_USB_PHY_CTRL_REG, |
| 259 | bit, bit); | 360 | bit, bit); |
| 361 | |||
| 362 | if (ab->flags & AB8500_USB_FLAG_USE_VBUS_HOST_QUIRK) { | ||
| 363 | if (sel_host) | ||
| 364 | abx500_set_register_interruptible(ab->dev, | ||
| 365 | AB8500_USB, AB8540_USB_OTG_CTL_REG, | ||
| 366 | AB8540_BIT_OTG_CTL_VBUS_VALID_ENA | | ||
| 367 | AB8540_BIT_OTG_CTL_ID_HOST_ENA | | ||
| 368 | AB8540_BIT_OTG_CTL_ID_DEV_ENA); | ||
| 369 | } | ||
| 260 | } | 370 | } |
| 261 | 371 | ||
| 262 | static void ab8500_usb_phy_disable(struct ab8500_usb *ab, bool sel_host) | 372 | static void ab8500_usb_phy_disable(struct ab8500_usb *ab, bool sel_host) |
| @@ -274,6 +384,8 @@ static void ab8500_usb_phy_disable(struct ab8500_usb *ab, bool sel_host) | |||
| 274 | /* Needed to disable the phy.*/ | 384 | /* Needed to disable the phy.*/ |
| 275 | ab8500_usb_wd_workaround(ab); | 385 | ab8500_usb_wd_workaround(ab); |
| 276 | 386 | ||
| 387 | clk_disable_unprepare(ab->sysclk); | ||
| 388 | |||
| 277 | ab8500_usb_regulator_disable(ab); | 389 | ab8500_usb_regulator_disable(ab); |
| 278 | 390 | ||
| 279 | if (!IS_ERR(ab->pinctrl)) { | 391 | if (!IS_ERR(ab->pinctrl)) { |
| @@ -286,7 +398,8 @@ static void ab8500_usb_phy_disable(struct ab8500_usb *ab, bool sel_host) | |||
| 286 | else if (pinctrl_select_state(ab->pinctrl, ab->pins_sleep)) | 398 | else if (pinctrl_select_state(ab->pinctrl, ab->pins_sleep)) |
| 287 | dev_err(ab->dev, "could not set pins to sleep state\n"); | 399 | dev_err(ab->dev, "could not set pins to sleep state\n"); |
| 288 | 400 | ||
| 289 | /* as USB pins are shared with idddet, release them to allow | 401 | /* |
| 402 | * as USB pins are shared with iddet, release them to allow | ||
| 290 | * iddet to request them | 403 | * iddet to request them |
| 291 | */ | 404 | */ |
| 292 | pinctrl_put(ab->pinctrl); | 405 | pinctrl_put(ab->pinctrl); |
| @@ -298,6 +411,254 @@ static void ab8500_usb_phy_disable(struct ab8500_usb *ab, bool sel_host) | |||
| 298 | #define ab8500_usb_peri_phy_en(ab) ab8500_usb_phy_enable(ab, false) | 411 | #define ab8500_usb_peri_phy_en(ab) ab8500_usb_phy_enable(ab, false) |
| 299 | #define ab8500_usb_peri_phy_dis(ab) ab8500_usb_phy_disable(ab, false) | 412 | #define ab8500_usb_peri_phy_dis(ab) ab8500_usb_phy_disable(ab, false) |
| 300 | 413 | ||
| 414 | static int ab9540_usb_link_status_update(struct ab8500_usb *ab, | ||
| 415 | enum ab9540_usb_link_status lsts) | ||
| 416 | { | ||
| 417 | enum ux500_musb_vbus_id_status event = 0; | ||
| 418 | |||
| 419 | dev_dbg(ab->dev, "ab9540_usb_link_status_update %d\n", lsts); | ||
| 420 | |||
| 421 | if (ab->previous_link_status_state == USB_LINK_HM_IDGND_9540 && | ||
| 422 | (lsts == USB_LINK_STD_HOST_C_NS_9540 || | ||
| 423 | lsts == USB_LINK_STD_HOST_NC_9540)) | ||
| 424 | return 0; | ||
| 425 | |||
| 426 | if (ab->previous_link_status_state == USB_LINK_ACA_RID_A_9540 && | ||
| 427 | (lsts == USB_LINK_STD_HOST_NC_9540)) | ||
| 428 | return 0; | ||
| 429 | |||
| 430 | ab->previous_link_status_state = lsts; | ||
| 431 | |||
| 432 | switch (lsts) { | ||
| 433 | case USB_LINK_ACA_RID_B_9540: | ||
| 434 | event = UX500_MUSB_RIDB; | ||
| 435 | case USB_LINK_NOT_CONFIGURED_9540: | ||
| 436 | case USB_LINK_RESERVED0_9540: | ||
| 437 | case USB_LINK_RESERVED1_9540: | ||
| 438 | case USB_LINK_RESERVED2_9540: | ||
| 439 | case USB_LINK_RESERVED3_9540: | ||
| 440 | if (ab->mode == USB_PERIPHERAL) | ||
| 441 | atomic_notifier_call_chain(&ab->phy.notifier, | ||
| 442 | UX500_MUSB_CLEAN, &ab->vbus_draw); | ||
| 443 | ab->mode = USB_IDLE; | ||
| 444 | ab->phy.otg->default_a = false; | ||
| 445 | ab->vbus_draw = 0; | ||
| 446 | if (event != UX500_MUSB_RIDB) | ||
| 447 | event = UX500_MUSB_NONE; | ||
| 448 | /* Fallback to default B_IDLE as nothing is connected. */ | ||
| 449 | ab->phy.state = OTG_STATE_B_IDLE; | ||
| 450 | break; | ||
| 451 | |||
| 452 | case USB_LINK_ACA_RID_C_NM_9540: | ||
| 453 | event = UX500_MUSB_RIDC; | ||
| 454 | case USB_LINK_STD_HOST_NC_9540: | ||
| 455 | case USB_LINK_STD_HOST_C_NS_9540: | ||
| 456 | case USB_LINK_STD_HOST_C_S_9540: | ||
| 457 | case USB_LINK_CDP_9540: | ||
| 458 | if (ab->mode == USB_HOST) { | ||
| 459 | ab->mode = USB_PERIPHERAL; | ||
| 460 | ab8500_usb_host_phy_dis(ab); | ||
| 461 | ab8500_usb_peri_phy_en(ab); | ||
| 462 | atomic_notifier_call_chain(&ab->phy.notifier, | ||
| 463 | UX500_MUSB_PREPARE, &ab->vbus_draw); | ||
| 464 | } | ||
| 465 | if (ab->mode == USB_IDLE) { | ||
| 466 | ab->mode = USB_PERIPHERAL; | ||
| 467 | ab8500_usb_peri_phy_en(ab); | ||
| 468 | atomic_notifier_call_chain(&ab->phy.notifier, | ||
| 469 | UX500_MUSB_PREPARE, &ab->vbus_draw); | ||
| 470 | } | ||
| 471 | if (event != UX500_MUSB_RIDC) | ||
| 472 | event = UX500_MUSB_VBUS; | ||
| 473 | break; | ||
| 474 | |||
| 475 | case USB_LINK_ACA_RID_A_9540: | ||
| 476 | event = UX500_MUSB_RIDA; | ||
| 477 | case USB_LINK_HM_IDGND_9540: | ||
| 478 | case USB_LINK_STD_UPSTREAM_9540: | ||
| 479 | if (ab->mode == USB_PERIPHERAL) { | ||
| 480 | ab->mode = USB_HOST; | ||
| 481 | ab8500_usb_peri_phy_dis(ab); | ||
| 482 | ab8500_usb_host_phy_en(ab); | ||
| 483 | atomic_notifier_call_chain(&ab->phy.notifier, | ||
| 484 | UX500_MUSB_PREPARE, &ab->vbus_draw); | ||
| 485 | } | ||
| 486 | if (ab->mode == USB_IDLE) { | ||
| 487 | ab->mode = USB_HOST; | ||
| 488 | ab8500_usb_host_phy_en(ab); | ||
| 489 | atomic_notifier_call_chain(&ab->phy.notifier, | ||
| 490 | UX500_MUSB_PREPARE, &ab->vbus_draw); | ||
| 491 | } | ||
| 492 | ab->phy.otg->default_a = true; | ||
| 493 | if (event != UX500_MUSB_RIDA) | ||
| 494 | event = UX500_MUSB_ID; | ||
| 495 | |||
| 496 | atomic_notifier_call_chain(&ab->phy.notifier, | ||
| 497 | event, &ab->vbus_draw); | ||
| 498 | break; | ||
| 499 | |||
| 500 | case USB_LINK_DEDICATED_CHG_9540: | ||
| 501 | ab->mode = USB_DEDICATED_CHG; | ||
| 502 | event = UX500_MUSB_CHARGER; | ||
| 503 | atomic_notifier_call_chain(&ab->phy.notifier, | ||
| 504 | event, &ab->vbus_draw); | ||
| 505 | break; | ||
| 506 | |||
| 507 | case USB_LINK_PHYEN_NO_VBUS_NO_IDGND_9540: | ||
| 508 | case USB_LINK_STD_UPSTREAM_NO_IDGNG_VBUS_9540: | ||
| 509 | if (!(is_ab9540_2p0_or_earlier(ab->ab8500))) { | ||
| 510 | event = UX500_MUSB_NONE; | ||
| 511 | if (ab->mode == USB_HOST) { | ||
| 512 | ab->phy.otg->default_a = false; | ||
| 513 | ab->vbus_draw = 0; | ||
| 514 | atomic_notifier_call_chain(&ab->phy.notifier, | ||
| 515 | event, &ab->vbus_draw); | ||
| 516 | ab8500_usb_host_phy_dis(ab); | ||
| 517 | ab->mode = USB_IDLE; | ||
| 518 | } | ||
| 519 | if (ab->mode == USB_PERIPHERAL) { | ||
| 520 | atomic_notifier_call_chain(&ab->phy.notifier, | ||
| 521 | event, &ab->vbus_draw); | ||
| 522 | ab8500_usb_peri_phy_dis(ab); | ||
| 523 | atomic_notifier_call_chain(&ab->phy.notifier, | ||
| 524 | UX500_MUSB_CLEAN, | ||
| 525 | &ab->vbus_draw); | ||
| 526 | ab->mode = USB_IDLE; | ||
| 527 | ab->phy.otg->default_a = false; | ||
| 528 | ab->vbus_draw = 0; | ||
| 529 | } | ||
| 530 | } | ||
| 531 | break; | ||
| 532 | |||
| 533 | default: | ||
| 534 | break; | ||
| 535 | } | ||
| 536 | |||
| 537 | return 0; | ||
| 538 | } | ||
| 539 | |||
| 540 | static int ab8540_usb_link_status_update(struct ab8500_usb *ab, | ||
| 541 | enum ab8540_usb_link_status lsts) | ||
| 542 | { | ||
| 543 | enum ux500_musb_vbus_id_status event = 0; | ||
| 544 | |||
| 545 | dev_dbg(ab->dev, "ab8540_usb_link_status_update %d\n", lsts); | ||
| 546 | |||
| 547 | if (ab->enabled_charging_detection) { | ||
| 548 | /* Disable USB Charger detection */ | ||
| 549 | abx500_mask_and_set_register_interruptible(ab->dev, | ||
| 550 | AB8500_USB, AB8540_VBUS_CTRL_REG, | ||
| 551 | AB8540_BIT_VBUS_CTRL_CHARG_DET_ENA, 0x00); | ||
| 552 | ab->enabled_charging_detection = false; | ||
| 553 | } | ||
| 554 | |||
| 555 | /* | ||
| 556 | * Spurious link_status interrupts are seen in case of a | ||
| 557 | * disconnection of a device in IDGND and RIDA stage | ||
| 558 | */ | ||
| 559 | if (ab->previous_link_status_state == USB_LINK_HM_IDGND_8540 && | ||
| 560 | (lsts == USB_LINK_STD_HOST_C_NS_8540 || | ||
| 561 | lsts == USB_LINK_STD_HOST_NC_8540)) | ||
| 562 | return 0; | ||
| 563 | |||
| 564 | if (ab->previous_link_status_state == USB_LINK_ACA_RID_A_8540 && | ||
| 565 | (lsts == USB_LINK_STD_HOST_NC_8540)) | ||
| 566 | return 0; | ||
| 567 | |||
| 568 | ab->previous_link_status_state = lsts; | ||
| 569 | |||
| 570 | switch (lsts) { | ||
| 571 | case USB_LINK_ACA_RID_B_8540: | ||
| 572 | event = UX500_MUSB_RIDB; | ||
| 573 | case USB_LINK_NOT_CONFIGURED_8540: | ||
| 574 | case USB_LINK_RESERVED0_8540: | ||
| 575 | case USB_LINK_RESERVED1_8540: | ||
| 576 | case USB_LINK_RESERVED2_8540: | ||
| 577 | case USB_LINK_RESERVED3_8540: | ||
| 578 | ab->mode = USB_IDLE; | ||
| 579 | ab->phy.otg->default_a = false; | ||
| 580 | ab->vbus_draw = 0; | ||
| 581 | if (event != UX500_MUSB_RIDB) | ||
| 582 | event = UX500_MUSB_NONE; | ||
| 583 | /* | ||
| 584 | * Fallback to default B_IDLE as nothing | ||
| 585 | * is connected | ||
| 586 | */ | ||
| 587 | ab->phy.state = OTG_STATE_B_IDLE; | ||
| 588 | break; | ||
| 589 | |||
| 590 | case USB_LINK_ACA_RID_C_NM_8540: | ||
| 591 | event = UX500_MUSB_RIDC; | ||
| 592 | case USB_LINK_STD_HOST_NC_8540: | ||
| 593 | case USB_LINK_STD_HOST_C_NS_8540: | ||
| 594 | case USB_LINK_STD_HOST_C_S_8540: | ||
| 595 | case USB_LINK_CDP_8540: | ||
| 596 | if (ab->mode == USB_IDLE) { | ||
| 597 | ab->mode = USB_PERIPHERAL; | ||
| 598 | ab8500_usb_peri_phy_en(ab); | ||
| 599 | atomic_notifier_call_chain(&ab->phy.notifier, | ||
| 600 | UX500_MUSB_PREPARE, &ab->vbus_draw); | ||
| 601 | } | ||
| 602 | if (event != UX500_MUSB_RIDC) | ||
| 603 | event = UX500_MUSB_VBUS; | ||
| 604 | break; | ||
| 605 | |||
| 606 | case USB_LINK_ACA_RID_A_8540: | ||
| 607 | case USB_LINK_ACA_DOCK_CHGR_8540: | ||
| 608 | event = UX500_MUSB_RIDA; | ||
| 609 | case USB_LINK_HM_IDGND_8540: | ||
| 610 | case USB_LINK_STD_UPSTREAM_8540: | ||
| 611 | if (ab->mode == USB_IDLE) { | ||
| 612 | ab->mode = USB_HOST; | ||
| 613 | ab8500_usb_host_phy_en(ab); | ||
| 614 | atomic_notifier_call_chain(&ab->phy.notifier, | ||
| 615 | UX500_MUSB_PREPARE, &ab->vbus_draw); | ||
| 616 | } | ||
| 617 | ab->phy.otg->default_a = true; | ||
| 618 | if (event != UX500_MUSB_RIDA) | ||
| 619 | event = UX500_MUSB_ID; | ||
| 620 | atomic_notifier_call_chain(&ab->phy.notifier, | ||
| 621 | event, &ab->vbus_draw); | ||
| 622 | break; | ||
| 623 | |||
| 624 | case USB_LINK_DEDICATED_CHG_8540: | ||
| 625 | ab->mode = USB_DEDICATED_CHG; | ||
| 626 | event = UX500_MUSB_CHARGER; | ||
| 627 | atomic_notifier_call_chain(&ab->phy.notifier, | ||
| 628 | event, &ab->vbus_draw); | ||
| 629 | break; | ||
| 630 | |||
| 631 | case USB_LINK_PHYEN_NO_VBUS_NO_IDGND_8540: | ||
| 632 | case USB_LINK_STD_UPSTREAM_NO_IDGNG_VBUS_8540: | ||
| 633 | event = UX500_MUSB_NONE; | ||
| 634 | if (ab->mode == USB_HOST) { | ||
| 635 | ab->phy.otg->default_a = false; | ||
| 636 | ab->vbus_draw = 0; | ||
| 637 | atomic_notifier_call_chain(&ab->phy.notifier, | ||
| 638 | event, &ab->vbus_draw); | ||
| 639 | ab8500_usb_host_phy_dis(ab); | ||
| 640 | ab->mode = USB_IDLE; | ||
| 641 | } | ||
| 642 | if (ab->mode == USB_PERIPHERAL) { | ||
| 643 | atomic_notifier_call_chain(&ab->phy.notifier, | ||
| 644 | event, &ab->vbus_draw); | ||
| 645 | ab8500_usb_peri_phy_dis(ab); | ||
| 646 | atomic_notifier_call_chain(&ab->phy.notifier, | ||
| 647 | UX500_MUSB_CLEAN, &ab->vbus_draw); | ||
| 648 | ab->mode = USB_IDLE; | ||
| 649 | ab->phy.otg->default_a = false; | ||
| 650 | ab->vbus_draw = 0; | ||
| 651 | } | ||
| 652 | break; | ||
| 653 | |||
| 654 | default: | ||
| 655 | event = UX500_MUSB_NONE; | ||
| 656 | break; | ||
| 657 | } | ||
| 658 | |||
| 659 | return 0; | ||
| 660 | } | ||
| 661 | |||
| 301 | static int ab8505_usb_link_status_update(struct ab8500_usb *ab, | 662 | static int ab8505_usb_link_status_update(struct ab8500_usb *ab, |
| 302 | enum ab8505_usb_link_status lsts) | 663 | enum ab8505_usb_link_status lsts) |
| 303 | { | 664 | { |
| @@ -498,6 +859,20 @@ static int abx500_usb_link_status_update(struct ab8500_usb *ab) | |||
| 498 | AB8500_USB, AB8505_USB_LINE_STAT_REG, ®); | 859 | AB8500_USB, AB8505_USB_LINE_STAT_REG, ®); |
| 499 | lsts = (reg >> 3) & 0x1F; | 860 | lsts = (reg >> 3) & 0x1F; |
| 500 | ret = ab8505_usb_link_status_update(ab, lsts); | 861 | ret = ab8505_usb_link_status_update(ab, lsts); |
| 862 | } else if (is_ab8540(ab->ab8500)) { | ||
| 863 | enum ab8540_usb_link_status lsts; | ||
| 864 | |||
| 865 | abx500_get_register_interruptible(ab->dev, | ||
| 866 | AB8500_USB, AB8540_USB_LINK_STAT_REG, ®); | ||
| 867 | lsts = (reg >> 3) & 0xFF; | ||
| 868 | ret = ab8540_usb_link_status_update(ab, lsts); | ||
| 869 | } else if (is_ab9540(ab->ab8500)) { | ||
| 870 | enum ab9540_usb_link_status lsts; | ||
| 871 | |||
| 872 | abx500_get_register_interruptible(ab->dev, | ||
| 873 | AB8500_USB, AB9540_USB_LINK_STAT_REG, ®); | ||
| 874 | lsts = (reg >> 3) & 0xFF; | ||
| 875 | ret = ab9540_usb_link_status_update(ab, lsts); | ||
| 501 | } | 876 | } |
| 502 | 877 | ||
| 503 | return ret; | 878 | return ret; |
| @@ -553,7 +928,7 @@ static irqreturn_t ab8500_usb_disconnect_irq(int irq, void *data) | |||
| 553 | 928 | ||
| 554 | static irqreturn_t ab8500_usb_link_status_irq(int irq, void *data) | 929 | static irqreturn_t ab8500_usb_link_status_irq(int irq, void *data) |
| 555 | { | 930 | { |
| 556 | struct ab8500_usb *ab = (struct ab8500_usb *) data; | 931 | struct ab8500_usb *ab = (struct ab8500_usb *)data; |
| 557 | 932 | ||
| 558 | abx500_usb_link_status_update(ab); | 933 | abx500_usb_link_status_update(ab); |
| 559 | 934 | ||
| @@ -572,6 +947,69 @@ static void ab8500_usb_phy_disable_work(struct work_struct *work) | |||
| 572 | ab8500_usb_peri_phy_dis(ab); | 947 | ab8500_usb_peri_phy_dis(ab); |
| 573 | } | 948 | } |
| 574 | 949 | ||
| 950 | /* Check if VBUS is set and linkstatus has not detected a cable. */ | ||
| 951 | static bool ab8500_usb_check_vbus_status(struct ab8500_usb *ab) | ||
| 952 | { | ||
| 953 | u8 isource2; | ||
| 954 | u8 reg; | ||
| 955 | enum ab8540_usb_link_status lsts; | ||
| 956 | |||
| 957 | abx500_get_register_interruptible(ab->dev, | ||
| 958 | AB8500_INTERRUPT, AB8500_IT_SOURCE2_REG, | ||
| 959 | &isource2); | ||
| 960 | |||
| 961 | /* If Vbus is below 3.6V abort */ | ||
| 962 | if (!(isource2 & AB8500_BIT_SOURCE2_VBUSDET)) | ||
| 963 | return false; | ||
| 964 | |||
| 965 | abx500_get_register_interruptible(ab->dev, | ||
| 966 | AB8500_USB, AB8540_USB_LINK_STAT_REG, | ||
| 967 | ®); | ||
| 968 | |||
| 969 | lsts = (reg >> 3) & 0xFF; | ||
| 970 | |||
| 971 | /* Check if linkstatus has detected a cable */ | ||
| 972 | if (lsts) | ||
| 973 | return false; | ||
| 974 | |||
| 975 | return true; | ||
| 976 | } | ||
| 977 | |||
| 978 | /* re-trigger charger detection again with watchdog re-kick. */ | ||
| 979 | static void ab8500_usb_vbus_turn_on_event_work(struct work_struct *work) | ||
| 980 | { | ||
| 981 | struct ab8500_usb *ab = container_of(work, struct ab8500_usb, | ||
| 982 | vbus_event_work); | ||
| 983 | |||
| 984 | if (ab->mode != USB_IDLE) | ||
| 985 | return; | ||
| 986 | |||
| 987 | abx500_set_register_interruptible(ab->dev, | ||
| 988 | AB8500_SYS_CTRL2_BLOCK, AB8500_MAIN_WD_CTRL_REG, | ||
| 989 | AB8500_BIT_WD_CTRL_ENABLE); | ||
| 990 | |||
| 991 | udelay(100); | ||
| 992 | |||
| 993 | abx500_set_register_interruptible(ab->dev, | ||
| 994 | AB8500_SYS_CTRL2_BLOCK, AB8500_MAIN_WD_CTRL_REG, | ||
| 995 | AB8500_BIT_WD_CTRL_ENABLE | AB8500_BIT_WD_CTRL_KICK); | ||
| 996 | |||
| 997 | udelay(100); | ||
| 998 | |||
| 999 | /* Disable Main watchdog */ | ||
| 1000 | abx500_set_register_interruptible(ab->dev, | ||
| 1001 | AB8500_SYS_CTRL2_BLOCK, AB8500_MAIN_WD_CTRL_REG, | ||
| 1002 | 0x0); | ||
| 1003 | |||
| 1004 | /* Enable USB Charger detection */ | ||
| 1005 | abx500_mask_and_set_register_interruptible(ab->dev, | ||
| 1006 | AB8500_USB, AB8540_VBUS_CTRL_REG, | ||
| 1007 | AB8540_BIT_VBUS_CTRL_CHARG_DET_ENA, | ||
| 1008 | AB8540_BIT_VBUS_CTRL_CHARG_DET_ENA); | ||
| 1009 | |||
| 1010 | ab->enabled_charging_detection = true; | ||
| 1011 | } | ||
| 1012 | |||
| 575 | static unsigned ab8500_eyediagram_workaroud(struct ab8500_usb *ab, unsigned mA) | 1013 | static unsigned ab8500_eyediagram_workaroud(struct ab8500_usb *ab, unsigned mA) |
| 576 | { | 1014 | { |
| 577 | /* | 1015 | /* |
| @@ -627,7 +1065,7 @@ static int ab8500_usb_set_peripheral(struct usb_otg *otg, | |||
| 627 | * is fixed. | 1065 | * is fixed. |
| 628 | */ | 1066 | */ |
| 629 | 1067 | ||
| 630 | if ((ab->mode != USB_IDLE) && (!gadget)) { | 1068 | if ((ab->mode != USB_IDLE) && !gadget) { |
| 631 | ab->mode = USB_IDLE; | 1069 | ab->mode = USB_IDLE; |
| 632 | schedule_work(&ab->phy_dis_work); | 1070 | schedule_work(&ab->phy_dis_work); |
| 633 | } | 1071 | } |
| @@ -651,7 +1089,7 @@ static int ab8500_usb_set_host(struct usb_otg *otg, struct usb_bus *host) | |||
| 651 | * is fixed. | 1089 | * is fixed. |
| 652 | */ | 1090 | */ |
| 653 | 1091 | ||
| 654 | if ((ab->mode != USB_IDLE) && (!host)) { | 1092 | if ((ab->mode != USB_IDLE) && !host) { |
| 655 | ab->mode = USB_IDLE; | 1093 | ab->mode = USB_IDLE; |
| 656 | schedule_work(&ab->phy_dis_work); | 1094 | schedule_work(&ab->phy_dis_work); |
| 657 | } | 1095 | } |
| @@ -659,6 +1097,33 @@ static int ab8500_usb_set_host(struct usb_otg *otg, struct usb_bus *host) | |||
| 659 | return 0; | 1097 | return 0; |
| 660 | } | 1098 | } |
| 661 | 1099 | ||
| 1100 | static void ab8500_usb_restart_phy(struct ab8500_usb *ab) | ||
| 1101 | { | ||
| 1102 | abx500_mask_and_set_register_interruptible(ab->dev, | ||
| 1103 | AB8500_USB, AB8500_USB_PHY_CTRL_REG, | ||
| 1104 | AB8500_BIT_PHY_CTRL_DEVICE_EN, | ||
| 1105 | AB8500_BIT_PHY_CTRL_DEVICE_EN); | ||
| 1106 | |||
| 1107 | udelay(100); | ||
| 1108 | |||
| 1109 | abx500_mask_and_set_register_interruptible(ab->dev, | ||
| 1110 | AB8500_USB, AB8500_USB_PHY_CTRL_REG, | ||
| 1111 | AB8500_BIT_PHY_CTRL_DEVICE_EN, | ||
| 1112 | 0); | ||
| 1113 | |||
| 1114 | abx500_mask_and_set_register_interruptible(ab->dev, | ||
| 1115 | AB8500_USB, AB8500_USB_PHY_CTRL_REG, | ||
| 1116 | AB8500_BIT_PHY_CTRL_HOST_EN, | ||
| 1117 | AB8500_BIT_PHY_CTRL_HOST_EN); | ||
| 1118 | |||
| 1119 | udelay(100); | ||
| 1120 | |||
| 1121 | abx500_mask_and_set_register_interruptible(ab->dev, | ||
| 1122 | AB8500_USB, AB8500_USB_PHY_CTRL_REG, | ||
| 1123 | AB8500_BIT_PHY_CTRL_HOST_EN, | ||
| 1124 | 0); | ||
| 1125 | } | ||
| 1126 | |||
| 662 | static int ab8500_usb_regulator_get(struct ab8500_usb *ab) | 1127 | static int ab8500_usb_regulator_get(struct ab8500_usb *ab) |
| 663 | { | 1128 | { |
| 664 | int err; | 1129 | int err; |
| @@ -693,48 +1158,197 @@ static int ab8500_usb_irq_setup(struct platform_device *pdev, | |||
| 693 | int err; | 1158 | int err; |
| 694 | int irq; | 1159 | int irq; |
| 695 | 1160 | ||
| 696 | irq = platform_get_irq_byname(pdev, "USB_LINK_STATUS"); | 1161 | if (ab->flags & AB8500_USB_FLAG_USE_LINK_STATUS_IRQ) { |
| 697 | if (irq < 0) { | 1162 | irq = platform_get_irq_byname(pdev, "USB_LINK_STATUS"); |
| 698 | dev_err(&pdev->dev, "Link status irq not found\n"); | 1163 | if (irq < 0) { |
| 699 | return irq; | 1164 | dev_err(&pdev->dev, "Link status irq not found\n"); |
| 700 | } | 1165 | return irq; |
| 701 | err = devm_request_threaded_irq(&pdev->dev, irq, NULL, | 1166 | } |
| 702 | ab8500_usb_link_status_irq, | 1167 | err = devm_request_threaded_irq(&pdev->dev, irq, NULL, |
| 703 | IRQF_NO_SUSPEND | IRQF_SHARED, "usb-link-status", ab); | 1168 | ab8500_usb_link_status_irq, |
| 704 | if (err < 0) { | 1169 | IRQF_NO_SUSPEND | IRQF_SHARED, |
| 705 | dev_err(ab->dev, "request_irq failed for link status irq\n"); | 1170 | "usb-link-status", ab); |
| 706 | return err; | 1171 | if (err < 0) { |
| 1172 | dev_err(ab->dev, "request_irq failed for link status irq\n"); | ||
| 1173 | return err; | ||
| 1174 | } | ||
| 707 | } | 1175 | } |
| 708 | 1176 | ||
| 709 | irq = platform_get_irq_byname(pdev, "ID_WAKEUP_F"); | 1177 | if (ab->flags & AB8500_USB_FLAG_USE_ID_WAKEUP_IRQ) { |
| 710 | if (irq < 0) { | 1178 | irq = platform_get_irq_byname(pdev, "ID_WAKEUP_F"); |
| 711 | dev_err(&pdev->dev, "ID fall irq not found\n"); | 1179 | if (irq < 0) { |
| 712 | return irq; | 1180 | dev_err(&pdev->dev, "ID fall irq not found\n"); |
| 713 | } | 1181 | return irq; |
| 714 | err = devm_request_threaded_irq(&pdev->dev, irq, NULL, | 1182 | } |
| 715 | ab8500_usb_disconnect_irq, | 1183 | err = devm_request_threaded_irq(&pdev->dev, irq, NULL, |
| 716 | IRQF_NO_SUSPEND | IRQF_SHARED, "usb-id-fall", ab); | 1184 | ab8500_usb_disconnect_irq, |
| 717 | if (err < 0) { | 1185 | IRQF_NO_SUSPEND | IRQF_SHARED, |
| 718 | dev_err(ab->dev, "request_irq failed for ID fall irq\n"); | 1186 | "usb-id-fall", ab); |
| 719 | return err; | 1187 | if (err < 0) { |
| 1188 | dev_err(ab->dev, "request_irq failed for ID fall irq\n"); | ||
| 1189 | return err; | ||
| 1190 | } | ||
| 720 | } | 1191 | } |
| 721 | 1192 | ||
| 722 | irq = platform_get_irq_byname(pdev, "VBUS_DET_F"); | 1193 | if (ab->flags & AB8500_USB_FLAG_USE_VBUS_DET_IRQ) { |
| 723 | if (irq < 0) { | 1194 | irq = platform_get_irq_byname(pdev, "VBUS_DET_F"); |
| 724 | dev_err(&pdev->dev, "VBUS fall irq not found\n"); | 1195 | if (irq < 0) { |
| 725 | return irq; | 1196 | dev_err(&pdev->dev, "VBUS fall irq not found\n"); |
| 726 | } | 1197 | return irq; |
| 727 | err = devm_request_threaded_irq(&pdev->dev, irq, NULL, | 1198 | } |
| 728 | ab8500_usb_disconnect_irq, | 1199 | err = devm_request_threaded_irq(&pdev->dev, irq, NULL, |
| 729 | IRQF_NO_SUSPEND | IRQF_SHARED, "usb-vbus-fall", ab); | 1200 | ab8500_usb_disconnect_irq, |
| 730 | if (err < 0) { | 1201 | IRQF_NO_SUSPEND | IRQF_SHARED, |
| 731 | dev_err(ab->dev, "request_irq failed for Vbus fall irq\n"); | 1202 | "usb-vbus-fall", ab); |
| 732 | return err; | 1203 | if (err < 0) { |
| 1204 | dev_err(ab->dev, "request_irq failed for Vbus fall irq\n"); | ||
| 1205 | return err; | ||
| 1206 | } | ||
| 733 | } | 1207 | } |
| 734 | 1208 | ||
| 735 | return 0; | 1209 | return 0; |
| 736 | } | 1210 | } |
| 737 | 1211 | ||
| 1212 | static void ab8500_usb_set_ab8500_tuning_values(struct ab8500_usb *ab) | ||
| 1213 | { | ||
| 1214 | int err; | ||
| 1215 | |||
| 1216 | /* Enable the PBT/Bank 0x12 access */ | ||
| 1217 | err = abx500_set_register_interruptible(ab->dev, | ||
| 1218 | AB8500_DEVELOPMENT, AB8500_BANK12_ACCESS, 0x01); | ||
| 1219 | if (err < 0) | ||
| 1220 | dev_err(ab->dev, "Failed to enable bank12 access err=%d\n", | ||
| 1221 | err); | ||
| 1222 | |||
| 1223 | err = abx500_set_register_interruptible(ab->dev, | ||
| 1224 | AB8500_DEBUG, AB8500_USB_PHY_TUNE1, 0xC8); | ||
| 1225 | if (err < 0) | ||
| 1226 | dev_err(ab->dev, "Failed to set PHY_TUNE1 register err=%d\n", | ||
| 1227 | err); | ||
| 1228 | |||
| 1229 | err = abx500_set_register_interruptible(ab->dev, | ||
| 1230 | AB8500_DEBUG, AB8500_USB_PHY_TUNE2, 0x00); | ||
| 1231 | if (err < 0) | ||
| 1232 | dev_err(ab->dev, "Failed to set PHY_TUNE2 register err=%d\n", | ||
| 1233 | err); | ||
| 1234 | |||
| 1235 | err = abx500_set_register_interruptible(ab->dev, | ||
| 1236 | AB8500_DEBUG, AB8500_USB_PHY_TUNE3, 0x78); | ||
| 1237 | if (err < 0) | ||
| 1238 | dev_err(ab->dev, "Failed to set PHY_TUNE3 regester err=%d\n", | ||
| 1239 | err); | ||
| 1240 | |||
| 1241 | /* Switch to normal mode/disable Bank 0x12 access */ | ||
| 1242 | err = abx500_set_register_interruptible(ab->dev, | ||
| 1243 | AB8500_DEVELOPMENT, AB8500_BANK12_ACCESS, 0x00); | ||
| 1244 | if (err < 0) | ||
| 1245 | dev_err(ab->dev, "Failed to switch bank12 access err=%d\n", | ||
| 1246 | err); | ||
| 1247 | } | ||
| 1248 | |||
| 1249 | static void ab8500_usb_set_ab8505_tuning_values(struct ab8500_usb *ab) | ||
| 1250 | { | ||
| 1251 | int err; | ||
| 1252 | |||
| 1253 | /* Enable the PBT/Bank 0x12 access */ | ||
| 1254 | err = abx500_mask_and_set_register_interruptible(ab->dev, | ||
| 1255 | AB8500_DEVELOPMENT, AB8500_BANK12_ACCESS, | ||
| 1256 | 0x01, 0x01); | ||
| 1257 | if (err < 0) | ||
| 1258 | dev_err(ab->dev, "Failed to enable bank12 access err=%d\n", | ||
| 1259 | err); | ||
| 1260 | |||
| 1261 | err = abx500_mask_and_set_register_interruptible(ab->dev, | ||
| 1262 | AB8500_DEBUG, AB8500_USB_PHY_TUNE1, | ||
| 1263 | 0xC8, 0xC8); | ||
| 1264 | if (err < 0) | ||
| 1265 | dev_err(ab->dev, "Failed to set PHY_TUNE1 register err=%d\n", | ||
| 1266 | err); | ||
| 1267 | |||
| 1268 | err = abx500_mask_and_set_register_interruptible(ab->dev, | ||
| 1269 | AB8500_DEBUG, AB8500_USB_PHY_TUNE2, | ||
| 1270 | 0x60, 0x60); | ||
| 1271 | if (err < 0) | ||
| 1272 | dev_err(ab->dev, "Failed to set PHY_TUNE2 register err=%d\n", | ||
| 1273 | err); | ||
| 1274 | |||
| 1275 | err = abx500_mask_and_set_register_interruptible(ab->dev, | ||
| 1276 | AB8500_DEBUG, AB8500_USB_PHY_TUNE3, | ||
| 1277 | 0xFC, 0x80); | ||
| 1278 | |||
| 1279 | if (err < 0) | ||
| 1280 | dev_err(ab->dev, "Failed to set PHY_TUNE3 regester err=%d\n", | ||
| 1281 | err); | ||
| 1282 | |||
| 1283 | /* Switch to normal mode/disable Bank 0x12 access */ | ||
| 1284 | err = abx500_mask_and_set_register_interruptible(ab->dev, | ||
| 1285 | AB8500_DEVELOPMENT, AB8500_BANK12_ACCESS, | ||
| 1286 | 0x00, 0x00); | ||
| 1287 | if (err < 0) | ||
| 1288 | dev_err(ab->dev, "Failed to switch bank12 access err=%d\n", | ||
| 1289 | err); | ||
| 1290 | } | ||
| 1291 | |||
| 1292 | static void ab8500_usb_set_ab8540_tuning_values(struct ab8500_usb *ab) | ||
| 1293 | { | ||
| 1294 | int err; | ||
| 1295 | |||
| 1296 | err = abx500_set_register_interruptible(ab->dev, | ||
| 1297 | AB8540_DEBUG, AB8500_USB_PHY_TUNE1, 0xCC); | ||
| 1298 | if (err < 0) | ||
| 1299 | dev_err(ab->dev, "Failed to set PHY_TUNE1 register ret=%d\n", | ||
| 1300 | err); | ||
| 1301 | |||
| 1302 | err = abx500_set_register_interruptible(ab->dev, | ||
| 1303 | AB8540_DEBUG, AB8500_USB_PHY_TUNE2, 0x60); | ||
| 1304 | if (err < 0) | ||
| 1305 | dev_err(ab->dev, "Failed to set PHY_TUNE2 register ret=%d\n", | ||
| 1306 | err); | ||
| 1307 | |||
| 1308 | err = abx500_set_register_interruptible(ab->dev, | ||
| 1309 | AB8540_DEBUG, AB8500_USB_PHY_TUNE3, 0x90); | ||
| 1310 | if (err < 0) | ||
| 1311 | dev_err(ab->dev, "Failed to set PHY_TUNE3 regester ret=%d\n", | ||
| 1312 | err); | ||
| 1313 | } | ||
| 1314 | |||
| 1315 | static void ab8500_usb_set_ab9540_tuning_values(struct ab8500_usb *ab) | ||
| 1316 | { | ||
| 1317 | int err; | ||
| 1318 | |||
| 1319 | /* Enable the PBT/Bank 0x12 access */ | ||
| 1320 | err = abx500_set_register_interruptible(ab->dev, | ||
| 1321 | AB8500_DEVELOPMENT, AB8500_BANK12_ACCESS, 0x01); | ||
| 1322 | if (err < 0) | ||
| 1323 | dev_err(ab->dev, "Failed to enable bank12 access err=%d\n", | ||
| 1324 | err); | ||
| 1325 | |||
| 1326 | err = abx500_set_register_interruptible(ab->dev, | ||
| 1327 | AB8500_DEBUG, AB8500_USB_PHY_TUNE1, 0xC8); | ||
| 1328 | if (err < 0) | ||
| 1329 | dev_err(ab->dev, "Failed to set PHY_TUNE1 register err=%d\n", | ||
| 1330 | err); | ||
| 1331 | |||
| 1332 | err = abx500_set_register_interruptible(ab->dev, | ||
| 1333 | AB8500_DEBUG, AB8500_USB_PHY_TUNE2, 0x60); | ||
| 1334 | if (err < 0) | ||
| 1335 | dev_err(ab->dev, "Failed to set PHY_TUNE2 register err=%d\n", | ||
| 1336 | err); | ||
| 1337 | |||
| 1338 | err = abx500_set_register_interruptible(ab->dev, | ||
| 1339 | AB8500_DEBUG, AB8500_USB_PHY_TUNE3, 0x80); | ||
| 1340 | if (err < 0) | ||
| 1341 | dev_err(ab->dev, "Failed to set PHY_TUNE3 regester err=%d\n", | ||
| 1342 | err); | ||
| 1343 | |||
| 1344 | /* Switch to normal mode/disable Bank 0x12 access */ | ||
| 1345 | err = abx500_set_register_interruptible(ab->dev, | ||
| 1346 | AB8500_DEVELOPMENT, AB8500_BANK12_ACCESS, 0x00); | ||
| 1347 | if (err < 0) | ||
| 1348 | dev_err(ab->dev, "Failed to switch bank12 access err=%d\n", | ||
| 1349 | err); | ||
| 1350 | } | ||
| 1351 | |||
| 738 | static int ab8500_usb_probe(struct platform_device *pdev) | 1352 | static int ab8500_usb_probe(struct platform_device *pdev) |
| 739 | { | 1353 | { |
| 740 | struct ab8500_usb *ab; | 1354 | struct ab8500_usb *ab; |
| @@ -772,6 +1386,33 @@ static int ab8500_usb_probe(struct platform_device *pdev) | |||
| 772 | otg->set_host = ab8500_usb_set_host; | 1386 | otg->set_host = ab8500_usb_set_host; |
| 773 | otg->set_peripheral = ab8500_usb_set_peripheral; | 1387 | otg->set_peripheral = ab8500_usb_set_peripheral; |
| 774 | 1388 | ||
| 1389 | if (is_ab8500(ab->ab8500)) { | ||
| 1390 | ab->flags |= AB8500_USB_FLAG_USE_LINK_STATUS_IRQ | | ||
| 1391 | AB8500_USB_FLAG_USE_ID_WAKEUP_IRQ | | ||
| 1392 | AB8500_USB_FLAG_USE_VBUS_DET_IRQ | | ||
| 1393 | AB8500_USB_FLAG_REGULATOR_SET_VOLTAGE; | ||
| 1394 | } else if (is_ab8505(ab->ab8500)) { | ||
| 1395 | ab->flags |= AB8500_USB_FLAG_USE_LINK_STATUS_IRQ | | ||
| 1396 | AB8500_USB_FLAG_USE_ID_WAKEUP_IRQ | | ||
| 1397 | AB8500_USB_FLAG_USE_VBUS_DET_IRQ | | ||
| 1398 | AB8500_USB_FLAG_REGULATOR_SET_VOLTAGE; | ||
| 1399 | } else if (is_ab8540(ab->ab8500)) { | ||
| 1400 | ab->flags |= AB8500_USB_FLAG_USE_LINK_STATUS_IRQ | | ||
| 1401 | AB8500_USB_FLAG_USE_CHECK_VBUS_STATUS | | ||
| 1402 | AB8500_USB_FLAG_USE_VBUS_HOST_QUIRK | | ||
| 1403 | AB8500_USB_FLAG_REGULATOR_SET_VOLTAGE; | ||
| 1404 | } else if (is_ab9540(ab->ab8500)) { | ||
| 1405 | ab->flags |= AB8500_USB_FLAG_USE_LINK_STATUS_IRQ | | ||
| 1406 | AB8500_USB_FLAG_REGULATOR_SET_VOLTAGE; | ||
| 1407 | if (is_ab9540_2p0_or_earlier(ab->ab8500)) | ||
| 1408 | ab->flags |= AB8500_USB_FLAG_USE_ID_WAKEUP_IRQ | | ||
| 1409 | AB8500_USB_FLAG_USE_VBUS_DET_IRQ; | ||
| 1410 | } | ||
| 1411 | |||
| 1412 | /* Disable regulator voltage setting for AB8500 <= v2.0 */ | ||
| 1413 | if (is_ab8500_2p0_or_earlier(ab->ab8500)) | ||
| 1414 | ab->flags &= ~AB8500_USB_FLAG_REGULATOR_SET_VOLTAGE; | ||
| 1415 | |||
| 775 | platform_set_drvdata(pdev, ab); | 1416 | platform_set_drvdata(pdev, ab); |
| 776 | 1417 | ||
| 777 | ATOMIC_INIT_NOTIFIER_HEAD(&ab->phy.notifier); | 1418 | ATOMIC_INIT_NOTIFIER_HEAD(&ab->phy.notifier); |
| @@ -779,10 +1420,18 @@ static int ab8500_usb_probe(struct platform_device *pdev) | |||
| 779 | /* all: Disable phy when called from set_host and set_peripheral */ | 1420 | /* all: Disable phy when called from set_host and set_peripheral */ |
| 780 | INIT_WORK(&ab->phy_dis_work, ab8500_usb_phy_disable_work); | 1421 | INIT_WORK(&ab->phy_dis_work, ab8500_usb_phy_disable_work); |
| 781 | 1422 | ||
| 1423 | INIT_WORK(&ab->vbus_event_work, ab8500_usb_vbus_turn_on_event_work); | ||
| 1424 | |||
| 782 | err = ab8500_usb_regulator_get(ab); | 1425 | err = ab8500_usb_regulator_get(ab); |
| 783 | if (err) | 1426 | if (err) |
| 784 | return err; | 1427 | return err; |
| 785 | 1428 | ||
| 1429 | ab->sysclk = devm_clk_get(ab->dev, "sysclk"); | ||
| 1430 | if (IS_ERR(ab->sysclk)) { | ||
| 1431 | dev_err(ab->dev, "Could not get sysclk.\n"); | ||
| 1432 | return PTR_ERR(ab->sysclk); | ||
| 1433 | } | ||
| 1434 | |||
| 786 | err = ab8500_usb_irq_setup(pdev, ab); | 1435 | err = ab8500_usb_irq_setup(pdev, ab); |
| 787 | if (err < 0) | 1436 | if (err < 0) |
| 788 | return err; | 1437 | return err; |
| @@ -793,85 +1442,33 @@ static int ab8500_usb_probe(struct platform_device *pdev) | |||
| 793 | return err; | 1442 | return err; |
| 794 | } | 1443 | } |
| 795 | 1444 | ||
| 796 | /* Phy tuning values for AB8500 */ | 1445 | if (is_ab8500(ab->ab8500) && !is_ab8500_2p0_or_earlier(ab->ab8500)) |
| 797 | if (!is_ab8500_2p0_or_earlier(ab->ab8500)) { | 1446 | /* Phy tuning values for AB8500 > v2.0 */ |
| 798 | /* Enable the PBT/Bank 0x12 access */ | 1447 | ab8500_usb_set_ab8500_tuning_values(ab); |
| 799 | err = abx500_set_register_interruptible(ab->dev, | 1448 | else if (is_ab8505(ab->ab8500)) |
| 800 | AB8500_DEVELOPMENT, AB8500_BANK12_ACCESS, 0x01); | 1449 | /* Phy tuning values for AB8505 */ |
| 801 | if (err < 0) | 1450 | ab8500_usb_set_ab8505_tuning_values(ab); |
| 802 | dev_err(ab->dev, "Failed to enable bank12 access err=%d\n", | 1451 | else if (is_ab8540(ab->ab8500)) |
| 803 | err); | 1452 | /* Phy tuning values for AB8540 */ |
| 804 | 1453 | ab8500_usb_set_ab8540_tuning_values(ab); | |
| 805 | err = abx500_set_register_interruptible(ab->dev, | 1454 | else if (is_ab9540(ab->ab8500)) |
| 806 | AB8500_DEBUG, AB8500_USB_PHY_TUNE1, 0xC8); | 1455 | /* Phy tuning values for AB9540 */ |
| 807 | if (err < 0) | 1456 | ab8500_usb_set_ab9540_tuning_values(ab); |
| 808 | dev_err(ab->dev, "Failed to set PHY_TUNE1 register err=%d\n", | ||
| 809 | err); | ||
| 810 | |||
| 811 | err = abx500_set_register_interruptible(ab->dev, | ||
| 812 | AB8500_DEBUG, AB8500_USB_PHY_TUNE2, 0x00); | ||
| 813 | if (err < 0) | ||
| 814 | dev_err(ab->dev, "Failed to set PHY_TUNE2 register err=%d\n", | ||
| 815 | err); | ||
| 816 | |||
| 817 | err = abx500_set_register_interruptible(ab->dev, | ||
| 818 | AB8500_DEBUG, AB8500_USB_PHY_TUNE3, 0x78); | ||
| 819 | if (err < 0) | ||
| 820 | dev_err(ab->dev, "Failed to set PHY_TUNE3 regester err=%d\n", | ||
| 821 | err); | ||
| 822 | |||
| 823 | /* Switch to normal mode/disable Bank 0x12 access */ | ||
| 824 | err = abx500_set_register_interruptible(ab->dev, | ||
| 825 | AB8500_DEVELOPMENT, AB8500_BANK12_ACCESS, 0x00); | ||
| 826 | if (err < 0) | ||
| 827 | dev_err(ab->dev, "Failed to switch bank12 access err=%d\n", | ||
| 828 | err); | ||
| 829 | } | ||
| 830 | |||
| 831 | /* Phy tuning values for AB8505 */ | ||
| 832 | if (is_ab8505(ab->ab8500)) { | ||
| 833 | /* Enable the PBT/Bank 0x12 access */ | ||
| 834 | err = abx500_mask_and_set_register_interruptible(ab->dev, | ||
| 835 | AB8500_DEVELOPMENT, AB8500_BANK12_ACCESS, | ||
| 836 | 0x01, 0x01); | ||
| 837 | if (err < 0) | ||
| 838 | dev_err(ab->dev, "Failed to enable bank12 access err=%d\n", | ||
| 839 | err); | ||
| 840 | |||
| 841 | err = abx500_mask_and_set_register_interruptible(ab->dev, | ||
| 842 | AB8500_DEBUG, AB8500_USB_PHY_TUNE1, | ||
| 843 | 0xC8, 0xC8); | ||
| 844 | if (err < 0) | ||
| 845 | dev_err(ab->dev, "Failed to set PHY_TUNE1 register err=%d\n", | ||
| 846 | err); | ||
| 847 | |||
| 848 | err = abx500_mask_and_set_register_interruptible(ab->dev, | ||
| 849 | AB8500_DEBUG, AB8500_USB_PHY_TUNE2, | ||
| 850 | 0x60, 0x60); | ||
| 851 | if (err < 0) | ||
| 852 | dev_err(ab->dev, "Failed to set PHY_TUNE2 register err=%d\n", | ||
| 853 | err); | ||
| 854 | |||
| 855 | err = abx500_mask_and_set_register_interruptible(ab->dev, | ||
| 856 | AB8500_DEBUG, AB8500_USB_PHY_TUNE3, | ||
| 857 | 0xFC, 0x80); | ||
| 858 | |||
| 859 | if (err < 0) | ||
| 860 | dev_err(ab->dev, "Failed to set PHY_TUNE3 regester err=%d\n", | ||
| 861 | err); | ||
| 862 | |||
| 863 | /* Switch to normal mode/disable Bank 0x12 access */ | ||
| 864 | err = abx500_mask_and_set_register_interruptible(ab->dev, | ||
| 865 | AB8500_DEVELOPMENT, AB8500_BANK12_ACCESS, | ||
| 866 | 0x00, 0x00); | ||
| 867 | if (err < 0) | ||
| 868 | dev_err(ab->dev, "Failed to switch bank12 access err=%d\n", | ||
| 869 | err); | ||
| 870 | } | ||
| 871 | 1457 | ||
| 872 | /* Needed to enable ID detection. */ | 1458 | /* Needed to enable ID detection. */ |
| 873 | ab8500_usb_wd_workaround(ab); | 1459 | ab8500_usb_wd_workaround(ab); |
| 874 | 1460 | ||
| 1461 | /* | ||
| 1462 | * This is required for usb-link-status to work properly when a | ||
| 1463 | * cable is connected at boot time. | ||
| 1464 | */ | ||
| 1465 | ab8500_usb_restart_phy(ab); | ||
| 1466 | |||
| 1467 | if (ab->flags & AB8500_USB_FLAG_USE_CHECK_VBUS_STATUS) { | ||
| 1468 | if (ab8500_usb_check_vbus_status(ab)) | ||
| 1469 | schedule_work(&ab->vbus_event_work); | ||
| 1470 | } | ||
| 1471 | |||
| 875 | abx500_usb_link_status_update(ab); | 1472 | abx500_usb_link_status_update(ab); |
| 876 | 1473 | ||
| 877 | dev_info(&pdev->dev, "revision 0x%2x driver initialized\n", rev); | 1474 | dev_info(&pdev->dev, "revision 0x%2x driver initialized\n", rev); |
| @@ -884,6 +1481,7 @@ static int ab8500_usb_remove(struct platform_device *pdev) | |||
| 884 | struct ab8500_usb *ab = platform_get_drvdata(pdev); | 1481 | struct ab8500_usb *ab = platform_get_drvdata(pdev); |
| 885 | 1482 | ||
| 886 | cancel_work_sync(&ab->phy_dis_work); | 1483 | cancel_work_sync(&ab->phy_dis_work); |
| 1484 | cancel_work_sync(&ab->vbus_event_work); | ||
| 887 | 1485 | ||
| 888 | usb_remove_phy(&ab->phy); | 1486 | usb_remove_phy(&ab->phy); |
| 889 | 1487 | ||
| @@ -895,11 +1493,20 @@ static int ab8500_usb_remove(struct platform_device *pdev) | |||
| 895 | return 0; | 1493 | return 0; |
| 896 | } | 1494 | } |
| 897 | 1495 | ||
| 1496 | static struct platform_device_id ab8500_usb_devtype[] = { | ||
| 1497 | { .name = "ab8500-usb", }, | ||
| 1498 | { .name = "ab8540-usb", }, | ||
| 1499 | { .name = "ab9540-usb", }, | ||
| 1500 | { /* sentinel */ } | ||
| 1501 | }; | ||
| 1502 | MODULE_DEVICE_TABLE(platform, ab8500_usb_devtype); | ||
| 1503 | |||
| 898 | static struct platform_driver ab8500_usb_driver = { | 1504 | static struct platform_driver ab8500_usb_driver = { |
| 899 | .probe = ab8500_usb_probe, | 1505 | .probe = ab8500_usb_probe, |
| 900 | .remove = ab8500_usb_remove, | 1506 | .remove = ab8500_usb_remove, |
| 1507 | .id_table = ab8500_usb_devtype, | ||
| 901 | .driver = { | 1508 | .driver = { |
| 902 | .name = "ab8500-usb", | 1509 | .name = "abx5x0-usb", |
| 903 | .owner = THIS_MODULE, | 1510 | .owner = THIS_MODULE, |
| 904 | }, | 1511 | }, |
| 905 | }; | 1512 | }; |
| @@ -916,7 +1523,6 @@ static void __exit ab8500_usb_exit(void) | |||
| 916 | } | 1523 | } |
| 917 | module_exit(ab8500_usb_exit); | 1524 | module_exit(ab8500_usb_exit); |
| 918 | 1525 | ||
| 919 | MODULE_ALIAS("platform:ab8500_usb"); | ||
| 920 | MODULE_AUTHOR("ST-Ericsson AB"); | 1526 | MODULE_AUTHOR("ST-Ericsson AB"); |
| 921 | MODULE_DESCRIPTION("AB8500 usb transceiver driver"); | 1527 | MODULE_DESCRIPTION("AB8500 family usb transceiver driver"); |
| 922 | MODULE_LICENSE("GPL"); | 1528 | MODULE_LICENSE("GPL"); |
