login
Login
/
Register
Search
Search this site:
Forums
News
Blogs
Features
Site
Home
»
Mailing list archives
»
linux-kernel
»
2008
»
February
»
4
Re: [PATCH] mmc: Handle suspend/resume in Ricoh MMC disabler (resent refreshed)
view
thread
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
[view in full thread]
From: Philip Langdale
Subject:
Re: [PATCH] mmc: Handle suspend/resume in Ricoh MMC disabler (resent refreshed)
Date: Monday, February 4, 2008 - 1:17 pm
On Mon, 4 Feb 2008 19:25:38 +0100, Frank Seidel <fseidel@suse.de> wrote:
quoted text
> From: Philip Langdale <philipl@overt.org> > > As pci config space is reinitialised on suspend/resume cycle, the > disabler needs to work its magic at resume time. For symmetry this > change also explicitly enables the controller at suspend time but > it's not strictly necessary. > > Signed-off-by: Philip Langdale <philipl@overt.org> > Signed-off-by: Frank Seidel <fseidel@suse.de> > --- > drivers/mmc/host/ricoh_mmc.c | 97 > +++++++++++++++++++++++++++++++------------ > 1 file changed, 72 insertions(+), 25 deletions(-) > > --- a/drivers/mmc/host/ricoh_mmc.c > +++ b/drivers/mmc/host/ricoh_mmc.c > @@ -41,6 +41,46 @@ static const struct pci_device_id pci_id > > MODULE_DEVICE_TABLE(pci, pci_ids); > > +static int ricoh_mmc_disable(struct pci_dev *fw_dev) > +{ > + u8 write_enable; > + u8 disable; > + > + pci_read_config_byte(fw_dev, 0xCB, &disable); > + if (disable & 0x02) { > + printk(KERN_INFO DRIVER_NAME > + ": Controller already disabled. Nothing to do.\n"); > + return -ENODEV; > + } > + > + pci_read_config_byte(fw_dev, 0xCA, &write_enable); > + pci_write_config_byte(fw_dev, 0xCA, 0x57); > + pci_write_config_byte(fw_dev, 0xCB, disable | 0x02); > + pci_write_config_byte(fw_dev, 0xCA, write_enable); > + > + printk(KERN_INFO DRIVER_NAME > + ": Controller is now disabled.\n"); > + > + return 0; > +} > + > +static int ricoh_mmc_enable(struct pci_dev *fw_dev) > +{ > + u8 write_enable; > + u8 disable; > + > + pci_read_config_byte(fw_dev, 0xCA, &write_enable); > + pci_read_config_byte(fw_dev, 0xCB, &disable); > + pci_write_config_byte(fw_dev, 0xCA, 0x57); > + pci_write_config_byte(fw_dev, 0xCB, disable & ~0x02); > + pci_write_config_byte(fw_dev, 0xCA, write_enable); > + > + printk(KERN_INFO DRIVER_NAME > + ": Controller is now re-enabled.\n"); > + > + return 0; > +} > + > static int __devinit ricoh_mmc_probe(struct pci_dev *pdev, > const struct pci_device_id *ent) > { > @@ -61,26 +101,12 @@ static int __devinit ricoh_mmc_probe(str > while ((fw_dev = pci_get_device(PCI_VENDOR_ID_RICOH, > PCI_DEVICE_ID_RICOH_R5C832, fw_dev))) { > if (PCI_SLOT(pdev->devfn) == PCI_SLOT(fw_dev->devfn) && > pdev->bus == fw_dev->bus) { > - u8 write_enable; > - u8 disable; > - > - pci_read_config_byte(fw_dev, 0xCB, &disable); > - if (disable & 0x02) { > - printk(KERN_INFO DRIVER_NAME > - ": Controller already disabled. Nothing to do.\n"); > + if (ricoh_mmc_disable(fw_dev) != 0) { > return -ENODEV; > } > > - pci_read_config_byte(fw_dev, 0xCA, &write_enable); > - pci_write_config_byte(fw_dev, 0xCA, 0x57); > - pci_write_config_byte(fw_dev, 0xCB, disable | 0x02); > - pci_write_config_byte(fw_dev, 0xCA, write_enable); > - > pci_set_drvdata(pdev, fw_dev); > > - printk(KERN_INFO DRIVER_NAME > - ": Controller is now disabled.\n"); > - > break; > } > } > @@ -96,30 +122,51 @@ static int __devinit ricoh_mmc_probe(str > > static void __devexit ricoh_mmc_remove(struct pci_dev *pdev) > { > - u8 write_enable; > - u8 disable; > struct pci_dev *fw_dev = NULL; > > fw_dev = pci_get_drvdata(pdev); > BUG_ON(fw_dev == NULL); > > - pci_read_config_byte(fw_dev, 0xCA, &write_enable); > - pci_read_config_byte(fw_dev, 0xCB, &disable); > - pci_write_config_byte(fw_dev, 0xCA, 0x57); > - pci_write_config_byte(fw_dev, 0xCB, disable & ~0x02); > - pci_write_config_byte(fw_dev, 0xCA, write_enable); > - > - printk(KERN_INFO DRIVER_NAME > - ": Controller is now re-enabled.\n"); > + ricoh_mmc_enable(fw_dev); > > pci_set_drvdata(pdev, NULL); > } > > +static int ricoh_mmc_suspend (struct pci_dev *pdev, pm_message_t state) > +{ > + struct pci_dev *fw_dev = NULL; > + > + fw_dev = pci_get_drvdata(pdev); > + BUG_ON(fw_dev == NULL); > + > + printk(KERN_INFO DRIVER_NAME ": Suspending.\n"); > + > + ricoh_mmc_enable(fw_dev); > + > + return 0; > +} > + > +static int ricoh_mmc_resume (struct pci_dev *pdev) > +{ > + struct pci_dev *fw_dev = NULL; > + > + fw_dev = pci_get_drvdata(pdev); > + BUG_ON(fw_dev == NULL); > + > + printk(KERN_INFO DRIVER_NAME ": Resuming.\n"); > + > + ricoh_mmc_disable(fw_dev); > + > + return 0; > +} > + > static struct pci_driver ricoh_mmc_driver = { > .name = DRIVER_NAME, > .id_table = pci_ids, > .probe = ricoh_mmc_probe, > .remove = __devexit_p(ricoh_mmc_remove), > + .suspend = ricoh_mmc_suspend, > + .resume = ricoh_mmc_resume, > }; > > >
/*****************************************************************************\ ACK. Thanks for fixing it up. --phil --
unsubscribe notice
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to
majordomo@vger.kernel.org
More majordomo info at
http://vger.kernel.org/majordomo-info.html
Please read the FAQ at
http://www.tux.org/lkml/
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
Messages in current thread:
[PATCH] mmc: extend ricoh_mmc to support Ricoh RL5c476
, Frank Seidel
, (Thu Jan 31, 10:38 am)
Re: [PATCH] mmc: extend ricoh_mmc to support Ricoh RL5c476
, Philip Langdale
, (Sat Feb 2, 12:16 am)
Re: [PATCH] mmc: extend ricoh_mmc to support Ricoh RL5c476
, Frank Seidel
, (Sat Feb 2, 2:30 am)
Re: [PATCH] mmc: extend ricoh_mmc to support Ricoh RL5c476
, Frank Seidel
, (Mon Feb 4, 11:25 am)
[PATCH] mmc: Handle suspend/resume in Ricoh MMC disabler ( ...
, Frank Seidel
, (Mon Feb 4, 11:25 am)
[PATCH v2] mmc: extend ricoh_mmc to support Ricoh RL5c476
, Frank Seidel
, (Mon Feb 4, 11:25 am)
Re: [PATCH] mmc: Handle suspend/resume in Ricoh MMC disabl ...
, Philip Langdale
, (Mon Feb 4, 1:17 pm)
Re: [PATCH v2] mmc: extend
, Philip Langdale
, (Mon Feb 4, 1:18 pm)
Re: [PATCH v2] mmc: extend ricoh_mmc to support Ricoh RL5c476
, Pierre Ossman
, (Thu Feb 7, 1:08 am)
Re: [PATCH v2] mmc: extend ricoh_mmc to support Ricoh RL5c476
, Frank Seidel
, (Thu Feb 7, 1:20 am)
Re: [PATCH v2] mmc: extend ricoh_mmc to support Ricoh RL5c476
, Pierre Ossman
, (Thu Feb 7, 10:19 am)
Navigation
Mailing list archives
Recent posts
Popular discussions
linux-kernel
:
Fortier,Vincent [Montreal]
2.6.21.5 june 30th to july 1st date hang?
Jeff Dike
[ PATCH 2/6 ] UML - Formatting fixes around os_{read_write}_file callers
Liam Girdwood
[PATCH 07/13] regulator: regulator test harness
Oleg Nesterov
Re: Getting the new RxRPC patches upstream
Stefan Seyfried
Re: 2.6.19-rc5: grub is much slower resuming from suspend-to-disk than in 2.6.18
linux-netdev
:
Arnaud Ebalard
Re: [REGRESSION,BISECTED] MIPv6 support broken by f4f914b58019f0
Jan Engelhardt
Re: [PATCH iptables] extension: add xt_cpu match
Jarek Poplawski
Re: [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock().
Sebastian Andrzej Siewior
[PATCH 8/8] net/emergency: remove locking from reycling pool if emergncy pools are...
David Miller
Re: [PATCH] qlcnic: dont assume NET_IP_ALIGN is 2
git
:
Jakub Narebski
Re: git on MacOSX and files with decomposed utf-8 file names
Brandon Casey
Re: Thunderbird and patches (was Re: [PATCH v2] Enable setting attach as the def...
Christian Couder
[PATCH 1/3] rev-parse: add test script for "--verify"
Ramkumar Ramachandra
Re: [GSoC update] git-remote-svn: The final one
Junio C Hamano
Re: git-rm isn't the inverse action of git-add
openbsd-misc
:
Joachim Schipper
Re: UVC Webcams
Florin Andrei
SOLVED [was: firewall is very slow, something's wrong]
Todd Alan Smith
Re: Microsoft gets the Most Secure Operating Systems award
Neal Hogan
Re: Need Advice: Thinkpad T60 or T61?
Sam Fourman Jr.
Re: Real men don't attack straw men
git-commits-head
:
Linux Kernel Mailing List
ACPI: Disable ARB_DISABLE on platforms where it is not needed
Linux Kernel Mailing List
m68knommu: add read_barrier_depends() and irqs_disabled_flags()
Linux Kernel Mailing List
[MTD] Add mtd panic_write function pointer
Linux Kernel Mailing List
[ARM] pxa: remove duplicate select statements from Kconfig
Linux Kernel Mailing List
mlx4_core: Don't read reserved fields in mlx4_QUERY_ADAPTER()
Colocation donated by:
Syndicate