1 From 94583a41047eb9489f576344b8ba9370cf4cbfb7 Mon Sep 17 00:00:00 2001
2 From: Al Cooper <alcooperx@gmail.com>
3 Date: Fri, 3 Jan 2020 13:18:03 -0500
4 Subject: [PATCH] phy: usb: Restructure in preparation for adding 7216 USB
7 The driver is being restructured in preparation for adding support
8 for the new Synopsys USB conroller on the 7216. Since all the bugs
9 and work-arounds in previous STB chips are supposed to be fixed,
10 most of the code in phy-brcm-usb-init.c is not needed. Instead of
11 adding more complexity to the already complicated phy-brcm-usb-init.c
12 module, the driver will be restructured to use a vector table to
13 dispatch into different C modules for the different controllers.
15 There was also some general cleanup done including some ipp setup
16 code that was incorrect.
18 Signed-off-by: Al Cooper <alcooperx@gmail.com>
19 Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
20 Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
22 drivers/phy/broadcom/phy-brcm-usb-init.c | 191 ++++++++++-------------
23 drivers/phy/broadcom/phy-brcm-usb-init.h | 140 +++++++++++++++--
24 drivers/phy/broadcom/phy-brcm-usb.c | 6 +-
25 3 files changed, 214 insertions(+), 123 deletions(-)
27 --- a/drivers/phy/broadcom/phy-brcm-usb-init.c
28 +++ b/drivers/phy/broadcom/phy-brcm-usb-init.c
29 @@ -129,10 +129,6 @@ enum {
30 USB_CTRL_SELECTOR_COUNT,
33 -#define USB_CTRL_REG(base, reg) ((void __iomem *)base + USB_CTRL_##reg)
34 -#define USB_XHCI_EC_REG(base, reg) ((void __iomem *)base + USB_XHCI_EC_##reg)
35 -#define USB_CTRL_MASK(reg, field) \
36 - USB_CTRL_##reg##_##field##_MASK
37 #define USB_CTRL_MASK_FAMILY(params, reg, field) \
38 (params->usb_reg_bits_map[USB_CTRL_##reg##_##field##_SELECTOR])
40 @@ -143,13 +139,6 @@ enum {
41 usb_ctrl_unset_family(params, USB_CTRL_##reg, \
42 USB_CTRL_##reg##_##field##_SELECTOR)
44 -#define USB_CTRL_SET(base, reg, field) \
45 - usb_ctrl_set(USB_CTRL_REG(base, reg), \
46 - USB_CTRL_##reg##_##field##_MASK)
47 -#define USB_CTRL_UNSET(base, reg, field) \
48 - usb_ctrl_unset(USB_CTRL_REG(base, reg), \
49 - USB_CTRL_##reg##_##field##_MASK)
52 #define MDIO_USB3 BIT(31)
54 @@ -405,26 +394,14 @@ usb_reg_bits_map_table[BRCM_FAMILY_COUNT
58 -static inline u32 brcmusb_readl(void __iomem *addr)
63 -static inline void brcmusb_writel(u32 val, void __iomem *addr)
69 void usb_ctrl_unset_family(struct brcm_usb_init_params *params,
70 u32 reg_offset, u32 field)
75 mask = params->usb_reg_bits_map[field];
76 - reg = params->ctrl_regs + reg_offset;
77 - brcmusb_writel(brcmusb_readl(reg) & ~mask, reg);
78 + brcm_usb_ctrl_unset(params->ctrl_regs + reg_offset, mask);
82 @@ -432,45 +409,27 @@ void usb_ctrl_set_family(struct brcm_usb
83 u32 reg_offset, u32 field)
88 mask = params->usb_reg_bits_map[field];
89 - reg = params->ctrl_regs + reg_offset;
90 - brcmusb_writel(brcmusb_readl(reg) | mask, reg);
91 + brcm_usb_ctrl_set(params->ctrl_regs + reg_offset, mask);
94 -static inline void usb_ctrl_set(void __iomem *reg, u32 field)
98 - value = brcmusb_readl(reg);
99 - brcmusb_writel(value | field, reg);
102 -static inline void usb_ctrl_unset(void __iomem *reg, u32 field)
106 - value = brcmusb_readl(reg);
107 - brcmusb_writel(value & ~field, reg);
110 static u32 brcmusb_usb_mdio_read(void __iomem *ctrl_base, u32 reg, int mode)
114 data = (reg << 16) | mode;
115 - brcmusb_writel(data, USB_CTRL_REG(ctrl_base, MDIO));
116 + brcm_usb_writel(data, USB_CTRL_REG(ctrl_base, MDIO));
118 - brcmusb_writel(data, USB_CTRL_REG(ctrl_base, MDIO));
119 + brcm_usb_writel(data, USB_CTRL_REG(ctrl_base, MDIO));
121 /* wait for the 60MHz parallel to serial shifter */
122 usleep_range(10, 20);
123 - brcmusb_writel(data, USB_CTRL_REG(ctrl_base, MDIO));
124 + brcm_usb_writel(data, USB_CTRL_REG(ctrl_base, MDIO));
125 /* wait for the 60MHz parallel to serial shifter */
126 usleep_range(10, 20);
128 - return brcmusb_readl(USB_CTRL_REG(ctrl_base, MDIO2)) & 0xffff;
129 + return brcm_usb_readl(USB_CTRL_REG(ctrl_base, MDIO2)) & 0xffff;
132 static void brcmusb_usb_mdio_write(void __iomem *ctrl_base, u32 reg,
133 @@ -479,14 +438,14 @@ static void brcmusb_usb_mdio_write(void
136 data = (reg << 16) | val | mode;
137 - brcmusb_writel(data, USB_CTRL_REG(ctrl_base, MDIO));
138 + brcm_usb_writel(data, USB_CTRL_REG(ctrl_base, MDIO));
140 - brcmusb_writel(data, USB_CTRL_REG(ctrl_base, MDIO));
141 + brcm_usb_writel(data, USB_CTRL_REG(ctrl_base, MDIO));
144 /* wait for the 60MHz parallel to serial shifter */
145 usleep_range(10, 20);
146 - brcmusb_writel(data, USB_CTRL_REG(ctrl_base, MDIO));
147 + brcm_usb_writel(data, USB_CTRL_REG(ctrl_base, MDIO));
148 /* wait for the 60MHz parallel to serial shifter */
149 usleep_range(10, 20);
151 @@ -713,12 +672,12 @@ static void brcmusb_usb3_otp_fix(struct
153 if (params->family_id != 0x74371000 || !xhci_ec_base)
155 - brcmusb_writel(0xa20c, USB_XHCI_EC_REG(xhci_ec_base, IRAADR));
156 - val = brcmusb_readl(USB_XHCI_EC_REG(xhci_ec_base, IRADAT));
157 + brcm_usb_writel(0xa20c, USB_XHCI_EC_REG(xhci_ec_base, IRAADR));
158 + val = brcm_usb_readl(USB_XHCI_EC_REG(xhci_ec_base, IRADAT));
160 /* set cfg_pick_ss_lock */
162 - brcmusb_writel(val, USB_XHCI_EC_REG(xhci_ec_base, IRADAT));
163 + brcm_usb_writel(val, USB_XHCI_EC_REG(xhci_ec_base, IRADAT));
165 /* Reset USB 3.0 PHY for workaround to take effect */
166 USB_CTRL_UNSET(params->ctrl_regs, USB30_CTL1, PHY3_RESETB);
167 @@ -751,7 +710,7 @@ static void brcmusb_xhci_soft_reset(stru
168 * - default chip/rev.
169 * NOTE: The minor rev is always ignored.
171 -static enum brcm_family_type brcmusb_get_family_type(
172 +static enum brcm_family_type get_family_type(
173 struct brcm_usb_init_params *params)
176 @@ -779,7 +738,7 @@ static enum brcm_family_type brcmusb_get
180 -void brcm_usb_init_ipp(struct brcm_usb_init_params *params)
181 +static void usb_init_ipp(struct brcm_usb_init_params *params)
183 void __iomem *ctrl = params->ctrl_regs;
185 @@ -795,7 +754,7 @@ void brcm_usb_init_ipp(struct brcm_usb_i
186 USB_CTRL_SET_FAMILY(params, USB30_CTL1, USB3_IPP);
189 - reg = brcmusb_readl(USB_CTRL_REG(ctrl, SETUP));
190 + reg = brcm_usb_readl(USB_CTRL_REG(ctrl, SETUP));
192 if (USB_CTRL_MASK_FAMILY(params, SETUP, STRAP_CC_DRD_MODE_ENABLE_SEL))
193 /* Never use the strap, it's going away. */
194 @@ -803,8 +762,8 @@ void brcm_usb_init_ipp(struct brcm_usb_i
196 STRAP_CC_DRD_MODE_ENABLE_SEL));
197 if (USB_CTRL_MASK_FAMILY(params, SETUP, STRAP_IPP_SEL))
198 + /* override ipp strap pin (if it exits) */
199 if (params->ipp != 2)
200 - /* override ipp strap pin (if it exits) */
201 reg &= ~(USB_CTRL_MASK_FAMILY(params, SETUP,
204 @@ -812,54 +771,26 @@ void brcm_usb_init_ipp(struct brcm_usb_i
205 reg &= ~(USB_CTRL_MASK(SETUP, IPP) | USB_CTRL_MASK(SETUP, IOC));
207 reg |= USB_CTRL_MASK(SETUP, IOC);
208 - if (params->ipp == 1 && ((reg & USB_CTRL_MASK(SETUP, IPP)) == 0))
209 + if (params->ipp == 1)
210 reg |= USB_CTRL_MASK(SETUP, IPP);
211 - brcmusb_writel(reg, USB_CTRL_REG(ctrl, SETUP));
212 + brcm_usb_writel(reg, USB_CTRL_REG(ctrl, SETUP));
215 * If we're changing IPP, make sure power is off long enough
216 * to turn off any connected devices.
218 - if (reg != orig_reg)
219 + if ((reg ^ orig_reg) & USB_CTRL_MASK(SETUP, IPP))
223 -int brcm_usb_init_get_dual_select(struct brcm_usb_init_params *params)
225 - void __iomem *ctrl = params->ctrl_regs;
228 - if (USB_CTRL_MASK_FAMILY(params, USB_DEVICE_CTL1, PORT_MODE)) {
229 - reg = brcmusb_readl(USB_CTRL_REG(ctrl, USB_DEVICE_CTL1));
230 - reg &= USB_CTRL_MASK_FAMILY(params, USB_DEVICE_CTL1,
236 -void brcm_usb_init_set_dual_select(struct brcm_usb_init_params *params,
239 - void __iomem *ctrl = params->ctrl_regs;
242 - if (USB_CTRL_MASK_FAMILY(params, USB_DEVICE_CTL1, PORT_MODE)) {
243 - reg = brcmusb_readl(USB_CTRL_REG(ctrl, USB_DEVICE_CTL1));
244 - reg &= ~USB_CTRL_MASK_FAMILY(params, USB_DEVICE_CTL1,
247 - brcmusb_writel(reg, USB_CTRL_REG(ctrl, USB_DEVICE_CTL1));
251 -void brcm_usb_init_common(struct brcm_usb_init_params *params)
252 +static void usb_init_common(struct brcm_usb_init_params *params)
255 void __iomem *ctrl = params->ctrl_regs;
257 /* Clear any pending wake conditions */
258 - reg = brcmusb_readl(USB_CTRL_REG(ctrl, USB_PM_STATUS));
259 - brcmusb_writel(reg, USB_CTRL_REG(ctrl, USB_PM_STATUS));
260 + reg = brcm_usb_readl(USB_CTRL_REG(ctrl, USB_PM_STATUS));
261 + brcm_usb_writel(reg, USB_CTRL_REG(ctrl, USB_PM_STATUS));
263 /* Take USB out of power down */
264 if (USB_CTRL_MASK_FAMILY(params, PLL_CTL, PLL_IDDQ_PWRDN)) {
265 @@ -885,7 +816,7 @@ void brcm_usb_init_common(struct brcm_us
266 /* Block auto PLL suspend by USB2 PHY (Sasi) */
267 USB_CTRL_SET(ctrl, PLL_CTL, PLL_SUSPEND_EN);
269 - reg = brcmusb_readl(USB_CTRL_REG(ctrl, SETUP));
270 + reg = brcm_usb_readl(USB_CTRL_REG(ctrl, SETUP));
271 if (params->selected_family == BRCM_FAMILY_7364A0)
272 /* Suppress overcurrent indication from USB30 ports for A0 */
273 reg |= USB_CTRL_MASK_FAMILY(params, SETUP, OC3_DISABLE);
274 @@ -901,16 +832,16 @@ void brcm_usb_init_common(struct brcm_us
275 reg |= USB_CTRL_MASK_FAMILY(params, SETUP, SCB1_EN);
276 if (USB_CTRL_MASK_FAMILY(params, SETUP, SCB2_EN))
277 reg |= USB_CTRL_MASK_FAMILY(params, SETUP, SCB2_EN);
278 - brcmusb_writel(reg, USB_CTRL_REG(ctrl, SETUP));
279 + brcm_usb_writel(reg, USB_CTRL_REG(ctrl, SETUP));
281 brcmusb_memc_fix(params);
283 if (USB_CTRL_MASK_FAMILY(params, USB_DEVICE_CTL1, PORT_MODE)) {
284 - reg = brcmusb_readl(USB_CTRL_REG(ctrl, USB_DEVICE_CTL1));
285 + reg = brcm_usb_readl(USB_CTRL_REG(ctrl, USB_DEVICE_CTL1));
286 reg &= ~USB_CTRL_MASK_FAMILY(params, USB_DEVICE_CTL1,
289 - brcmusb_writel(reg, USB_CTRL_REG(ctrl, USB_DEVICE_CTL1));
290 + brcm_usb_writel(reg, USB_CTRL_REG(ctrl, USB_DEVICE_CTL1));
292 if (USB_CTRL_MASK_FAMILY(params, USB_PM, BDC_SOFT_RESETB)) {
293 switch (params->mode) {
294 @@ -932,7 +863,7 @@ void brcm_usb_init_common(struct brcm_us
298 -void brcm_usb_init_eohci(struct brcm_usb_init_params *params)
299 +static void usb_init_eohci(struct brcm_usb_init_params *params)
302 void __iomem *ctrl = params->ctrl_regs;
303 @@ -948,10 +879,10 @@ void brcm_usb_init_eohci(struct brcm_usb
304 USB_CTRL_SET(ctrl, EBRIDGE, ESTOP_SCB_REQ);
306 /* Setup the endian bits */
307 - reg = brcmusb_readl(USB_CTRL_REG(ctrl, SETUP));
308 + reg = brcm_usb_readl(USB_CTRL_REG(ctrl, SETUP));
309 reg &= ~USB_CTRL_SETUP_ENDIAN_BITS;
310 reg |= USB_CTRL_MASK_FAMILY(params, SETUP, ENDIAN);
311 - brcmusb_writel(reg, USB_CTRL_REG(ctrl, SETUP));
312 + brcm_usb_writel(reg, USB_CTRL_REG(ctrl, SETUP));
314 if (params->selected_family == BRCM_FAMILY_7271A0)
315 /* Enable LS keep alive fix for certain keyboards */
316 @@ -962,14 +893,14 @@ void brcm_usb_init_eohci(struct brcm_usb
317 * Make the burst size 512 bytes to fix a hardware bug
318 * on the 7255a0. See HW7255-24.
320 - reg = brcmusb_readl(USB_CTRL_REG(ctrl, EBRIDGE));
321 + reg = brcm_usb_readl(USB_CTRL_REG(ctrl, EBRIDGE));
322 reg &= ~USB_CTRL_MASK(EBRIDGE, EBR_SCB_SIZE);
324 - brcmusb_writel(reg, USB_CTRL_REG(ctrl, EBRIDGE));
325 + brcm_usb_writel(reg, USB_CTRL_REG(ctrl, EBRIDGE));
329 -void brcm_usb_init_xhci(struct brcm_usb_init_params *params)
330 +static void usb_init_xhci(struct brcm_usb_init_params *params)
332 void __iomem *ctrl = params->ctrl_regs;
334 @@ -997,7 +928,7 @@ void brcm_usb_init_xhci(struct brcm_usb_
335 brcmusb_usb3_otp_fix(params);
338 -void brcm_usb_uninit_common(struct brcm_usb_init_params *params)
339 +static void usb_uninit_common(struct brcm_usb_init_params *params)
341 if (USB_CTRL_MASK_FAMILY(params, USB_PM, USB_PWRDN))
342 USB_CTRL_SET_FAMILY(params, USB_PM, USB_PWRDN);
343 @@ -1006,17 +937,47 @@ void brcm_usb_uninit_common(struct brcm_
344 USB_CTRL_SET_FAMILY(params, PLL_CTL, PLL_IDDQ_PWRDN);
347 -void brcm_usb_uninit_eohci(struct brcm_usb_init_params *params)
348 +static void usb_uninit_eohci(struct brcm_usb_init_params *params)
352 -void brcm_usb_uninit_xhci(struct brcm_usb_init_params *params)
353 +static void usb_uninit_xhci(struct brcm_usb_init_params *params)
355 brcmusb_xhci_soft_reset(params, 1);
356 USB_CTRL_SET(params->ctrl_regs, USB30_PCTL, PHY3_IDDQ_OVERRIDE);
359 -void brcm_usb_wake_enable(struct brcm_usb_init_params *params,
360 +static int usb_get_dual_select(struct brcm_usb_init_params *params)
362 + void __iomem *ctrl = params->ctrl_regs;
365 + pr_debug("%s\n", __func__);
366 + if (USB_CTRL_MASK_FAMILY(params, USB_DEVICE_CTL1, PORT_MODE)) {
367 + reg = brcm_usb_readl(USB_CTRL_REG(ctrl, USB_DEVICE_CTL1));
368 + reg &= USB_CTRL_MASK_FAMILY(params, USB_DEVICE_CTL1,
374 +static void usb_set_dual_select(struct brcm_usb_init_params *params, int mode)
376 + void __iomem *ctrl = params->ctrl_regs;
379 + pr_debug("%s\n", __func__);
381 + if (USB_CTRL_MASK_FAMILY(params, USB_DEVICE_CTL1, PORT_MODE)) {
382 + reg = brcm_usb_readl(USB_CTRL_REG(ctrl, USB_DEVICE_CTL1));
383 + reg &= ~USB_CTRL_MASK_FAMILY(params, USB_DEVICE_CTL1,
386 + brcm_usb_writel(reg, USB_CTRL_REG(ctrl, USB_DEVICE_CTL1));
390 +static void usb_wake_enable(struct brcm_usb_init_params *params,
393 void __iomem *ctrl = params->ctrl_regs;
394 @@ -1027,13 +988,29 @@ void brcm_usb_wake_enable(struct brcm_us
395 USB_CTRL_UNSET(ctrl, USB_PM, RMTWKUP_EN);
398 -void brcm_usb_set_family_map(struct brcm_usb_init_params *params)
399 +static const struct brcm_usb_init_ops bcm7445_ops = {
400 + .init_ipp = usb_init_ipp,
401 + .init_common = usb_init_common,
402 + .init_eohci = usb_init_eohci,
403 + .init_xhci = usb_init_xhci,
404 + .uninit_common = usb_uninit_common,
405 + .uninit_eohci = usb_uninit_eohci,
406 + .uninit_xhci = usb_uninit_xhci,
407 + .get_dual_select = usb_get_dual_select,
408 + .set_dual_select = usb_set_dual_select,
409 + .wake_enable = usb_wake_enable,
412 +void brcm_usb_dvr_init_7445(struct brcm_usb_init_params *params)
416 - fam = brcmusb_get_family_type(params);
417 + pr_debug("%s\n", __func__);
419 + fam = get_family_type(params);
420 params->selected_family = fam;
421 params->usb_reg_bits_map =
422 &usb_reg_bits_map_table[fam][0];
423 params->family_name = family_names[fam];
424 + params->ops = &bcm7445_ops;
426 --- a/drivers/phy/broadcom/phy-brcm-usb-init.h
427 +++ b/drivers/phy/broadcom/phy-brcm-usb-init.h
430 struct brcm_usb_init_params;
432 +#define USB_CTRL_REG(base, reg) ((void __iomem *)base + USB_CTRL_##reg)
433 +#define USB_XHCI_EC_REG(base, reg) ((void __iomem *)base + USB_XHCI_EC_##reg)
434 +#define USB_CTRL_MASK(reg, field) \
435 + USB_CTRL_##reg##_##field##_MASK
436 +#define USB_CTRL_SET(base, reg, field) \
437 + brcm_usb_ctrl_set(USB_CTRL_REG(base, reg), \
438 + USB_CTRL_##reg##_##field##_MASK)
439 +#define USB_CTRL_UNSET(base, reg, field) \
440 + brcm_usb_ctrl_unset(USB_CTRL_REG(base, reg), \
441 + USB_CTRL_##reg##_##field##_MASK)
443 +struct brcm_usb_init_params;
445 +struct brcm_usb_init_ops {
446 + void (*init_ipp)(struct brcm_usb_init_params *params);
447 + void (*init_common)(struct brcm_usb_init_params *params);
448 + void (*init_eohci)(struct brcm_usb_init_params *params);
449 + void (*init_xhci)(struct brcm_usb_init_params *params);
450 + void (*uninit_common)(struct brcm_usb_init_params *params);
451 + void (*uninit_eohci)(struct brcm_usb_init_params *params);
452 + void (*uninit_xhci)(struct brcm_usb_init_params *params);
453 + int (*get_dual_select)(struct brcm_usb_init_params *params);
454 + void (*set_dual_select)(struct brcm_usb_init_params *params, int mode);
455 + void (*wake_enable)(struct brcm_usb_init_params *params,
459 struct brcm_usb_init_params {
460 void __iomem *ctrl_regs;
461 void __iomem *xhci_ec_regs;
462 @@ -24,20 +51,107 @@ struct brcm_usb_init_params {
464 const char *family_name;
465 const u32 *usb_reg_bits_map;
466 + const struct brcm_usb_init_ops *ops;
469 -void brcm_usb_set_family_map(struct brcm_usb_init_params *params);
470 -int brcm_usb_init_get_dual_select(struct brcm_usb_init_params *params);
471 -void brcm_usb_init_set_dual_select(struct brcm_usb_init_params *params,
474 -void brcm_usb_init_ipp(struct brcm_usb_init_params *ini);
475 -void brcm_usb_init_common(struct brcm_usb_init_params *ini);
476 -void brcm_usb_init_eohci(struct brcm_usb_init_params *ini);
477 -void brcm_usb_init_xhci(struct brcm_usb_init_params *ini);
478 -void brcm_usb_uninit_common(struct brcm_usb_init_params *ini);
479 -void brcm_usb_uninit_eohci(struct brcm_usb_init_params *ini);
480 -void brcm_usb_uninit_xhci(struct brcm_usb_init_params *ini);
481 -void brcm_usb_wake_enable(struct brcm_usb_init_params *params, int enable);
482 +void brcm_usb_dvr_init_7445(struct brcm_usb_init_params *params);
484 +static inline u32 brcm_usb_readl(void __iomem *addr)
487 + * MIPS endianness is configured by boot strap, which also reverses all
488 + * bus endianness (i.e., big-endian CPU + big endian bus ==> native
491 + * Other architectures (e.g., ARM) either do not support big endian, or
492 + * else leave I/O in little endian mode.
494 + if (IS_ENABLED(CONFIG_MIPS) && IS_ENABLED(__BIG_ENDIAN))
495 + return __raw_readl(addr);
497 + return readl_relaxed(addr);
500 +static inline void brcm_usb_writel(u32 val, void __iomem *addr)
502 + /* See brcmnand_readl() comments */
503 + if (IS_ENABLED(CONFIG_MIPS) && IS_ENABLED(__BIG_ENDIAN))
504 + __raw_writel(val, addr);
506 + writel_relaxed(val, addr);
509 +static inline void brcm_usb_ctrl_unset(void __iomem *reg, u32 mask)
511 + brcm_usb_writel(brcm_usb_readl(reg) & ~(mask), reg);
514 +static inline void brcm_usb_ctrl_set(void __iomem *reg, u32 mask)
516 + brcm_usb_writel(brcm_usb_readl(reg) | (mask), reg);
519 +static inline void brcm_usb_init_ipp(struct brcm_usb_init_params *ini)
521 + if (ini->ops->init_ipp)
522 + ini->ops->init_ipp(ini);
525 +static inline void brcm_usb_init_common(struct brcm_usb_init_params *ini)
527 + if (ini->ops->init_common)
528 + ini->ops->init_common(ini);
531 +static inline void brcm_usb_init_eohci(struct brcm_usb_init_params *ini)
533 + if (ini->ops->init_eohci)
534 + ini->ops->init_eohci(ini);
537 +static inline void brcm_usb_init_xhci(struct brcm_usb_init_params *ini)
539 + if (ini->ops->init_xhci)
540 + ini->ops->init_xhci(ini);
543 +static inline void brcm_usb_uninit_common(struct brcm_usb_init_params *ini)
545 + if (ini->ops->uninit_common)
546 + ini->ops->uninit_common(ini);
549 +static inline void brcm_usb_uninit_eohci(struct brcm_usb_init_params *ini)
551 + if (ini->ops->uninit_eohci)
552 + ini->ops->uninit_eohci(ini);
555 +static inline void brcm_usb_uninit_xhci(struct brcm_usb_init_params *ini)
557 + if (ini->ops->uninit_xhci)
558 + ini->ops->uninit_xhci(ini);
561 +static inline void brcm_usb_wake_enable(struct brcm_usb_init_params *ini,
564 + if (ini->ops->wake_enable)
565 + ini->ops->wake_enable(ini, enable);
568 +static inline int brcm_usb_get_dual_select(struct brcm_usb_init_params *ini)
570 + if (ini->ops->get_dual_select)
571 + return ini->ops->get_dual_select(ini);
575 +static inline void brcm_usb_set_dual_select(struct brcm_usb_init_params *ini,
578 + if (ini->ops->set_dual_select)
579 + ini->ops->set_dual_select(ini, mode);
582 #endif /* _USB_BRCM_COMMON_INIT_H */
583 --- a/drivers/phy/broadcom/phy-brcm-usb.c
584 +++ b/drivers/phy/broadcom/phy-brcm-usb.c
585 @@ -207,7 +207,7 @@ static ssize_t dual_select_store(struct
586 res = name_to_value(&brcm_dual_mode_to_name[0],
587 ARRAY_SIZE(brcm_dual_mode_to_name), buf, &value);
589 - brcm_usb_init_set_dual_select(&priv->ini, value);
590 + brcm_usb_set_dual_select(&priv->ini, value);
593 mutex_unlock(&sysfs_lock);
594 @@ -222,7 +222,7 @@ static ssize_t dual_select_show(struct d
597 mutex_lock(&sysfs_lock);
598 - value = brcm_usb_init_get_dual_select(&priv->ini);
599 + value = brcm_usb_get_dual_select(&priv->ini);
600 mutex_unlock(&sysfs_lock);
601 return sprintf(buf, "%s\n",
602 value_to_name(&brcm_dual_mode_to_name[0],
603 @@ -331,7 +331,7 @@ static int brcm_usb_phy_probe(struct pla
605 priv->ini.family_id = brcmstb_get_family_id();
606 priv->ini.product_id = brcmstb_get_product_id();
607 - brcm_usb_set_family_map(&priv->ini);
608 + brcm_usb_dvr_init_7445(&priv->ini);
609 dev_dbg(dev, "Best mapping table is for %s\n",
610 priv->ini.family_name);
611 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);