This sets up the dynamically detected IM-PD1 GPIO lines

by way of GPIO descriptors, avoiding any use of the GPIO
 global numberspace.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJUCXtyAAoJEEEQszewGV1zGLsQAKeUjWMSeSZj/6POdBUsAGz/
 eDfVBdMBuc9X8jOupqW3fEyKnWAG0ItfHuKJ69k/z+E8qUuih3Op6Wzb3DTZl7KF
 Vhqiw2Wxc+V+UuuQbGuHNStph8OlBdM1kct19S5nUScNE6eiyg14HGPKC9Pjn37X
 Oz4OAnIUxuLOFSNRCujCO2Q9DCINRAmR5hzFrKw5rmYsk/ekFkZFmIwY4yjuHszE
 3YxS7lbwyd9PgsFtKzFPCD2CaE+bg5XnW0og6u4fRx96uUZsFD3p1V0LXczicm5H
 vcgUHeZS+cMWyuvwoA6ODr6tHILgNVofyqW9YyIRVTfH1FT2/dBh7/gmVsGoEbBd
 Y2L75huOprHl6rgrt21zcIBQIY2S9GTBspXIhZBuRt4mhtUI/e4ahVvOP2CaZXtM
 hz7csVH2VNuO5E2NYHTAm0jcWrrwrdtYKoiuAi0RGVRgZBkg9uYUDmlTKAclsORu
 uH2MDx3+p8G74vgD6DCiaAep3OsS5PCEbECkSkym91y6ZbpuNh7VyhCKbAEw8q6C
 +hVP/T7hydRD0EIxNkNB0M5Q/YarXVvrClcj2oXo2C1mTZFdQrTFMijpUhMxVgND
 3QEhHZrS6k205LtuCaADgd5R4Qgf4LM0SdAigm1FwRUgoNlKiyONoOeY8UWQCdE0
 fovRupLS65wD2Xur5M77
 =/CT4
 -----END PGP SIGNATURE-----

Merge tag 'integrator-for-v3.18-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-integrator into next/soc

Merge "single Integrator patch" from Linus Walleij:

This sets up the dynamically detected IM-PD1 GPIO lines
by way of GPIO descriptors, avoiding any use of the GPIO
global numberspace.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>

* tag 'integrator-for-v3.18-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-integrator:
  ARM: integrator: add MMCI device to IM-PD1
This commit is contained in:
Arnd Bergmann 2014-09-05 22:46:24 +02:00
commit 0b7f509d45

View File

@ -20,10 +20,13 @@
#include <linux/mm.h>
#include <linux/amba/bus.h>
#include <linux/amba/clcd.h>
#include <linux/amba/mmci.h>
#include <linux/amba/pl061.h>
#include <linux/io.h>
#include <linux/platform_data/clk-integrator.h>
#include <linux/slab.h>
#include <linux/irqchip/arm-vic.h>
#include <linux/gpio/machine.h>
#include <asm/sizes.h>
#include "lm.h"
@ -51,6 +54,13 @@ void impd1_tweak_control(struct device *dev, u32 mask, u32 val)
EXPORT_SYMBOL(impd1_tweak_control);
/*
* MMC support
*/
static struct mmci_platform_data mmc_data = {
.ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
};
/*
* CLCD support
*/
@ -291,6 +301,7 @@ static struct impd1_device impd1_devs[] = {
.offset = 0x00700000,
.irq = { 7, 8 },
.id = 0x00041181,
.platform_data = &mmc_data,
}, {
.offset = 0x00800000,
.irq = { 9 },
@ -372,6 +383,43 @@ static int __init_refok impd1_probe(struct lm_device *dev)
pc_base = dev->resource.start + idev->offset;
snprintf(devname, 32, "lm%x:%5.5lx", dev->id, idev->offset >> 12);
/* Add GPIO descriptor lookup table for the PL061 block */
if (idev->offset == 0x00400000) {
struct gpiod_lookup_table *lookup;
char *chipname;
char *mmciname;
lookup = devm_kzalloc(&dev->dev,
sizeof(*lookup) + 3 * sizeof(struct gpiod_lookup),
GFP_KERNEL);
chipname = devm_kstrdup(&dev->dev, devname, GFP_KERNEL);
mmciname = kasprintf(GFP_KERNEL, "lm%x:00700", dev->id);
lookup->dev_id = mmciname;
/*
* Offsets on GPIO block 1:
* 3 = MMC WP (write protect)
* 4 = MMC CD (card detect)
*
* Offsets on GPIO block 2:
* 0 = Up key
* 1 = Down key
* 2 = Left key
* 3 = Right key
* 4 = Key lower left
* 5 = Key lower right
*/
/* We need the two MMCI GPIO entries */
lookup->table[0].chip_label = chipname;
lookup->table[0].chip_hwnum = 3;
lookup->table[0].con_id = "wp";
lookup->table[1].chip_label = chipname;
lookup->table[1].chip_hwnum = 4;
lookup->table[1].con_id = "cd";
lookup->table[1].flags = GPIO_ACTIVE_LOW;
gpiod_add_lookup_table(lookup);
}
d = amba_ahb_device_add_res(&dev->dev, devname, pc_base, SZ_4K,
irq1, irq2,
idev->platform_data, idev->id,