Skip to content

Commit

Permalink
Merge branch 'for-lak' of git://git.linuxtogo.org/home/thesing/collie…
Browse files Browse the repository at this point in the history
… into sa1100
  • Loading branch information
Russell King committed Dec 6, 2009
2 parents 729fae4 + 9823b2d commit ba71e17
Show file tree
Hide file tree
Showing 15 changed files with 649 additions and 63 deletions.
79 changes: 74 additions & 5 deletions arch/arm/mach-sa1100/collie.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <linux/mtd/partitions.h>
#include <linux/timer.h>
#include <linux/gpio.h>
#include <linux/pda_power.h>

#include <mach/hardware.h>
#include <asm/mach-types.h>
Expand Down Expand Up @@ -56,6 +57,7 @@ static struct resource collie_scoop_resources[] = {
static struct scoop_config collie_scoop_setup = {
.io_dir = COLLIE_SCOOP_IO_DIR,
.io_out = COLLIE_SCOOP_IO_OUT,
.gpio_base = COLLIE_SCOOP_GPIO_BASE,
};

struct platform_device colliescoop_device = {
Expand Down Expand Up @@ -85,6 +87,70 @@ static struct scoop_pcmcia_config collie_pcmcia_config = {
static struct mcp_plat_data collie_mcp_data = {
.mccr0 = MCCR0_ADM | MCCR0_ExtClk,
.sclk_rate = 9216000,
.gpio_base = COLLIE_TC35143_GPIO_BASE,
};

/*
* Collie AC IN
*/
static int collie_power_init(struct device *dev)
{
int ret = gpio_request(COLLIE_GPIO_AC_IN, "ac in");
if (ret)
goto err_gpio_req;

ret = gpio_direction_input(COLLIE_GPIO_AC_IN);
if (ret)
goto err_gpio_in;

return 0;

err_gpio_in:
gpio_free(COLLIE_GPIO_AC_IN);
err_gpio_req:
return ret;
}

static void collie_power_exit(struct device *dev)
{
gpio_free(COLLIE_GPIO_AC_IN);
}

static int collie_power_ac_online(void)
{
return gpio_get_value(COLLIE_GPIO_AC_IN) == 2;
}

static char *collie_ac_supplied_to[] = {
"main-battery",
"backup-battery",
};

static struct pda_power_pdata collie_power_data = {
.init = collie_power_init,
.is_ac_online = collie_power_ac_online,
.exit = collie_power_exit,
.supplied_to = collie_ac_supplied_to,
.num_supplicants = ARRAY_SIZE(collie_ac_supplied_to),
};

static struct resource collie_power_resource[] = {
{
.name = "ac",
.start = gpio_to_irq(COLLIE_GPIO_AC_IN),
.end = gpio_to_irq(COLLIE_GPIO_AC_IN),
.flags = IORESOURCE_IRQ |
IORESOURCE_IRQ_HIGHEDGE |
IORESOURCE_IRQ_LOWEDGE,
},
};

static struct platform_device collie_power_device = {
.name = "pda-power",
.id = -1,
.dev.platform_data = &collie_power_data,
.resource = collie_power_resource,
.num_resources = ARRAY_SIZE(collie_power_resource),
};

#ifdef CONFIG_SHARP_LOCOMO
Expand Down Expand Up @@ -178,6 +244,7 @@ struct platform_device collie_locomo_device = {
static struct platform_device *devices[] __initdata = {
&collie_locomo_device,
&colliescoop_device,
&collie_power_device,
};

static struct mtd_partition collie_partitions[] = {
Expand Down Expand Up @@ -248,22 +315,24 @@ static void __init collie_init(void)
GPDR = GPIO_LDD8 | GPIO_LDD9 | GPIO_LDD10 | GPIO_LDD11 | GPIO_LDD12 |
GPIO_LDD13 | GPIO_LDD14 | GPIO_LDD15 | GPIO_SSP_TXD |
GPIO_SSP_SCLK | GPIO_SSP_SFRM | GPIO_SDLC_SCLK |
COLLIE_GPIO_UCB1x00_RESET | COLLIE_GPIO_nMIC_ON |
COLLIE_GPIO_nREMOCON_ON | GPIO_32_768kHz;
_COLLIE_GPIO_UCB1x00_RESET | _COLLIE_GPIO_nMIC_ON |
_COLLIE_GPIO_nREMOCON_ON | GPIO_32_768kHz;

PPDR = PPC_LDD0 | PPC_LDD1 | PPC_LDD2 | PPC_LDD3 | PPC_LDD4 | PPC_LDD5 |
PPC_LDD6 | PPC_LDD7 | PPC_L_PCLK | PPC_L_LCLK | PPC_L_FCLK | PPC_L_BIAS |
PPC_TXD1 | PPC_TXD2 | PPC_TXD3 | PPC_TXD4 | PPC_SCLK | PPC_SFRM;

PWER = COLLIE_GPIO_AC_IN | COLLIE_GPIO_CO | COLLIE_GPIO_ON_KEY |
COLLIE_GPIO_WAKEUP | COLLIE_GPIO_nREMOCON_INT | PWER_RTC;
PWER = _COLLIE_GPIO_AC_IN | _COLLIE_GPIO_CO | _COLLIE_GPIO_ON_KEY |
_COLLIE_GPIO_WAKEUP | _COLLIE_GPIO_nREMOCON_INT | PWER_RTC;

PGSR = COLLIE_GPIO_nREMOCON_ON;
PGSR = _COLLIE_GPIO_nREMOCON_ON;

PSDR = PPC_RXD1 | PPC_RXD2 | PPC_RXD3 | PPC_RXD4;

PCFR = PCFR_OPDE;

GPSR |= _COLLIE_GPIO_UCB1x00_RESET;


platform_scoop_config = &collie_pcmcia_config;

Expand Down
77 changes: 44 additions & 33 deletions arch/arm/mach-sa1100/include/mach/collie.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,29 +25,39 @@
#define COLLIE_GPIO_VPEN (COLLIE_SCOOP_GPIO_BASE + 7)
#define COLLIE_SCP_LB_VOL_CHG SCOOP_GPCR_PA19

#define COLLIE_SCOOP_IO_DIR ( COLLIE_SCP_MUTE_L | COLLIE_SCP_MUTE_R | \
#define COLLIE_SCOOP_IO_DIR (COLLIE_SCP_MUTE_L | COLLIE_SCP_MUTE_R | \
COLLIE_SCP_5VON | COLLIE_SCP_AMP_ON | \
COLLIE_SCP_LB_VOL_CHG )
#define COLLIE_SCOOP_IO_OUT ( COLLIE_SCP_MUTE_L | COLLIE_SCP_MUTE_R )
COLLIE_SCP_LB_VOL_CHG)
#define COLLIE_SCOOP_IO_OUT (COLLIE_SCP_MUTE_L | COLLIE_SCP_MUTE_R)

/* GPIOs for which the generic definition doesn't say much */
/* GPIOs for gpiolib */

#define COLLIE_GPIO_ON_KEY GPIO_GPIO (0)
#define COLLIE_GPIO_AC_IN GPIO_GPIO (1)
#define COLLIE_GPIO_SDIO_INT GPIO_GPIO (11)
#define COLLIE_GPIO_CF_IRQ GPIO_GPIO (14)
#define COLLIE_GPIO_nREMOCON_INT GPIO_GPIO (15)
#define COLLIE_GPIO_UCB1x00_RESET GPIO_GPIO (16)
#define COLLIE_GPIO_nMIC_ON GPIO_GPIO (17)
#define COLLIE_GPIO_nREMOCON_ON GPIO_GPIO (18)
#define COLLIE_GPIO_CO GPIO_GPIO (20)
#define COLLIE_GPIO_MCP_CLK GPIO_GPIO (21)
#define COLLIE_GPIO_CF_CD GPIO_GPIO (22)
#define COLLIE_GPIO_UCB1x00_IRQ GPIO_GPIO (23)
#define COLLIE_GPIO_WAKEUP GPIO_GPIO (24)
#define COLLIE_GPIO_GA_INT GPIO_GPIO (25)
#define COLLIE_GPIO_MAIN_BAT_LOW GPIO_GPIO (26)
#define COLLIE_GPIO_ON_KEY (0)
#define COLLIE_GPIO_AC_IN (1)
#define COLLIE_GPIO_SDIO_INT (11)
#define COLLIE_GPIO_CF_IRQ (14)
#define COLLIE_GPIO_nREMOCON_INT (15)
#define COLLIE_GPIO_UCB1x00_RESET (16)
#define COLLIE_GPIO_nMIC_ON (17)
#define COLLIE_GPIO_nREMOCON_ON (18)
#define COLLIE_GPIO_CO (20)
#define COLLIE_GPIO_MCP_CLK (21)
#define COLLIE_GPIO_CF_CD (22)
#define COLLIE_GPIO_UCB1x00_IRQ (23)
#define COLLIE_GPIO_WAKEUP (24)
#define COLLIE_GPIO_GA_INT (25)
#define COLLIE_GPIO_MAIN_BAT_LOW (26)

/* GPIO definitions for direct register access */

#define _COLLIE_GPIO_ON_KEY GPIO_GPIO(0)
#define _COLLIE_GPIO_AC_IN GPIO_GPIO(1)
#define _COLLIE_GPIO_nREMOCON_INT GPIO_GPIO(15)
#define _COLLIE_GPIO_UCB1x00_RESET GPIO_GPIO(16)
#define _COLLIE_GPIO_nMIC_ON GPIO_GPIO(17)
#define _COLLIE_GPIO_nREMOCON_ON GPIO_GPIO(18)
#define _COLLIE_GPIO_CO GPIO_GPIO(20)
#define _COLLIE_GPIO_WAKEUP GPIO_GPIO(24)
/* Interrupts */

#define COLLIE_IRQ_GPIO_ON_KEY IRQ_GPIO0
Expand All @@ -70,19 +80,20 @@
#define COLLIE_LCM_IRQ_GPIO_nSD_WP IRQ_LOCOMO_GPIO14

/* GPIO's on the TC35143AF (Toshiba Analog Frontend) */
#define COLLIE_TC35143_GPIO_VERSION0 UCB_IO_0 /* GPIO0=Version */
#define COLLIE_TC35143_GPIO_TBL_CHK UCB_IO_1 /* GPIO1=TBL_CHK */
#define COLLIE_TC35143_GPIO_VPEN_ON UCB_IO_2 /* GPIO2=VPNE_ON */
#define COLLIE_TC35143_GPIO_IR_ON UCB_IO_3 /* GPIO3=IR_ON */
#define COLLIE_TC35143_GPIO_AMP_ON UCB_IO_4 /* GPIO4=AMP_ON */
#define COLLIE_TC35143_GPIO_VERSION1 UCB_IO_5 /* GPIO5=Version */
#define COLLIE_TC35143_GPIO_FS8KLPF UCB_IO_5 /* GPIO5=fs 8k LPF */
#define COLLIE_TC35143_GPIO_BUZZER_BIAS UCB_IO_6 /* GPIO6=BUZZER BIAS */
#define COLLIE_TC35143_GPIO_MBAT_ON UCB_IO_7 /* GPIO7=MBAT_ON */
#define COLLIE_TC35143_GPIO_BBAT_ON UCB_IO_8 /* GPIO8=BBAT_ON */
#define COLLIE_TC35143_GPIO_TMP_ON UCB_IO_9 /* GPIO9=TMP_ON */
#define COLLIE_TC35143_GPIO_IN ( UCB_IO_0 | UCB_IO_2 | UCB_IO_5 )
#define COLLIE_TC35143_GPIO_OUT ( UCB_IO_1 | UCB_IO_3 | UCB_IO_4 | UCB_IO_6 | \
UCB_IO_7 | UCB_IO_8 | UCB_IO_9 )
#define COLLIE_TC35143_GPIO_BASE (GPIO_MAX + 13)
#define COLLIE_TC35143_GPIO_VERSION0 UCB_IO_0
#define COLLIE_TC35143_GPIO_TBL_CHK UCB_IO_1
#define COLLIE_TC35143_GPIO_VPEN_ON UCB_IO_2
#define COLLIE_TC35143_GPIO_IR_ON UCB_IO_3
#define COLLIE_TC35143_GPIO_AMP_ON UCB_IO_4
#define COLLIE_TC35143_GPIO_VERSION1 UCB_IO_5
#define COLLIE_TC35143_GPIO_FS8KLPF UCB_IO_5
#define COLLIE_TC35143_GPIO_BUZZER_BIAS UCB_IO_6
#define COLLIE_GPIO_MBAT_ON (COLLIE_TC35143_GPIO_BASE + 7)
#define COLLIE_GPIO_BBAT_ON (COLLIE_TC35143_GPIO_BASE + 8)
#define COLLIE_GPIO_TMP_ON (COLLIE_TC35143_GPIO_BASE + 9)
#define COLLIE_TC35143_GPIO_IN (UCB_IO_0 | UCB_IO_2 | UCB_IO_5)
#define COLLIE_TC35143_GPIO_OUT (UCB_IO_1 | UCB_IO_3 | UCB_IO_4 \
| UCB_IO_6)

#endif
19 changes: 4 additions & 15 deletions arch/arm/mach-sa1100/include/mach/gpio.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,9 @@ static inline void gpio_set_value(unsigned gpio, int value)

#define gpio_cansleep __gpio_cansleep

static inline unsigned gpio_to_irq(unsigned gpio)
{
if (gpio < 11)
return IRQ_GPIO0 + gpio;
else
return IRQ_GPIO11 - 11 + gpio;
}

static inline unsigned irq_to_gpio(unsigned irq)
{
if (irq < IRQ_GPIO11_27)
return irq - IRQ_GPIO0;
else
return irq - IRQ_GPIO11 + 11;
}
#define gpio_to_irq(gpio) ((gpio < 11) ? (IRQ_GPIO0 + gpio) : \
(IRQ_GPIO11 - 11 + gpio))
#define irq_to_gpio(irq) ((irq < IRQ_GPIO11_27) ? (irq - IRQ_GPIO0) : \
(irq - IRQ_GPIO11 + 11))

#endif
1 change: 1 addition & 0 deletions arch/arm/mach-sa1100/include/mach/mcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ struct mcp_plat_data {
u32 mccr0;
u32 mccr1;
unsigned int sclk_rate;
int gpio_base;
};

#endif
2 changes: 1 addition & 1 deletion drivers/leds/leds-locomo.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ static void locomoled_brightness_set1(struct led_classdev *led_cdev,

static struct led_classdev locomo_led0 = {
.name = "locomo:amber:charge",
.default_trigger = "sharpsl-charge",
.default_trigger = "main-battery-charging",
.brightness_set = locomoled_brightness_set0,
};

Expand Down
2 changes: 1 addition & 1 deletion drivers/mfd/mcp-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
#include <linux/device.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/mfd/mcp.h>

#include <mach/dma.h>
#include <asm/system.h>

#include "mcp.h"

#define to_mcp(d) container_of(d, struct mcp, attached_device)
#define to_mcp_driver(d) container_of(d, struct mcp_driver, drv)
Expand Down
3 changes: 2 additions & 1 deletion drivers/mfd/mcp-sa11x0.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <linux/spinlock.h>
#include <linux/slab.h>
#include <linux/platform_device.h>
#include <linux/mfd/mcp.h>

#include <mach/dma.h>
#include <mach/hardware.h>
Expand All @@ -28,7 +29,6 @@

#include <mach/assabet.h>

#include "mcp.h"

struct mcp_sa11x0 {
u32 mccr0;
Expand Down Expand Up @@ -163,6 +163,7 @@ static int mcp_sa11x0_probe(struct platform_device *pdev)
mcp->dma_audio_wr = DMA_Ser4MCP0Wr;
mcp->dma_telco_rd = DMA_Ser4MCP1Rd;
mcp->dma_telco_wr = DMA_Ser4MCP1Wr;
mcp->gpio_base = data->gpio_base;

platform_set_drvdata(pdev, mcp);

Expand Down
2 changes: 1 addition & 1 deletion drivers/mfd/ucb1x00-assabet.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
#include <linux/fs.h>
#include <linux/proc_fs.h>
#include <linux/device.h>
#include <linux/mfd/ucb1x00.h>

#include <mach/dma.h>

#include "ucb1x00.h"

#define UCB1X00_ATTR(name,input)\
static ssize_t name##_show(struct device *dev, struct device_attribute *attr, \
Expand Down
Loading

0 comments on commit ba71e17

Please sign in to comment.