aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-07-13 12:54:26 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-07-13 12:54:26 -0400
commit7801dc33bec3ad33f0de2c4138eeb6f785ada8dc (patch)
tree242892df3f0171f043cacb83cdc62911bce77c32
parent68394bfbe507f266bb13d8152976218a97f51b45 (diff)
parentb330f85d3d42cbe091736a0abd8f005b448d133a (diff)
Merge tag 'mfd-for-linus-3.5' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6
Pull MFD Fixes from Samuel Ortiz: - Three Palmas fixes, One of them being a build error fix. - Two mc13xx fixes. One for fixing an SPI regmap configuration and another one for working around an i.Mx hardware bug. - One omap-usb regression fix. - One twl6040 build breakage fix. - One file deletion (ab5500-core.h) that was overlooked during the last merge window. * tag 'mfd-for-linus-3.5' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6: mfd: Add missing hunk to change palmas irq to clear on read mfd: Fix palmas regulator pdata missing mfd: USB: Fix the omap-usb EHCI ULPI PHY reset fix issues. mfd: Update twl6040 Kconfig to avoid build breakage mfd: Delete ab5500-core.h mfd: mc13xxx workaround SPI hardware bug on i.Mx mfd: Fix mc13xxx SPI regmap mfd: Add terminating entry for i2c_device_id palmas table
-rw-r--r--drivers/mfd/Kconfig1
-rw-r--r--drivers/mfd/ab5500-core.h87
-rw-r--r--drivers/mfd/mc13xxx-spi.c67
-rw-r--r--drivers/mfd/omap-usb-host.c48
-rw-r--r--drivers/mfd/palmas.c13
-rw-r--r--drivers/usb/host/ehci-omap.c18
6 files changed, 133 insertions, 101 deletions
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index e129c820df7d..92144ed1ad46 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -286,6 +286,7 @@ config TWL6040_CORE
286 depends on I2C=y && GENERIC_HARDIRQS 286 depends on I2C=y && GENERIC_HARDIRQS
287 select MFD_CORE 287 select MFD_CORE
288 select REGMAP_I2C 288 select REGMAP_I2C
289 select IRQ_DOMAIN
289 default n 290 default n
290 help 291 help
291 Say yes here if you want support for Texas Instruments TWL6040 audio 292 Say yes here if you want support for Texas Instruments TWL6040 audio
diff --git a/drivers/mfd/ab5500-core.h b/drivers/mfd/ab5500-core.h
deleted file mode 100644
index 63b30b17e4f3..000000000000
--- a/drivers/mfd/ab5500-core.h
+++ /dev/null
@@ -1,87 +0,0 @@
1/*
2 * Copyright (C) 2011 ST-Ericsson
3 * License terms: GNU General Public License (GPL) version 2
4 * Shared definitions and data structures for the AB5500 MFD driver
5 */
6
7/* Read/write operation values. */
8#define AB5500_PERM_RD (0x01)
9#define AB5500_PERM_WR (0x02)
10
11/* Read/write permissions. */
12#define AB5500_PERM_RO (AB5500_PERM_RD)
13#define AB5500_PERM_RW (AB5500_PERM_RD | AB5500_PERM_WR)
14
15#define AB5500_MASK_BASE (0x60)
16#define AB5500_MASK_END (0x79)
17#define AB5500_CHIP_ID (0x20)
18
19/**
20 * struct ab5500_reg_range
21 * @first: the first address of the range
22 * @last: the last address of the range
23 * @perm: access permissions for the range
24 */
25struct ab5500_reg_range {
26 u8 first;
27 u8 last;
28 u8 perm;
29};
30
31/**
32 * struct ab5500_i2c_ranges
33 * @count: the number of ranges in the list
34 * @range: the list of register ranges
35 */
36struct ab5500_i2c_ranges {
37 u8 nranges;
38 u8 bankid;
39 const struct ab5500_reg_range *range;
40};
41
42/**
43 * struct ab5500_i2c_banks
44 * @count: the number of ranges in the list
45 * @range: the list of register ranges
46 */
47struct ab5500_i2c_banks {
48 u8 nbanks;
49 const struct ab5500_i2c_ranges *bank;
50};
51
52/**
53 * struct ab5500_bank
54 * @slave_addr: I2C slave_addr found in AB5500 specification
55 * @name: Documentation name of the bank. For reference
56 */
57struct ab5500_bank {
58 u8 slave_addr;
59 const char *name;
60};
61
62static const struct ab5500_bank bankinfo[AB5500_NUM_BANKS] = {
63 [AB5500_BANK_VIT_IO_I2C_CLK_TST_OTP] = {
64 AB5500_ADDR_VIT_IO_I2C_CLK_TST_OTP, "VIT_IO_I2C_CLK_TST_OTP"},
65 [AB5500_BANK_VDDDIG_IO_I2C_CLK_TST] = {
66 AB5500_ADDR_VDDDIG_IO_I2C_CLK_TST, "VDDDIG_IO_I2C_CLK_TST"},
67 [AB5500_BANK_VDENC] = {AB5500_ADDR_VDENC, "VDENC"},
68 [AB5500_BANK_SIM_USBSIM] = {AB5500_ADDR_SIM_USBSIM, "SIM_USBSIM"},
69 [AB5500_BANK_LED] = {AB5500_ADDR_LED, "LED"},
70 [AB5500_BANK_ADC] = {AB5500_ADDR_ADC, "ADC"},
71 [AB5500_BANK_RTC] = {AB5500_ADDR_RTC, "RTC"},
72 [AB5500_BANK_STARTUP] = {AB5500_ADDR_STARTUP, "STARTUP"},
73 [AB5500_BANK_DBI_ECI] = {AB5500_ADDR_DBI_ECI, "DBI-ECI"},
74 [AB5500_BANK_CHG] = {AB5500_ADDR_CHG, "CHG"},
75 [AB5500_BANK_FG_BATTCOM_ACC] = {
76 AB5500_ADDR_FG_BATTCOM_ACC, "FG_BATCOM_ACC"},
77 [AB5500_BANK_USB] = {AB5500_ADDR_USB, "USB"},
78 [AB5500_BANK_IT] = {AB5500_ADDR_IT, "IT"},
79 [AB5500_BANK_VIBRA] = {AB5500_ADDR_VIBRA, "VIBRA"},
80 [AB5500_BANK_AUDIO_HEADSETUSB] = {
81 AB5500_ADDR_AUDIO_HEADSETUSB, "AUDIO_HEADSETUSB"},
82};
83
84int ab5500_get_register_interruptible_raw(struct ab5500 *ab, u8 bank, u8 reg,
85 u8 *value);
86int ab5500_mask_and_set_register_interruptible_raw(struct ab5500 *ab, u8 bank,
87 u8 reg, u8 bitmask, u8 bitvalues);
diff --git a/drivers/mfd/mc13xxx-spi.c b/drivers/mfd/mc13xxx-spi.c
index 3fcdab3eb8eb..03df422feb76 100644
--- a/drivers/mfd/mc13xxx-spi.c
+++ b/drivers/mfd/mc13xxx-spi.c
@@ -49,10 +49,72 @@ static struct regmap_config mc13xxx_regmap_spi_config = {
49 .reg_bits = 7, 49 .reg_bits = 7,
50 .pad_bits = 1, 50 .pad_bits = 1,
51 .val_bits = 24, 51 .val_bits = 24,
52 .write_flag_mask = 0x80,
52 53
53 .max_register = MC13XXX_NUMREGS, 54 .max_register = MC13XXX_NUMREGS,
54 55
55 .cache_type = REGCACHE_NONE, 56 .cache_type = REGCACHE_NONE,
57 .use_single_rw = 1,
58};
59
60static int mc13xxx_spi_read(void *context, const void *reg, size_t reg_size,
61 void *val, size_t val_size)
62{
63 unsigned char w[4] = { *((unsigned char *) reg), 0, 0, 0};
64 unsigned char r[4];
65 unsigned char *p = val;
66 struct device *dev = context;
67 struct spi_device *spi = to_spi_device(dev);
68 struct spi_transfer t = {
69 .tx_buf = w,
70 .rx_buf = r,
71 .len = 4,
72 };
73
74 struct spi_message m;
75 int ret;
76
77 if (val_size != 3 || reg_size != 1)
78 return -ENOTSUPP;
79
80 spi_message_init(&m);
81 spi_message_add_tail(&t, &m);
82 ret = spi_sync(spi, &m);
83
84 memcpy(p, &r[1], 3);
85
86 return ret;
87}
88
89static int mc13xxx_spi_write(void *context, const void *data, size_t count)
90{
91 struct device *dev = context;
92 struct spi_device *spi = to_spi_device(dev);
93
94 if (count != 4)
95 return -ENOTSUPP;
96
97 return spi_write(spi, data, count);
98}
99
100/*
101 * We cannot use regmap-spi generic bus implementation here.
102 * The MC13783 chip will get corrupted if CS signal is deasserted
103 * and on i.Mx31 SoC (the target SoC for MC13783 PMIC) the SPI controller
104 * has the following errata (DSPhl22960):
105 * "The CSPI negates SS when the FIFO becomes empty with
106 * SSCTL= 0. Software cannot guarantee that the FIFO will not
107 * drain because of higher priority interrupts and the
108 * non-realtime characteristics of the operating system. As a
109 * result, the SS will negate before all of the data has been
110 * transferred to/from the peripheral."
111 * We workaround this by accessing the SPI controller with a
112 * single transfert.
113 */
114
115static struct regmap_bus regmap_mc13xxx_bus = {
116 .write = mc13xxx_spi_write,
117 .read = mc13xxx_spi_read,
56}; 118};
57 119
58static int mc13xxx_spi_probe(struct spi_device *spi) 120static int mc13xxx_spi_probe(struct spi_device *spi)
@@ -73,12 +135,13 @@ static int mc13xxx_spi_probe(struct spi_device *spi)
73 135
74 dev_set_drvdata(&spi->dev, mc13xxx); 136 dev_set_drvdata(&spi->dev, mc13xxx);
75 spi->mode = SPI_MODE_0 | SPI_CS_HIGH; 137 spi->mode = SPI_MODE_0 | SPI_CS_HIGH;
76 spi->bits_per_word = 32;
77 138
78 mc13xxx->dev = &spi->dev; 139 mc13xxx->dev = &spi->dev;
79 mutex_init(&mc13xxx->lock); 140 mutex_init(&mc13xxx->lock);
80 141
81 mc13xxx->regmap = regmap_init_spi(spi, &mc13xxx_regmap_spi_config); 142 mc13xxx->regmap = regmap_init(&spi->dev, &regmap_mc13xxx_bus, &spi->dev,
143 &mc13xxx_regmap_spi_config);
144
82 if (IS_ERR(mc13xxx->regmap)) { 145 if (IS_ERR(mc13xxx->regmap)) {
83 ret = PTR_ERR(mc13xxx->regmap); 146 ret = PTR_ERR(mc13xxx->regmap);
84 dev_err(mc13xxx->dev, "Failed to initialize register map: %d\n", 147 dev_err(mc13xxx->dev, "Failed to initialize register map: %d\n",
diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
index 7e96bb229724..41088ecbb2a9 100644
--- a/drivers/mfd/omap-usb-host.c
+++ b/drivers/mfd/omap-usb-host.c
@@ -25,6 +25,7 @@
25#include <linux/clk.h> 25#include <linux/clk.h>
26#include <linux/dma-mapping.h> 26#include <linux/dma-mapping.h>
27#include <linux/spinlock.h> 27#include <linux/spinlock.h>
28#include <linux/gpio.h>
28#include <plat/cpu.h> 29#include <plat/cpu.h>
29#include <plat/usb.h> 30#include <plat/usb.h>
30#include <linux/pm_runtime.h> 31#include <linux/pm_runtime.h>
@@ -500,8 +501,21 @@ static void omap_usbhs_init(struct device *dev)
500 dev_dbg(dev, "starting TI HSUSB Controller\n"); 501 dev_dbg(dev, "starting TI HSUSB Controller\n");
501 502
502 pm_runtime_get_sync(dev); 503 pm_runtime_get_sync(dev);
503 spin_lock_irqsave(&omap->lock, flags);
504 504
505 if (pdata->ehci_data->phy_reset) {
506 if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[0]))
507 gpio_request_one(pdata->ehci_data->reset_gpio_port[0],
508 GPIOF_OUT_INIT_LOW, "USB1 PHY reset");
509
510 if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[1]))
511 gpio_request_one(pdata->ehci_data->reset_gpio_port[1],
512 GPIOF_OUT_INIT_LOW, "USB2 PHY reset");
513
514 /* Hold the PHY in RESET for enough time till DIR is high */
515 udelay(10);
516 }
517
518 spin_lock_irqsave(&omap->lock, flags);
505 omap->usbhs_rev = usbhs_read(omap->uhh_base, OMAP_UHH_REVISION); 519 omap->usbhs_rev = usbhs_read(omap->uhh_base, OMAP_UHH_REVISION);
506 dev_dbg(dev, "OMAP UHH_REVISION 0x%x\n", omap->usbhs_rev); 520 dev_dbg(dev, "OMAP UHH_REVISION 0x%x\n", omap->usbhs_rev);
507 521
@@ -581,9 +595,39 @@ static void omap_usbhs_init(struct device *dev)
581 } 595 }
582 596
583 spin_unlock_irqrestore(&omap->lock, flags); 597 spin_unlock_irqrestore(&omap->lock, flags);
598
599 if (pdata->ehci_data->phy_reset) {
600 /* Hold the PHY in RESET for enough time till
601 * PHY is settled and ready
602 */
603 udelay(10);
604
605 if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[0]))
606 gpio_set_value_cansleep
607 (pdata->ehci_data->reset_gpio_port[0], 1);
608
609 if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[1]))
610 gpio_set_value_cansleep
611 (pdata->ehci_data->reset_gpio_port[1], 1);
612 }
613
584 pm_runtime_put_sync(dev); 614 pm_runtime_put_sync(dev);
585} 615}
586 616
617static void omap_usbhs_deinit(struct device *dev)
618{
619 struct usbhs_hcd_omap *omap = dev_get_drvdata(dev);
620 struct usbhs_omap_platform_data *pdata = &omap->platdata;
621
622 if (pdata->ehci_data->phy_reset) {
623 if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[0]))
624 gpio_free(pdata->ehci_data->reset_gpio_port[0]);
625
626 if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[1]))
627 gpio_free(pdata->ehci_data->reset_gpio_port[1]);
628 }
629}
630
587 631
588/** 632/**
589 * usbhs_omap_probe - initialize TI-based HCDs 633 * usbhs_omap_probe - initialize TI-based HCDs
@@ -767,6 +811,7 @@ static int __devinit usbhs_omap_probe(struct platform_device *pdev)
767 goto end_probe; 811 goto end_probe;
768 812
769err_alloc: 813err_alloc:
814 omap_usbhs_deinit(&pdev->dev);
770 iounmap(omap->tll_base); 815 iounmap(omap->tll_base);
771 816
772err_tll: 817err_tll:
@@ -818,6 +863,7 @@ static int __devexit usbhs_omap_remove(struct platform_device *pdev)
818{ 863{
819 struct usbhs_hcd_omap *omap = platform_get_drvdata(pdev); 864 struct usbhs_hcd_omap *omap = platform_get_drvdata(pdev);
820 865
866 omap_usbhs_deinit(&pdev->dev);
821 iounmap(omap->tll_base); 867 iounmap(omap->tll_base);
822 iounmap(omap->uhh_base); 868 iounmap(omap->uhh_base);
823 clk_put(omap->init_60m_fclk); 869 clk_put(omap->init_60m_fclk);
diff --git a/drivers/mfd/palmas.c b/drivers/mfd/palmas.c
index 00c0aba7eba0..c4a69f193a1d 100644
--- a/drivers/mfd/palmas.c
+++ b/drivers/mfd/palmas.c
@@ -356,7 +356,14 @@ static int __devinit palmas_i2c_probe(struct i2c_client *i2c,
356 } 356 }
357 } 357 }
358 358
359 ret = regmap_add_irq_chip(palmas->regmap[1], palmas->irq, 359 /* Change IRQ into clear on read mode for efficiency */
360 slave = PALMAS_BASE_TO_SLAVE(PALMAS_INTERRUPT_BASE);
361 addr = PALMAS_BASE_TO_REG(PALMAS_INTERRUPT_BASE, PALMAS_INT_CTRL);
362 reg = PALMAS_INT_CTRL_INT_CLEAR;
363
364 regmap_write(palmas->regmap[slave], addr, reg);
365
366 ret = regmap_add_irq_chip(palmas->regmap[slave], palmas->irq,
360 IRQF_ONESHOT | IRQF_TRIGGER_LOW, -1, &palmas_irq_chip, 367 IRQF_ONESHOT | IRQF_TRIGGER_LOW, -1, &palmas_irq_chip,
361 &palmas->irq_data); 368 &palmas->irq_data);
362 if (ret < 0) 369 if (ret < 0)
@@ -441,6 +448,9 @@ static int __devinit palmas_i2c_probe(struct i2c_client *i2c,
441 goto err; 448 goto err;
442 } 449 }
443 450
451 children[PALMAS_PMIC_ID].platform_data = pdata->pmic_pdata;
452 children[PALMAS_PMIC_ID].pdata_size = sizeof(*pdata->pmic_pdata);
453
444 ret = mfd_add_devices(palmas->dev, -1, 454 ret = mfd_add_devices(palmas->dev, -1,
445 children, ARRAY_SIZE(palmas_children), 455 children, ARRAY_SIZE(palmas_children),
446 NULL, regmap_irq_chip_get_base(palmas->irq_data)); 456 NULL, regmap_irq_chip_get_base(palmas->irq_data));
@@ -472,6 +482,7 @@ static const struct i2c_device_id palmas_i2c_id[] = {
472 { "twl6035", }, 482 { "twl6035", },
473 { "twl6037", }, 483 { "twl6037", },
474 { "tps65913", }, 484 { "tps65913", },
485 { /* end */ }
475}; 486};
476MODULE_DEVICE_TABLE(i2c, palmas_i2c_id); 487MODULE_DEVICE_TABLE(i2c, palmas_i2c_id);
477 488
diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
index 17cfb8a1131c..c30435499a02 100644
--- a/drivers/usb/host/ehci-omap.c
+++ b/drivers/usb/host/ehci-omap.c
@@ -281,14 +281,13 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
281 } 281 }
282 } 282 }
283 283
284 /* Hold PHYs in reset while initializing EHCI controller */
284 if (pdata->phy_reset) { 285 if (pdata->phy_reset) {
285 if (gpio_is_valid(pdata->reset_gpio_port[0])) 286 if (gpio_is_valid(pdata->reset_gpio_port[0]))
286 gpio_request_one(pdata->reset_gpio_port[0], 287 gpio_set_value_cansleep(pdata->reset_gpio_port[0], 0);
287 GPIOF_OUT_INIT_LOW, "USB1 PHY reset");
288 288
289 if (gpio_is_valid(pdata->reset_gpio_port[1])) 289 if (gpio_is_valid(pdata->reset_gpio_port[1]))
290 gpio_request_one(pdata->reset_gpio_port[1], 290 gpio_set_value_cansleep(pdata->reset_gpio_port[1], 0);
291 GPIOF_OUT_INIT_LOW, "USB2 PHY reset");
292 291
293 /* Hold the PHY in RESET for enough time till DIR is high */ 292 /* Hold the PHY in RESET for enough time till DIR is high */
294 udelay(10); 293 udelay(10);
@@ -330,6 +329,11 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
330 omap_ehci->hcs_params = readl(&omap_ehci->caps->hcs_params); 329 omap_ehci->hcs_params = readl(&omap_ehci->caps->hcs_params);
331 330
332 ehci_reset(omap_ehci); 331 ehci_reset(omap_ehci);
332 ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
333 if (ret) {
334 dev_err(dev, "failed to add hcd with err %d\n", ret);
335 goto err_add_hcd;
336 }
333 337
334 if (pdata->phy_reset) { 338 if (pdata->phy_reset) {
335 /* Hold the PHY in RESET for enough time till 339 /* Hold the PHY in RESET for enough time till
@@ -344,12 +348,6 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
344 gpio_set_value_cansleep(pdata->reset_gpio_port[1], 1); 348 gpio_set_value_cansleep(pdata->reset_gpio_port[1], 1);
345 } 349 }
346 350
347 ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
348 if (ret) {
349 dev_err(dev, "failed to add hcd with err %d\n", ret);
350 goto err_add_hcd;
351 }
352
353 /* root ports should always stay powered */ 351 /* root ports should always stay powered */
354 ehci_port_power(omap_ehci, 1); 352 ehci_port_power(omap_ehci, 1);
355 353