mirror of
https://github.com/edk2-porting/linux-next.git
synced 2025-01-10 06:34:17 +08:00
A first round of GPIO fixes for the v3.11 series:
- OMAP device tree boot fix - Handle an error condition in the MSM driver -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.13 (GNU/Linux) iQIcBAABAgAGBQJR7cUHAAoJEEEQszewGV1zor0P/3cBk+OpJxbEtC0xf4RZJLka VQ9Yv/W7aaIbdYCvNwoXOCBFFW2eWniN6XwHRzWmxRZNnP7GrNLRU41KchCuRrjz mZMKKwwjHriIZ9Kz1WmB2Pbc2mKAOoEc0vjRQCiNajR+/dyQnrjYqwo9mEQO1g6Z Yn4n8tx85CJVF+63Its5UnYy3yHNDuzt160SyGb660qYiinBlWmf0N+pzZ9MKlvZ 9HUsRElfgjRqwvIan0SzhkdP3PBWdycEo8sRXv4Wgb1+Jb5YkbNhFjbRIJUyUVOx +gyfXhsvYWFEOANpzywbRdfUpfjYVkER/rNkDeTZzwvjneyCVokzawVfvkpMikmH pJ4gxxipRcELsTLa5h+EaA80MfiKlH/LesGiEQimr17vVkTu6ZPGHmb0PKISQp39 JZmTdwqodWCzV/Eldtz8ykKx8fZzDg7Y9cTr7SGPgTTFgpaOdzU0wIQTVy2fBjPV +SOWJ/998eV9tatI+v4v+xyPD8zeyGuC14IDGZa/kwsJf9S8/87gfVXNyMnUOz/F edyLuX7kFt7segkpBoWD5wa+LAIsnzSNVhlLvV6UX2rz4j9V9zv7fe8pi5JFvjbh dG3T0/y2OpC5aEzbI8DeTU+FBO6+ss47vqhEaalmUawKlk5RgjgVlVhp4phfP0IQ 2A32KgcjBKV4/QMh3evq =Ld25 -----END PGP SIGNATURE----- Merge tag 'gpio-for-v3.11-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio Pull gpio fixes from Linus Walleij: "A first round of GPIO fixes for the v3.11 series: - OMAP device tree boot fix - Handle an error condition in the MSM driver The OMAP patches have been around since around the merge window, but since they first caused more breakage I let them boil in -next for a while. These should be fine now" * tag 'gpio-for-v3.11-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: drivers: gpio: msm: Fix the error condition for reading ngpio gpio/omap: fix build error when OF_GPIO is not defined. gpio/omap: auto request GPIO as input if used as IRQ via DT gpio/omap: don't create an IRQ mapping for every GPIO on DT
This commit is contained in:
commit
b7371e3125
@ -378,7 +378,7 @@ static int msm_gpio_probe(struct platform_device *pdev)
|
|||||||
int ret, ngpio;
|
int ret, ngpio;
|
||||||
struct resource *res;
|
struct resource *res;
|
||||||
|
|
||||||
if (!of_property_read_u32(pdev->dev.of_node, "ngpio", &ngpio)) {
|
if (of_property_read_u32(pdev->dev.of_node, "ngpio", &ngpio)) {
|
||||||
dev_err(&pdev->dev, "%s: ngpio property missing\n", __func__);
|
dev_err(&pdev->dev, "%s: ngpio property missing\n", __func__);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
@ -1037,6 +1037,18 @@ omap_mpuio_alloc_gc(struct gpio_bank *bank, unsigned int irq_start,
|
|||||||
IRQ_NOREQUEST | IRQ_NOPROBE, 0);
|
IRQ_NOREQUEST | IRQ_NOPROBE, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(CONFIG_OF_GPIO)
|
||||||
|
static inline bool omap_gpio_chip_boot_dt(struct gpio_chip *chip)
|
||||||
|
{
|
||||||
|
return chip->of_node != NULL;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
static inline bool omap_gpio_chip_boot_dt(struct gpio_chip *chip)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void omap_gpio_chip_init(struct gpio_bank *bank)
|
static void omap_gpio_chip_init(struct gpio_bank *bank)
|
||||||
{
|
{
|
||||||
int j;
|
int j;
|
||||||
@ -1068,24 +1080,68 @@ static void omap_gpio_chip_init(struct gpio_bank *bank)
|
|||||||
|
|
||||||
gpiochip_add(&bank->chip);
|
gpiochip_add(&bank->chip);
|
||||||
|
|
||||||
for (j = 0; j < bank->width; j++) {
|
/*
|
||||||
int irq = irq_create_mapping(bank->domain, j);
|
* REVISIT these explicit calls to irq_create_mapping()
|
||||||
irq_set_lockdep_class(irq, &gpio_lock_class);
|
* to do the GPIO to IRQ domain mapping for each GPIO in
|
||||||
irq_set_chip_data(irq, bank);
|
* the bank can be removed once all OMAP platforms have
|
||||||
if (bank->is_mpuio) {
|
* been migrated to Device Tree boot only.
|
||||||
omap_mpuio_alloc_gc(bank, irq, bank->width);
|
* Since in DT boot irq_create_mapping() is called from
|
||||||
} else {
|
* irq_create_of_mapping() only for the GPIO lines that
|
||||||
irq_set_chip_and_handler(irq, &gpio_irq_chip,
|
* are used as interrupts.
|
||||||
handle_simple_irq);
|
*/
|
||||||
set_irq_flags(irq, IRQF_VALID);
|
if (!omap_gpio_chip_boot_dt(&bank->chip))
|
||||||
}
|
for (j = 0; j < bank->width; j++)
|
||||||
}
|
irq_create_mapping(bank->domain, j);
|
||||||
irq_set_chained_handler(bank->irq, gpio_irq_handler);
|
irq_set_chained_handler(bank->irq, gpio_irq_handler);
|
||||||
irq_set_handler_data(bank->irq, bank);
|
irq_set_handler_data(bank->irq, bank);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct of_device_id omap_gpio_match[];
|
static const struct of_device_id omap_gpio_match[];
|
||||||
|
|
||||||
|
static int omap_gpio_irq_map(struct irq_domain *d, unsigned int virq,
|
||||||
|
irq_hw_number_t hwirq)
|
||||||
|
{
|
||||||
|
struct gpio_bank *bank = d->host_data;
|
||||||
|
int gpio;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
if (!bank)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
irq_set_lockdep_class(virq, &gpio_lock_class);
|
||||||
|
irq_set_chip_data(virq, bank);
|
||||||
|
if (bank->is_mpuio) {
|
||||||
|
omap_mpuio_alloc_gc(bank, virq, bank->width);
|
||||||
|
} else {
|
||||||
|
irq_set_chip_and_handler(virq, &gpio_irq_chip,
|
||||||
|
handle_simple_irq);
|
||||||
|
set_irq_flags(virq, IRQF_VALID);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* REVISIT most GPIO IRQ chip drivers need to call
|
||||||
|
* gpio_request() before a GPIO line can be used as an
|
||||||
|
* IRQ. Ideally this should be handled by the IRQ core
|
||||||
|
* but until then this has to be done on a per driver
|
||||||
|
* basis. Remove this once this is managed by the core.
|
||||||
|
*/
|
||||||
|
if (omap_gpio_chip_boot_dt(&bank->chip)) {
|
||||||
|
gpio = irq_to_gpio(bank, hwirq);
|
||||||
|
ret = gpio_request_one(gpio, GPIOF_IN, NULL);
|
||||||
|
if (ret) {
|
||||||
|
dev_err(bank->dev, "Could not request GPIO%d\n", gpio);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct irq_domain_ops omap_gpio_irq_ops = {
|
||||||
|
.xlate = irq_domain_xlate_onetwocell,
|
||||||
|
.map = omap_gpio_irq_map,
|
||||||
|
};
|
||||||
|
|
||||||
static int omap_gpio_probe(struct platform_device *pdev)
|
static int omap_gpio_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct device *dev = &pdev->dev;
|
struct device *dev = &pdev->dev;
|
||||||
@ -1151,10 +1207,10 @@ static int omap_gpio_probe(struct platform_device *pdev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bank->domain = irq_domain_add_legacy(node, bank->width, irq_base,
|
bank->domain = irq_domain_add_legacy(node, bank->width, irq_base,
|
||||||
0, &irq_domain_simple_ops, NULL);
|
0, &omap_gpio_irq_ops, bank);
|
||||||
#else
|
#else
|
||||||
bank->domain = irq_domain_add_linear(node, bank->width,
|
bank->domain = irq_domain_add_linear(node, bank->width,
|
||||||
&irq_domain_simple_ops, NULL);
|
&omap_gpio_irq_ops, bank);
|
||||||
#endif
|
#endif
|
||||||
if (!bank->domain) {
|
if (!bank->domain) {
|
||||||
dev_err(dev, "Couldn't register an IRQ domain\n");
|
dev_err(dev, "Couldn't register an IRQ domain\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user