diff options
author | Takashi Iwai <tiwai@suse.de> | 2011-01-12 20:01:02 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-13 11:03:21 -0500 |
commit | 68860b96ebac0d56961cf80b94f65dab55e39069 (patch) | |
tree | ad9b49de53ec5161fe9730f32a032d174830e93b | |
parent | 23c5947ac3f7a610bb4cb9e433802b36edc80fdf (diff) |
memstick: set PMOS values propery for JMicron 38x controllers
Add a function jmb38x_ms_pmos() to enable / disable PMOS setups for
JMicron 38x controllers.
Signed-off-by: Aries Lee <arieslee@jmicron.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Cc: Alex Dubov <oakad@yahoo.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | drivers/memstick/host/jmb38x_ms.c | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/drivers/memstick/host/jmb38x_ms.c b/drivers/memstick/host/jmb38x_ms.c index c90ba5082252..4ce8773fa3b8 100644 --- a/drivers/memstick/host/jmb38x_ms.c +++ b/drivers/memstick/host/jmb38x_ms.c | |||
@@ -758,6 +758,35 @@ static int jmb38x_ms_set_param(struct memstick_host *msh, | |||
758 | return 0; | 758 | return 0; |
759 | } | 759 | } |
760 | 760 | ||
761 | #define PCI_PMOS0_CONTROL 0xae | ||
762 | #define PMOS0_ENABLE 0x01 | ||
763 | #define PMOS0_OVERCURRENT_LEVEL_2_4V 0x06 | ||
764 | #define PMOS0_EN_OVERCURRENT_DEBOUNCE 0x40 | ||
765 | #define PMOS0_SW_LED_POLARITY_ENABLE 0x80 | ||
766 | #define PMOS0_ACTIVE_BITS (PMOS0_ENABLE | PMOS0_EN_OVERCURRENT_DEBOUNCE | \ | ||
767 | PMOS0_OVERCURRENT_LEVEL_2_4V) | ||
768 | #define PCI_CLOCK_CTL 0xb9 | ||
769 | |||
770 | static int jmb38x_ms_pmos(struct pci_dev *pdev, int flag) | ||
771 | { | ||
772 | unsigned char val; | ||
773 | |||
774 | pci_read_config_byte(pdev, PCI_PMOS0_CONTROL, &val); | ||
775 | if (flag) | ||
776 | val |= PMOS0_ACTIVE_BITS; | ||
777 | else | ||
778 | val &= ~PMOS0_ACTIVE_BITS; | ||
779 | pci_write_config_byte(pdev, PCI_PMOS0_CONTROL, val); | ||
780 | dev_dbg(&pdev->dev, "JMB38x: set PMOS0 val 0x%x\n", val); | ||
781 | |||
782 | pci_read_config_byte(pdev, PCI_CLOCK_CTL, &val); | ||
783 | pci_write_config_byte(pdev, PCI_CLOCK_CTL, val & ~0x0f); | ||
784 | pci_write_config_byte(pdev, PCI_CLOCK_CTL, val | 0x01); | ||
785 | dev_dbg(&pdev->dev, "Clock Control by PCI config is disabled!\n"); | ||
786 | |||
787 | return 0; | ||
788 | } | ||
789 | |||
761 | #ifdef CONFIG_PM | 790 | #ifdef CONFIG_PM |
762 | 791 | ||
763 | static int jmb38x_ms_suspend(struct pci_dev *dev, pm_message_t state) | 792 | static int jmb38x_ms_suspend(struct pci_dev *dev, pm_message_t state) |
@@ -790,8 +819,7 @@ static int jmb38x_ms_resume(struct pci_dev *dev) | |||
790 | return rc; | 819 | return rc; |
791 | pci_set_master(dev); | 820 | pci_set_master(dev); |
792 | 821 | ||
793 | pci_read_config_dword(dev, 0xac, &rc); | 822 | jmb38x_ms_pmos(dev, 1); |
794 | pci_write_config_dword(dev, 0xac, rc | 0x00470000); | ||
795 | 823 | ||
796 | for (rc = 0; rc < jm->host_cnt; ++rc) { | 824 | for (rc = 0; rc < jm->host_cnt; ++rc) { |
797 | if (!jm->hosts[rc]) | 825 | if (!jm->hosts[rc]) |
@@ -900,8 +928,7 @@ static int jmb38x_ms_probe(struct pci_dev *pdev, | |||
900 | goto err_out; | 928 | goto err_out; |
901 | } | 929 | } |
902 | 930 | ||
903 | pci_read_config_dword(pdev, 0xac, &rc); | 931 | jmb38x_ms_pmos(pdev, 1); |
904 | pci_write_config_dword(pdev, 0xac, rc | 0x00470000); | ||
905 | 932 | ||
906 | cnt = jmb38x_ms_count_slots(pdev); | 933 | cnt = jmb38x_ms_count_slots(pdev); |
907 | if (!cnt) { | 934 | if (!cnt) { |
@@ -982,6 +1009,8 @@ static void jmb38x_ms_remove(struct pci_dev *dev) | |||
982 | jmb38x_ms_free_host(jm->hosts[cnt]); | 1009 | jmb38x_ms_free_host(jm->hosts[cnt]); |
983 | } | 1010 | } |
984 | 1011 | ||
1012 | jmb38x_ms_pmos(dev, 0); | ||
1013 | |||
985 | pci_set_drvdata(dev, NULL); | 1014 | pci_set_drvdata(dev, NULL); |
986 | pci_release_regions(dev); | 1015 | pci_release_regions(dev); |
987 | pci_disable_device(dev); | 1016 | pci_disable_device(dev); |