First git repo commit for the libreCMC project
[librecmc/librecmc.git] / target / linux / generic / patches-4.4 / 023-bcma-from-4.9.patch
1 --- a/drivers/bcma/driver_chipcommon.c
2 +++ b/drivers/bcma/driver_chipcommon.c
3 @@ -36,12 +36,31 @@ u32 bcma_chipco_get_alp_clock(struct bcm
4  }
5  EXPORT_SYMBOL_GPL(bcma_chipco_get_alp_clock);
6  
7 +static bool bcma_core_cc_has_pmu_watchdog(struct bcma_drv_cc *cc)
8 +{
9 +       struct bcma_bus *bus = cc->core->bus;
10 +
11 +       if (cc->capabilities & BCMA_CC_CAP_PMU) {
12 +               if (bus->chipinfo.id == BCMA_CHIP_ID_BCM53573) {
13 +                       WARN(bus->chipinfo.rev <= 1, "No watchdog available\n");
14 +                       /* 53573B0 and 53573B1 have bugged PMU watchdog. It can
15 +                        * be enabled but timer can't be bumped. Use CC one
16 +                        * instead.
17 +                        */
18 +                       return false;
19 +               }
20 +               return true;
21 +       } else {
22 +               return false;
23 +       }
24 +}
25 +
26  static u32 bcma_chipco_watchdog_get_max_timer(struct bcma_drv_cc *cc)
27  {
28         struct bcma_bus *bus = cc->core->bus;
29         u32 nb;
30  
31 -       if (cc->capabilities & BCMA_CC_CAP_PMU) {
32 +       if (bcma_core_cc_has_pmu_watchdog(cc)) {
33                 if (bus->chipinfo.id == BCMA_CHIP_ID_BCM4706)
34                         nb = 32;
35                 else if (cc->core->id.rev < 26)
36 @@ -95,9 +114,16 @@ static int bcma_chipco_watchdog_ticks_pe
37  
38  int bcma_chipco_watchdog_register(struct bcma_drv_cc *cc)
39  {
40 +       struct bcma_bus *bus = cc->core->bus;
41         struct bcm47xx_wdt wdt = {};
42         struct platform_device *pdev;
43  
44 +       if (bus->chipinfo.id == BCMA_CHIP_ID_BCM53573 &&
45 +           bus->chipinfo.rev <= 1) {
46 +               pr_debug("No watchdog on 53573A0 / 53573A1\n");
47 +               return 0;
48 +       }
49 +
50         wdt.driver_data = cc;
51         wdt.timer_set = bcma_chipco_watchdog_timer_set_wdt;
52         wdt.timer_set_ms = bcma_chipco_watchdog_timer_set_ms_wdt;
53 @@ -105,7 +131,7 @@ int bcma_chipco_watchdog_register(struct
54                 bcma_chipco_watchdog_get_max_timer(cc) / cc->ticks_per_ms;
55  
56         pdev = platform_device_register_data(NULL, "bcm47xx-wdt",
57 -                                            cc->core->bus->num, &wdt,
58 +                                            bus->num, &wdt,
59                                              sizeof(wdt));
60         if (IS_ERR(pdev))
61                 return PTR_ERR(pdev);
62 @@ -217,7 +243,7 @@ u32 bcma_chipco_watchdog_timer_set(struc
63         u32 maxt;
64  
65         maxt = bcma_chipco_watchdog_get_max_timer(cc);
66 -       if (cc->capabilities & BCMA_CC_CAP_PMU) {
67 +       if (bcma_core_cc_has_pmu_watchdog(cc)) {
68                 if (ticks == 1)
69                         ticks = 2;
70                 else if (ticks > maxt)
71 --- a/include/linux/bcma/bcma.h
72 +++ b/include/linux/bcma/bcma.h
73 @@ -204,6 +204,9 @@ struct bcma_host_ops {
74  #define  BCMA_PKG_ID_BCM4709   0
75  #define BCMA_CHIP_ID_BCM47094  53030
76  #define BCMA_CHIP_ID_BCM53018  53018
77 +#define BCMA_CHIP_ID_BCM53573  53573
78 +#define  BCMA_PKG_ID_BCM53573  0
79 +#define  BCMA_PKG_ID_BCM47189  1
80  
81  /* Board types (on PCI usually equals to the subsystem dev id) */
82  /* BCM4313 */