mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-26 19:00:25 +00:00
ARM: davinci: hawk: use gpio descriptor for mmc pins
Currently the mmc driver is polling the gpio to know if the card was removed. By using a gpio descriptor instead of the platform callbacks, the driver will be able to register the gpio using the mmc core APIs designed for this purpose. This has the advantage that an irq will be registered, and polling is no longer needed. Also, a dependency on platform callbacks is removed for this board. Signed-off-by: Axel Haslam <ahaslam@baylibre.com> Signed-off-by: Sekhar Nori <nsekhar@ti.com>
This commit is contained in:
parent
8439a1d77d
commit
c69f43fb4f
1 changed files with 11 additions and 31 deletions
|
@ -13,6 +13,7 @@
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
#include <linux/console.h>
|
#include <linux/console.h>
|
||||||
#include <linux/gpio.h>
|
#include <linux/gpio.h>
|
||||||
|
#include <linux/gpio/machine.h>
|
||||||
#include <linux/platform_data/gpio-davinci.h>
|
#include <linux/platform_data/gpio-davinci.h>
|
||||||
#include <linux/regulator/machine.h>
|
#include <linux/regulator/machine.h>
|
||||||
|
|
||||||
|
@ -25,8 +26,6 @@
|
||||||
#include <mach/mux.h>
|
#include <mach/mux.h>
|
||||||
|
|
||||||
#define HAWKBOARD_PHY_ID "davinci_mdio-0:07"
|
#define HAWKBOARD_PHY_ID "davinci_mdio-0:07"
|
||||||
#define DA850_HAWK_MMCSD_CD_PIN GPIO_TO_PIN(3, 12)
|
|
||||||
#define DA850_HAWK_MMCSD_WP_PIN GPIO_TO_PIN(3, 13)
|
|
||||||
|
|
||||||
#define DA850_USB1_VBUS_PIN GPIO_TO_PIN(2, 4)
|
#define DA850_USB1_VBUS_PIN GPIO_TO_PIN(2, 4)
|
||||||
#define DA850_USB1_OC_PIN GPIO_TO_PIN(6, 13)
|
#define DA850_USB1_OC_PIN GPIO_TO_PIN(6, 13)
|
||||||
|
@ -123,19 +122,16 @@ static const short hawk_mmcsd0_pins[] = {
|
||||||
-1
|
-1
|
||||||
};
|
};
|
||||||
|
|
||||||
static int da850_hawk_mmc_get_ro(int index)
|
static struct gpiod_lookup_table mmc_gpios_table = {
|
||||||
{
|
.dev_id = "da830-mmc.0",
|
||||||
return gpio_get_value(DA850_HAWK_MMCSD_WP_PIN);
|
.table = {
|
||||||
}
|
/* CD: gpio3_12: gpio60: chip 1 contains gpio range 32-63*/
|
||||||
|
GPIO_LOOKUP("davinci_gpio.1", 28, "cd", GPIO_ACTIVE_LOW),
|
||||||
static int da850_hawk_mmc_get_cd(int index)
|
GPIO_LOOKUP("davinci_gpio.1", 29, "wp", GPIO_ACTIVE_LOW),
|
||||||
{
|
},
|
||||||
return !gpio_get_value(DA850_HAWK_MMCSD_CD_PIN);
|
};
|
||||||
}
|
|
||||||
|
|
||||||
static struct davinci_mmc_config da850_mmc_config = {
|
static struct davinci_mmc_config da850_mmc_config = {
|
||||||
.get_ro = da850_hawk_mmc_get_ro,
|
|
||||||
.get_cd = da850_hawk_mmc_get_cd,
|
|
||||||
.wires = 4,
|
.wires = 4,
|
||||||
.max_freq = 50000000,
|
.max_freq = 50000000,
|
||||||
.caps = MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
|
.caps = MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
|
||||||
|
@ -151,21 +147,7 @@ static __init void omapl138_hawk_mmc_init(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = gpio_request_one(DA850_HAWK_MMCSD_CD_PIN,
|
gpiod_add_lookup_table(&mmc_gpios_table);
|
||||||
GPIOF_DIR_IN, "MMC CD");
|
|
||||||
if (ret < 0) {
|
|
||||||
pr_warn("%s: can not open GPIO %d\n",
|
|
||||||
__func__, DA850_HAWK_MMCSD_CD_PIN);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = gpio_request_one(DA850_HAWK_MMCSD_WP_PIN,
|
|
||||||
GPIOF_DIR_IN, "MMC WP");
|
|
||||||
if (ret < 0) {
|
|
||||||
pr_warn("%s: can not open GPIO %d\n",
|
|
||||||
__func__, DA850_HAWK_MMCSD_WP_PIN);
|
|
||||||
goto mmc_setup_wp_fail;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = da8xx_register_mmcsd0(&da850_mmc_config);
|
ret = da8xx_register_mmcsd0(&da850_mmc_config);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
@ -176,9 +158,7 @@ static __init void omapl138_hawk_mmc_init(void)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mmc_setup_mmcsd_fail:
|
mmc_setup_mmcsd_fail:
|
||||||
gpio_free(DA850_HAWK_MMCSD_WP_PIN);
|
gpiod_remove_lookup_table(&mmc_gpios_table);
|
||||||
mmc_setup_wp_fail:
|
|
||||||
gpio_free(DA850_HAWK_MMCSD_CD_PIN);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static irqreturn_t omapl138_hawk_usb_ocic_irq(int irq, void *dev_id);
|
static irqreturn_t omapl138_hawk_usb_ocic_irq(int irq, void *dev_id);
|
||||||
|
|
Loading…
Reference in a new issue