提交 b955153b 编写于 作者: R Russell King

ARM: sa1100/assabet: add BCR/BSR GPIO driver

Add a GPIO driver for the board control register/board status register
for the sa1100/assabet platform.  This allows us to transition a range
of drivers to use the gpiod APIs rather than the platform private
ASSABET_BCR_* interfaces.
Signed-off-by: NRussell King <rmk+kernel@armlinux.org.uk>
上级 30a7acd5
...@@ -5,6 +5,7 @@ menu "SA11x0 Implementations" ...@@ -5,6 +5,7 @@ menu "SA11x0 Implementations"
config SA1100_ASSABET config SA1100_ASSABET
bool "Assabet" bool "Assabet"
select ARM_SA1110_CPUFREQ select ARM_SA1110_CPUFREQ
select GPIO_REG
help help
Say Y here if you are using the Intel(R) StrongARM(R) SA-1110 Say Y here if you are using the Intel(R) StrongARM(R) SA-1110
Microprocessor Development Board (also known as the Assabet). Microprocessor Development Board (also known as the Assabet).
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/gpio/gpio-reg.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/platform_data/sa11x0-serial.h> #include <linux/platform_data/sa11x0-serial.h>
#include <linux/serial_core.h> #include <linux/serial_core.h>
...@@ -61,20 +62,45 @@ ...@@ -61,20 +62,45 @@
unsigned long SCR_value = ASSABET_SCR_INIT; unsigned long SCR_value = ASSABET_SCR_INIT;
EXPORT_SYMBOL(SCR_value); EXPORT_SYMBOL(SCR_value);
static unsigned long BCR_value = ASSABET_BCR_DB1110; static struct gpio_chip *assabet_bcr_gc;
static const char *assabet_names[] = {
"cf_pwr", "cf_gfx_reset", "nsoft_reset", "irda_fsel",
"irda_md0", "irda_md1", "stereo_loopback", "ncf_bus_on",
"audio_pwr_on", "light_pwr_on", "lcd16data", "lcd_pwr_on",
"rs232_on", "nred_led", "ngreen_led", "vib_on",
"com_dtr", "com_rts", "radio_wake_mod", "i2c_enab",
"tvir_enab", "qmute", "radio_pwr_on", "spkr_off",
"rs232_valid", "com_dcd", "com_cts", "com_dsr",
"radio_cts", "radio_dsr", "radio_dcd", "radio_ri",
};
/* The old deprecated interface */
void ASSABET_BCR_frob(unsigned int mask, unsigned int val) void ASSABET_BCR_frob(unsigned int mask, unsigned int val)
{ {
unsigned long flags; unsigned long m = mask, v = val;
local_irq_save(flags); assabet_bcr_gc->set_multiple(assabet_bcr_gc, &m, &v);
BCR_value = (BCR_value & ~mask) | val;
ASSABET_BCR = BCR_value;
local_irq_restore(flags);
} }
EXPORT_SYMBOL(ASSABET_BCR_frob); EXPORT_SYMBOL(ASSABET_BCR_frob);
static int __init assabet_init_gpio(void __iomem *reg, u32 def_val)
{
struct gpio_chip *gc;
writel_relaxed(def_val, reg);
gc = gpio_reg_init(NULL, reg, -1, 32, "assabet", 0xff000000, def_val,
assabet_names, NULL, NULL);
if (IS_ERR(gc))
return PTR_ERR(gc);
assabet_bcr_gc = gc;
return gc->base;
}
/* /*
* The codec reset goes to three devices, so we need to release * The codec reset goes to three devices, so we need to release
* the rest when any one of these requests it. However, that * the rest when any one of these requests it. However, that
...@@ -146,7 +172,7 @@ static void adv7171_write(unsigned reg, unsigned val) ...@@ -146,7 +172,7 @@ static void adv7171_write(unsigned reg, unsigned val)
unsigned gpdr = GPDR; unsigned gpdr = GPDR;
unsigned gplr = GPLR; unsigned gplr = GPLR;
ASSABET_BCR = BCR_value | ASSABET_BCR_AUDIO_ON; ASSABET_BCR_frob(ASSABET_BCR_AUDIO_ON, ASSABET_BCR_AUDIO_ON);
udelay(100); udelay(100);
GPCR = SDA | SCK | MOD; /* clear L3 mode to ensure UDA1341 doesn't respond */ GPCR = SDA | SCK | MOD; /* clear L3 mode to ensure UDA1341 doesn't respond */
...@@ -457,14 +483,6 @@ static void __init assabet_init(void) ...@@ -457,14 +483,6 @@ static void __init assabet_init(void)
sa11x0_ppc_configure_mcp(); sa11x0_ppc_configure_mcp();
if (machine_has_neponset()) { if (machine_has_neponset()) {
/*
* Angel sets this, but other bootloaders may not.
*
* This must precede any driver calls to BCR_set()
* or BCR_clear().
*/
ASSABET_BCR = BCR_value = ASSABET_BCR_DB1111;
#ifndef CONFIG_ASSABET_NEPONSET #ifndef CONFIG_ASSABET_NEPONSET
printk( "Warning: Neponset detected but full support " printk( "Warning: Neponset detected but full support "
"hasn't been configured in the kernel\n" ); "hasn't been configured in the kernel\n" );
...@@ -748,12 +766,31 @@ static int __init assabet_leds_init(void) ...@@ -748,12 +766,31 @@ static int __init assabet_leds_init(void)
fs_initcall(assabet_leds_init); fs_initcall(assabet_leds_init);
#endif #endif
void __init assabet_init_irq(void)
{
u32 def_val;
sa1100_init_irq();
if (machine_has_neponset())
def_val = ASSABET_BCR_DB1111;
else
def_val = ASSABET_BCR_DB1110;
/*
* Angel sets this, but other bootloaders may not.
*
* This must precede any driver calls to BCR_set() or BCR_clear().
*/
assabet_init_gpio((void *)&ASSABET_BCR, def_val);
}
MACHINE_START(ASSABET, "Intel-Assabet") MACHINE_START(ASSABET, "Intel-Assabet")
.atag_offset = 0x100, .atag_offset = 0x100,
.fixup = fixup_assabet, .fixup = fixup_assabet,
.map_io = assabet_map_io, .map_io = assabet_map_io,
.nr_irqs = SA1100_NR_IRQS, .nr_irqs = SA1100_NR_IRQS,
.init_irq = sa1100_init_irq, .init_irq = assabet_init_irq,
.init_time = sa1100_timer_init, .init_time = sa1100_timer_init,
.init_machine = assabet_init, .init_machine = assabet_init,
.init_late = sa11x0_init_late, .init_late = sa11x0_init_late,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册