diff options
Diffstat (limited to 'drivers')
31 files changed, 1011 insertions, 147 deletions
diff --git a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c index 25ce15bb1c08..a632f25f144a 100644 --- a/drivers/char/hvc_console.c +++ b/drivers/char/hvc_console.c | |||
@@ -678,7 +678,7 @@ int hvc_poll(struct hvc_struct *hp) | |||
678 | EXPORT_SYMBOL_GPL(hvc_poll); | 678 | EXPORT_SYMBOL_GPL(hvc_poll); |
679 | 679 | ||
680 | /** | 680 | /** |
681 | * hvc_resize() - Update terminal window size information. | 681 | * __hvc_resize() - Update terminal window size information. |
682 | * @hp: HVC console pointer | 682 | * @hp: HVC console pointer |
683 | * @ws: Terminal window size structure | 683 | * @ws: Terminal window size structure |
684 | * | 684 | * |
@@ -687,12 +687,12 @@ EXPORT_SYMBOL_GPL(hvc_poll); | |||
687 | * | 687 | * |
688 | * Locking: Locking free; the function MUST be called holding hp->lock | 688 | * Locking: Locking free; the function MUST be called holding hp->lock |
689 | */ | 689 | */ |
690 | void hvc_resize(struct hvc_struct *hp, struct winsize ws) | 690 | void __hvc_resize(struct hvc_struct *hp, struct winsize ws) |
691 | { | 691 | { |
692 | hp->ws = ws; | 692 | hp->ws = ws; |
693 | schedule_work(&hp->tty_resize); | 693 | schedule_work(&hp->tty_resize); |
694 | } | 694 | } |
695 | EXPORT_SYMBOL_GPL(hvc_resize); | 695 | EXPORT_SYMBOL_GPL(__hvc_resize); |
696 | 696 | ||
697 | /* | 697 | /* |
698 | * This kthread is either polling or interrupt driven. This is determined by | 698 | * This kthread is either polling or interrupt driven. This is determined by |
diff --git a/drivers/char/hvc_console.h b/drivers/char/hvc_console.h index 3c85d78c975c..10950ca706d8 100644 --- a/drivers/char/hvc_console.h +++ b/drivers/char/hvc_console.h | |||
@@ -28,6 +28,7 @@ | |||
28 | #define HVC_CONSOLE_H | 28 | #define HVC_CONSOLE_H |
29 | #include <linux/kref.h> | 29 | #include <linux/kref.h> |
30 | #include <linux/tty.h> | 30 | #include <linux/tty.h> |
31 | #include <linux/spinlock.h> | ||
31 | 32 | ||
32 | /* | 33 | /* |
33 | * This is the max number of console adapters that can/will be found as | 34 | * This is the max number of console adapters that can/will be found as |
@@ -88,7 +89,16 @@ int hvc_poll(struct hvc_struct *hp); | |||
88 | void hvc_kick(void); | 89 | void hvc_kick(void); |
89 | 90 | ||
90 | /* Resize hvc tty terminal window */ | 91 | /* Resize hvc tty terminal window */ |
91 | extern void hvc_resize(struct hvc_struct *hp, struct winsize ws); | 92 | extern void __hvc_resize(struct hvc_struct *hp, struct winsize ws); |
93 | |||
94 | static inline void hvc_resize(struct hvc_struct *hp, struct winsize ws) | ||
95 | { | ||
96 | unsigned long flags; | ||
97 | |||
98 | spin_lock_irqsave(&hp->lock, flags); | ||
99 | __hvc_resize(hp, ws); | ||
100 | spin_unlock_irqrestore(&hp->lock, flags); | ||
101 | } | ||
92 | 102 | ||
93 | /* default notifier for irq based notification */ | 103 | /* default notifier for irq based notification */ |
94 | extern int notifier_add_irq(struct hvc_struct *hp, int data); | 104 | extern int notifier_add_irq(struct hvc_struct *hp, int data); |
diff --git a/drivers/char/hvc_iucv.c b/drivers/char/hvc_iucv.c index 0ecac7e532f6..b8a5d654d3d0 100644 --- a/drivers/char/hvc_iucv.c +++ b/drivers/char/hvc_iucv.c | |||
@@ -273,7 +273,9 @@ static int hvc_iucv_write(struct hvc_iucv_private *priv, | |||
273 | case MSG_TYPE_WINSIZE: | 273 | case MSG_TYPE_WINSIZE: |
274 | if (rb->mbuf->datalen != sizeof(struct winsize)) | 274 | if (rb->mbuf->datalen != sizeof(struct winsize)) |
275 | break; | 275 | break; |
276 | hvc_resize(priv->hvc, *((struct winsize *) rb->mbuf->data)); | 276 | /* The caller must ensure that the hvc is locked, which |
277 | * is the case when called from hvc_iucv_get_chars() */ | ||
278 | __hvc_resize(priv->hvc, *((struct winsize *) rb->mbuf->data)); | ||
277 | break; | 279 | break; |
278 | 280 | ||
279 | case MSG_TYPE_ERROR: /* ignored ... */ | 281 | case MSG_TYPE_ERROR: /* ignored ... */ |
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig index 6bedd2fcfc15..737335ff2b21 100644 --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig | |||
@@ -477,8 +477,8 @@ config I2C_PNX | |||
477 | will be called i2c-pnx. | 477 | will be called i2c-pnx. |
478 | 478 | ||
479 | config I2C_PXA | 479 | config I2C_PXA |
480 | tristate "Intel PXA2XX I2C adapter (EXPERIMENTAL)" | 480 | tristate "Intel PXA2XX I2C adapter" |
481 | depends on EXPERIMENTAL && ARCH_PXA | 481 | depends on ARCH_PXA || ARCH_MMP |
482 | help | 482 | help |
483 | If you have devices in the PXA I2C bus, say yes to this option. | 483 | If you have devices in the PXA I2C bus, say yes to this option. |
484 | This driver can also be built as a module. If so, the module | 484 | This driver can also be built as a module. If so, the module |
diff --git a/drivers/infiniband/core/mad_rmpp.c b/drivers/infiniband/core/mad_rmpp.c index 57a3c6f947b2..4e0f2829e0e5 100644 --- a/drivers/infiniband/core/mad_rmpp.c +++ b/drivers/infiniband/core/mad_rmpp.c | |||
@@ -37,7 +37,8 @@ | |||
37 | enum rmpp_state { | 37 | enum rmpp_state { |
38 | RMPP_STATE_ACTIVE, | 38 | RMPP_STATE_ACTIVE, |
39 | RMPP_STATE_TIMEOUT, | 39 | RMPP_STATE_TIMEOUT, |
40 | RMPP_STATE_COMPLETE | 40 | RMPP_STATE_COMPLETE, |
41 | RMPP_STATE_CANCELING | ||
41 | }; | 42 | }; |
42 | 43 | ||
43 | struct mad_rmpp_recv { | 44 | struct mad_rmpp_recv { |
@@ -87,18 +88,22 @@ void ib_cancel_rmpp_recvs(struct ib_mad_agent_private *agent) | |||
87 | 88 | ||
88 | spin_lock_irqsave(&agent->lock, flags); | 89 | spin_lock_irqsave(&agent->lock, flags); |
89 | list_for_each_entry(rmpp_recv, &agent->rmpp_list, list) { | 90 | list_for_each_entry(rmpp_recv, &agent->rmpp_list, list) { |
91 | if (rmpp_recv->state != RMPP_STATE_COMPLETE) | ||
92 | ib_free_recv_mad(rmpp_recv->rmpp_wc); | ||
93 | rmpp_recv->state = RMPP_STATE_CANCELING; | ||
94 | } | ||
95 | spin_unlock_irqrestore(&agent->lock, flags); | ||
96 | |||
97 | list_for_each_entry(rmpp_recv, &agent->rmpp_list, list) { | ||
90 | cancel_delayed_work(&rmpp_recv->timeout_work); | 98 | cancel_delayed_work(&rmpp_recv->timeout_work); |
91 | cancel_delayed_work(&rmpp_recv->cleanup_work); | 99 | cancel_delayed_work(&rmpp_recv->cleanup_work); |
92 | } | 100 | } |
93 | spin_unlock_irqrestore(&agent->lock, flags); | ||
94 | 101 | ||
95 | flush_workqueue(agent->qp_info->port_priv->wq); | 102 | flush_workqueue(agent->qp_info->port_priv->wq); |
96 | 103 | ||
97 | list_for_each_entry_safe(rmpp_recv, temp_rmpp_recv, | 104 | list_for_each_entry_safe(rmpp_recv, temp_rmpp_recv, |
98 | &agent->rmpp_list, list) { | 105 | &agent->rmpp_list, list) { |
99 | list_del(&rmpp_recv->list); | 106 | list_del(&rmpp_recv->list); |
100 | if (rmpp_recv->state != RMPP_STATE_COMPLETE) | ||
101 | ib_free_recv_mad(rmpp_recv->rmpp_wc); | ||
102 | destroy_rmpp_recv(rmpp_recv); | 107 | destroy_rmpp_recv(rmpp_recv); |
103 | } | 108 | } |
104 | } | 109 | } |
@@ -260,6 +265,10 @@ static void recv_cleanup_handler(struct work_struct *work) | |||
260 | unsigned long flags; | 265 | unsigned long flags; |
261 | 266 | ||
262 | spin_lock_irqsave(&rmpp_recv->agent->lock, flags); | 267 | spin_lock_irqsave(&rmpp_recv->agent->lock, flags); |
268 | if (rmpp_recv->state == RMPP_STATE_CANCELING) { | ||
269 | spin_unlock_irqrestore(&rmpp_recv->agent->lock, flags); | ||
270 | return; | ||
271 | } | ||
263 | list_del(&rmpp_recv->list); | 272 | list_del(&rmpp_recv->list); |
264 | spin_unlock_irqrestore(&rmpp_recv->agent->lock, flags); | 273 | spin_unlock_irqrestore(&rmpp_recv->agent->lock, flags); |
265 | destroy_rmpp_recv(rmpp_recv); | 274 | destroy_rmpp_recv(rmpp_recv); |
diff --git a/drivers/infiniband/hw/mthca/mthca_catas.c b/drivers/infiniband/hw/mthca/mthca_catas.c index 056b2a4c6970..0aa0110e4b6c 100644 --- a/drivers/infiniband/hw/mthca/mthca_catas.c +++ b/drivers/infiniband/hw/mthca/mthca_catas.c | |||
@@ -68,11 +68,16 @@ static void catas_reset(struct work_struct *work) | |||
68 | spin_unlock_irq(&catas_lock); | 68 | spin_unlock_irq(&catas_lock); |
69 | 69 | ||
70 | list_for_each_entry_safe(dev, tmpdev, &tlist, catas_err.list) { | 70 | list_for_each_entry_safe(dev, tmpdev, &tlist, catas_err.list) { |
71 | struct pci_dev *pdev = dev->pdev; | ||
71 | ret = __mthca_restart_one(dev->pdev); | 72 | ret = __mthca_restart_one(dev->pdev); |
73 | /* 'dev' now is not valid */ | ||
72 | if (ret) | 74 | if (ret) |
73 | mthca_err(dev, "Reset failed (%d)\n", ret); | 75 | printk(KERN_ERR "mthca %s: Reset failed (%d)\n", |
74 | else | 76 | pci_name(pdev), ret); |
75 | mthca_dbg(dev, "Reset succeeded\n"); | 77 | else { |
78 | struct mthca_dev *d = pci_get_drvdata(pdev); | ||
79 | mthca_dbg(d, "Reset succeeded\n"); | ||
80 | } | ||
76 | } | 81 | } |
77 | 82 | ||
78 | mutex_unlock(&mthca_device_mutex); | 83 | mutex_unlock(&mthca_device_mutex); |
diff --git a/drivers/infiniband/hw/nes/nes_nic.c b/drivers/infiniband/hw/nes/nes_nic.c index 538e409d4515..e593af3354b8 100644 --- a/drivers/infiniband/hw/nes/nes_nic.c +++ b/drivers/infiniband/hw/nes/nes_nic.c | |||
@@ -1566,7 +1566,6 @@ static const struct net_device_ops nes_netdev_ops = { | |||
1566 | .ndo_set_mac_address = nes_netdev_set_mac_address, | 1566 | .ndo_set_mac_address = nes_netdev_set_mac_address, |
1567 | .ndo_set_multicast_list = nes_netdev_set_multicast_list, | 1567 | .ndo_set_multicast_list = nes_netdev_set_multicast_list, |
1568 | .ndo_change_mtu = nes_netdev_change_mtu, | 1568 | .ndo_change_mtu = nes_netdev_change_mtu, |
1569 | .ndo_set_mac_address = eth_mac_addr, | ||
1570 | .ndo_validate_addr = eth_validate_addr, | 1569 | .ndo_validate_addr = eth_validate_addr, |
1571 | .ndo_vlan_rx_register = nes_netdev_vlan_rx_register, | 1570 | .ndo_vlan_rx_register = nes_netdev_vlan_rx_register, |
1572 | }; | 1571 | }; |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c index 25874fc680c9..8763c1ea5eb4 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c | |||
@@ -362,12 +362,19 @@ void ipoib_mcast_carrier_on_task(struct work_struct *work) | |||
362 | { | 362 | { |
363 | struct ipoib_dev_priv *priv = container_of(work, struct ipoib_dev_priv, | 363 | struct ipoib_dev_priv *priv = container_of(work, struct ipoib_dev_priv, |
364 | carrier_on_task); | 364 | carrier_on_task); |
365 | struct ib_port_attr attr; | ||
365 | 366 | ||
366 | /* | 367 | /* |
367 | * Take rtnl_lock to avoid racing with ipoib_stop() and | 368 | * Take rtnl_lock to avoid racing with ipoib_stop() and |
368 | * turning the carrier back on while a device is being | 369 | * turning the carrier back on while a device is being |
369 | * removed. | 370 | * removed. |
370 | */ | 371 | */ |
372 | if (ib_query_port(priv->ca, priv->port, &attr) || | ||
373 | attr.state != IB_PORT_ACTIVE) { | ||
374 | ipoib_dbg(priv, "Keeping carrier off until IB port is active\n"); | ||
375 | return; | ||
376 | } | ||
377 | |||
371 | rtnl_lock(); | 378 | rtnl_lock(); |
372 | netif_carrier_on(priv->dev); | 379 | netif_carrier_on(priv->dev); |
373 | rtnl_unlock(); | 380 | rtnl_unlock(); |
diff --git a/drivers/media/video/sh_mobile_ceu_camera.c b/drivers/media/video/sh_mobile_ceu_camera.c index 5ab7c5aefd62..65ac474c517a 100644 --- a/drivers/media/video/sh_mobile_ceu_camera.c +++ b/drivers/media/video/sh_mobile_ceu_camera.c | |||
@@ -404,7 +404,7 @@ static int sh_mobile_ceu_add_device(struct soc_camera_device *icd) | |||
404 | "SuperH Mobile CEU driver attached to camera %d\n", | 404 | "SuperH Mobile CEU driver attached to camera %d\n", |
405 | icd->devnum); | 405 | icd->devnum); |
406 | 406 | ||
407 | clk_enable(pcdev->clk); | 407 | pm_runtime_get_sync(ici->v4l2_dev.dev); |
408 | 408 | ||
409 | ceu_write(pcdev, CAPSR, 1 << 16); /* reset */ | 409 | ceu_write(pcdev, CAPSR, 1 << 16); /* reset */ |
410 | while (ceu_read(pcdev, CSTSR) & 1) | 410 | while (ceu_read(pcdev, CSTSR) & 1) |
@@ -438,7 +438,7 @@ static void sh_mobile_ceu_remove_device(struct soc_camera_device *icd) | |||
438 | } | 438 | } |
439 | spin_unlock_irqrestore(&pcdev->lock, flags); | 439 | spin_unlock_irqrestore(&pcdev->lock, flags); |
440 | 440 | ||
441 | clk_disable(pcdev->clk); | 441 | pm_runtime_put_sync(ici->v4l2_dev.dev); |
442 | 442 | ||
443 | dev_info(icd->dev.parent, | 443 | dev_info(icd->dev.parent, |
444 | "SuperH Mobile CEU driver detached from camera %d\n", | 444 | "SuperH Mobile CEU driver detached from camera %d\n", |
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index 8741d0f5146a..3d1e5329da12 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c | |||
@@ -22,12 +22,13 @@ | |||
22 | #include <linux/clk.h> | 22 | #include <linux/clk.h> |
23 | #include <linux/scatterlist.h> | 23 | #include <linux/scatterlist.h> |
24 | #include <linux/gpio.h> | 24 | #include <linux/gpio.h> |
25 | #include <linux/amba/mmci.h> | ||
26 | #include <linux/regulator/consumer.h> | ||
25 | 27 | ||
26 | #include <asm/cacheflush.h> | 28 | #include <asm/cacheflush.h> |
27 | #include <asm/div64.h> | 29 | #include <asm/div64.h> |
28 | #include <asm/io.h> | 30 | #include <asm/io.h> |
29 | #include <asm/sizes.h> | 31 | #include <asm/sizes.h> |
30 | #include <asm/mach/mmc.h> | ||
31 | 32 | ||
32 | #include "mmci.h" | 33 | #include "mmci.h" |
33 | 34 | ||
@@ -38,6 +39,36 @@ | |||
38 | 39 | ||
39 | static unsigned int fmax = 515633; | 40 | static unsigned int fmax = 515633; |
40 | 41 | ||
42 | /* | ||
43 | * This must be called with host->lock held | ||
44 | */ | ||
45 | static void mmci_set_clkreg(struct mmci_host *host, unsigned int desired) | ||
46 | { | ||
47 | u32 clk = 0; | ||
48 | |||
49 | if (desired) { | ||
50 | if (desired >= host->mclk) { | ||
51 | clk = MCI_CLK_BYPASS; | ||
52 | host->cclk = host->mclk; | ||
53 | } else { | ||
54 | clk = host->mclk / (2 * desired) - 1; | ||
55 | if (clk >= 256) | ||
56 | clk = 255; | ||
57 | host->cclk = host->mclk / (2 * (clk + 1)); | ||
58 | } | ||
59 | if (host->hw_designer == 0x80) | ||
60 | clk |= MCI_FCEN; /* Bug fix in ST IP block */ | ||
61 | clk |= MCI_CLK_ENABLE; | ||
62 | /* This hasn't proven to be worthwhile */ | ||
63 | /* clk |= MCI_CLK_PWRSAVE; */ | ||
64 | } | ||
65 | |||
66 | if (host->mmc->ios.bus_width == MMC_BUS_WIDTH_4) | ||
67 | clk |= MCI_WIDE_BUS; | ||
68 | |||
69 | writel(clk, host->base + MMCICLOCK); | ||
70 | } | ||
71 | |||
41 | static void | 72 | static void |
42 | mmci_request_end(struct mmci_host *host, struct mmc_request *mrq) | 73 | mmci_request_end(struct mmci_host *host, struct mmc_request *mrq) |
43 | { | 74 | { |
@@ -419,30 +450,31 @@ static void mmci_request(struct mmc_host *mmc, struct mmc_request *mrq) | |||
419 | static void mmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | 450 | static void mmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) |
420 | { | 451 | { |
421 | struct mmci_host *host = mmc_priv(mmc); | 452 | struct mmci_host *host = mmc_priv(mmc); |
422 | u32 clk = 0, pwr = 0; | 453 | u32 pwr = 0; |
423 | 454 | unsigned long flags; | |
424 | if (ios->clock) { | ||
425 | if (ios->clock >= host->mclk) { | ||
426 | clk = MCI_CLK_BYPASS; | ||
427 | host->cclk = host->mclk; | ||
428 | } else { | ||
429 | clk = host->mclk / (2 * ios->clock) - 1; | ||
430 | if (clk >= 256) | ||
431 | clk = 255; | ||
432 | host->cclk = host->mclk / (2 * (clk + 1)); | ||
433 | } | ||
434 | if (host->hw_designer == AMBA_VENDOR_ST) | ||
435 | clk |= MCI_FCEN; /* Bug fix in ST IP block */ | ||
436 | clk |= MCI_CLK_ENABLE; | ||
437 | } | ||
438 | |||
439 | if (host->plat->translate_vdd) | ||
440 | pwr |= host->plat->translate_vdd(mmc_dev(mmc), ios->vdd); | ||
441 | 455 | ||
442 | switch (ios->power_mode) { | 456 | switch (ios->power_mode) { |
443 | case MMC_POWER_OFF: | 457 | case MMC_POWER_OFF: |
458 | if(host->vcc && | ||
459 | regulator_is_enabled(host->vcc)) | ||
460 | regulator_disable(host->vcc); | ||
444 | break; | 461 | break; |
445 | case MMC_POWER_UP: | 462 | case MMC_POWER_UP: |
463 | #ifdef CONFIG_REGULATOR | ||
464 | if (host->vcc) | ||
465 | /* This implicitly enables the regulator */ | ||
466 | mmc_regulator_set_ocr(host->vcc, ios->vdd); | ||
467 | #endif | ||
468 | /* | ||
469 | * The translate_vdd function is not used if you have | ||
470 | * an external regulator, or your design is really weird. | ||
471 | * Using it would mean sending in power control BOTH using | ||
472 | * a regulator AND the 4 MMCIPWR bits. If we don't have | ||
473 | * a regulator, we might have some other platform specific | ||
474 | * power control behind this translate function. | ||
475 | */ | ||
476 | if (!host->vcc && host->plat->translate_vdd) | ||
477 | pwr |= host->plat->translate_vdd(mmc_dev(mmc), ios->vdd); | ||
446 | /* The ST version does not have this, fall through to POWER_ON */ | 478 | /* The ST version does not have this, fall through to POWER_ON */ |
447 | if (host->hw_designer != AMBA_VENDOR_ST) { | 479 | if (host->hw_designer != AMBA_VENDOR_ST) { |
448 | pwr |= MCI_PWR_UP; | 480 | pwr |= MCI_PWR_UP; |
@@ -465,12 +497,16 @@ static void mmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
465 | } | 497 | } |
466 | } | 498 | } |
467 | 499 | ||
468 | writel(clk, host->base + MMCICLOCK); | 500 | spin_lock_irqsave(&host->lock, flags); |
501 | |||
502 | mmci_set_clkreg(host, ios->clock); | ||
469 | 503 | ||
470 | if (host->pwr != pwr) { | 504 | if (host->pwr != pwr) { |
471 | host->pwr = pwr; | 505 | host->pwr = pwr; |
472 | writel(pwr, host->base + MMCIPOWER); | 506 | writel(pwr, host->base + MMCIPOWER); |
473 | } | 507 | } |
508 | |||
509 | spin_unlock_irqrestore(&host->lock, flags); | ||
474 | } | 510 | } |
475 | 511 | ||
476 | static int mmci_get_ro(struct mmc_host *mmc) | 512 | static int mmci_get_ro(struct mmc_host *mmc) |
@@ -517,7 +553,7 @@ static void mmci_check_status(unsigned long data) | |||
517 | 553 | ||
518 | static int __devinit mmci_probe(struct amba_device *dev, struct amba_id *id) | 554 | static int __devinit mmci_probe(struct amba_device *dev, struct amba_id *id) |
519 | { | 555 | { |
520 | struct mmc_platform_data *plat = dev->dev.platform_data; | 556 | struct mmci_platform_data *plat = dev->dev.platform_data; |
521 | struct mmci_host *host; | 557 | struct mmci_host *host; |
522 | struct mmc_host *mmc; | 558 | struct mmc_host *mmc; |
523 | int ret; | 559 | int ret; |
@@ -583,7 +619,30 @@ static int __devinit mmci_probe(struct amba_device *dev, struct amba_id *id) | |||
583 | mmc->ops = &mmci_ops; | 619 | mmc->ops = &mmci_ops; |
584 | mmc->f_min = (host->mclk + 511) / 512; | 620 | mmc->f_min = (host->mclk + 511) / 512; |
585 | mmc->f_max = min(host->mclk, fmax); | 621 | mmc->f_max = min(host->mclk, fmax); |
586 | mmc->ocr_avail = plat->ocr_mask; | 622 | #ifdef CONFIG_REGULATOR |
623 | /* If we're using the regulator framework, try to fetch a regulator */ | ||
624 | host->vcc = regulator_get(&dev->dev, "vmmc"); | ||
625 | if (IS_ERR(host->vcc)) | ||
626 | host->vcc = NULL; | ||
627 | else { | ||
628 | int mask = mmc_regulator_get_ocrmask(host->vcc); | ||
629 | |||
630 | if (mask < 0) | ||
631 | dev_err(&dev->dev, "error getting OCR mask (%d)\n", | ||
632 | mask); | ||
633 | else { | ||
634 | host->mmc->ocr_avail = (u32) mask; | ||
635 | if (plat->ocr_mask) | ||
636 | dev_warn(&dev->dev, | ||
637 | "Provided ocr_mask/setpower will not be used " | ||
638 | "(using regulator instead)\n"); | ||
639 | } | ||
640 | } | ||
641 | #endif | ||
642 | /* Fall back to platform data if no regulator is found */ | ||
643 | if (host->vcc == NULL) | ||
644 | mmc->ocr_avail = plat->ocr_mask; | ||
645 | mmc->caps = plat->capabilities; | ||
587 | 646 | ||
588 | /* | 647 | /* |
589 | * We can do SGIO | 648 | * We can do SGIO |
@@ -720,6 +779,10 @@ static int __devexit mmci_remove(struct amba_device *dev) | |||
720 | clk_disable(host->clk); | 779 | clk_disable(host->clk); |
721 | clk_put(host->clk); | 780 | clk_put(host->clk); |
722 | 781 | ||
782 | if (regulator_is_enabled(host->vcc)) | ||
783 | regulator_disable(host->vcc); | ||
784 | regulator_put(host->vcc); | ||
785 | |||
723 | mmc_free_host(mmc); | 786 | mmc_free_host(mmc); |
724 | 787 | ||
725 | amba_release_regions(dev); | 788 | amba_release_regions(dev); |
diff --git a/drivers/mmc/host/mmci.h b/drivers/mmc/host/mmci.h index 839f264c9725..1ceb9a90f59b 100644 --- a/drivers/mmc/host/mmci.h +++ b/drivers/mmc/host/mmci.h | |||
@@ -161,7 +161,7 @@ struct mmci_host { | |||
161 | unsigned int mclk; | 161 | unsigned int mclk; |
162 | unsigned int cclk; | 162 | unsigned int cclk; |
163 | u32 pwr; | 163 | u32 pwr; |
164 | struct mmc_platform_data *plat; | 164 | struct mmci_platform_data *plat; |
165 | 165 | ||
166 | u8 hw_designer; | 166 | u8 hw_designer; |
167 | u8 hw_revision:4; | 167 | u8 hw_revision:4; |
@@ -175,6 +175,7 @@ struct mmci_host { | |||
175 | struct scatterlist *sg_ptr; | 175 | struct scatterlist *sg_ptr; |
176 | unsigned int sg_off; | 176 | unsigned int sg_off; |
177 | unsigned int size; | 177 | unsigned int size; |
178 | struct regulator *vcc; | ||
178 | }; | 179 | }; |
179 | 180 | ||
180 | static inline void mmci_init_sg(struct mmci_host *host, struct mmc_data *data) | 181 | static inline void mmci_init_sg(struct mmci_host *host, struct mmc_data *data) |
diff --git a/drivers/mmc/host/pxamci.c b/drivers/mmc/host/pxamci.c index e55ac792d68c..5e0b1529964d 100644 --- a/drivers/mmc/host/pxamci.c +++ b/drivers/mmc/host/pxamci.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/mmc/host.h> | 28 | #include <linux/mmc/host.h> |
29 | #include <linux/io.h> | 29 | #include <linux/io.h> |
30 | #include <linux/regulator/consumer.h> | 30 | #include <linux/regulator/consumer.h> |
31 | #include <linux/gpio.h> | ||
31 | 32 | ||
32 | #include <asm/sizes.h> | 33 | #include <asm/sizes.h> |
33 | 34 | ||
@@ -96,10 +97,18 @@ static inline void pxamci_init_ocr(struct pxamci_host *host) | |||
96 | 97 | ||
97 | static inline void pxamci_set_power(struct pxamci_host *host, unsigned int vdd) | 98 | static inline void pxamci_set_power(struct pxamci_host *host, unsigned int vdd) |
98 | { | 99 | { |
100 | int on; | ||
101 | |||
99 | #ifdef CONFIG_REGULATOR | 102 | #ifdef CONFIG_REGULATOR |
100 | if (host->vcc) | 103 | if (host->vcc) |
101 | mmc_regulator_set_ocr(host->vcc, vdd); | 104 | mmc_regulator_set_ocr(host->vcc, vdd); |
102 | #endif | 105 | #endif |
106 | if (!host->vcc && host->pdata && | ||
107 | gpio_is_valid(host->pdata->gpio_power)) { | ||
108 | on = ((1 << vdd) & host->pdata->ocr_mask); | ||
109 | gpio_set_value(host->pdata->gpio_power, | ||
110 | !!on ^ host->pdata->gpio_power_invert); | ||
111 | } | ||
103 | if (!host->vcc && host->pdata && host->pdata->setpower) | 112 | if (!host->vcc && host->pdata && host->pdata->setpower) |
104 | host->pdata->setpower(mmc_dev(host->mmc), vdd); | 113 | host->pdata->setpower(mmc_dev(host->mmc), vdd); |
105 | } | 114 | } |
@@ -421,6 +430,12 @@ static int pxamci_get_ro(struct mmc_host *mmc) | |||
421 | { | 430 | { |
422 | struct pxamci_host *host = mmc_priv(mmc); | 431 | struct pxamci_host *host = mmc_priv(mmc); |
423 | 432 | ||
433 | if (host->pdata && gpio_is_valid(host->pdata->gpio_card_ro)) { | ||
434 | if (host->pdata->gpio_card_ro_invert) | ||
435 | return !gpio_get_value(host->pdata->gpio_card_ro); | ||
436 | else | ||
437 | return gpio_get_value(host->pdata->gpio_card_ro); | ||
438 | } | ||
424 | if (host->pdata && host->pdata->get_ro) | 439 | if (host->pdata && host->pdata->get_ro) |
425 | return !!host->pdata->get_ro(mmc_dev(mmc)); | 440 | return !!host->pdata->get_ro(mmc_dev(mmc)); |
426 | /* | 441 | /* |
@@ -534,7 +549,7 @@ static int pxamci_probe(struct platform_device *pdev) | |||
534 | struct mmc_host *mmc; | 549 | struct mmc_host *mmc; |
535 | struct pxamci_host *host = NULL; | 550 | struct pxamci_host *host = NULL; |
536 | struct resource *r, *dmarx, *dmatx; | 551 | struct resource *r, *dmarx, *dmatx; |
537 | int ret, irq; | 552 | int ret, irq, gpio_cd = -1, gpio_ro = -1, gpio_power = -1; |
538 | 553 | ||
539 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 554 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
540 | irq = platform_get_irq(pdev, 0); | 555 | irq = platform_get_irq(pdev, 0); |
@@ -661,13 +676,63 @@ static int pxamci_probe(struct platform_device *pdev) | |||
661 | } | 676 | } |
662 | host->dma_drcmrtx = dmatx->start; | 677 | host->dma_drcmrtx = dmatx->start; |
663 | 678 | ||
679 | if (host->pdata) { | ||
680 | gpio_cd = host->pdata->gpio_card_detect; | ||
681 | gpio_ro = host->pdata->gpio_card_ro; | ||
682 | gpio_power = host->pdata->gpio_power; | ||
683 | } | ||
684 | if (gpio_is_valid(gpio_power)) { | ||
685 | ret = gpio_request(gpio_power, "mmc card power"); | ||
686 | if (ret) { | ||
687 | dev_err(&pdev->dev, "Failed requesting gpio_power %d\n", gpio_power); | ||
688 | goto out; | ||
689 | } | ||
690 | gpio_direction_output(gpio_power, | ||
691 | host->pdata->gpio_power_invert); | ||
692 | } | ||
693 | if (gpio_is_valid(gpio_ro)) { | ||
694 | ret = gpio_request(gpio_ro, "mmc card read only"); | ||
695 | if (ret) { | ||
696 | dev_err(&pdev->dev, "Failed requesting gpio_ro %d\n", gpio_power); | ||
697 | goto err_gpio_ro; | ||
698 | } | ||
699 | gpio_direction_input(gpio_ro); | ||
700 | } | ||
701 | if (gpio_is_valid(gpio_cd)) { | ||
702 | ret = gpio_request(gpio_cd, "mmc card detect"); | ||
703 | if (ret) { | ||
704 | dev_err(&pdev->dev, "Failed requesting gpio_cd %d\n", gpio_power); | ||
705 | goto err_gpio_cd; | ||
706 | } | ||
707 | gpio_direction_input(gpio_cd); | ||
708 | |||
709 | ret = request_irq(gpio_to_irq(gpio_cd), pxamci_detect_irq, | ||
710 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, | ||
711 | "mmc card detect", mmc); | ||
712 | if (ret) { | ||
713 | dev_err(&pdev->dev, "failed to request card detect IRQ\n"); | ||
714 | goto err_request_irq; | ||
715 | } | ||
716 | } | ||
717 | |||
664 | if (host->pdata && host->pdata->init) | 718 | if (host->pdata && host->pdata->init) |
665 | host->pdata->init(&pdev->dev, pxamci_detect_irq, mmc); | 719 | host->pdata->init(&pdev->dev, pxamci_detect_irq, mmc); |
666 | 720 | ||
721 | if (gpio_is_valid(gpio_power) && host->pdata->setpower) | ||
722 | dev_warn(&pdev->dev, "gpio_power and setpower() both defined\n"); | ||
723 | if (gpio_is_valid(gpio_ro) && host->pdata->get_ro) | ||
724 | dev_warn(&pdev->dev, "gpio_ro and get_ro() both defined\n"); | ||
725 | |||
667 | mmc_add_host(mmc); | 726 | mmc_add_host(mmc); |
668 | 727 | ||
669 | return 0; | 728 | return 0; |
670 | 729 | ||
730 | err_request_irq: | ||
731 | gpio_free(gpio_cd); | ||
732 | err_gpio_cd: | ||
733 | gpio_free(gpio_ro); | ||
734 | err_gpio_ro: | ||
735 | gpio_free(gpio_power); | ||
671 | out: | 736 | out: |
672 | if (host) { | 737 | if (host) { |
673 | if (host->dma >= 0) | 738 | if (host->dma >= 0) |
@@ -688,12 +753,26 @@ static int pxamci_probe(struct platform_device *pdev) | |||
688 | static int pxamci_remove(struct platform_device *pdev) | 753 | static int pxamci_remove(struct platform_device *pdev) |
689 | { | 754 | { |
690 | struct mmc_host *mmc = platform_get_drvdata(pdev); | 755 | struct mmc_host *mmc = platform_get_drvdata(pdev); |
756 | int gpio_cd = -1, gpio_ro = -1, gpio_power = -1; | ||
691 | 757 | ||
692 | platform_set_drvdata(pdev, NULL); | 758 | platform_set_drvdata(pdev, NULL); |
693 | 759 | ||
694 | if (mmc) { | 760 | if (mmc) { |
695 | struct pxamci_host *host = mmc_priv(mmc); | 761 | struct pxamci_host *host = mmc_priv(mmc); |
696 | 762 | ||
763 | if (host->pdata) { | ||
764 | gpio_cd = host->pdata->gpio_card_detect; | ||
765 | gpio_ro = host->pdata->gpio_card_ro; | ||
766 | gpio_power = host->pdata->gpio_power; | ||
767 | } | ||
768 | if (gpio_is_valid(gpio_cd)) { | ||
769 | free_irq(gpio_to_irq(gpio_cd), mmc); | ||
770 | gpio_free(gpio_cd); | ||
771 | } | ||
772 | if (gpio_is_valid(gpio_ro)) | ||
773 | gpio_free(gpio_ro); | ||
774 | if (gpio_is_valid(gpio_power)) | ||
775 | gpio_free(gpio_power); | ||
697 | if (host->vcc) | 776 | if (host->vcc) |
698 | regulator_put(host->vcc); | 777 | regulator_put(host->vcc); |
699 | 778 | ||
@@ -725,20 +804,20 @@ static int pxamci_remove(struct platform_device *pdev) | |||
725 | } | 804 | } |
726 | 805 | ||
727 | #ifdef CONFIG_PM | 806 | #ifdef CONFIG_PM |
728 | static int pxamci_suspend(struct platform_device *dev, pm_message_t state) | 807 | static int pxamci_suspend(struct device *dev) |
729 | { | 808 | { |
730 | struct mmc_host *mmc = platform_get_drvdata(dev); | 809 | struct mmc_host *mmc = dev_get_drvdata(dev); |
731 | int ret = 0; | 810 | int ret = 0; |
732 | 811 | ||
733 | if (mmc) | 812 | if (mmc) |
734 | ret = mmc_suspend_host(mmc, state); | 813 | ret = mmc_suspend_host(mmc, PMSG_SUSPEND); |
735 | 814 | ||
736 | return ret; | 815 | return ret; |
737 | } | 816 | } |
738 | 817 | ||
739 | static int pxamci_resume(struct platform_device *dev) | 818 | static int pxamci_resume(struct device *dev) |
740 | { | 819 | { |
741 | struct mmc_host *mmc = platform_get_drvdata(dev); | 820 | struct mmc_host *mmc = dev_get_drvdata(dev); |
742 | int ret = 0; | 821 | int ret = 0; |
743 | 822 | ||
744 | if (mmc) | 823 | if (mmc) |
@@ -746,19 +825,22 @@ static int pxamci_resume(struct platform_device *dev) | |||
746 | 825 | ||
747 | return ret; | 826 | return ret; |
748 | } | 827 | } |
749 | #else | 828 | |
750 | #define pxamci_suspend NULL | 829 | static struct dev_pm_ops pxamci_pm_ops = { |
751 | #define pxamci_resume NULL | 830 | .suspend = pxamci_suspend, |
831 | .resume = pxamci_resume, | ||
832 | }; | ||
752 | #endif | 833 | #endif |
753 | 834 | ||
754 | static struct platform_driver pxamci_driver = { | 835 | static struct platform_driver pxamci_driver = { |
755 | .probe = pxamci_probe, | 836 | .probe = pxamci_probe, |
756 | .remove = pxamci_remove, | 837 | .remove = pxamci_remove, |
757 | .suspend = pxamci_suspend, | ||
758 | .resume = pxamci_resume, | ||
759 | .driver = { | 838 | .driver = { |
760 | .name = DRIVER_NAME, | 839 | .name = DRIVER_NAME, |
761 | .owner = THIS_MODULE, | 840 | .owner = THIS_MODULE, |
841 | #ifdef CONFIG_PM | ||
842 | .pm = &pxamci_pm_ops, | ||
843 | #endif | ||
762 | }, | 844 | }, |
763 | }; | 845 | }; |
764 | 846 | ||
diff --git a/drivers/net/cris/eth_v10.c b/drivers/net/cris/eth_v10.c index 15c0195ebd31..a24be34a3f7a 100644 --- a/drivers/net/cris/eth_v10.c +++ b/drivers/net/cris/eth_v10.c | |||
@@ -768,10 +768,24 @@ e100_negotiate(struct net_device* dev) | |||
768 | 768 | ||
769 | e100_set_mdio_reg(dev, np->mii_if.phy_id, MII_ADVERTISE, data); | 769 | e100_set_mdio_reg(dev, np->mii_if.phy_id, MII_ADVERTISE, data); |
770 | 770 | ||
771 | /* Renegotiate with link partner */ | 771 | data = e100_get_mdio_reg(dev, np->mii_if.phy_id, MII_BMCR); |
772 | if (autoneg_normal) { | 772 | if (autoneg_normal) { |
773 | data = e100_get_mdio_reg(dev, np->mii_if.phy_id, MII_BMCR); | 773 | /* Renegotiate with link partner */ |
774 | data |= BMCR_ANENABLE | BMCR_ANRESTART; | 774 | data |= BMCR_ANENABLE | BMCR_ANRESTART; |
775 | } else { | ||
776 | /* Don't negotiate speed or duplex */ | ||
777 | data &= ~(BMCR_ANENABLE | BMCR_ANRESTART); | ||
778 | |||
779 | /* Set speed and duplex static */ | ||
780 | if (current_speed_selection == 10) | ||
781 | data &= ~BMCR_SPEED100; | ||
782 | else | ||
783 | data |= BMCR_SPEED100; | ||
784 | |||
785 | if (current_duplex != full) | ||
786 | data &= ~BMCR_FULLDPLX; | ||
787 | else | ||
788 | data |= BMCR_FULLDPLX; | ||
775 | } | 789 | } |
776 | e100_set_mdio_reg(dev, np->mii_if.phy_id, MII_BMCR, data); | 790 | e100_set_mdio_reg(dev, np->mii_if.phy_id, MII_BMCR, data); |
777 | } | 791 | } |
diff --git a/drivers/net/irda/pxaficp_ir.c b/drivers/net/irda/pxaficp_ir.c index 1445e5865196..84db145d2b59 100644 --- a/drivers/net/irda/pxaficp_ir.c +++ b/drivers/net/irda/pxaficp_ir.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/etherdevice.h> | 17 | #include <linux/etherdevice.h> |
18 | #include <linux/platform_device.h> | 18 | #include <linux/platform_device.h> |
19 | #include <linux/clk.h> | 19 | #include <linux/clk.h> |
20 | #include <linux/gpio.h> | ||
20 | 21 | ||
21 | #include <net/irda/irda.h> | 22 | #include <net/irda/irda.h> |
22 | #include <net/irda/irmod.h> | 23 | #include <net/irda/irmod.h> |
@@ -163,6 +164,22 @@ inline static void pxa_irda_fir_dma_tx_start(struct pxa_irda *si) | |||
163 | } | 164 | } |
164 | 165 | ||
165 | /* | 166 | /* |
167 | * Set the IrDA communications mode. | ||
168 | */ | ||
169 | static void pxa_irda_set_mode(struct pxa_irda *si, int mode) | ||
170 | { | ||
171 | if (si->pdata->transceiver_mode) | ||
172 | si->pdata->transceiver_mode(si->dev, mode); | ||
173 | else { | ||
174 | if (gpio_is_valid(si->pdata->gpio_pwdown)) | ||
175 | gpio_set_value(si->pdata->gpio_pwdown, | ||
176 | !(mode & IR_OFF) ^ | ||
177 | !si->pdata->gpio_pwdown_inverted); | ||
178 | pxa2xx_transceiver_mode(si->dev, mode); | ||
179 | } | ||
180 | } | ||
181 | |||
182 | /* | ||
166 | * Set the IrDA communications speed. | 183 | * Set the IrDA communications speed. |
167 | */ | 184 | */ |
168 | static int pxa_irda_set_speed(struct pxa_irda *si, int speed) | 185 | static int pxa_irda_set_speed(struct pxa_irda *si, int speed) |
@@ -188,7 +205,7 @@ static int pxa_irda_set_speed(struct pxa_irda *si, int speed) | |||
188 | pxa_irda_disable_clk(si); | 205 | pxa_irda_disable_clk(si); |
189 | 206 | ||
190 | /* set board transceiver to SIR mode */ | 207 | /* set board transceiver to SIR mode */ |
191 | si->pdata->transceiver_mode(si->dev, IR_SIRMODE); | 208 | pxa_irda_set_mode(si, IR_SIRMODE); |
192 | 209 | ||
193 | /* enable the STUART clock */ | 210 | /* enable the STUART clock */ |
194 | pxa_irda_enable_sirclk(si); | 211 | pxa_irda_enable_sirclk(si); |
@@ -222,7 +239,7 @@ static int pxa_irda_set_speed(struct pxa_irda *si, int speed) | |||
222 | ICCR0 = 0; | 239 | ICCR0 = 0; |
223 | 240 | ||
224 | /* set board transceiver to FIR mode */ | 241 | /* set board transceiver to FIR mode */ |
225 | si->pdata->transceiver_mode(si->dev, IR_FIRMODE); | 242 | pxa_irda_set_mode(si, IR_FIRMODE); |
226 | 243 | ||
227 | /* enable the FICP clock */ | 244 | /* enable the FICP clock */ |
228 | pxa_irda_enable_firclk(si); | 245 | pxa_irda_enable_firclk(si); |
@@ -641,7 +658,7 @@ static void pxa_irda_shutdown(struct pxa_irda *si) | |||
641 | local_irq_restore(flags); | 658 | local_irq_restore(flags); |
642 | 659 | ||
643 | /* power off board transceiver */ | 660 | /* power off board transceiver */ |
644 | si->pdata->transceiver_mode(si->dev, IR_OFF); | 661 | pxa_irda_set_mode(si, IR_OFF); |
645 | 662 | ||
646 | printk(KERN_DEBUG "pxa_ir: irda shutdown\n"); | 663 | printk(KERN_DEBUG "pxa_ir: irda shutdown\n"); |
647 | } | 664 | } |
@@ -849,10 +866,26 @@ static int pxa_irda_probe(struct platform_device *pdev) | |||
849 | if (err) | 866 | if (err) |
850 | goto err_mem_5; | 867 | goto err_mem_5; |
851 | 868 | ||
852 | if (si->pdata->startup) | 869 | if (gpio_is_valid(si->pdata->gpio_pwdown)) { |
870 | err = gpio_request(si->pdata->gpio_pwdown, "IrDA switch"); | ||
871 | if (err) | ||
872 | goto err_startup; | ||
873 | err = gpio_direction_output(si->pdata->gpio_pwdown, | ||
874 | !si->pdata->gpio_pwdown_inverted); | ||
875 | if (err) { | ||
876 | gpio_free(si->pdata->gpio_pwdown); | ||
877 | goto err_startup; | ||
878 | } | ||
879 | } | ||
880 | |||
881 | if (si->pdata->startup) { | ||
853 | err = si->pdata->startup(si->dev); | 882 | err = si->pdata->startup(si->dev); |
854 | if (err) | 883 | if (err) |
855 | goto err_startup; | 884 | goto err_startup; |
885 | } | ||
886 | |||
887 | if (gpio_is_valid(si->pdata->gpio_pwdown) && si->pdata->startup) | ||
888 | dev_warn(si->dev, "gpio_pwdown and startup() both defined!\n"); | ||
856 | 889 | ||
857 | dev->netdev_ops = &pxa_irda_netdev_ops; | 890 | dev->netdev_ops = &pxa_irda_netdev_ops; |
858 | 891 | ||
@@ -903,6 +936,8 @@ static int pxa_irda_remove(struct platform_device *_dev) | |||
903 | if (dev) { | 936 | if (dev) { |
904 | struct pxa_irda *si = netdev_priv(dev); | 937 | struct pxa_irda *si = netdev_priv(dev); |
905 | unregister_netdev(dev); | 938 | unregister_netdev(dev); |
939 | if (gpio_is_valid(si->pdata->gpio_pwdown)) | ||
940 | gpio_free(si->pdata->gpio_pwdown); | ||
906 | if (si->pdata->shutdown) | 941 | if (si->pdata->shutdown) |
907 | si->pdata->shutdown(si->dev); | 942 | si->pdata->shutdown(si->dev); |
908 | kfree(si->tx_buff.head); | 943 | kfree(si->tx_buff.head); |
diff --git a/drivers/net/mlx4/fw.c b/drivers/net/mlx4/fw.c index cee199ceba2f..3c16602172fc 100644 --- a/drivers/net/mlx4/fw.c +++ b/drivers/net/mlx4/fw.c | |||
@@ -33,6 +33,7 @@ | |||
33 | */ | 33 | */ |
34 | 34 | ||
35 | #include <linux/mlx4/cmd.h> | 35 | #include <linux/mlx4/cmd.h> |
36 | #include <linux/cache.h> | ||
36 | 37 | ||
37 | #include "fw.h" | 38 | #include "fw.h" |
38 | #include "icm.h" | 39 | #include "icm.h" |
@@ -698,6 +699,7 @@ int mlx4_INIT_HCA(struct mlx4_dev *dev, struct mlx4_init_hca_param *param) | |||
698 | #define INIT_HCA_IN_SIZE 0x200 | 699 | #define INIT_HCA_IN_SIZE 0x200 |
699 | #define INIT_HCA_VERSION_OFFSET 0x000 | 700 | #define INIT_HCA_VERSION_OFFSET 0x000 |
700 | #define INIT_HCA_VERSION 2 | 701 | #define INIT_HCA_VERSION 2 |
702 | #define INIT_HCA_CACHELINE_SZ_OFFSET 0x0e | ||
701 | #define INIT_HCA_FLAGS_OFFSET 0x014 | 703 | #define INIT_HCA_FLAGS_OFFSET 0x014 |
702 | #define INIT_HCA_QPC_OFFSET 0x020 | 704 | #define INIT_HCA_QPC_OFFSET 0x020 |
703 | #define INIT_HCA_QPC_BASE_OFFSET (INIT_HCA_QPC_OFFSET + 0x10) | 705 | #define INIT_HCA_QPC_BASE_OFFSET (INIT_HCA_QPC_OFFSET + 0x10) |
@@ -735,6 +737,9 @@ int mlx4_INIT_HCA(struct mlx4_dev *dev, struct mlx4_init_hca_param *param) | |||
735 | 737 | ||
736 | *((u8 *) mailbox->buf + INIT_HCA_VERSION_OFFSET) = INIT_HCA_VERSION; | 738 | *((u8 *) mailbox->buf + INIT_HCA_VERSION_OFFSET) = INIT_HCA_VERSION; |
737 | 739 | ||
740 | *((u8 *) mailbox->buf + INIT_HCA_CACHELINE_SZ_OFFSET) = | ||
741 | (ilog2(cache_line_size()) - 4) << 5; | ||
742 | |||
738 | #if defined(__LITTLE_ENDIAN) | 743 | #if defined(__LITTLE_ENDIAN) |
739 | *(inbox + INIT_HCA_FLAGS_OFFSET / 4) &= ~cpu_to_be32(1 << 1); | 744 | *(inbox + INIT_HCA_FLAGS_OFFSET / 4) &= ~cpu_to_be32(1 << 1); |
740 | #elif defined(__BIG_ENDIAN) | 745 | #elif defined(__BIG_ENDIAN) |
diff --git a/drivers/pcmcia/Makefile b/drivers/pcmcia/Makefile index 047394d98ac2..3247828aa203 100644 --- a/drivers/pcmcia/Makefile +++ b/drivers/pcmcia/Makefile | |||
@@ -71,6 +71,7 @@ pxa2xx-obj-$(CONFIG_MACH_ARMCORE) += pxa2xx_cm_x2xx_cs.o | |||
71 | pxa2xx-obj-$(CONFIG_ARCH_VIPER) += pxa2xx_viper.o | 71 | pxa2xx-obj-$(CONFIG_ARCH_VIPER) += pxa2xx_viper.o |
72 | pxa2xx-obj-$(CONFIG_TRIZEPS_PCMCIA) += pxa2xx_trizeps4.o | 72 | pxa2xx-obj-$(CONFIG_TRIZEPS_PCMCIA) += pxa2xx_trizeps4.o |
73 | pxa2xx-obj-$(CONFIG_MACH_PALMTX) += pxa2xx_palmtx.o | 73 | pxa2xx-obj-$(CONFIG_MACH_PALMTX) += pxa2xx_palmtx.o |
74 | pxa2xx-obj-$(CONFIG_MACH_PALMTC) += pxa2xx_palmtc.o | ||
74 | pxa2xx-obj-$(CONFIG_MACH_PALMLD) += pxa2xx_palmld.o | 75 | pxa2xx-obj-$(CONFIG_MACH_PALMLD) += pxa2xx_palmld.o |
75 | pxa2xx-obj-$(CONFIG_MACH_E740) += pxa2xx_e740.o | 76 | pxa2xx-obj-$(CONFIG_MACH_E740) += pxa2xx_e740.o |
76 | pxa2xx-obj-$(CONFIG_MACH_STARGATE2) += pxa2xx_stargate2.o | 77 | pxa2xx-obj-$(CONFIG_MACH_STARGATE2) += pxa2xx_stargate2.o |
diff --git a/drivers/pcmcia/pxa2xx_base.c b/drivers/pcmcia/pxa2xx_base.c index c49a7269f6d1..87e22ef8eb02 100644 --- a/drivers/pcmcia/pxa2xx_base.c +++ b/drivers/pcmcia/pxa2xx_base.c | |||
@@ -300,25 +300,29 @@ static int pxa2xx_drv_pcmcia_remove(struct platform_device *dev) | |||
300 | return soc_common_drv_pcmcia_remove(&dev->dev); | 300 | return soc_common_drv_pcmcia_remove(&dev->dev); |
301 | } | 301 | } |
302 | 302 | ||
303 | static int pxa2xx_drv_pcmcia_suspend(struct platform_device *dev, pm_message_t state) | 303 | static int pxa2xx_drv_pcmcia_suspend(struct device *dev) |
304 | { | 304 | { |
305 | return pcmcia_socket_dev_suspend(&dev->dev, state); | 305 | return pcmcia_socket_dev_suspend(dev, PMSG_SUSPEND); |
306 | } | 306 | } |
307 | 307 | ||
308 | static int pxa2xx_drv_pcmcia_resume(struct platform_device *dev) | 308 | static int pxa2xx_drv_pcmcia_resume(struct device *dev) |
309 | { | 309 | { |
310 | pxa2xx_configure_sockets(&dev->dev); | 310 | pxa2xx_configure_sockets(dev); |
311 | return pcmcia_socket_dev_resume(&dev->dev); | 311 | return pcmcia_socket_dev_resume(dev); |
312 | } | 312 | } |
313 | 313 | ||
314 | static struct dev_pm_ops pxa2xx_drv_pcmcia_pm_ops = { | ||
315 | .suspend = pxa2xx_drv_pcmcia_suspend, | ||
316 | .resume = pxa2xx_drv_pcmcia_resume, | ||
317 | }; | ||
318 | |||
314 | static struct platform_driver pxa2xx_pcmcia_driver = { | 319 | static struct platform_driver pxa2xx_pcmcia_driver = { |
315 | .probe = pxa2xx_drv_pcmcia_probe, | 320 | .probe = pxa2xx_drv_pcmcia_probe, |
316 | .remove = pxa2xx_drv_pcmcia_remove, | 321 | .remove = pxa2xx_drv_pcmcia_remove, |
317 | .suspend = pxa2xx_drv_pcmcia_suspend, | ||
318 | .resume = pxa2xx_drv_pcmcia_resume, | ||
319 | .driver = { | 322 | .driver = { |
320 | .name = "pxa2xx-pcmcia", | 323 | .name = "pxa2xx-pcmcia", |
321 | .owner = THIS_MODULE, | 324 | .owner = THIS_MODULE, |
325 | .pm = &pxa2xx_drv_pcmcia_pm_ops, | ||
322 | }, | 326 | }, |
323 | }; | 327 | }; |
324 | 328 | ||
diff --git a/drivers/pcmcia/pxa2xx_palmtc.c b/drivers/pcmcia/pxa2xx_palmtc.c new file mode 100644 index 000000000000..3a8993ed5621 --- /dev/null +++ b/drivers/pcmcia/pxa2xx_palmtc.c | |||
@@ -0,0 +1,230 @@ | |||
1 | /* | ||
2 | * linux/drivers/pcmcia/pxa2xx_palmtc.c | ||
3 | * | ||
4 | * Driver for Palm Tungsten|C PCMCIA | ||
5 | * | ||
6 | * Copyright (C) 2008 Alex Osborne <ato@meshy.org> | ||
7 | * Copyright (C) 2009 Marek Vasut <marek.vasut@gmail.com> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License version 2 as | ||
11 | * published by the Free Software Foundation. | ||
12 | * | ||
13 | */ | ||
14 | |||
15 | #include <linux/module.h> | ||
16 | #include <linux/platform_device.h> | ||
17 | #include <linux/gpio.h> | ||
18 | #include <linux/delay.h> | ||
19 | |||
20 | #include <asm/mach-types.h> | ||
21 | #include <mach/palmtc.h> | ||
22 | #include "soc_common.h" | ||
23 | |||
24 | static int palmtc_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | ||
25 | { | ||
26 | int ret; | ||
27 | |||
28 | ret = gpio_request(GPIO_NR_PALMTC_PCMCIA_POWER1, "PCMCIA PWR1"); | ||
29 | if (ret) | ||
30 | goto err1; | ||
31 | ret = gpio_direction_output(GPIO_NR_PALMTC_PCMCIA_POWER1, 0); | ||
32 | if (ret) | ||
33 | goto err2; | ||
34 | |||
35 | ret = gpio_request(GPIO_NR_PALMTC_PCMCIA_POWER2, "PCMCIA PWR2"); | ||
36 | if (ret) | ||
37 | goto err2; | ||
38 | ret = gpio_direction_output(GPIO_NR_PALMTC_PCMCIA_POWER2, 0); | ||
39 | if (ret) | ||
40 | goto err3; | ||
41 | |||
42 | ret = gpio_request(GPIO_NR_PALMTC_PCMCIA_POWER3, "PCMCIA PWR3"); | ||
43 | if (ret) | ||
44 | goto err3; | ||
45 | ret = gpio_direction_output(GPIO_NR_PALMTC_PCMCIA_POWER3, 0); | ||
46 | if (ret) | ||
47 | goto err4; | ||
48 | |||
49 | ret = gpio_request(GPIO_NR_PALMTC_PCMCIA_RESET, "PCMCIA RST"); | ||
50 | if (ret) | ||
51 | goto err4; | ||
52 | ret = gpio_direction_output(GPIO_NR_PALMTC_PCMCIA_RESET, 1); | ||
53 | if (ret) | ||
54 | goto err5; | ||
55 | |||
56 | ret = gpio_request(GPIO_NR_PALMTC_PCMCIA_READY, "PCMCIA RDY"); | ||
57 | if (ret) | ||
58 | goto err5; | ||
59 | ret = gpio_direction_input(GPIO_NR_PALMTC_PCMCIA_READY); | ||
60 | if (ret) | ||
61 | goto err6; | ||
62 | |||
63 | ret = gpio_request(GPIO_NR_PALMTC_PCMCIA_PWRREADY, "PCMCIA PWRRDY"); | ||
64 | if (ret) | ||
65 | goto err6; | ||
66 | ret = gpio_direction_input(GPIO_NR_PALMTC_PCMCIA_PWRREADY); | ||
67 | if (ret) | ||
68 | goto err7; | ||
69 | |||
70 | skt->irq = IRQ_GPIO(GPIO_NR_PALMTC_PCMCIA_READY); | ||
71 | return 0; | ||
72 | |||
73 | err7: | ||
74 | gpio_free(GPIO_NR_PALMTC_PCMCIA_PWRREADY); | ||
75 | err6: | ||
76 | gpio_free(GPIO_NR_PALMTC_PCMCIA_READY); | ||
77 | err5: | ||
78 | gpio_free(GPIO_NR_PALMTC_PCMCIA_RESET); | ||
79 | err4: | ||
80 | gpio_free(GPIO_NR_PALMTC_PCMCIA_POWER3); | ||
81 | err3: | ||
82 | gpio_free(GPIO_NR_PALMTC_PCMCIA_POWER2); | ||
83 | err2: | ||
84 | gpio_free(GPIO_NR_PALMTC_PCMCIA_POWER1); | ||
85 | err1: | ||
86 | return ret; | ||
87 | } | ||
88 | |||
89 | static void palmtc_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) | ||
90 | { | ||
91 | gpio_free(GPIO_NR_PALMTC_PCMCIA_PWRREADY); | ||
92 | gpio_free(GPIO_NR_PALMTC_PCMCIA_READY); | ||
93 | gpio_free(GPIO_NR_PALMTC_PCMCIA_RESET); | ||
94 | gpio_free(GPIO_NR_PALMTC_PCMCIA_POWER3); | ||
95 | gpio_free(GPIO_NR_PALMTC_PCMCIA_POWER2); | ||
96 | gpio_free(GPIO_NR_PALMTC_PCMCIA_POWER1); | ||
97 | } | ||
98 | |||
99 | static void palmtc_pcmcia_socket_state(struct soc_pcmcia_socket *skt, | ||
100 | struct pcmcia_state *state) | ||
101 | { | ||
102 | state->detect = 1; /* always inserted */ | ||
103 | state->ready = !!gpio_get_value(GPIO_NR_PALMTC_PCMCIA_READY); | ||
104 | state->bvd1 = 1; | ||
105 | state->bvd2 = 1; | ||
106 | state->wrprot = 0; | ||
107 | state->vs_3v = 1; | ||
108 | state->vs_Xv = 0; | ||
109 | } | ||
110 | |||
111 | static int palmtc_wifi_powerdown(void) | ||
112 | { | ||
113 | gpio_set_value(GPIO_NR_PALMTC_PCMCIA_RESET, 1); | ||
114 | gpio_set_value(GPIO_NR_PALMTC_PCMCIA_POWER2, 0); | ||
115 | mdelay(40); | ||
116 | gpio_set_value(GPIO_NR_PALMTC_PCMCIA_POWER1, 0); | ||
117 | return 0; | ||
118 | } | ||
119 | |||
120 | static int palmtc_wifi_powerup(void) | ||
121 | { | ||
122 | int timeout = 50; | ||
123 | |||
124 | gpio_set_value(GPIO_NR_PALMTC_PCMCIA_POWER3, 1); | ||
125 | mdelay(50); | ||
126 | |||
127 | /* Power up the card, 1.8V first, after a while 3.3V */ | ||
128 | gpio_set_value(GPIO_NR_PALMTC_PCMCIA_POWER1, 1); | ||
129 | mdelay(100); | ||
130 | gpio_set_value(GPIO_NR_PALMTC_PCMCIA_POWER2, 1); | ||
131 | |||
132 | /* Wait till the card is ready */ | ||
133 | while (!gpio_get_value(GPIO_NR_PALMTC_PCMCIA_PWRREADY) && | ||
134 | timeout) { | ||
135 | mdelay(1); | ||
136 | timeout--; | ||
137 | } | ||
138 | |||
139 | /* Power down the WiFi in case of error */ | ||
140 | if (!timeout) { | ||
141 | palmtc_wifi_powerdown(); | ||
142 | return 1; | ||
143 | } | ||
144 | |||
145 | /* Reset the card */ | ||
146 | gpio_set_value(GPIO_NR_PALMTC_PCMCIA_RESET, 1); | ||
147 | mdelay(20); | ||
148 | gpio_set_value(GPIO_NR_PALMTC_PCMCIA_RESET, 0); | ||
149 | mdelay(25); | ||
150 | |||
151 | gpio_set_value(GPIO_NR_PALMTC_PCMCIA_POWER3, 0); | ||
152 | |||
153 | return 0; | ||
154 | } | ||
155 | |||
156 | static int palmtc_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, | ||
157 | const socket_state_t *state) | ||
158 | { | ||
159 | int ret = 1; | ||
160 | |||
161 | if (state->Vcc == 0) | ||
162 | ret = palmtc_wifi_powerdown(); | ||
163 | else if (state->Vcc == 33) | ||
164 | ret = palmtc_wifi_powerup(); | ||
165 | |||
166 | return ret; | ||
167 | } | ||
168 | |||
169 | static void palmtc_pcmcia_socket_init(struct soc_pcmcia_socket *skt) | ||
170 | { | ||
171 | } | ||
172 | |||
173 | static void palmtc_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt) | ||
174 | { | ||
175 | } | ||
176 | |||
177 | static struct pcmcia_low_level palmtc_pcmcia_ops = { | ||
178 | .owner = THIS_MODULE, | ||
179 | |||
180 | .first = 0, | ||
181 | .nr = 1, | ||
182 | |||
183 | .hw_init = palmtc_pcmcia_hw_init, | ||
184 | .hw_shutdown = palmtc_pcmcia_hw_shutdown, | ||
185 | |||
186 | .socket_state = palmtc_pcmcia_socket_state, | ||
187 | .configure_socket = palmtc_pcmcia_configure_socket, | ||
188 | |||
189 | .socket_init = palmtc_pcmcia_socket_init, | ||
190 | .socket_suspend = palmtc_pcmcia_socket_suspend, | ||
191 | }; | ||
192 | |||
193 | static struct platform_device *palmtc_pcmcia_device; | ||
194 | |||
195 | static int __init palmtc_pcmcia_init(void) | ||
196 | { | ||
197 | int ret; | ||
198 | |||
199 | if (!machine_is_palmtc()) | ||
200 | return -ENODEV; | ||
201 | |||
202 | palmtc_pcmcia_device = platform_device_alloc("pxa2xx-pcmcia", -1); | ||
203 | if (!palmtc_pcmcia_device) | ||
204 | return -ENOMEM; | ||
205 | |||
206 | ret = platform_device_add_data(palmtc_pcmcia_device, &palmtc_pcmcia_ops, | ||
207 | sizeof(palmtc_pcmcia_ops)); | ||
208 | |||
209 | if (!ret) | ||
210 | ret = platform_device_add(palmtc_pcmcia_device); | ||
211 | |||
212 | if (ret) | ||
213 | platform_device_put(palmtc_pcmcia_device); | ||
214 | |||
215 | return ret; | ||
216 | } | ||
217 | |||
218 | static void __exit palmtc_pcmcia_exit(void) | ||
219 | { | ||
220 | platform_device_unregister(palmtc_pcmcia_device); | ||
221 | } | ||
222 | |||
223 | module_init(palmtc_pcmcia_init); | ||
224 | module_exit(palmtc_pcmcia_exit); | ||
225 | |||
226 | MODULE_AUTHOR("Alex Osborne <ato@meshy.org>," | ||
227 | " Marek Vasut <marek.vasut@gmail.com>"); | ||
228 | MODULE_DESCRIPTION("PCMCIA support for Palm Tungsten|C"); | ||
229 | MODULE_ALIAS("platform:pxa2xx-pcmcia"); | ||
230 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/rtc/rtc-pxa.c b/drivers/rtc/rtc-pxa.c index bb8cc05605ac..747ca194fad4 100644 --- a/drivers/rtc/rtc-pxa.c +++ b/drivers/rtc/rtc-pxa.c | |||
@@ -438,34 +438,37 @@ static int __exit pxa_rtc_remove(struct platform_device *pdev) | |||
438 | } | 438 | } |
439 | 439 | ||
440 | #ifdef CONFIG_PM | 440 | #ifdef CONFIG_PM |
441 | static int pxa_rtc_suspend(struct platform_device *pdev, pm_message_t state) | 441 | static int pxa_rtc_suspend(struct device *dev) |
442 | { | 442 | { |
443 | struct pxa_rtc *pxa_rtc = platform_get_drvdata(pdev); | 443 | struct pxa_rtc *pxa_rtc = dev_get_drvdata(dev); |
444 | 444 | ||
445 | if (device_may_wakeup(&pdev->dev)) | 445 | if (device_may_wakeup(dev)) |
446 | enable_irq_wake(pxa_rtc->irq_Alrm); | 446 | enable_irq_wake(pxa_rtc->irq_Alrm); |
447 | return 0; | 447 | return 0; |
448 | } | 448 | } |
449 | 449 | ||
450 | static int pxa_rtc_resume(struct platform_device *pdev) | 450 | static int pxa_rtc_resume(struct device *dev) |
451 | { | 451 | { |
452 | struct pxa_rtc *pxa_rtc = platform_get_drvdata(pdev); | 452 | struct pxa_rtc *pxa_rtc = dev_get_drvdata(dev); |
453 | 453 | ||
454 | if (device_may_wakeup(&pdev->dev)) | 454 | if (device_may_wakeup(dev)) |
455 | disable_irq_wake(pxa_rtc->irq_Alrm); | 455 | disable_irq_wake(pxa_rtc->irq_Alrm); |
456 | return 0; | 456 | return 0; |
457 | } | 457 | } |
458 | #else | 458 | |
459 | #define pxa_rtc_suspend NULL | 459 | static struct dev_pm_ops pxa_rtc_pm_ops = { |
460 | #define pxa_rtc_resume NULL | 460 | .suspend = pxa_rtc_suspend, |
461 | .resume = pxa_rtc_resume, | ||
462 | }; | ||
461 | #endif | 463 | #endif |
462 | 464 | ||
463 | static struct platform_driver pxa_rtc_driver = { | 465 | static struct platform_driver pxa_rtc_driver = { |
464 | .remove = __exit_p(pxa_rtc_remove), | 466 | .remove = __exit_p(pxa_rtc_remove), |
465 | .suspend = pxa_rtc_suspend, | ||
466 | .resume = pxa_rtc_resume, | ||
467 | .driver = { | 467 | .driver = { |
468 | .name = "pxa-rtc", | 468 | .name = "pxa-rtc", |
469 | #ifdef CONFIG_PM | ||
470 | .pm = &pxa_rtc_pm_ops, | ||
471 | #endif | ||
469 | }, | 472 | }, |
470 | }; | 473 | }; |
471 | 474 | ||
diff --git a/drivers/rtc/rtc-sa1100.c b/drivers/rtc/rtc-sa1100.c index 021b2928f0b9..29f98a70586e 100644 --- a/drivers/rtc/rtc-sa1100.c +++ b/drivers/rtc/rtc-sa1100.c | |||
@@ -393,31 +393,34 @@ static int sa1100_rtc_remove(struct platform_device *pdev) | |||
393 | } | 393 | } |
394 | 394 | ||
395 | #ifdef CONFIG_PM | 395 | #ifdef CONFIG_PM |
396 | static int sa1100_rtc_suspend(struct platform_device *pdev, pm_message_t state) | 396 | static int sa1100_rtc_suspend(struct device *dev) |
397 | { | 397 | { |
398 | if (device_may_wakeup(&pdev->dev)) | 398 | if (device_may_wakeup(dev)) |
399 | enable_irq_wake(IRQ_RTCAlrm); | 399 | enable_irq_wake(IRQ_RTCAlrm); |
400 | return 0; | 400 | return 0; |
401 | } | 401 | } |
402 | 402 | ||
403 | static int sa1100_rtc_resume(struct platform_device *pdev) | 403 | static int sa1100_rtc_resume(struct device *dev) |
404 | { | 404 | { |
405 | if (device_may_wakeup(&pdev->dev)) | 405 | if (device_may_wakeup(dev)) |
406 | disable_irq_wake(IRQ_RTCAlrm); | 406 | disable_irq_wake(IRQ_RTCAlrm); |
407 | return 0; | 407 | return 0; |
408 | } | 408 | } |
409 | #else | 409 | |
410 | #define sa1100_rtc_suspend NULL | 410 | static struct dev_pm_ops sa1100_rtc_pm_ops = { |
411 | #define sa1100_rtc_resume NULL | 411 | .suspend = sa1100_rtc_suspend, |
412 | .resume = sa1100_rtc_resume, | ||
413 | }; | ||
412 | #endif | 414 | #endif |
413 | 415 | ||
414 | static struct platform_driver sa1100_rtc_driver = { | 416 | static struct platform_driver sa1100_rtc_driver = { |
415 | .probe = sa1100_rtc_probe, | 417 | .probe = sa1100_rtc_probe, |
416 | .remove = sa1100_rtc_remove, | 418 | .remove = sa1100_rtc_remove, |
417 | .suspend = sa1100_rtc_suspend, | ||
418 | .resume = sa1100_rtc_resume, | ||
419 | .driver = { | 419 | .driver = { |
420 | .name = "sa1100-rtc", | 420 | .name = "sa1100-rtc", |
421 | #ifdef CONFIG_PM | ||
422 | .pm = &sa1100_rtc_pm_ops, | ||
423 | #endif | ||
421 | }, | 424 | }, |
422 | }; | 425 | }; |
423 | 426 | ||
diff --git a/drivers/serial/cpm_uart/cpm_uart_core.c b/drivers/serial/cpm_uart/cpm_uart_core.c index 8d349b23249a..300cea768d74 100644 --- a/drivers/serial/cpm_uart/cpm_uart_core.c +++ b/drivers/serial/cpm_uart/cpm_uart_core.c | |||
@@ -649,7 +649,7 @@ static int cpm_uart_tx_pump(struct uart_port *port) | |||
649 | u8 *p; | 649 | u8 *p; |
650 | int count; | 650 | int count; |
651 | struct uart_cpm_port *pinfo = (struct uart_cpm_port *)port; | 651 | struct uart_cpm_port *pinfo = (struct uart_cpm_port *)port; |
652 | struct circ_buf *xmit = &port->info->xmit; | 652 | struct circ_buf *xmit = &port->state->xmit; |
653 | 653 | ||
654 | /* Handle xon/xoff */ | 654 | /* Handle xon/xoff */ |
655 | if (port->x_char) { | 655 | if (port->x_char) { |
diff --git a/drivers/serial/crisv10.c b/drivers/serial/crisv10.c index 7be52fe288eb..31f172397af3 100644 --- a/drivers/serial/crisv10.c +++ b/drivers/serial/crisv10.c | |||
@@ -18,6 +18,7 @@ static char *serial_version = "$Revision: 1.25 $"; | |||
18 | #include <linux/tty.h> | 18 | #include <linux/tty.h> |
19 | #include <linux/tty_flip.h> | 19 | #include <linux/tty_flip.h> |
20 | #include <linux/major.h> | 20 | #include <linux/major.h> |
21 | #include <linux/smp_lock.h> | ||
21 | #include <linux/string.h> | 22 | #include <linux/string.h> |
22 | #include <linux/fcntl.h> | 23 | #include <linux/fcntl.h> |
23 | #include <linux/mm.h> | 24 | #include <linux/mm.h> |
diff --git a/drivers/serial/pxa.c b/drivers/serial/pxa.c index 6443b7ff274a..b8629d74f6a2 100644 --- a/drivers/serial/pxa.c +++ b/drivers/serial/pxa.c | |||
@@ -726,9 +726,10 @@ static struct uart_driver serial_pxa_reg = { | |||
726 | .cons = PXA_CONSOLE, | 726 | .cons = PXA_CONSOLE, |
727 | }; | 727 | }; |
728 | 728 | ||
729 | static int serial_pxa_suspend(struct platform_device *dev, pm_message_t state) | 729 | #ifdef CONFIG_PM |
730 | static int serial_pxa_suspend(struct device *dev) | ||
730 | { | 731 | { |
731 | struct uart_pxa_port *sport = platform_get_drvdata(dev); | 732 | struct uart_pxa_port *sport = dev_get_drvdata(dev); |
732 | 733 | ||
733 | if (sport) | 734 | if (sport) |
734 | uart_suspend_port(&serial_pxa_reg, &sport->port); | 735 | uart_suspend_port(&serial_pxa_reg, &sport->port); |
@@ -736,9 +737,9 @@ static int serial_pxa_suspend(struct platform_device *dev, pm_message_t state) | |||
736 | return 0; | 737 | return 0; |
737 | } | 738 | } |
738 | 739 | ||
739 | static int serial_pxa_resume(struct platform_device *dev) | 740 | static int serial_pxa_resume(struct device *dev) |
740 | { | 741 | { |
741 | struct uart_pxa_port *sport = platform_get_drvdata(dev); | 742 | struct uart_pxa_port *sport = dev_get_drvdata(dev); |
742 | 743 | ||
743 | if (sport) | 744 | if (sport) |
744 | uart_resume_port(&serial_pxa_reg, &sport->port); | 745 | uart_resume_port(&serial_pxa_reg, &sport->port); |
@@ -746,6 +747,12 @@ static int serial_pxa_resume(struct platform_device *dev) | |||
746 | return 0; | 747 | return 0; |
747 | } | 748 | } |
748 | 749 | ||
750 | static struct dev_pm_ops serial_pxa_pm_ops = { | ||
751 | .suspend = serial_pxa_suspend, | ||
752 | .resume = serial_pxa_resume, | ||
753 | }; | ||
754 | #endif | ||
755 | |||
749 | static int serial_pxa_probe(struct platform_device *dev) | 756 | static int serial_pxa_probe(struct platform_device *dev) |
750 | { | 757 | { |
751 | struct uart_pxa_port *sport; | 758 | struct uart_pxa_port *sport; |
@@ -825,11 +832,12 @@ static struct platform_driver serial_pxa_driver = { | |||
825 | .probe = serial_pxa_probe, | 832 | .probe = serial_pxa_probe, |
826 | .remove = serial_pxa_remove, | 833 | .remove = serial_pxa_remove, |
827 | 834 | ||
828 | .suspend = serial_pxa_suspend, | ||
829 | .resume = serial_pxa_resume, | ||
830 | .driver = { | 835 | .driver = { |
831 | .name = "pxa2xx-uart", | 836 | .name = "pxa2xx-uart", |
832 | .owner = THIS_MODULE, | 837 | .owner = THIS_MODULE, |
838 | #ifdef CONFIG_PM | ||
839 | .pm = &serial_pxa_pm_ops, | ||
840 | #endif | ||
833 | }, | 841 | }, |
834 | }; | 842 | }; |
835 | 843 | ||
diff --git a/drivers/spi/amba-pl022.c b/drivers/spi/amba-pl022.c index c0f950a7cbec..958a3ffc8987 100644 --- a/drivers/spi/amba-pl022.c +++ b/drivers/spi/amba-pl022.c | |||
@@ -532,7 +532,7 @@ static void restore_state(struct pl022 *pl022) | |||
532 | GEN_MASK_BITS(SSP_DATA_BITS_12, SSP_CR0_MASK_DSS, 0) | \ | 532 | GEN_MASK_BITS(SSP_DATA_BITS_12, SSP_CR0_MASK_DSS, 0) | \ |
533 | GEN_MASK_BITS(SSP_MICROWIRE_CHANNEL_FULL_DUPLEX, SSP_CR0_MASK_HALFDUP, 5) | \ | 533 | GEN_MASK_BITS(SSP_MICROWIRE_CHANNEL_FULL_DUPLEX, SSP_CR0_MASK_HALFDUP, 5) | \ |
534 | GEN_MASK_BITS(SSP_CLK_POL_IDLE_LOW, SSP_CR0_MASK_SPO, 6) | \ | 534 | GEN_MASK_BITS(SSP_CLK_POL_IDLE_LOW, SSP_CR0_MASK_SPO, 6) | \ |
535 | GEN_MASK_BITS(SSP_CLK_FALLING_EDGE, SSP_CR0_MASK_SPH, 7) | \ | 535 | GEN_MASK_BITS(SSP_CLK_SECOND_EDGE, SSP_CR0_MASK_SPH, 7) | \ |
536 | GEN_MASK_BITS(NMDK_SSP_DEFAULT_CLKRATE, SSP_CR0_MASK_SCR, 8) | \ | 536 | GEN_MASK_BITS(NMDK_SSP_DEFAULT_CLKRATE, SSP_CR0_MASK_SCR, 8) | \ |
537 | GEN_MASK_BITS(SSP_BITS_8, SSP_CR0_MASK_CSS, 16) | \ | 537 | GEN_MASK_BITS(SSP_BITS_8, SSP_CR0_MASK_CSS, 16) | \ |
538 | GEN_MASK_BITS(SSP_INTERFACE_MOTOROLA_SPI, SSP_CR0_MASK_FRF, 21) \ | 538 | GEN_MASK_BITS(SSP_INTERFACE_MOTOROLA_SPI, SSP_CR0_MASK_FRF, 21) \ |
@@ -1247,8 +1247,8 @@ static int verify_controller_parameters(struct pl022 *pl022, | |||
1247 | return -EINVAL; | 1247 | return -EINVAL; |
1248 | } | 1248 | } |
1249 | if (chip_info->iface == SSP_INTERFACE_MOTOROLA_SPI) { | 1249 | if (chip_info->iface == SSP_INTERFACE_MOTOROLA_SPI) { |
1250 | if ((chip_info->clk_phase != SSP_CLK_RISING_EDGE) | 1250 | if ((chip_info->clk_phase != SSP_CLK_FIRST_EDGE) |
1251 | && (chip_info->clk_phase != SSP_CLK_FALLING_EDGE)) { | 1251 | && (chip_info->clk_phase != SSP_CLK_SECOND_EDGE)) { |
1252 | dev_err(chip_info->dev, | 1252 | dev_err(chip_info->dev, |
1253 | "Clock Phase is configured incorrectly\n"); | 1253 | "Clock Phase is configured incorrectly\n"); |
1254 | return -EINVAL; | 1254 | return -EINVAL; |
@@ -1485,7 +1485,7 @@ static int pl022_setup(struct spi_device *spi) | |||
1485 | chip_info->data_size = SSP_DATA_BITS_12; | 1485 | chip_info->data_size = SSP_DATA_BITS_12; |
1486 | chip_info->rx_lev_trig = SSP_RX_1_OR_MORE_ELEM; | 1486 | chip_info->rx_lev_trig = SSP_RX_1_OR_MORE_ELEM; |
1487 | chip_info->tx_lev_trig = SSP_TX_1_OR_MORE_EMPTY_LOC; | 1487 | chip_info->tx_lev_trig = SSP_TX_1_OR_MORE_EMPTY_LOC; |
1488 | chip_info->clk_phase = SSP_CLK_FALLING_EDGE; | 1488 | chip_info->clk_phase = SSP_CLK_SECOND_EDGE; |
1489 | chip_info->clk_pol = SSP_CLK_POL_IDLE_LOW; | 1489 | chip_info->clk_pol = SSP_CLK_POL_IDLE_LOW; |
1490 | chip_info->ctrl_len = SSP_BITS_8; | 1490 | chip_info->ctrl_len = SSP_BITS_8; |
1491 | chip_info->wait_state = SSP_MWIRE_WAIT_ZERO; | 1491 | chip_info->wait_state = SSP_MWIRE_WAIT_ZERO; |
diff --git a/drivers/spi/pxa2xx_spi.c b/drivers/spi/pxa2xx_spi.c index 31dd56f0dae9..c8c2b693ffac 100644 --- a/drivers/spi/pxa2xx_spi.c +++ b/drivers/spi/pxa2xx_spi.c | |||
@@ -1668,10 +1668,9 @@ static void pxa2xx_spi_shutdown(struct platform_device *pdev) | |||
1668 | } | 1668 | } |
1669 | 1669 | ||
1670 | #ifdef CONFIG_PM | 1670 | #ifdef CONFIG_PM |
1671 | 1671 | static int pxa2xx_spi_suspend(struct device *dev) | |
1672 | static int pxa2xx_spi_suspend(struct platform_device *pdev, pm_message_t state) | ||
1673 | { | 1672 | { |
1674 | struct driver_data *drv_data = platform_get_drvdata(pdev); | 1673 | struct driver_data *drv_data = dev_get_drvdata(dev); |
1675 | struct ssp_device *ssp = drv_data->ssp; | 1674 | struct ssp_device *ssp = drv_data->ssp; |
1676 | int status = 0; | 1675 | int status = 0; |
1677 | 1676 | ||
@@ -1684,9 +1683,9 @@ static int pxa2xx_spi_suspend(struct platform_device *pdev, pm_message_t state) | |||
1684 | return 0; | 1683 | return 0; |
1685 | } | 1684 | } |
1686 | 1685 | ||
1687 | static int pxa2xx_spi_resume(struct platform_device *pdev) | 1686 | static int pxa2xx_spi_resume(struct device *dev) |
1688 | { | 1687 | { |
1689 | struct driver_data *drv_data = platform_get_drvdata(pdev); | 1688 | struct driver_data *drv_data = dev_get_drvdata(dev); |
1690 | struct ssp_device *ssp = drv_data->ssp; | 1689 | struct ssp_device *ssp = drv_data->ssp; |
1691 | int status = 0; | 1690 | int status = 0; |
1692 | 1691 | ||
@@ -1703,26 +1702,29 @@ static int pxa2xx_spi_resume(struct platform_device *pdev) | |||
1703 | /* Start the queue running */ | 1702 | /* Start the queue running */ |
1704 | status = start_queue(drv_data); | 1703 | status = start_queue(drv_data); |
1705 | if (status != 0) { | 1704 | if (status != 0) { |
1706 | dev_err(&pdev->dev, "problem starting queue (%d)\n", status); | 1705 | dev_err(dev, "problem starting queue (%d)\n", status); |
1707 | return status; | 1706 | return status; |
1708 | } | 1707 | } |
1709 | 1708 | ||
1710 | return 0; | 1709 | return 0; |
1711 | } | 1710 | } |
1712 | #else | 1711 | |
1713 | #define pxa2xx_spi_suspend NULL | 1712 | static struct dev_pm_ops pxa2xx_spi_pm_ops = { |
1714 | #define pxa2xx_spi_resume NULL | 1713 | .suspend = pxa2xx_spi_suspend, |
1715 | #endif /* CONFIG_PM */ | 1714 | .resume = pxa2xx_spi_resume, |
1715 | }; | ||
1716 | #endif | ||
1716 | 1717 | ||
1717 | static struct platform_driver driver = { | 1718 | static struct platform_driver driver = { |
1718 | .driver = { | 1719 | .driver = { |
1719 | .name = "pxa2xx-spi", | 1720 | .name = "pxa2xx-spi", |
1720 | .owner = THIS_MODULE, | 1721 | .owner = THIS_MODULE, |
1722 | #ifdef CONFIG_PM | ||
1723 | .pm = &pxa2xx_spi_pm_ops, | ||
1724 | #endif | ||
1721 | }, | 1725 | }, |
1722 | .remove = pxa2xx_spi_remove, | 1726 | .remove = pxa2xx_spi_remove, |
1723 | .shutdown = pxa2xx_spi_shutdown, | 1727 | .shutdown = pxa2xx_spi_shutdown, |
1724 | .suspend = pxa2xx_spi_suspend, | ||
1725 | .resume = pxa2xx_spi_resume, | ||
1726 | }; | 1728 | }; |
1727 | 1729 | ||
1728 | static int __init pxa2xx_spi_init(void) | 1730 | static int __init pxa2xx_spi_init(void) |
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c index b5294a9344de..f1c06202fdf2 100644 --- a/drivers/usb/host/ohci-pxa27x.c +++ b/drivers/usb/host/ohci-pxa27x.c | |||
@@ -481,38 +481,47 @@ static int ohci_hcd_pxa27x_drv_remove(struct platform_device *pdev) | |||
481 | return 0; | 481 | return 0; |
482 | } | 482 | } |
483 | 483 | ||
484 | #ifdef CONFIG_PM | 484 | #ifdef CONFIG_PM |
485 | static int ohci_hcd_pxa27x_drv_suspend(struct platform_device *pdev, pm_message_t state) | 485 | static int ohci_hcd_pxa27x_drv_suspend(struct device *dev) |
486 | { | 486 | { |
487 | struct usb_hcd *hcd = platform_get_drvdata(pdev); | 487 | struct usb_hcd *hcd = dev_get_drvdata(dev); |
488 | struct pxa27x_ohci *ohci = to_pxa27x_ohci(hcd); | 488 | struct pxa27x_ohci *ohci = to_pxa27x_ohci(hcd); |
489 | 489 | ||
490 | if (time_before(jiffies, ohci->ohci.next_statechange)) | 490 | if (time_before(jiffies, ohci->ohci.next_statechange)) |
491 | msleep(5); | 491 | msleep(5); |
492 | ohci->ohci.next_statechange = jiffies; | 492 | ohci->ohci.next_statechange = jiffies; |
493 | 493 | ||
494 | pxa27x_stop_hc(ohci, &pdev->dev); | 494 | pxa27x_stop_hc(ohci, dev); |
495 | hcd->state = HC_STATE_SUSPENDED; | 495 | hcd->state = HC_STATE_SUSPENDED; |
496 | 496 | ||
497 | return 0; | 497 | return 0; |
498 | } | 498 | } |
499 | 499 | ||
500 | static int ohci_hcd_pxa27x_drv_resume(struct platform_device *pdev) | 500 | static int ohci_hcd_pxa27x_drv_resume(struct device *dev) |
501 | { | 501 | { |
502 | struct usb_hcd *hcd = platform_get_drvdata(pdev); | 502 | struct usb_hcd *hcd = dev_get_drvdata(dev); |
503 | struct pxa27x_ohci *ohci = to_pxa27x_ohci(hcd); | 503 | struct pxa27x_ohci *ohci = to_pxa27x_ohci(hcd); |
504 | struct pxaohci_platform_data *inf = dev->platform_data; | ||
504 | int status; | 505 | int status; |
505 | 506 | ||
506 | if (time_before(jiffies, ohci->ohci.next_statechange)) | 507 | if (time_before(jiffies, ohci->ohci.next_statechange)) |
507 | msleep(5); | 508 | msleep(5); |
508 | ohci->ohci.next_statechange = jiffies; | 509 | ohci->ohci.next_statechange = jiffies; |
509 | 510 | ||
510 | if ((status = pxa27x_start_hc(ohci, &pdev->dev)) < 0) | 511 | if ((status = pxa27x_start_hc(ohci, dev)) < 0) |
511 | return status; | 512 | return status; |
512 | 513 | ||
514 | /* Select Power Management Mode */ | ||
515 | pxa27x_ohci_select_pmm(ohci, inf->port_mode); | ||
516 | |||
513 | ohci_finish_controller_resume(hcd); | 517 | ohci_finish_controller_resume(hcd); |
514 | return 0; | 518 | return 0; |
515 | } | 519 | } |
520 | |||
521 | static struct dev_pm_ops ohci_hcd_pxa27x_pm_ops = { | ||
522 | .suspend = ohci_hcd_pxa27x_drv_suspend, | ||
523 | .resume = ohci_hcd_pxa27x_drv_resume, | ||
524 | }; | ||
516 | #endif | 525 | #endif |
517 | 526 | ||
518 | /* work with hotplug and coldplug */ | 527 | /* work with hotplug and coldplug */ |
@@ -522,13 +531,12 @@ static struct platform_driver ohci_hcd_pxa27x_driver = { | |||
522 | .probe = ohci_hcd_pxa27x_drv_probe, | 531 | .probe = ohci_hcd_pxa27x_drv_probe, |
523 | .remove = ohci_hcd_pxa27x_drv_remove, | 532 | .remove = ohci_hcd_pxa27x_drv_remove, |
524 | .shutdown = usb_hcd_platform_shutdown, | 533 | .shutdown = usb_hcd_platform_shutdown, |
525 | #ifdef CONFIG_PM | ||
526 | .suspend = ohci_hcd_pxa27x_drv_suspend, | ||
527 | .resume = ohci_hcd_pxa27x_drv_resume, | ||
528 | #endif | ||
529 | .driver = { | 534 | .driver = { |
530 | .name = "pxa27x-ohci", | 535 | .name = "pxa27x-ohci", |
531 | .owner = THIS_MODULE, | 536 | .owner = THIS_MODULE, |
537 | #ifdef CONFIG_PM | ||
538 | .pm = &ohci_hcd_pxa27x_pm_ops, | ||
539 | #endif | ||
532 | }, | 540 | }, |
533 | }; | 541 | }; |
534 | 542 | ||
diff --git a/drivers/video/backlight/da903x_bl.c b/drivers/video/backlight/da903x_bl.c index 93bb4340cc64..701a1081e199 100644 --- a/drivers/video/backlight/da903x_bl.c +++ b/drivers/video/backlight/da903x_bl.c | |||
@@ -154,34 +154,38 @@ static int da903x_backlight_remove(struct platform_device *pdev) | |||
154 | } | 154 | } |
155 | 155 | ||
156 | #ifdef CONFIG_PM | 156 | #ifdef CONFIG_PM |
157 | static int da903x_backlight_suspend(struct platform_device *pdev, | 157 | static int da903x_backlight_suspend(struct device *dev) |
158 | pm_message_t state) | ||
159 | { | 158 | { |
159 | struct platform_device *pdev = to_platform_device(dev); | ||
160 | struct backlight_device *bl = platform_get_drvdata(pdev); | 160 | struct backlight_device *bl = platform_get_drvdata(pdev); |
161 | return da903x_backlight_set(bl, 0); | 161 | return da903x_backlight_set(bl, 0); |
162 | } | 162 | } |
163 | 163 | ||
164 | static int da903x_backlight_resume(struct platform_device *pdev) | 164 | static int da903x_backlight_resume(struct device *dev) |
165 | { | 165 | { |
166 | struct platform_device *pdev = to_platform_device(dev); | ||
166 | struct backlight_device *bl = platform_get_drvdata(pdev); | 167 | struct backlight_device *bl = platform_get_drvdata(pdev); |
167 | 168 | ||
168 | backlight_update_status(bl); | 169 | backlight_update_status(bl); |
169 | return 0; | 170 | return 0; |
170 | } | 171 | } |
171 | #else | 172 | |
172 | #define da903x_backlight_suspend NULL | 173 | static struct dev_pm_ops da903x_backlight_pm_ops = { |
173 | #define da903x_backlight_resume NULL | 174 | .suspend = da903x_backlight_suspend, |
175 | .resume = da903x_backlight_resume, | ||
176 | }; | ||
174 | #endif | 177 | #endif |
175 | 178 | ||
176 | static struct platform_driver da903x_backlight_driver = { | 179 | static struct platform_driver da903x_backlight_driver = { |
177 | .driver = { | 180 | .driver = { |
178 | .name = "da903x-backlight", | 181 | .name = "da903x-backlight", |
179 | .owner = THIS_MODULE, | 182 | .owner = THIS_MODULE, |
183 | #ifdef CONFIG_PM | ||
184 | .pm = &da903x_backlight_pm_ops, | ||
185 | #endif | ||
180 | }, | 186 | }, |
181 | .probe = da903x_backlight_probe, | 187 | .probe = da903x_backlight_probe, |
182 | .remove = da903x_backlight_remove, | 188 | .remove = da903x_backlight_remove, |
183 | .suspend = da903x_backlight_suspend, | ||
184 | .resume = da903x_backlight_resume, | ||
185 | }; | 189 | }; |
186 | 190 | ||
187 | static int __init da903x_backlight_init(void) | 191 | static int __init da903x_backlight_init(void) |
diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c index 6506117c134b..1820c4a24434 100644 --- a/drivers/video/pxafb.c +++ b/drivers/video/pxafb.c | |||
@@ -1638,24 +1638,26 @@ pxafb_freq_policy(struct notifier_block *nb, unsigned long val, void *data) | |||
1638 | * Power management hooks. Note that we won't be called from IRQ context, | 1638 | * Power management hooks. Note that we won't be called from IRQ context, |
1639 | * unlike the blank functions above, so we may sleep. | 1639 | * unlike the blank functions above, so we may sleep. |
1640 | */ | 1640 | */ |
1641 | static int pxafb_suspend(struct platform_device *dev, pm_message_t state) | 1641 | static int pxafb_suspend(struct device *dev) |
1642 | { | 1642 | { |
1643 | struct pxafb_info *fbi = platform_get_drvdata(dev); | 1643 | struct pxafb_info *fbi = dev_get_drvdata(dev); |
1644 | 1644 | ||
1645 | set_ctrlr_state(fbi, C_DISABLE_PM); | 1645 | set_ctrlr_state(fbi, C_DISABLE_PM); |
1646 | return 0; | 1646 | return 0; |
1647 | } | 1647 | } |
1648 | 1648 | ||
1649 | static int pxafb_resume(struct platform_device *dev) | 1649 | static int pxafb_resume(struct device *dev) |
1650 | { | 1650 | { |
1651 | struct pxafb_info *fbi = platform_get_drvdata(dev); | 1651 | struct pxafb_info *fbi = dev_get_drvdata(dev); |
1652 | 1652 | ||
1653 | set_ctrlr_state(fbi, C_ENABLE_PM); | 1653 | set_ctrlr_state(fbi, C_ENABLE_PM); |
1654 | return 0; | 1654 | return 0; |
1655 | } | 1655 | } |
1656 | #else | 1656 | |
1657 | #define pxafb_suspend NULL | 1657 | static struct dev_pm_ops pxafb_pm_ops = { |
1658 | #define pxafb_resume NULL | 1658 | .suspend = pxafb_suspend, |
1659 | .resume = pxafb_resume, | ||
1660 | }; | ||
1659 | #endif | 1661 | #endif |
1660 | 1662 | ||
1661 | static int __devinit pxafb_init_video_memory(struct pxafb_info *fbi) | 1663 | static int __devinit pxafb_init_video_memory(struct pxafb_info *fbi) |
@@ -2081,6 +2083,9 @@ static int __devinit pxafb_probe(struct platform_device *dev) | |||
2081 | goto failed; | 2083 | goto failed; |
2082 | } | 2084 | } |
2083 | 2085 | ||
2086 | if (cpu_is_pxa3xx() && inf->acceleration_enabled) | ||
2087 | fbi->fb.fix.accel = FB_ACCEL_PXA3XX; | ||
2088 | |||
2084 | fbi->backlight_power = inf->pxafb_backlight_power; | 2089 | fbi->backlight_power = inf->pxafb_backlight_power; |
2085 | fbi->lcd_power = inf->pxafb_lcd_power; | 2090 | fbi->lcd_power = inf->pxafb_lcd_power; |
2086 | 2091 | ||
@@ -2091,14 +2096,14 @@ static int __devinit pxafb_probe(struct platform_device *dev) | |||
2091 | goto failed_fbi; | 2096 | goto failed_fbi; |
2092 | } | 2097 | } |
2093 | 2098 | ||
2094 | r = request_mem_region(r->start, r->end - r->start + 1, dev->name); | 2099 | r = request_mem_region(r->start, resource_size(r), dev->name); |
2095 | if (r == NULL) { | 2100 | if (r == NULL) { |
2096 | dev_err(&dev->dev, "failed to request I/O memory\n"); | 2101 | dev_err(&dev->dev, "failed to request I/O memory\n"); |
2097 | ret = -EBUSY; | 2102 | ret = -EBUSY; |
2098 | goto failed_fbi; | 2103 | goto failed_fbi; |
2099 | } | 2104 | } |
2100 | 2105 | ||
2101 | fbi->mmio_base = ioremap(r->start, r->end - r->start + 1); | 2106 | fbi->mmio_base = ioremap(r->start, resource_size(r)); |
2102 | if (fbi->mmio_base == NULL) { | 2107 | if (fbi->mmio_base == NULL) { |
2103 | dev_err(&dev->dev, "failed to map I/O memory\n"); | 2108 | dev_err(&dev->dev, "failed to map I/O memory\n"); |
2104 | ret = -EBUSY; | 2109 | ret = -EBUSY; |
@@ -2197,7 +2202,7 @@ failed_free_dma: | |||
2197 | failed_free_io: | 2202 | failed_free_io: |
2198 | iounmap(fbi->mmio_base); | 2203 | iounmap(fbi->mmio_base); |
2199 | failed_free_res: | 2204 | failed_free_res: |
2200 | release_mem_region(r->start, r->end - r->start + 1); | 2205 | release_mem_region(r->start, resource_size(r)); |
2201 | failed_fbi: | 2206 | failed_fbi: |
2202 | clk_put(fbi->clk); | 2207 | clk_put(fbi->clk); |
2203 | platform_set_drvdata(dev, NULL); | 2208 | platform_set_drvdata(dev, NULL); |
@@ -2237,7 +2242,7 @@ static int __devexit pxafb_remove(struct platform_device *dev) | |||
2237 | iounmap(fbi->mmio_base); | 2242 | iounmap(fbi->mmio_base); |
2238 | 2243 | ||
2239 | r = platform_get_resource(dev, IORESOURCE_MEM, 0); | 2244 | r = platform_get_resource(dev, IORESOURCE_MEM, 0); |
2240 | release_mem_region(r->start, r->end - r->start + 1); | 2245 | release_mem_region(r->start, resource_size(r)); |
2241 | 2246 | ||
2242 | clk_put(fbi->clk); | 2247 | clk_put(fbi->clk); |
2243 | kfree(fbi); | 2248 | kfree(fbi); |
@@ -2248,11 +2253,12 @@ static int __devexit pxafb_remove(struct platform_device *dev) | |||
2248 | static struct platform_driver pxafb_driver = { | 2253 | static struct platform_driver pxafb_driver = { |
2249 | .probe = pxafb_probe, | 2254 | .probe = pxafb_probe, |
2250 | .remove = __devexit_p(pxafb_remove), | 2255 | .remove = __devexit_p(pxafb_remove), |
2251 | .suspend = pxafb_suspend, | ||
2252 | .resume = pxafb_resume, | ||
2253 | .driver = { | 2256 | .driver = { |
2254 | .owner = THIS_MODULE, | 2257 | .owner = THIS_MODULE, |
2255 | .name = "pxa2xx-fb", | 2258 | .name = "pxa2xx-fb", |
2259 | #ifdef CONFIG_PM | ||
2260 | .pm = &pxafb_pm_ops, | ||
2261 | #endif | ||
2256 | }, | 2262 | }, |
2257 | }; | 2263 | }; |
2258 | 2264 | ||
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index ff3eb8ff6bd7..3711b888d482 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig | |||
@@ -282,6 +282,13 @@ config NUC900_WATCHDOG | |||
282 | To compile this driver as a module, choose M here: the | 282 | To compile this driver as a module, choose M here: the |
283 | module will be called nuc900_wdt. | 283 | module will be called nuc900_wdt. |
284 | 284 | ||
285 | config ADX_WATCHDOG | ||
286 | tristate "Avionic Design Xanthos watchdog" | ||
287 | depends on ARCH_PXA_ADX | ||
288 | help | ||
289 | Say Y here if you want support for the watchdog timer on Avionic | ||
290 | Design Xanthos boards. | ||
291 | |||
285 | # AVR32 Architecture | 292 | # AVR32 Architecture |
286 | 293 | ||
287 | config AT32AP700X_WDT | 294 | config AT32AP700X_WDT |
diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile index 348b3b862c99..699199b1baa6 100644 --- a/drivers/watchdog/Makefile +++ b/drivers/watchdog/Makefile | |||
@@ -45,6 +45,7 @@ obj-$(CONFIG_ORION_WATCHDOG) += orion_wdt.o | |||
45 | obj-$(CONFIG_COH901327_WATCHDOG) += coh901327_wdt.o | 45 | obj-$(CONFIG_COH901327_WATCHDOG) += coh901327_wdt.o |
46 | obj-$(CONFIG_STMP3XXX_WATCHDOG) += stmp3xxx_wdt.o | 46 | obj-$(CONFIG_STMP3XXX_WATCHDOG) += stmp3xxx_wdt.o |
47 | obj-$(CONFIG_NUC900_WATCHDOG) += nuc900_wdt.o | 47 | obj-$(CONFIG_NUC900_WATCHDOG) += nuc900_wdt.o |
48 | obj-$(CONFIG_ADX_WATCHDOG) += adx_wdt.o | ||
48 | 49 | ||
49 | # AVR32 Architecture | 50 | # AVR32 Architecture |
50 | obj-$(CONFIG_AT32AP700X_WDT) += at32ap700x_wdt.o | 51 | obj-$(CONFIG_AT32AP700X_WDT) += at32ap700x_wdt.o |
diff --git a/drivers/watchdog/adx_wdt.c b/drivers/watchdog/adx_wdt.c new file mode 100644 index 000000000000..77afb0acc500 --- /dev/null +++ b/drivers/watchdog/adx_wdt.c | |||
@@ -0,0 +1,354 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2008-2009 Avionic Design GmbH | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | |||
9 | #include <linux/fs.h> | ||
10 | #include <linux/io.h> | ||
11 | #include <linux/miscdevice.h> | ||
12 | #include <linux/module.h> | ||
13 | #include <linux/platform_device.h> | ||
14 | #include <linux/types.h> | ||
15 | #include <linux/uaccess.h> | ||
16 | #include <linux/watchdog.h> | ||
17 | |||
18 | #define WATCHDOG_NAME "adx-wdt" | ||
19 | |||
20 | /* register offsets */ | ||
21 | #define ADX_WDT_CONTROL 0x00 | ||
22 | #define ADX_WDT_CONTROL_ENABLE (1 << 0) | ||
23 | #define ADX_WDT_CONTROL_nRESET (1 << 1) | ||
24 | #define ADX_WDT_TIMEOUT 0x08 | ||
25 | |||
26 | static struct platform_device *adx_wdt_dev; | ||
27 | static unsigned long driver_open; | ||
28 | |||
29 | #define WDT_STATE_STOP 0 | ||
30 | #define WDT_STATE_START 1 | ||
31 | |||
32 | struct adx_wdt { | ||
33 | void __iomem *base; | ||
34 | unsigned long timeout; | ||
35 | unsigned int state; | ||
36 | unsigned int wake; | ||
37 | spinlock_t lock; | ||
38 | }; | ||
39 | |||
40 | static struct watchdog_info adx_wdt_info = { | ||
41 | .identity = "Avionic Design Xanthos Watchdog", | ||
42 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, | ||
43 | }; | ||
44 | |||
45 | static void adx_wdt_start_locked(struct adx_wdt *wdt) | ||
46 | { | ||
47 | u32 ctrl; | ||
48 | |||
49 | ctrl = readl(wdt->base + ADX_WDT_CONTROL); | ||
50 | ctrl |= ADX_WDT_CONTROL_ENABLE; | ||
51 | writel(ctrl, wdt->base + ADX_WDT_CONTROL); | ||
52 | wdt->state = WDT_STATE_START; | ||
53 | } | ||
54 | |||
55 | static void adx_wdt_start(struct adx_wdt *wdt) | ||
56 | { | ||
57 | unsigned long flags; | ||
58 | |||
59 | spin_lock_irqsave(&wdt->lock, flags); | ||
60 | adx_wdt_start_locked(wdt); | ||
61 | spin_unlock_irqrestore(&wdt->lock, flags); | ||
62 | } | ||
63 | |||
64 | static void adx_wdt_stop_locked(struct adx_wdt *wdt) | ||
65 | { | ||
66 | u32 ctrl; | ||
67 | |||
68 | ctrl = readl(wdt->base + ADX_WDT_CONTROL); | ||
69 | ctrl &= ~ADX_WDT_CONTROL_ENABLE; | ||
70 | writel(ctrl, wdt->base + ADX_WDT_CONTROL); | ||
71 | wdt->state = WDT_STATE_STOP; | ||
72 | } | ||
73 | |||
74 | static void adx_wdt_stop(struct adx_wdt *wdt) | ||
75 | { | ||
76 | unsigned long flags; | ||
77 | |||
78 | spin_lock_irqsave(&wdt->lock, flags); | ||
79 | adx_wdt_stop_locked(wdt); | ||
80 | spin_unlock_irqrestore(&wdt->lock, flags); | ||
81 | } | ||
82 | |||
83 | static void adx_wdt_set_timeout(struct adx_wdt *wdt, unsigned long seconds) | ||
84 | { | ||
85 | unsigned long timeout = seconds * 1000; | ||
86 | unsigned long flags; | ||
87 | unsigned int state; | ||
88 | |||
89 | spin_lock_irqsave(&wdt->lock, flags); | ||
90 | state = wdt->state; | ||
91 | adx_wdt_stop_locked(wdt); | ||
92 | writel(timeout, wdt->base + ADX_WDT_TIMEOUT); | ||
93 | |||
94 | if (state == WDT_STATE_START) | ||
95 | adx_wdt_start_locked(wdt); | ||
96 | |||
97 | wdt->timeout = timeout; | ||
98 | spin_unlock_irqrestore(&wdt->lock, flags); | ||
99 | } | ||
100 | |||
101 | static void adx_wdt_get_timeout(struct adx_wdt *wdt, unsigned long *seconds) | ||
102 | { | ||
103 | *seconds = wdt->timeout / 1000; | ||
104 | } | ||
105 | |||
106 | static void adx_wdt_keepalive(struct adx_wdt *wdt) | ||
107 | { | ||
108 | unsigned long flags; | ||
109 | |||
110 | spin_lock_irqsave(&wdt->lock, flags); | ||
111 | writel(wdt->timeout, wdt->base + ADX_WDT_TIMEOUT); | ||
112 | spin_unlock_irqrestore(&wdt->lock, flags); | ||
113 | } | ||
114 | |||
115 | static int adx_wdt_open(struct inode *inode, struct file *file) | ||
116 | { | ||
117 | struct adx_wdt *wdt = platform_get_drvdata(adx_wdt_dev); | ||
118 | |||
119 | if (test_and_set_bit(0, &driver_open)) | ||
120 | return -EBUSY; | ||
121 | |||
122 | file->private_data = wdt; | ||
123 | adx_wdt_set_timeout(wdt, 30); | ||
124 | adx_wdt_start(wdt); | ||
125 | |||
126 | return nonseekable_open(inode, file); | ||
127 | } | ||
128 | |||
129 | static int adx_wdt_release(struct inode *inode, struct file *file) | ||
130 | { | ||
131 | struct adx_wdt *wdt = file->private_data; | ||
132 | |||
133 | adx_wdt_stop(wdt); | ||
134 | clear_bit(0, &driver_open); | ||
135 | |||
136 | return 0; | ||
137 | } | ||
138 | |||
139 | static long adx_wdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | ||
140 | { | ||
141 | struct adx_wdt *wdt = file->private_data; | ||
142 | void __user *argp = (void __user *)arg; | ||
143 | unsigned long __user *p = argp; | ||
144 | unsigned long seconds = 0; | ||
145 | unsigned int options; | ||
146 | long ret = -EINVAL; | ||
147 | |||
148 | switch (cmd) { | ||
149 | case WDIOC_GETSUPPORT: | ||
150 | if (copy_to_user(argp, &adx_wdt_info, sizeof(adx_wdt_info))) | ||
151 | return -EFAULT; | ||
152 | else | ||
153 | return 0; | ||
154 | |||
155 | case WDIOC_GETSTATUS: | ||
156 | case WDIOC_GETBOOTSTATUS: | ||
157 | return put_user(0, p); | ||
158 | |||
159 | case WDIOC_KEEPALIVE: | ||
160 | adx_wdt_keepalive(wdt); | ||
161 | return 0; | ||
162 | |||
163 | case WDIOC_SETTIMEOUT: | ||
164 | if (get_user(seconds, p)) | ||
165 | return -EFAULT; | ||
166 | |||
167 | adx_wdt_set_timeout(wdt, seconds); | ||
168 | |||
169 | /* fallthrough */ | ||
170 | case WDIOC_GETTIMEOUT: | ||
171 | adx_wdt_get_timeout(wdt, &seconds); | ||
172 | return put_user(seconds, p); | ||
173 | |||
174 | case WDIOC_SETOPTIONS: | ||
175 | if (copy_from_user(&options, argp, sizeof(options))) | ||
176 | return -EFAULT; | ||
177 | |||
178 | if (options & WDIOS_DISABLECARD) { | ||
179 | adx_wdt_stop(wdt); | ||
180 | ret = 0; | ||
181 | } | ||
182 | |||
183 | if (options & WDIOS_ENABLECARD) { | ||
184 | adx_wdt_start(wdt); | ||
185 | ret = 0; | ||
186 | } | ||
187 | |||
188 | return ret; | ||
189 | |||
190 | default: | ||
191 | break; | ||
192 | } | ||
193 | |||
194 | return -ENOTTY; | ||
195 | } | ||
196 | |||
197 | static ssize_t adx_wdt_write(struct file *file, const char __user *data, | ||
198 | size_t len, loff_t *ppos) | ||
199 | { | ||
200 | struct adx_wdt *wdt = file->private_data; | ||
201 | |||
202 | if (len) | ||
203 | adx_wdt_keepalive(wdt); | ||
204 | |||
205 | return len; | ||
206 | } | ||
207 | |||
208 | static const struct file_operations adx_wdt_fops = { | ||
209 | .owner = THIS_MODULE, | ||
210 | .llseek = no_llseek, | ||
211 | .open = adx_wdt_open, | ||
212 | .release = adx_wdt_release, | ||
213 | .unlocked_ioctl = adx_wdt_ioctl, | ||
214 | .write = adx_wdt_write, | ||
215 | }; | ||
216 | |||
217 | static struct miscdevice adx_wdt_miscdev = { | ||
218 | .minor = WATCHDOG_MINOR, | ||
219 | .name = "watchdog", | ||
220 | .fops = &adx_wdt_fops, | ||
221 | }; | ||
222 | |||
223 | static int __devinit adx_wdt_probe(struct platform_device *pdev) | ||
224 | { | ||
225 | struct resource *res; | ||
226 | struct adx_wdt *wdt; | ||
227 | int ret = 0; | ||
228 | u32 ctrl; | ||
229 | |||
230 | wdt = devm_kzalloc(&pdev->dev, sizeof(*wdt), GFP_KERNEL); | ||
231 | if (!wdt) { | ||
232 | dev_err(&pdev->dev, "cannot allocate WDT structure\n"); | ||
233 | return -ENOMEM; | ||
234 | } | ||
235 | |||
236 | spin_lock_init(&wdt->lock); | ||
237 | |||
238 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
239 | if (!res) { | ||
240 | dev_err(&pdev->dev, "cannot obtain I/O memory region\n"); | ||
241 | return -ENXIO; | ||
242 | } | ||
243 | |||
244 | res = devm_request_mem_region(&pdev->dev, res->start, | ||
245 | res->end - res->start + 1, res->name); | ||
246 | if (!res) { | ||
247 | dev_err(&pdev->dev, "cannot request I/O memory region\n"); | ||
248 | return -ENXIO; | ||
249 | } | ||
250 | |||
251 | wdt->base = devm_ioremap_nocache(&pdev->dev, res->start, | ||
252 | res->end - res->start + 1); | ||
253 | if (!wdt->base) { | ||
254 | dev_err(&pdev->dev, "cannot remap I/O memory region\n"); | ||
255 | return -ENXIO; | ||
256 | } | ||
257 | |||
258 | /* disable watchdog and reboot on timeout */ | ||
259 | ctrl = readl(wdt->base + ADX_WDT_CONTROL); | ||
260 | ctrl &= ~ADX_WDT_CONTROL_ENABLE; | ||
261 | ctrl &= ~ADX_WDT_CONTROL_nRESET; | ||
262 | writel(ctrl, wdt->base + ADX_WDT_CONTROL); | ||
263 | |||
264 | platform_set_drvdata(pdev, wdt); | ||
265 | adx_wdt_dev = pdev; | ||
266 | |||
267 | ret = misc_register(&adx_wdt_miscdev); | ||
268 | if (ret) { | ||
269 | dev_err(&pdev->dev, "cannot register miscdev on minor %d " | ||
270 | "(err=%d)\n", WATCHDOG_MINOR, ret); | ||
271 | return ret; | ||
272 | } | ||
273 | |||
274 | return 0; | ||
275 | } | ||
276 | |||
277 | static int __devexit adx_wdt_remove(struct platform_device *pdev) | ||
278 | { | ||
279 | struct adx_wdt *wdt = platform_get_drvdata(pdev); | ||
280 | |||
281 | misc_deregister(&adx_wdt_miscdev); | ||
282 | adx_wdt_stop(wdt); | ||
283 | platform_set_drvdata(pdev, NULL); | ||
284 | |||
285 | return 0; | ||
286 | } | ||
287 | |||
288 | static void adx_wdt_shutdown(struct platform_device *pdev) | ||
289 | { | ||
290 | struct adx_wdt *wdt = platform_get_drvdata(pdev); | ||
291 | adx_wdt_stop(wdt); | ||
292 | } | ||
293 | |||
294 | #ifdef CONFIG_PM | ||
295 | static int adx_wdt_suspend(struct device *dev) | ||
296 | { | ||
297 | struct platform_device *pdev = to_platform_device(dev); | ||
298 | struct adx_wdt *wdt = platform_get_drvdata(pdev); | ||
299 | |||
300 | wdt->wake = (wdt->state == WDT_STATE_START) ? 1 : 0; | ||
301 | adx_wdt_stop(wdt); | ||
302 | |||
303 | return 0; | ||
304 | } | ||
305 | |||
306 | static int adx_wdt_resume(struct device *dev) | ||
307 | { | ||
308 | struct platform_device *pdev = to_platform_device(dev); | ||
309 | struct adx_wdt *wdt = platform_get_drvdata(pdev); | ||
310 | |||
311 | if (wdt->wake) | ||
312 | adx_wdt_start(wdt); | ||
313 | |||
314 | return 0; | ||
315 | } | ||
316 | |||
317 | static struct dev_pm_ops adx_wdt_pm_ops = { | ||
318 | .suspend = adx_wdt_suspend, | ||
319 | .resume = adx_wdt_resume, | ||
320 | }; | ||
321 | |||
322 | # define ADX_WDT_PM_OPS (&adx_wdt_pm_ops) | ||
323 | #else | ||
324 | # define ADX_WDT_PM_OPS NULL | ||
325 | #endif | ||
326 | |||
327 | static struct platform_driver adx_wdt_driver = { | ||
328 | .probe = adx_wdt_probe, | ||
329 | .remove = __devexit_p(adx_wdt_remove), | ||
330 | .shutdown = adx_wdt_shutdown, | ||
331 | .driver = { | ||
332 | .name = WATCHDOG_NAME, | ||
333 | .owner = THIS_MODULE, | ||
334 | .pm = ADX_WDT_PM_OPS, | ||
335 | }, | ||
336 | }; | ||
337 | |||
338 | static int __init adx_wdt_init(void) | ||
339 | { | ||
340 | return platform_driver_register(&adx_wdt_driver); | ||
341 | } | ||
342 | |||
343 | static void __exit adx_wdt_exit(void) | ||
344 | { | ||
345 | platform_driver_unregister(&adx_wdt_driver); | ||
346 | } | ||
347 | |||
348 | module_init(adx_wdt_init); | ||
349 | module_exit(adx_wdt_exit); | ||
350 | |||
351 | MODULE_DESCRIPTION("Avionic Design Xanthos Watchdog Driver"); | ||
352 | MODULE_LICENSE("GPL v2"); | ||
353 | MODULE_AUTHOR("Thierry Reding <thierry.reding@avionic-design.de>"); | ||
354 | MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); | ||