diff options
| -rw-r--r-- | drivers/bus/brcmstb_gisb.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/drivers/bus/brcmstb_gisb.c b/drivers/bus/brcmstb_gisb.c index 41b09418f515..e7ccd21a45c9 100644 --- a/drivers/bus/brcmstb_gisb.c +++ b/drivers/bus/brcmstb_gisb.c | |||
| @@ -23,6 +23,7 @@ | |||
| 23 | #include <linux/list.h> | 23 | #include <linux/list.h> |
| 24 | #include <linux/of.h> | 24 | #include <linux/of.h> |
| 25 | #include <linux/bitops.h> | 25 | #include <linux/bitops.h> |
| 26 | #include <linux/pm.h> | ||
| 26 | 27 | ||
| 27 | #include <asm/bug.h> | 28 | #include <asm/bug.h> |
| 28 | #include <asm/signal.h> | 29 | #include <asm/signal.h> |
| @@ -48,6 +49,7 @@ struct brcmstb_gisb_arb_device { | |||
| 48 | struct list_head next; | 49 | struct list_head next; |
| 49 | u32 valid_mask; | 50 | u32 valid_mask; |
| 50 | const char *master_names[sizeof(u32) * BITS_PER_BYTE]; | 51 | const char *master_names[sizeof(u32) * BITS_PER_BYTE]; |
| 52 | u32 saved_timeout; | ||
| 51 | }; | 53 | }; |
| 52 | 54 | ||
| 53 | static LIST_HEAD(brcmstb_gisb_arb_device_list); | 55 | static LIST_HEAD(brcmstb_gisb_arb_device_list); |
| @@ -264,6 +266,39 @@ static int brcmstb_gisb_arb_probe(struct platform_device *pdev) | |||
| 264 | return 0; | 266 | return 0; |
| 265 | } | 267 | } |
| 266 | 268 | ||
| 269 | #ifdef CONFIG_PM_SLEEP | ||
| 270 | static int brcmstb_gisb_arb_suspend(struct device *dev) | ||
| 271 | { | ||
| 272 | struct platform_device *pdev = to_platform_device(dev); | ||
| 273 | struct brcmstb_gisb_arb_device *gdev = platform_get_drvdata(pdev); | ||
| 274 | |||
| 275 | gdev->saved_timeout = ioread32(gdev->base + ARB_TIMER); | ||
| 276 | |||
| 277 | return 0; | ||
| 278 | } | ||
| 279 | |||
| 280 | /* Make sure we provide the same timeout value that was configured before, and | ||
| 281 | * do this before the GISB timeout interrupt handler has any chance to run. | ||
| 282 | */ | ||
| 283 | static int brcmstb_gisb_arb_resume_noirq(struct device *dev) | ||
| 284 | { | ||
| 285 | struct platform_device *pdev = to_platform_device(dev); | ||
| 286 | struct brcmstb_gisb_arb_device *gdev = platform_get_drvdata(pdev); | ||
| 287 | |||
| 288 | iowrite32(gdev->saved_timeout, gdev->base + ARB_TIMER); | ||
| 289 | |||
| 290 | return 0; | ||
| 291 | } | ||
| 292 | #else | ||
| 293 | #define brcmstb_gisb_arb_suspend NULL | ||
| 294 | #define brcmstb_gisb_arb_resume_noirq NULL | ||
| 295 | #endif | ||
| 296 | |||
| 297 | static const struct dev_pm_ops brcmstb_gisb_arb_pm_ops = { | ||
| 298 | .suspend = brcmstb_gisb_arb_suspend, | ||
| 299 | .resume_noirq = brcmstb_gisb_arb_resume_noirq, | ||
| 300 | }; | ||
| 301 | |||
| 267 | static const struct of_device_id brcmstb_gisb_arb_of_match[] = { | 302 | static const struct of_device_id brcmstb_gisb_arb_of_match[] = { |
| 268 | { .compatible = "brcm,gisb-arb" }, | 303 | { .compatible = "brcm,gisb-arb" }, |
| 269 | { }, | 304 | { }, |
| @@ -275,6 +310,7 @@ static struct platform_driver brcmstb_gisb_arb_driver = { | |||
| 275 | .name = "brcm-gisb-arb", | 310 | .name = "brcm-gisb-arb", |
| 276 | .owner = THIS_MODULE, | 311 | .owner = THIS_MODULE, |
| 277 | .of_match_table = brcmstb_gisb_arb_of_match, | 312 | .of_match_table = brcmstb_gisb_arb_of_match, |
| 313 | .pm = &brcmstb_gisb_arb_pm_ops, | ||
| 278 | }, | 314 | }, |
| 279 | }; | 315 | }; |
| 280 | 316 | ||
