Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc/fsl-lbc: Modify suspend/resume entry sequence

Modify platform driver suspend/resume to syscore
suspend/resume. This is because p1022ds needs to use
localbus when entering the PCIE resume.

Signed-off-by: Raghav Dogra <raghav.dogra@nxp.com>
[scottwood: dropped makefile churn]
Signed-off-by: Scott Wood <oss@buserror.net>

authored by

Raghav Dogra and committed by
Scott Wood
ac6082dd 921fff35

+38 -11
+38 -11
arch/powerpc/sysdev/fsl_lbc.c
··· 27 27 #include <linux/platform_device.h> 28 28 #include <linux/interrupt.h> 29 29 #include <linux/mod_devicetable.h> 30 + #include <linux/syscore_ops.h> 30 31 #include <asm/prom.h> 31 32 #include <asm/fsl_lbc.h> 32 33 ··· 353 352 #ifdef CONFIG_SUSPEND 354 353 355 354 /* save lbc registers */ 356 - static int fsl_lbc_suspend(struct platform_device *pdev, pm_message_t state) 355 + static int fsl_lbc_syscore_suspend(void) 357 356 { 358 - struct fsl_lbc_ctrl *ctrl = dev_get_drvdata(&pdev->dev); 359 - struct fsl_lbc_regs __iomem *lbc = ctrl->regs; 357 + struct fsl_lbc_ctrl *ctrl; 358 + struct fsl_lbc_regs __iomem *lbc; 359 + 360 + ctrl = fsl_lbc_ctrl_dev; 361 + if (!ctrl) 362 + goto out; 363 + 364 + lbc = ctrl->regs; 365 + if (!lbc) 366 + goto out; 360 367 361 368 ctrl->saved_regs = kmalloc(sizeof(struct fsl_lbc_regs), GFP_KERNEL); 362 369 if (!ctrl->saved_regs) 363 370 return -ENOMEM; 364 371 365 372 _memcpy_fromio(ctrl->saved_regs, lbc, sizeof(struct fsl_lbc_regs)); 373 + 374 + out: 366 375 return 0; 367 376 } 368 377 369 378 /* restore lbc registers */ 370 - static int fsl_lbc_resume(struct platform_device *pdev) 379 + static void fsl_lbc_syscore_resume(void) 371 380 { 372 - struct fsl_lbc_ctrl *ctrl = dev_get_drvdata(&pdev->dev); 373 - struct fsl_lbc_regs __iomem *lbc = ctrl->regs; 381 + struct fsl_lbc_ctrl *ctrl; 382 + struct fsl_lbc_regs __iomem *lbc; 383 + 384 + ctrl = fsl_lbc_ctrl_dev; 385 + if (!ctrl) 386 + goto out; 387 + 388 + lbc = ctrl->regs; 389 + if (!lbc) 390 + goto out; 374 391 375 392 if (ctrl->saved_regs) { 376 393 _memcpy_toio(lbc, ctrl->saved_regs, ··· 396 377 kfree(ctrl->saved_regs); 397 378 ctrl->saved_regs = NULL; 398 379 } 399 - return 0; 380 + 381 + out: 382 + return; 400 383 } 401 384 #endif /* CONFIG_SUSPEND */ 402 385 ··· 410 389 {}, 411 390 }; 412 391 392 + #ifdef CONFIG_SUSPEND 393 + static struct syscore_ops lbc_syscore_pm_ops = { 394 + .suspend = fsl_lbc_syscore_suspend, 395 + .resume = fsl_lbc_syscore_resume, 396 + }; 397 + #endif 398 + 413 399 static struct platform_driver fsl_lbc_ctrl_driver = { 414 400 .driver = { 415 401 .name = "fsl-lbc", 416 402 .of_match_table = fsl_lbc_match, 417 403 }, 418 404 .probe = fsl_lbc_ctrl_probe, 419 - #ifdef CONFIG_SUSPEND 420 - .suspend = fsl_lbc_suspend, 421 - .resume = fsl_lbc_resume, 422 - #endif 423 405 }; 424 406 425 407 static int __init fsl_lbc_init(void) 426 408 { 409 + #ifdef CONFIG_SUSPEND 410 + register_syscore_ops(&lbc_syscore_pm_ops); 411 + #endif 427 412 return platform_driver_register(&fsl_lbc_ctrl_driver); 428 413 } 429 414 subsys_initcall(fsl_lbc_init);