Commit d4e7d09f authored by Dmitry Baryshkov's avatar Dmitry Baryshkov Committed by Russell King

[ARM] 4972/1: Tosa: convert scoop GPIOs usage to generic gpio code

Convert set/reset_scoop_gpio to generic gpio calls.
This patch depends on the pxaficp_ir hooks patch.
Signed-off-by: default avatarDmitry Baryshkov <dbaryshkov@gmail.com>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent baf1c5d2
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/gpio_keys.h> #include <linux/gpio_keys.h>
#include <linux/input.h> #include <linux/input.h>
#include <linux/gpio.h>
#include <asm/setup.h> #include <asm/setup.h>
#include <asm/memory.h> #include <asm/memory.h>
...@@ -166,8 +167,7 @@ static struct resource tosa_scoop_resources[] = { ...@@ -166,8 +167,7 @@ static struct resource tosa_scoop_resources[] = {
static struct scoop_config tosa_scoop_setup = { static struct scoop_config tosa_scoop_setup = {
.io_dir = TOSA_SCOOP_IO_DIR, .io_dir = TOSA_SCOOP_IO_DIR,
.io_out = TOSA_SCOOP_IO_OUT, .gpio_base = TOSA_SCOOP_GPIO_BASE,
}; };
struct platform_device tosascoop_device = { struct platform_device tosascoop_device = {
...@@ -194,7 +194,7 @@ static struct resource tosa_scoop_jc_resources[] = { ...@@ -194,7 +194,7 @@ static struct resource tosa_scoop_jc_resources[] = {
static struct scoop_config tosa_scoop_jc_setup = { static struct scoop_config tosa_scoop_jc_setup = {
.io_dir = TOSA_SCOOP_JC_IO_DIR, .io_dir = TOSA_SCOOP_JC_IO_DIR,
.io_out = TOSA_SCOOP_JC_IO_OUT, .gpio_base = TOSA_SCOOP_JC_GPIO_BASE,
}; };
struct platform_device tosascoop_jc_device = { struct platform_device tosascoop_jc_device = {
...@@ -232,20 +232,8 @@ static struct scoop_pcmcia_config tosa_pcmcia_config = { ...@@ -232,20 +232,8 @@ static struct scoop_pcmcia_config tosa_pcmcia_config = {
/* /*
* USB Device Controller * USB Device Controller
*/ */
static void tosa_udc_command(int cmd)
{
switch(cmd) {
case PXA2XX_UDC_CMD_CONNECT:
set_scoop_gpio(&tosascoop_jc_device.dev,TOSA_SCOOP_JC_USB_PULLUP);
break;
case PXA2XX_UDC_CMD_DISCONNECT:
reset_scoop_gpio(&tosascoop_jc_device.dev,TOSA_SCOOP_JC_USB_PULLUP);
break;
}
}
static struct pxa2xx_udc_mach_info udc_info __initdata = { static struct pxa2xx_udc_mach_info udc_info __initdata = {
.udc_command = tosa_udc_command, .gpio_pullup = TOSA_GPIO_USB_PULLUP,
.gpio_vbus = TOSA_GPIO_USB_IN, .gpio_vbus = TOSA_GPIO_USB_IN,
.gpio_vbus_inverted = 1, .gpio_vbus_inverted = 1,
}; };
...@@ -264,9 +252,39 @@ static int tosa_mci_init(struct device *dev, irq_handler_t tosa_detect_int, void ...@@ -264,9 +252,39 @@ static int tosa_mci_init(struct device *dev, irq_handler_t tosa_detect_int, void
err = request_irq(TOSA_IRQ_GPIO_nSD_DETECT, tosa_detect_int, err = request_irq(TOSA_IRQ_GPIO_nSD_DETECT, tosa_detect_int,
IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
"MMC/SD card detect", data); "MMC/SD card detect", data);
if (err) if (err) {
printk(KERN_ERR "tosa_mci_init: MMC/SD: can't request MMC card detect IRQ\n"); printk(KERN_ERR "tosa_mci_init: MMC/SD: can't request MMC card detect IRQ\n");
goto err_irq;
}
err = gpio_request(TOSA_GPIO_SD_WP, "sd_wp");
if (err) {
printk(KERN_ERR "tosa_mci_init: can't request SD_WP gpio\n");
goto err_gpio_wp;
}
err = gpio_direction_input(TOSA_GPIO_SD_WP);
if (err)
goto err_gpio_wp_dir;
err = gpio_request(TOSA_GPIO_PWR_ON, "sd_pwr");
if (err) {
printk(KERN_ERR "tosa_mci_init: can't request SD_PWR gpio\n");
goto err_gpio_pwr;
}
err = gpio_direction_output(TOSA_GPIO_PWR_ON, 0);
if (err)
goto err_gpio_pwr_dir;
return 0;
err_gpio_pwr_dir:
gpio_free(TOSA_GPIO_PWR_ON);
err_gpio_pwr:
err_gpio_wp_dir:
gpio_free(TOSA_GPIO_SD_WP);
err_gpio_wp:
free_irq(TOSA_IRQ_GPIO_nSD_DETECT, data);
err_irq:
return err; return err;
} }
...@@ -275,19 +293,21 @@ static void tosa_mci_setpower(struct device *dev, unsigned int vdd) ...@@ -275,19 +293,21 @@ static void tosa_mci_setpower(struct device *dev, unsigned int vdd)
struct pxamci_platform_data* p_d = dev->platform_data; struct pxamci_platform_data* p_d = dev->platform_data;
if (( 1 << vdd) & p_d->ocr_mask) { if (( 1 << vdd) & p_d->ocr_mask) {
set_scoop_gpio(&tosascoop_device.dev,TOSA_SCOOP_PWR_ON); gpio_set_value(TOSA_GPIO_PWR_ON, 1);
} else { } else {
reset_scoop_gpio(&tosascoop_device.dev,TOSA_SCOOP_PWR_ON); gpio_set_value(TOSA_GPIO_PWR_ON, 0);
} }
} }
static int tosa_mci_get_ro(struct device *dev) static int tosa_mci_get_ro(struct device *dev)
{ {
return (read_scoop_reg(&tosascoop_device.dev, SCOOP_GPWR)&TOSA_SCOOP_SD_WP); return gpio_get_value(TOSA_GPIO_SD_WP);
} }
static void tosa_mci_exit(struct device *dev, void *data) static void tosa_mci_exit(struct device *dev, void *data)
{ {
gpio_free(TOSA_GPIO_PWR_ON);
gpio_free(TOSA_GPIO_SD_WP);
free_irq(TOSA_IRQ_GPIO_nSD_DETECT, data); free_irq(TOSA_IRQ_GPIO_nSD_DETECT, data);
} }
...@@ -302,18 +322,36 @@ static struct pxamci_platform_data tosa_mci_platform_data = { ...@@ -302,18 +322,36 @@ static struct pxamci_platform_data tosa_mci_platform_data = {
/* /*
* Irda * Irda
*/ */
static void tosa_irda_transceiver_mode(struct device *dev, int mode) static int tosa_irda_startup(struct device *dev)
{ {
if (mode & IR_OFF) { int ret;
reset_scoop_gpio(&tosascoop_device.dev,TOSA_SCOOP_IR_POWERDWN);
} else { ret = gpio_request(TOSA_GPIO_IR_POWERDWN, "IrDA powerdown");
set_scoop_gpio(&tosascoop_device.dev,TOSA_SCOOP_IR_POWERDWN); if (ret)
return ret;
ret = gpio_direction_output(TOSA_GPIO_IR_POWERDWN, 0);
if (ret)
gpio_free(TOSA_GPIO_IR_POWERDWN);
return ret;
} }
static void tosa_irda_shutdown(struct device *dev)
{
gpio_free(TOSA_GPIO_IR_POWERDWN);
}
static void tosa_irda_transceiver_mode(struct device *dev, int mode)
{
gpio_set_value(TOSA_GPIO_IR_POWERDWN, !(mode & IR_OFF));
} }
static struct pxaficp_platform_data tosa_ficp_platform_data = { static struct pxaficp_platform_data tosa_ficp_platform_data = {
.transceiver_cap = IR_SIRMODE | IR_OFF, .transceiver_cap = IR_SIRMODE | IR_OFF,
.transceiver_mode = tosa_irda_transceiver_mode, .transceiver_mode = tosa_irda_transceiver_mode,
.startup = tosa_irda_startup,
.shutdown = tosa_irda_shutdown,
}; };
/* /*
......
...@@ -23,11 +23,12 @@ ...@@ -23,11 +23,12 @@
/* /*
* SCOOP2 internal GPIOs * SCOOP2 internal GPIOs
*/ */
#define TOSA_SCOOP_GPIO_BASE NR_BUILTIN_GPIO
#define TOSA_SCOOP_PXA_VCORE1 SCOOP_GPCR_PA11 #define TOSA_SCOOP_PXA_VCORE1 SCOOP_GPCR_PA11
#define TOSA_SCOOP_TC6393_REST_IN SCOOP_GPCR_PA12 #define TOSA_SCOOP_TC6393_REST_IN SCOOP_GPCR_PA12
#define TOSA_SCOOP_IR_POWERDWN SCOOP_GPCR_PA13 #define TOSA_GPIO_IR_POWERDWN (TOSA_SCOOP_GPIO_BASE + 2)
#define TOSA_SCOOP_SD_WP SCOOP_GPCR_PA14 #define TOSA_GPIO_SD_WP (TOSA_SCOOP_GPIO_BASE + 3)
#define TOSA_SCOOP_PWR_ON SCOOP_GPCR_PA15 #define TOSA_GPIO_PWR_ON (TOSA_SCOOP_GPIO_BASE + 4)
#define TOSA_SCOOP_AUD_PWR_ON SCOOP_GPCR_PA16 #define TOSA_SCOOP_AUD_PWR_ON SCOOP_GPCR_PA16
#define TOSA_SCOOP_BT_RESET SCOOP_GPCR_PA17 #define TOSA_SCOOP_BT_RESET SCOOP_GPCR_PA17
#define TOSA_SCOOP_BT_PWR_EN SCOOP_GPCR_PA18 #define TOSA_SCOOP_BT_PWR_EN SCOOP_GPCR_PA18
...@@ -35,7 +36,7 @@ ...@@ -35,7 +36,7 @@
/* GPIO Direction 1 : output mode / 0:input mode */ /* GPIO Direction 1 : output mode / 0:input mode */
#define TOSA_SCOOP_IO_DIR ( TOSA_SCOOP_PXA_VCORE1 | TOSA_SCOOP_TC6393_REST_IN | \ #define TOSA_SCOOP_IO_DIR ( TOSA_SCOOP_PXA_VCORE1 | TOSA_SCOOP_TC6393_REST_IN | \
TOSA_SCOOP_IR_POWERDWN | TOSA_SCOOP_PWR_ON | TOSA_SCOOP_AUD_PWR_ON |\ TOSA_SCOOP_AUD_PWR_ON |\
TOSA_SCOOP_BT_RESET | TOSA_SCOOP_BT_PWR_EN ) TOSA_SCOOP_BT_RESET | TOSA_SCOOP_BT_PWR_EN )
/* GPIO out put level when init 1: Hi */ /* GPIO out put level when init 1: Hi */
#define TOSA_SCOOP_IO_OUT ( TOSA_SCOOP_TC6393_REST_IN ) #define TOSA_SCOOP_IO_OUT ( TOSA_SCOOP_TC6393_REST_IN )
...@@ -43,10 +44,11 @@ ...@@ -43,10 +44,11 @@
/* /*
* SCOOP2 jacket GPIOs * SCOOP2 jacket GPIOs
*/ */
#define TOSA_SCOOP_JC_GPIO_BASE (NR_BUILTIN_GPIO + 12)
#define TOSA_SCOOP_JC_BT_LED SCOOP_GPCR_PA11 #define TOSA_SCOOP_JC_BT_LED SCOOP_GPCR_PA11
#define TOSA_SCOOP_JC_NOTE_LED SCOOP_GPCR_PA12 #define TOSA_SCOOP_JC_NOTE_LED SCOOP_GPCR_PA12
#define TOSA_SCOOP_JC_CHRG_ERR_LED SCOOP_GPCR_PA13 #define TOSA_SCOOP_JC_CHRG_ERR_LED SCOOP_GPCR_PA13
#define TOSA_SCOOP_JC_USB_PULLUP SCOOP_GPCR_PA14 #define TOSA_GPIO_USB_PULLUP (TOSA_SCOOP_JC_GPIO_BASE + 3)
#define TOSA_SCOOP_JC_TC6393_SUSPEND SCOOP_GPCR_PA15 #define TOSA_SCOOP_JC_TC6393_SUSPEND SCOOP_GPCR_PA15
#define TOSA_SCOOP_JC_TC3693_L3V_ON SCOOP_GPCR_PA16 #define TOSA_SCOOP_JC_TC3693_L3V_ON SCOOP_GPCR_PA16
#define TOSA_SCOOP_JC_WLAN_DETECT SCOOP_GPCR_PA17 #define TOSA_SCOOP_JC_WLAN_DETECT SCOOP_GPCR_PA17
...@@ -55,11 +57,9 @@ ...@@ -55,11 +57,9 @@
/* GPIO Direction 1 : output mode / 0:input mode */ /* GPIO Direction 1 : output mode / 0:input mode */
#define TOSA_SCOOP_JC_IO_DIR ( TOSA_SCOOP_JC_BT_LED | TOSA_SCOOP_JC_NOTE_LED | \ #define TOSA_SCOOP_JC_IO_DIR ( TOSA_SCOOP_JC_BT_LED | TOSA_SCOOP_JC_NOTE_LED | \
TOSA_SCOOP_JC_CHRG_ERR_LED | TOSA_SCOOP_JC_USB_PULLUP | \ TOSA_SCOOP_JC_CHRG_ERR_LED | \
TOSA_SCOOP_JC_TC6393_SUSPEND | TOSA_SCOOP_JC_TC3693_L3V_ON | \ TOSA_SCOOP_JC_TC6393_SUSPEND | TOSA_SCOOP_JC_TC3693_L3V_ON | \
TOSA_SCOOP_JC_WLAN_LED | TOSA_SCOOP_JC_CARD_LIMIT_SEL ) TOSA_SCOOP_JC_WLAN_LED | TOSA_SCOOP_JC_CARD_LIMIT_SEL )
/* GPIO out put level when init 1: Hi */
#define TOSA_SCOOP_JC_IO_OUT ( 0 )
/* /*
* Timing Generator * Timing Generator
...@@ -73,15 +73,6 @@ ...@@ -73,15 +73,6 @@
#define TG_PINICTL 0x06 #define TG_PINICTL 0x06
#define TG_HPOSCTL 0x07 #define TG_HPOSCTL 0x07
/*
* LED
*/
#define TOSA_SCOOP_LED_BLUE TOSA_SCOOP_GPCR_PA11
#define TOSA_SCOOP_LED_GREEN TOSA_SCOOP_GPCR_PA12
#define TOSA_SCOOP_LED_ORANGE TOSA_SCOOP_GPCR_PA13
#define TOSA_SCOOP_LED_WLAN TOSA_SCOOP_GPCR_PA18
/* /*
* PXA GPIOs * PXA GPIOs
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment