You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
Merge branch 'msm-core' of git://codeaurora.org/quic/kernel/dwalker/linux-msm into devel-stable
This commit is contained in:
@@ -6,6 +6,8 @@ Interrupts
|
||||
- ARM Interrupt subsystem documentation
|
||||
IXP2000
|
||||
- Release Notes for Linux on Intel's IXP2000 Network Processor
|
||||
msm
|
||||
- MSM specific documentation
|
||||
Netwinder
|
||||
- Netwinder specific documentation
|
||||
Porting
|
||||
|
||||
@@ -0,0 +1,176 @@
|
||||
This document provides an overview of the msm_gpiomux interface, which
|
||||
is used to provide gpio pin multiplexing and configuration on mach-msm
|
||||
targets.
|
||||
|
||||
History
|
||||
=======
|
||||
|
||||
The first-generation API for gpio configuration & multiplexing on msm
|
||||
is the function gpio_tlmm_config(). This function has a few notable
|
||||
shortcomings, which led to its deprecation and replacement by gpiomux:
|
||||
|
||||
The 'disable' parameter: Setting the second parameter to
|
||||
gpio_tlmm_config to GPIO_CFG_DISABLE tells the peripheral
|
||||
processor in charge of the subsystem to perform a look-up into a
|
||||
low-power table and apply the low-power/sleep setting for the pin.
|
||||
As the msm family evolved this became problematic. Not all pins
|
||||
have sleep settings, not all peripheral processors will accept requests
|
||||
to apply said sleep settings, and not all msm targets have their gpio
|
||||
subsystems managed by a peripheral processor. In order to get consistent
|
||||
behavior on all targets, drivers are forced to ignore this parameter,
|
||||
rendering it useless.
|
||||
|
||||
The 'direction' flag: for all mux-settings other than raw-gpio (0),
|
||||
the output-enable bit of a gpio is hard-wired to a known
|
||||
input (usually VDD or ground). For those settings, the direction flag
|
||||
is meaningless at best, and deceptive at worst. In addition, using the
|
||||
direction flag to change output-enable (OE) directly can cause trouble in
|
||||
gpiolib, which has no visibility into gpio direction changes made
|
||||
in this way. Direction control in gpio mode should be made through gpiolib.
|
||||
|
||||
Key Features of gpiomux
|
||||
=======================
|
||||
|
||||
- A consistent interface across all generations of msm. Drivers can expect
|
||||
the same results on every target.
|
||||
- gpiomux plays nicely with gpiolib. Functions that should belong to gpiolib
|
||||
are left to gpiolib and not duplicated here. gpiomux is written with the
|
||||
intent that gpio_chips will call gpiomux reference-counting methods
|
||||
from their request() and free() hooks, providing full integration.
|
||||
- Tabular configuration. Instead of having to call gpio_tlmm_config
|
||||
hundreds of times, gpio configuration is placed in a single table.
|
||||
- Per-gpio sleep. Each gpio is individually reference counted, allowing only
|
||||
those lines which are in use to be put in high-power states.
|
||||
- 0 means 'do nothing': all flags are designed so that the default memset-zero
|
||||
equates to a sensible default of 'no configuration', preventing users
|
||||
from having to provide hundreds of 'no-op' configs for unused or
|
||||
unwanted lines.
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
To use gpiomux, provide configuration information for relevant gpio lines
|
||||
in the msm_gpiomux_configs table. Since a 0 equates to "unconfigured",
|
||||
only those lines to be managed by gpiomux need to be specified. Here
|
||||
is a completely fictional example:
|
||||
|
||||
struct msm_gpiomux_config msm_gpiomux_configs[GPIOMUX_NGPIOS] = {
|
||||
[12] = {
|
||||
.active = GPIOMUX_VALID | GPIOMUX_DRV_8MA | GPIOMUX_FUNC_1,
|
||||
.suspended = GPIOMUX_VALID | GPIOMUX_PULL_DOWN,
|
||||
},
|
||||
[34] = {
|
||||
.suspended = GPIOMUX_VALID | GPIOMUX_PULL_DOWN,
|
||||
},
|
||||
};
|
||||
|
||||
To indicate that a gpio is in use, call msm_gpiomux_get() to increase
|
||||
its reference count. To decrease the reference count, call msm_gpiomux_put().
|
||||
|
||||
The effect of this configuration is as follows:
|
||||
|
||||
When the system boots, gpios 12 and 34 will be initialized with their
|
||||
'suspended' configurations. All other gpios, which were left unconfigured,
|
||||
will not be touched.
|
||||
|
||||
When msm_gpiomux_get() is called on gpio 12 to raise its reference count
|
||||
above 0, its active configuration will be applied. Since no other gpio
|
||||
line has a valid active configuration, msm_gpiomux_get() will have no
|
||||
effect on any other line.
|
||||
|
||||
When msm_gpiomux_put() is called on gpio 12 or 34 to drop their reference
|
||||
count to 0, their suspended configurations will be applied.
|
||||
Since no other gpio line has a valid suspended configuration, no other
|
||||
gpio line will be effected by msm_gpiomux_put(). Since gpio 34 has no valid
|
||||
active configuration, this is effectively a no-op for gpio 34 as well,
|
||||
with one small caveat, see the section "About Output-Enable Settings".
|
||||
|
||||
All of the GPIOMUX_VALID flags may seem like unnecessary overhead, but
|
||||
they address some important issues. As unused entries (all those
|
||||
except 12 and 34) are zero-filled, gpiomux needs a way to distinguish
|
||||
the used fields from the unused. In addition, the all-zero pattern
|
||||
is a valid configuration! Therefore, gpiomux defines an additional bit
|
||||
which is used to indicate when a field is used. This has the pleasant
|
||||
side-effect of allowing calls to msm_gpiomux_write to use '0' to indicate
|
||||
that a value should not be changed:
|
||||
|
||||
msm_gpiomux_write(0, GPIOMUX_VALID, 0);
|
||||
|
||||
replaces the active configuration of gpio 0 with an all-zero configuration,
|
||||
but leaves the suspended configuration as it was.
|
||||
|
||||
Static Configurations
|
||||
=====================
|
||||
|
||||
To install a static configuration, which is applied at boot and does
|
||||
not change after that, install a configuration with a suspended component
|
||||
but no active component, as in the previous example:
|
||||
|
||||
[34] = {
|
||||
.suspended = GPIOMUX_VALID | GPIOMUX_PULL_DOWN,
|
||||
},
|
||||
|
||||
The suspended setting is applied during boot, and the lack of any valid
|
||||
active setting prevents any other setting from being applied at runtime.
|
||||
If other subsystems attempting to access the line is a concern, one could
|
||||
*really* anchor the configuration down by calling msm_gpiomux_get on the
|
||||
line at initialization to move the line into active mode. With the line
|
||||
held, it will never be re-suspended, and with no valid active configuration,
|
||||
no new configurations will be applied.
|
||||
|
||||
But then, if having other subsystems grabbing for the line is truly a concern,
|
||||
it should be reserved with gpio_request instead, which carries an implicit
|
||||
msm_gpiomux_get.
|
||||
|
||||
gpiomux and gpiolib
|
||||
===================
|
||||
|
||||
It is expected that msm gpio_chips will call msm_gpiomux_get() and
|
||||
msm_gpiomux_put() from their request and free hooks, like this fictional
|
||||
example:
|
||||
|
||||
static int request(struct gpio_chip *chip, unsigned offset)
|
||||
{
|
||||
return msm_gpiomux_get(chip->base + offset);
|
||||
}
|
||||
|
||||
static void free(struct gpio_chip *chip, unsigned offset)
|
||||
{
|
||||
msm_gpiomux_put(chip->base + offset);
|
||||
}
|
||||
|
||||
...somewhere in a gpio_chip declaration...
|
||||
.request = request,
|
||||
.free = free,
|
||||
|
||||
This provides important functionality:
|
||||
- It guarantees that a gpio line will have its 'active' config applied
|
||||
when the line is requested, and will not be suspended while the line
|
||||
remains requested; and
|
||||
- It guarantees that gpio-direction settings from gpiolib behave sensibly.
|
||||
See "About Output-Enable Settings."
|
||||
|
||||
This mechanism allows for "auto-request" of gpiomux lines via gpiolib
|
||||
when it is suitable. Drivers wishing more exact control are, of course,
|
||||
free to also use msm_gpiomux_set and msm_gpiomux_get.
|
||||
|
||||
About Output-Enable Settings
|
||||
============================
|
||||
|
||||
Some msm targets do not have the ability to query the current gpio
|
||||
configuration setting. This means that changes made to the output-enable
|
||||
(OE) bit by gpiolib cannot be consistently detected and preserved by gpiomux.
|
||||
Therefore, when gpiomux applies a configuration setting, any direction
|
||||
settings which may have been applied by gpiolib are lost and the default
|
||||
input settings are re-applied.
|
||||
|
||||
For this reason, drivers should not assume that gpio direction settings
|
||||
continue to hold if they free and then re-request a gpio. This seems like
|
||||
common sense - after all, anybody could have obtained the line in the
|
||||
meantime - but it needs saying.
|
||||
|
||||
This also means that calls to msm_gpiomux_write will reset the OE bit,
|
||||
which means that if the gpio line is held by a client of gpiolib and
|
||||
msm_gpiomux_write is called, the direction setting has been lost and
|
||||
gpiolib's internal state has been broken.
|
||||
Release gpio lines before reconfiguring them.
|
||||
@@ -10,6 +10,8 @@ config ARCH_MSM7X00A
|
||||
select MSM_SMD
|
||||
select MSM_SMD_PKG3
|
||||
select CPU_V6
|
||||
select MSM_PROC_COMM
|
||||
select HAS_MSM_DEBUG_UART_PHYS
|
||||
|
||||
config ARCH_MSM7X30
|
||||
bool "MSM7x30"
|
||||
@@ -18,6 +20,9 @@ config ARCH_MSM7X30
|
||||
select MSM_VIC
|
||||
select CPU_V7
|
||||
select MSM_REMOTE_SPINLOCK_DEKKERS
|
||||
select MSM_GPIOMUX
|
||||
select MSM_PROC_COMM
|
||||
select HAS_MSM_DEBUG_UART_PHYS
|
||||
|
||||
config ARCH_QSD8X50
|
||||
bool "QSD8X50"
|
||||
@@ -26,6 +31,19 @@ config ARCH_QSD8X50
|
||||
select MSM_VIC
|
||||
select CPU_V7
|
||||
select MSM_REMOTE_SPINLOCK_LDREX
|
||||
select MSM_GPIOMUX
|
||||
select MSM_PROC_COMM
|
||||
select HAS_MSM_DEBUG_UART_PHYS
|
||||
|
||||
config ARCH_MSM8X60
|
||||
bool "MSM8X60"
|
||||
select ARM_GIC
|
||||
select CPU_V7
|
||||
select MSM_V2_TLMM
|
||||
select MSM_GPIOMUX
|
||||
select MACH_MSM8X60_SURF if (!MACH_MSM8X60_RUMI3 && !MACH_MSM8X60_SIM \
|
||||
&& !MACH_MSM8X60_FFA)
|
||||
|
||||
endchoice
|
||||
|
||||
config MSM_SOC_REV_A
|
||||
@@ -36,6 +54,9 @@ config ARCH_MSM_ARM11
|
||||
config ARCH_MSM_SCORPION
|
||||
bool
|
||||
|
||||
config HAS_MSM_DEBUG_UART_PHYS
|
||||
bool
|
||||
|
||||
config MSM_VIC
|
||||
bool
|
||||
|
||||
@@ -74,6 +95,30 @@ config MACH_QSD8X50A_ST1_5
|
||||
help
|
||||
Support for the Qualcomm ST1.5.
|
||||
|
||||
config MACH_MSM8X60_RUMI3
|
||||
depends on ARCH_MSM8X60
|
||||
bool "MSM8x60 RUMI3"
|
||||
help
|
||||
Support for the Qualcomm MSM8x60 RUMI3 emulator.
|
||||
|
||||
config MACH_MSM8X60_SURF
|
||||
depends on ARCH_MSM8X60
|
||||
bool "MSM8x60 SURF"
|
||||
help
|
||||
Support for the Qualcomm MSM8x60 SURF eval board.
|
||||
|
||||
config MACH_MSM8X60_SIM
|
||||
depends on ARCH_MSM8X60
|
||||
bool "MSM8x60 Simulator"
|
||||
help
|
||||
Support for the Qualcomm MSM8x60 simulator.
|
||||
|
||||
config MACH_MSM8X60_FFA
|
||||
depends on ARCH_MSM8X60
|
||||
bool "MSM8x60 FFA"
|
||||
help
|
||||
Support for the Qualcomm MSM8x60 FFA eval board.
|
||||
|
||||
endmenu
|
||||
|
||||
config MSM_DEBUG_UART
|
||||
@@ -82,6 +127,7 @@ config MSM_DEBUG_UART
|
||||
default 2 if MSM_DEBUG_UART2
|
||||
default 3 if MSM_DEBUG_UART3
|
||||
|
||||
if HAS_MSM_DEBUG_UART_PHYS
|
||||
choice
|
||||
prompt "Debug UART"
|
||||
|
||||
@@ -99,11 +145,20 @@ choice
|
||||
config MSM_DEBUG_UART3
|
||||
bool "UART3"
|
||||
endchoice
|
||||
endif
|
||||
|
||||
config MSM_SMD_PKG3
|
||||
bool
|
||||
|
||||
config MSM_PROC_COMM
|
||||
bool
|
||||
|
||||
config MSM_SMD
|
||||
bool
|
||||
|
||||
config MSM_GPIOMUX
|
||||
bool
|
||||
|
||||
config MSM_V2_TLMM
|
||||
bool
|
||||
endif
|
||||
|
||||
@@ -1,16 +1,20 @@
|
||||
obj-y += proc_comm.o
|
||||
obj-y += io.o idle.o timer.o dma.o
|
||||
obj-y += vreg.o
|
||||
obj-y += io.o idle.o timer.o
|
||||
ifndef CONFIG_ARCH_MSM8X60
|
||||
obj-y += acpuclock-arm11.o
|
||||
obj-y += clock.o clock-pcom.o
|
||||
obj-y += gpio.o
|
||||
obj-y += dma.o
|
||||
endif
|
||||
|
||||
ifdef CONFIG_MSM_VIC
|
||||
obj-y += irq-vic.o
|
||||
else
|
||||
ifndef CONFIG_ARCH_MSM8X60
|
||||
obj-y += irq.o
|
||||
endif
|
||||
endif
|
||||
|
||||
obj-$(CONFIG_ARCH_MSM8X60) += clock-dummy.o iommu.o iommu_dev.o devices-msm8x60-iommu.o
|
||||
obj-$(CONFIG_MSM_PROC_COMM) += proc_comm.o clock-pcom.o vreg.o
|
||||
obj-$(CONFIG_MSM_PROC_COMM) += clock.o
|
||||
obj-$(CONFIG_ARCH_QSD8X50) += sirc.o
|
||||
obj-$(CONFIG_MSM_SMD) += smd.o smd_debug.o
|
||||
obj-$(CONFIG_MSM_SMD) += last_radio_log.o
|
||||
@@ -19,4 +23,11 @@ obj-$(CONFIG_MACH_TROUT) += board-trout.o board-trout-gpio.o board-trout-mmc.o d
|
||||
obj-$(CONFIG_MACH_HALIBUT) += board-halibut.o devices-msm7x00.o
|
||||
obj-$(CONFIG_ARCH_MSM7X30) += board-msm7x30.o devices-msm7x30.o
|
||||
obj-$(CONFIG_ARCH_QSD8X50) += board-qsd8x50.o devices-qsd8x50.o
|
||||
obj-$(CONFIG_ARCH_MSM8X60) += board-msm8x60.o
|
||||
|
||||
obj-$(CONFIG_ARCH_MSM7X30) += gpiomux-7x30.o gpiomux-v1.o gpiomux.o
|
||||
obj-$(CONFIG_ARCH_QSD8X50) += gpiomux-8x50.o gpiomux-v1.o gpiomux.o
|
||||
obj-$(CONFIG_ARCH_MSM8X60) += gpiomux-8x60.o gpiomux-v2.o gpiomux.o
|
||||
ifndef CONFIG_MSM_V2_TLMM
|
||||
obj-y += gpio.o
|
||||
endif
|
||||
|
||||
@@ -39,27 +39,11 @@
|
||||
|
||||
extern struct sys_timer msm_timer;
|
||||
|
||||
#ifdef CONFIG_SERIAL_MSM_CONSOLE
|
||||
static struct msm_gpio uart2_config_data[] = {
|
||||
{ GPIO_CFG(49, 2, GPIO_OUTPUT, GPIO_PULL_DOWN, GPIO_2MA), "UART2_RFR"},
|
||||
{ GPIO_CFG(50, 2, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), "UART2_CTS"},
|
||||
{ GPIO_CFG(51, 2, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), "UART2_Rx"},
|
||||
{ GPIO_CFG(52, 2, GPIO_OUTPUT, GPIO_PULL_DOWN, GPIO_2MA), "UART2_Tx"},
|
||||
};
|
||||
|
||||
static void msm7x30_init_uart2(void)
|
||||
{
|
||||
msm_gpios_request_enable(uart2_config_data,
|
||||
ARRAY_SIZE(uart2_config_data));
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
static struct platform_device *devices[] __initdata = {
|
||||
#if defined(CONFIG_SERIAL_MSM) || defined(CONFIG_MSM_SERIAL_DEBUGGER)
|
||||
&msm_device_uart2,
|
||||
#endif
|
||||
|
||||
&msm_device_smd,
|
||||
};
|
||||
|
||||
static void __init msm7x30_init_irq(void)
|
||||
@@ -70,10 +54,6 @@ static void __init msm7x30_init_irq(void)
|
||||
static void __init msm7x30_init(void)
|
||||
{
|
||||
platform_add_devices(devices, ARRAY_SIZE(devices));
|
||||
#ifdef CONFIG_SERIAL_MSM_CONSOLE
|
||||
msm7x30_init_uart2();
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
static void __init msm7x30_map_io(void)
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 and
|
||||
* only version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/irq.h>
|
||||
|
||||
#include <asm/mach-types.h>
|
||||
#include <asm/mach/arch.h>
|
||||
#include <asm/hardware/gic.h>
|
||||
|
||||
#include <mach/board.h>
|
||||
#include <mach/msm_iomap.h>
|
||||
|
||||
void __iomem *gic_cpu_base_addr;
|
||||
|
||||
unsigned long clk_get_max_axi_khz(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void __init msm8x60_map_io(void)
|
||||
{
|
||||
msm_map_msm8x60_io();
|
||||
}
|
||||
|
||||
static void __init msm8x60_init_irq(void)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
gic_dist_init(0, MSM_QGIC_DIST_BASE, GIC_PPI_START);
|
||||
gic_cpu_base_addr = (void *)MSM_QGIC_CPU_BASE;
|
||||
gic_cpu_init(0, MSM_QGIC_CPU_BASE);
|
||||
|
||||
/* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
|
||||
writel(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
|
||||
|
||||
/* RUMI does not adhere to GIC spec by enabling STIs by default.
|
||||
* Enable/clear is supposed to be RO for STIs, but is RW on RUMI.
|
||||
*/
|
||||
if (!machine_is_msm8x60_sim())
|
||||
writel(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
|
||||
|
||||
/* FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
|
||||
* as they are configured as level, which does not play nice with
|
||||
* handle_percpu_irq.
|
||||
*/
|
||||
for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
|
||||
if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
|
||||
set_irq_handler(i, handle_percpu_irq);
|
||||
}
|
||||
}
|
||||
|
||||
static void __init msm8x60_init(void)
|
||||
{
|
||||
}
|
||||
|
||||
MACHINE_START(MSM8X60_RUMI3, "QCT MSM8X60 RUMI3")
|
||||
.map_io = msm8x60_map_io,
|
||||
.init_irq = msm8x60_init_irq,
|
||||
.init_machine = msm8x60_init,
|
||||
.timer = &msm_timer,
|
||||
MACHINE_END
|
||||
|
||||
MACHINE_START(MSM8X60_SURF, "QCT MSM8X60 SURF")
|
||||
.map_io = msm8x60_map_io,
|
||||
.init_irq = msm8x60_init_irq,
|
||||
.init_machine = msm8x60_init,
|
||||
.timer = &msm_timer,
|
||||
MACHINE_END
|
||||
|
||||
MACHINE_START(MSM8X60_SIM, "QCT MSM8X60 SIMULATOR")
|
||||
.map_io = msm8x60_map_io,
|
||||
.init_irq = msm8x60_init_irq,
|
||||
.init_machine = msm8x60_init,
|
||||
.timer = &msm_timer,
|
||||
MACHINE_END
|
||||
|
||||
MACHINE_START(MSM8X60_FFA, "QCT MSM8X60 FFA")
|
||||
.map_io = msm8x60_map_io,
|
||||
.init_irq = msm8x60_init_irq,
|
||||
.init_machine = msm8x60_init,
|
||||
.timer = &msm_timer,
|
||||
MACHINE_END
|
||||
@@ -35,21 +35,50 @@
|
||||
|
||||
extern struct sys_timer msm_timer;
|
||||
|
||||
static struct msm_gpio uart3_config_data[] = {
|
||||
{ GPIO_CFG(86, 1, GPIO_INPUT, GPIO_PULL_DOWN, GPIO_2MA), "UART2_Rx"},
|
||||
{ GPIO_CFG(87, 1, GPIO_OUTPUT, GPIO_PULL_DOWN, GPIO_2MA), "UART2_Tx"},
|
||||
static const resource_size_t qsd8x50_surf_smc91x_base __initdata = 0x70000300;
|
||||
static const unsigned qsd8x50_surf_smc91x_gpio __initdata = 156;
|
||||
|
||||
/* Leave smc91x resources empty here, as we'll fill them in
|
||||
* at run-time: they vary from board to board, and the true
|
||||
* configuration won't be known until boot.
|
||||
*/
|
||||
static struct resource smc91x_resources[] __initdata = {
|
||||
[0] = {
|
||||
.flags = IORESOURCE_MEM,
|
||||
},
|
||||
[1] = {
|
||||
.flags = IORESOURCE_IRQ,
|
||||
},
|
||||
};
|
||||
|
||||
static struct platform_device smc91x_device __initdata = {
|
||||
.name = "smc91x",
|
||||
.id = 0,
|
||||
.num_resources = ARRAY_SIZE(smc91x_resources),
|
||||
.resource = smc91x_resources,
|
||||
};
|
||||
|
||||
static int __init msm_init_smc91x(void)
|
||||
{
|
||||
if (machine_is_qsd8x50_surf()) {
|
||||
smc91x_resources[0].start = qsd8x50_surf_smc91x_base;
|
||||
smc91x_resources[0].end = qsd8x50_surf_smc91x_base + 0xff;
|
||||
smc91x_resources[1].start =
|
||||
gpio_to_irq(qsd8x50_surf_smc91x_gpio);
|
||||
smc91x_resources[1].end =
|
||||
gpio_to_irq(qsd8x50_surf_smc91x_gpio);
|
||||
platform_device_register(&smc91x_device);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
module_init(msm_init_smc91x);
|
||||
|
||||
static struct platform_device *devices[] __initdata = {
|
||||
&msm_device_uart3,
|
||||
&msm_device_smd,
|
||||
};
|
||||
|
||||
static void msm8x50_init_uart3(void)
|
||||
{
|
||||
msm_gpios_request_enable(uart3_config_data,
|
||||
ARRAY_SIZE(uart3_config_data));
|
||||
}
|
||||
|
||||
static void __init qsd8x50_map_io(void)
|
||||
{
|
||||
msm_map_qsd8x50_io();
|
||||
@@ -64,7 +93,6 @@ static void __init qsd8x50_init_irq(void)
|
||||
|
||||
static void __init qsd8x50_init(void)
|
||||
{
|
||||
msm8x50_init_uart3();
|
||||
platform_add_devices(devices, ARRAY_SIZE(devices));
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 and
|
||||
* only version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
#include <linux/clk.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/module.h>
|
||||
|
||||
struct clk *clk_get(struct device *dev, const char *id)
|
||||
{
|
||||
return ERR_PTR(-ENOENT);
|
||||
}
|
||||
EXPORT_SYMBOL(clk_get);
|
||||
|
||||
int clk_enable(struct clk *clk)
|
||||
{
|
||||
return -ENOENT;
|
||||
}
|
||||
EXPORT_SYMBOL(clk_enable);
|
||||
|
||||
void clk_disable(struct clk *clk)
|
||||
{
|
||||
}
|
||||
EXPORT_SYMBOL(clk_disable);
|
||||
|
||||
unsigned long clk_get_rate(struct clk *clk)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(clk_get_rate);
|
||||
|
||||
int clk_set_rate(struct clk *clk, unsigned long rate)
|
||||
{
|
||||
return -ENOENT;
|
||||
}
|
||||
EXPORT_SYMBOL(clk_set_rate);
|
||||
|
||||
void clk_put(struct clk *clk)
|
||||
{
|
||||
}
|
||||
EXPORT_SYMBOL(clk_put);
|
||||
@@ -51,6 +51,11 @@ struct platform_device msm_device_uart2 = {
|
||||
.resource = resources_uart2,
|
||||
};
|
||||
|
||||
struct platform_device msm_device_smd = {
|
||||
.name = "msm_smd",
|
||||
.id = -1,
|
||||
};
|
||||
|
||||
struct clk msm_clocks_7x30[] = {
|
||||
CLK_PCOM("adm_clk", ADM_CLK, NULL, 0),
|
||||
CLK_PCOM("adsp_clk", ADSP_CLK, NULL, 0),
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -48,6 +48,11 @@ struct platform_device msm_device_uart3 = {
|
||||
.resource = resources_uart3,
|
||||
};
|
||||
|
||||
struct platform_device msm_device_smd = {
|
||||
.name = "msm_smd",
|
||||
.id = -1,
|
||||
};
|
||||
|
||||
struct clk msm_clocks_8x50[] = {
|
||||
CLK_PCOM("adm_clk", ADM_CLK, NULL, 0),
|
||||
CLK_PCOM("ebi1_clk", EBI1_CLK, NULL, CLK_MIN),
|
||||
|
||||
+346
-55
@@ -1,7 +1,7 @@
|
||||
/* linux/arch/arm/mach-msm/gpio.c
|
||||
*
|
||||
* Copyright (C) 2007 Google, Inc.
|
||||
* Copyright (c) 2009, Code Aurora Forum. All rights reserved.
|
||||
* Copyright (c) 2009-2010, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* This software is licensed under the terms of the GNU General Public
|
||||
* License version 2, as published by the Free Software Foundation, and
|
||||
@@ -14,72 +14,363 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/irq.h>
|
||||
#include <linux/module.h>
|
||||
#include <mach/gpio.h>
|
||||
#include "proc_comm.h"
|
||||
#include "gpio_hw.h"
|
||||
#include "gpiomux.h"
|
||||
|
||||
int gpio_tlmm_config(unsigned config, unsigned disable)
|
||||
{
|
||||
return msm_proc_comm(PCOM_RPC_GPIO_TLMM_CONFIG_EX, &config, &disable);
|
||||
}
|
||||
EXPORT_SYMBOL(gpio_tlmm_config);
|
||||
#define FIRST_GPIO_IRQ MSM_GPIO_TO_INT(0)
|
||||
|
||||
int msm_gpios_enable(const struct msm_gpio *table, int size)
|
||||
{
|
||||
int rc;
|
||||
int i;
|
||||
const struct msm_gpio *g;
|
||||
for (i = 0; i < size; i++) {
|
||||
g = table + i;
|
||||
rc = gpio_tlmm_config(g->gpio_cfg, GPIO_ENABLE);
|
||||
if (rc) {
|
||||
pr_err("gpio_tlmm_config(0x%08x, GPIO_ENABLE)"
|
||||
" <%s> failed: %d\n",
|
||||
g->gpio_cfg, g->label ?: "?", rc);
|
||||
pr_err("pin %d func %d dir %d pull %d drvstr %d\n",
|
||||
GPIO_PIN(g->gpio_cfg), GPIO_FUNC(g->gpio_cfg),
|
||||
GPIO_DIR(g->gpio_cfg), GPIO_PULL(g->gpio_cfg),
|
||||
GPIO_DRVSTR(g->gpio_cfg));
|
||||
goto err;
|
||||
}
|
||||
#define MSM_GPIO_BANK(bank, first, last) \
|
||||
{ \
|
||||
.regs = { \
|
||||
.out = MSM_GPIO_OUT_##bank, \
|
||||
.in = MSM_GPIO_IN_##bank, \
|
||||
.int_status = MSM_GPIO_INT_STATUS_##bank, \
|
||||
.int_clear = MSM_GPIO_INT_CLEAR_##bank, \
|
||||
.int_en = MSM_GPIO_INT_EN_##bank, \
|
||||
.int_edge = MSM_GPIO_INT_EDGE_##bank, \
|
||||
.int_pos = MSM_GPIO_INT_POS_##bank, \
|
||||
.oe = MSM_GPIO_OE_##bank, \
|
||||
}, \
|
||||
.chip = { \
|
||||
.base = (first), \
|
||||
.ngpio = (last) - (first) + 1, \
|
||||
.get = msm_gpio_get, \
|
||||
.set = msm_gpio_set, \
|
||||
.direction_input = msm_gpio_direction_input, \
|
||||
.direction_output = msm_gpio_direction_output, \
|
||||
.to_irq = msm_gpio_to_irq, \
|
||||
.request = msm_gpio_request, \
|
||||
.free = msm_gpio_free, \
|
||||
} \
|
||||
}
|
||||
|
||||
#define MSM_GPIO_BROKEN_INT_CLEAR 1
|
||||
|
||||
struct msm_gpio_regs {
|
||||
void __iomem *out;
|
||||
void __iomem *in;
|
||||
void __iomem *int_status;
|
||||
void __iomem *int_clear;
|
||||
void __iomem *int_en;
|
||||
void __iomem *int_edge;
|
||||
void __iomem *int_pos;
|
||||
void __iomem *oe;
|
||||
};
|
||||
|
||||
struct msm_gpio_chip {
|
||||
spinlock_t lock;
|
||||
struct gpio_chip chip;
|
||||
struct msm_gpio_regs regs;
|
||||
#if MSM_GPIO_BROKEN_INT_CLEAR
|
||||
unsigned int_status_copy;
|
||||
#endif
|
||||
unsigned int both_edge_detect;
|
||||
unsigned int int_enable[2]; /* 0: awake, 1: sleep */
|
||||
};
|
||||
|
||||
static int msm_gpio_write(struct msm_gpio_chip *msm_chip,
|
||||
unsigned offset, unsigned on)
|
||||
{
|
||||
unsigned mask = BIT(offset);
|
||||
unsigned val;
|
||||
|
||||
val = readl(msm_chip->regs.out);
|
||||
if (on)
|
||||
writel(val | mask, msm_chip->regs.out);
|
||||
else
|
||||
writel(val & ~mask, msm_chip->regs.out);
|
||||
return 0;
|
||||
err:
|
||||
msm_gpios_disable(table, i);
|
||||
return rc;
|
||||
}
|
||||
EXPORT_SYMBOL(msm_gpios_enable);
|
||||
|
||||
void msm_gpios_disable(const struct msm_gpio *table, int size)
|
||||
static void msm_gpio_update_both_edge_detect(struct msm_gpio_chip *msm_chip)
|
||||
{
|
||||
int rc;
|
||||
int i;
|
||||
const struct msm_gpio *g;
|
||||
for (i = size-1; i >= 0; i--) {
|
||||
g = table + i;
|
||||
rc = gpio_tlmm_config(g->gpio_cfg, GPIO_DISABLE);
|
||||
if (rc) {
|
||||
pr_err("gpio_tlmm_config(0x%08x, GPIO_DISABLE)"
|
||||
" <%s> failed: %d\n",
|
||||
g->gpio_cfg, g->label ?: "?", rc);
|
||||
pr_err("pin %d func %d dir %d pull %d drvstr %d\n",
|
||||
GPIO_PIN(g->gpio_cfg), GPIO_FUNC(g->gpio_cfg),
|
||||
GPIO_DIR(g->gpio_cfg), GPIO_PULL(g->gpio_cfg),
|
||||
GPIO_DRVSTR(g->gpio_cfg));
|
||||
int loop_limit = 100;
|
||||
unsigned pol, val, val2, intstat;
|
||||
do {
|
||||
val = readl(msm_chip->regs.in);
|
||||
pol = readl(msm_chip->regs.int_pos);
|
||||
pol = (pol & ~msm_chip->both_edge_detect) |
|
||||
(~val & msm_chip->both_edge_detect);
|
||||
writel(pol, msm_chip->regs.int_pos);
|
||||
intstat = readl(msm_chip->regs.int_status);
|
||||
val2 = readl(msm_chip->regs.in);
|
||||
if (((val ^ val2) & msm_chip->both_edge_detect & ~intstat) == 0)
|
||||
return;
|
||||
} while (loop_limit-- > 0);
|
||||
printk(KERN_ERR "msm_gpio_update_both_edge_detect, "
|
||||
"failed to reach stable state %x != %x\n", val, val2);
|
||||
}
|
||||
|
||||
static int msm_gpio_clear_detect_status(struct msm_gpio_chip *msm_chip,
|
||||
unsigned offset)
|
||||
{
|
||||
unsigned bit = BIT(offset);
|
||||
|
||||
#if MSM_GPIO_BROKEN_INT_CLEAR
|
||||
/* Save interrupts that already triggered before we loose them. */
|
||||
/* Any interrupt that triggers between the read of int_status */
|
||||
/* and the write to int_clear will still be lost though. */
|
||||
msm_chip->int_status_copy |= readl(msm_chip->regs.int_status);
|
||||
msm_chip->int_status_copy &= ~bit;
|
||||
#endif
|
||||
writel(bit, msm_chip->regs.int_clear);
|
||||
msm_gpio_update_both_edge_detect(msm_chip);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int msm_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
|
||||
{
|
||||
struct msm_gpio_chip *msm_chip;
|
||||
unsigned long irq_flags;
|
||||
|
||||
msm_chip = container_of(chip, struct msm_gpio_chip, chip);
|
||||
spin_lock_irqsave(&msm_chip->lock, irq_flags);
|
||||
writel(readl(msm_chip->regs.oe) & ~BIT(offset), msm_chip->regs.oe);
|
||||
spin_unlock_irqrestore(&msm_chip->lock, irq_flags);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
msm_gpio_direction_output(struct gpio_chip *chip, unsigned offset, int value)
|
||||
{
|
||||
struct msm_gpio_chip *msm_chip;
|
||||
unsigned long irq_flags;
|
||||
|
||||
msm_chip = container_of(chip, struct msm_gpio_chip, chip);
|
||||
spin_lock_irqsave(&msm_chip->lock, irq_flags);
|
||||
msm_gpio_write(msm_chip, offset, value);
|
||||
writel(readl(msm_chip->regs.oe) | BIT(offset), msm_chip->regs.oe);
|
||||
spin_unlock_irqrestore(&msm_chip->lock, irq_flags);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int msm_gpio_get(struct gpio_chip *chip, unsigned offset)
|
||||
{
|
||||
struct msm_gpio_chip *msm_chip;
|
||||
|
||||
msm_chip = container_of(chip, struct msm_gpio_chip, chip);
|
||||
return (readl(msm_chip->regs.in) & (1U << offset)) ? 1 : 0;
|
||||
}
|
||||
|
||||
static void msm_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
|
||||
{
|
||||
struct msm_gpio_chip *msm_chip;
|
||||
unsigned long irq_flags;
|
||||
|
||||
msm_chip = container_of(chip, struct msm_gpio_chip, chip);
|
||||
spin_lock_irqsave(&msm_chip->lock, irq_flags);
|
||||
msm_gpio_write(msm_chip, offset, value);
|
||||
spin_unlock_irqrestore(&msm_chip->lock, irq_flags);
|
||||
}
|
||||
|
||||
static int msm_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
|
||||
{
|
||||
return MSM_GPIO_TO_INT(chip->base + offset);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_MSM_GPIOMUX
|
||||
static int msm_gpio_request(struct gpio_chip *chip, unsigned offset)
|
||||
{
|
||||
return msm_gpiomux_get(chip->base + offset);
|
||||
}
|
||||
|
||||
static void msm_gpio_free(struct gpio_chip *chip, unsigned offset)
|
||||
{
|
||||
msm_gpiomux_put(chip->base + offset);
|
||||
}
|
||||
#else
|
||||
#define msm_gpio_request NULL
|
||||
#define msm_gpio_free NULL
|
||||
#endif
|
||||
|
||||
struct msm_gpio_chip msm_gpio_chips[] = {
|
||||
#if defined(CONFIG_ARCH_MSM7X00A)
|
||||
MSM_GPIO_BANK(0, 0, 15),
|
||||
MSM_GPIO_BANK(1, 16, 42),
|
||||
MSM_GPIO_BANK(2, 43, 67),
|
||||
MSM_GPIO_BANK(3, 68, 94),
|
||||
MSM_GPIO_BANK(4, 95, 106),
|
||||
MSM_GPIO_BANK(5, 107, 121),
|
||||
#elif defined(CONFIG_ARCH_MSM7X25) || defined(CONFIG_ARCH_MSM7X27)
|
||||
MSM_GPIO_BANK(0, 0, 15),
|
||||
MSM_GPIO_BANK(1, 16, 42),
|
||||
MSM_GPIO_BANK(2, 43, 67),
|
||||
MSM_GPIO_BANK(3, 68, 94),
|
||||
MSM_GPIO_BANK(4, 95, 106),
|
||||
MSM_GPIO_BANK(5, 107, 132),
|
||||
#elif defined(CONFIG_ARCH_MSM7X30)
|
||||
MSM_GPIO_BANK(0, 0, 15),
|
||||
MSM_GPIO_BANK(1, 16, 43),
|
||||
MSM_GPIO_BANK(2, 44, 67),
|
||||
MSM_GPIO_BANK(3, 68, 94),
|
||||
MSM_GPIO_BANK(4, 95, 106),
|
||||
MSM_GPIO_BANK(5, 107, 133),
|
||||
MSM_GPIO_BANK(6, 134, 150),
|
||||
MSM_GPIO_BANK(7, 151, 181),
|
||||
#elif defined(CONFIG_ARCH_QSD8X50)
|
||||
MSM_GPIO_BANK(0, 0, 15),
|
||||
MSM_GPIO_BANK(1, 16, 42),
|
||||
MSM_GPIO_BANK(2, 43, 67),
|
||||
MSM_GPIO_BANK(3, 68, 94),
|
||||
MSM_GPIO_BANK(4, 95, 103),
|
||||
MSM_GPIO_BANK(5, 104, 121),
|
||||
MSM_GPIO_BANK(6, 122, 152),
|
||||
MSM_GPIO_BANK(7, 153, 164),
|
||||
#endif
|
||||
};
|
||||
|
||||
static void msm_gpio_irq_ack(unsigned int irq)
|
||||
{
|
||||
unsigned long irq_flags;
|
||||
struct msm_gpio_chip *msm_chip = get_irq_chip_data(irq);
|
||||
spin_lock_irqsave(&msm_chip->lock, irq_flags);
|
||||
msm_gpio_clear_detect_status(msm_chip,
|
||||
irq - gpio_to_irq(msm_chip->chip.base));
|
||||
spin_unlock_irqrestore(&msm_chip->lock, irq_flags);
|
||||
}
|
||||
|
||||
static void msm_gpio_irq_mask(unsigned int irq)
|
||||
{
|
||||
unsigned long irq_flags;
|
||||
struct msm_gpio_chip *msm_chip = get_irq_chip_data(irq);
|
||||
unsigned offset = irq - gpio_to_irq(msm_chip->chip.base);
|
||||
|
||||
spin_lock_irqsave(&msm_chip->lock, irq_flags);
|
||||
/* level triggered interrupts are also latched */
|
||||
if (!(readl(msm_chip->regs.int_edge) & BIT(offset)))
|
||||
msm_gpio_clear_detect_status(msm_chip, offset);
|
||||
msm_chip->int_enable[0] &= ~BIT(offset);
|
||||
writel(msm_chip->int_enable[0], msm_chip->regs.int_en);
|
||||
spin_unlock_irqrestore(&msm_chip->lock, irq_flags);
|
||||
}
|
||||
|
||||
static void msm_gpio_irq_unmask(unsigned int irq)
|
||||
{
|
||||
unsigned long irq_flags;
|
||||
struct msm_gpio_chip *msm_chip = get_irq_chip_data(irq);
|
||||
unsigned offset = irq - gpio_to_irq(msm_chip->chip.base);
|
||||
|
||||
spin_lock_irqsave(&msm_chip->lock, irq_flags);
|
||||
/* level triggered interrupts are also latched */
|
||||
if (!(readl(msm_chip->regs.int_edge) & BIT(offset)))
|
||||
msm_gpio_clear_detect_status(msm_chip, offset);
|
||||
msm_chip->int_enable[0] |= BIT(offset);
|
||||
writel(msm_chip->int_enable[0], msm_chip->regs.int_en);
|
||||
spin_unlock_irqrestore(&msm_chip->lock, irq_flags);
|
||||
}
|
||||
|
||||
static int msm_gpio_irq_set_wake(unsigned int irq, unsigned int on)
|
||||
{
|
||||
unsigned long irq_flags;
|
||||
struct msm_gpio_chip *msm_chip = get_irq_chip_data(irq);
|
||||
unsigned offset = irq - gpio_to_irq(msm_chip->chip.base);
|
||||
|
||||
spin_lock_irqsave(&msm_chip->lock, irq_flags);
|
||||
|
||||
if (on)
|
||||
msm_chip->int_enable[1] |= BIT(offset);
|
||||
else
|
||||
msm_chip->int_enable[1] &= ~BIT(offset);
|
||||
|
||||
spin_unlock_irqrestore(&msm_chip->lock, irq_flags);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int msm_gpio_irq_set_type(unsigned int irq, unsigned int flow_type)
|
||||
{
|
||||
unsigned long irq_flags;
|
||||
struct msm_gpio_chip *msm_chip = get_irq_chip_data(irq);
|
||||
unsigned offset = irq - gpio_to_irq(msm_chip->chip.base);
|
||||
unsigned val, mask = BIT(offset);
|
||||
|
||||
spin_lock_irqsave(&msm_chip->lock, irq_flags);
|
||||
val = readl(msm_chip->regs.int_edge);
|
||||
if (flow_type & IRQ_TYPE_EDGE_BOTH) {
|
||||
writel(val | mask, msm_chip->regs.int_edge);
|
||||
irq_desc[irq].handle_irq = handle_edge_irq;
|
||||
} else {
|
||||
writel(val & ~mask, msm_chip->regs.int_edge);
|
||||
irq_desc[irq].handle_irq = handle_level_irq;
|
||||
}
|
||||
if ((flow_type & IRQ_TYPE_EDGE_BOTH) == IRQ_TYPE_EDGE_BOTH) {
|
||||
msm_chip->both_edge_detect |= mask;
|
||||
msm_gpio_update_both_edge_detect(msm_chip);
|
||||
} else {
|
||||
msm_chip->both_edge_detect &= ~mask;
|
||||
val = readl(msm_chip->regs.int_pos);
|
||||
if (flow_type & (IRQF_TRIGGER_RISING | IRQF_TRIGGER_HIGH))
|
||||
writel(val | mask, msm_chip->regs.int_pos);
|
||||
else
|
||||
writel(val & ~mask, msm_chip->regs.int_pos);
|
||||
}
|
||||
spin_unlock_irqrestore(&msm_chip->lock, irq_flags);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void msm_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
|
||||
{
|
||||
int i, j, mask;
|
||||
unsigned val;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(msm_gpio_chips); i++) {
|
||||
struct msm_gpio_chip *msm_chip = &msm_gpio_chips[i];
|
||||
val = readl(msm_chip->regs.int_status);
|
||||
val &= msm_chip->int_enable[0];
|
||||
while (val) {
|
||||
mask = val & -val;
|
||||
j = fls(mask) - 1;
|
||||
/* printk("%s %08x %08x bit %d gpio %d irq %d\n",
|
||||
__func__, v, m, j, msm_chip->chip.start + j,
|
||||
FIRST_GPIO_IRQ + msm_chip->chip.start + j); */
|
||||
val &= ~mask;
|
||||
generic_handle_irq(FIRST_GPIO_IRQ +
|
||||
msm_chip->chip.base + j);
|
||||
}
|
||||
}
|
||||
desc->chip->ack(irq);
|
||||
}
|
||||
EXPORT_SYMBOL(msm_gpios_disable);
|
||||
|
||||
int msm_gpios_request_enable(const struct msm_gpio *table, int size)
|
||||
{
|
||||
int rc = msm_gpios_enable(table, size);
|
||||
return rc;
|
||||
}
|
||||
EXPORT_SYMBOL(msm_gpios_request_enable);
|
||||
static struct irq_chip msm_gpio_irq_chip = {
|
||||
.name = "msmgpio",
|
||||
.ack = msm_gpio_irq_ack,
|
||||
.mask = msm_gpio_irq_mask,
|
||||
.unmask = msm_gpio_irq_unmask,
|
||||
.set_wake = msm_gpio_irq_set_wake,
|
||||
.set_type = msm_gpio_irq_set_type,
|
||||
};
|
||||
|
||||
void msm_gpios_disable_free(const struct msm_gpio *table, int size)
|
||||
static int __init msm_init_gpio(void)
|
||||
{
|
||||
msm_gpios_disable(table, size);
|
||||
int i, j = 0;
|
||||
|
||||
for (i = FIRST_GPIO_IRQ; i < FIRST_GPIO_IRQ + NR_GPIO_IRQS; i++) {
|
||||
if (i - FIRST_GPIO_IRQ >=
|
||||
msm_gpio_chips[j].chip.base +
|
||||
msm_gpio_chips[j].chip.ngpio)
|
||||
j++;
|
||||
set_irq_chip_data(i, &msm_gpio_chips[j]);
|
||||
set_irq_chip(i, &msm_gpio_irq_chip);
|
||||
set_irq_handler(i, handle_edge_irq);
|
||||
set_irq_flags(i, IRQF_VALID);
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(msm_gpio_chips); i++) {
|
||||
spin_lock_init(&msm_gpio_chips[i].lock);
|
||||
writel(0, msm_gpio_chips[i].regs.int_en);
|
||||
gpiochip_add(&msm_gpio_chips[i].chip);
|
||||
}
|
||||
|
||||
set_irq_chained_handler(INT_GPIO_GROUP1, msm_gpio_irq_handler);
|
||||
set_irq_chained_handler(INT_GPIO_GROUP2, msm_gpio_irq_handler);
|
||||
set_irq_wake(INT_GPIO_GROUP1, 1);
|
||||
set_irq_wake(INT_GPIO_GROUP2, 2);
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(msm_gpios_disable_free);
|
||||
|
||||
postcore_initcall(msm_init_gpio);
|
||||
|
||||
@@ -0,0 +1,278 @@
|
||||
/* arch/arm/mach-msm/gpio_hw.h
|
||||
*
|
||||
* Copyright (C) 2007 Google, Inc.
|
||||
* Author: Brian Swetland <swetland@google.com>
|
||||
* Copyright (c) 2008-2010, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* This software is licensed under the terms of the GNU General Public
|
||||
* License version 2, as published by the Free Software Foundation, and
|
||||
* may be copied, distributed, and modified under those terms.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __ARCH_ARM_MACH_MSM_GPIO_HW_H
|
||||
#define __ARCH_ARM_MACH_MSM_GPIO_HW_H
|
||||
|
||||
#include <mach/msm_iomap.h>
|
||||
|
||||
/* see 80-VA736-2 Rev C pp 695-751
|
||||
**
|
||||
** These are actually the *shadow* gpio registers, since the
|
||||
** real ones (which allow full access) are only available to the
|
||||
** ARM9 side of the world.
|
||||
**
|
||||
** Since the _BASE need to be page-aligned when we're mapping them
|
||||
** to virtual addresses, adjust for the additional offset in these
|
||||
** macros.
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_ARCH_MSM7X30)
|
||||
#define MSM_GPIO1_REG(off) (MSM_GPIO1_BASE + (off))
|
||||
#define MSM_GPIO2_REG(off) (MSM_GPIO2_BASE + 0x400 + (off))
|
||||
#else
|
||||
#define MSM_GPIO1_REG(off) (MSM_GPIO1_BASE + 0x800 + (off))
|
||||
#define MSM_GPIO2_REG(off) (MSM_GPIO2_BASE + 0xC00 + (off))
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_ARCH_MSM7X00A) || defined(CONFIG_ARCH_MSM7X25) ||\
|
||||
defined(CONFIG_ARCH_MSM7X27)
|
||||
|
||||
/* output value */
|
||||
#define MSM_GPIO_OUT_0 MSM_GPIO1_REG(0x00) /* gpio 15-0 */
|
||||
#define MSM_GPIO_OUT_1 MSM_GPIO2_REG(0x00) /* gpio 42-16 */
|
||||
#define MSM_GPIO_OUT_2 MSM_GPIO1_REG(0x04) /* gpio 67-43 */
|
||||
#define MSM_GPIO_OUT_3 MSM_GPIO1_REG(0x08) /* gpio 94-68 */
|
||||
#define MSM_GPIO_OUT_4 MSM_GPIO1_REG(0x0C) /* gpio 106-95 */
|
||||
#define MSM_GPIO_OUT_5 MSM_GPIO1_REG(0x50) /* gpio 107-121 */
|
||||
|
||||
/* same pin map as above, output enable */
|
||||
#define MSM_GPIO_OE_0 MSM_GPIO1_REG(0x10)
|
||||
#define MSM_GPIO_OE_1 MSM_GPIO2_REG(0x08)
|
||||
#define MSM_GPIO_OE_2 MSM_GPIO1_REG(0x14)
|
||||
#define MSM_GPIO_OE_3 MSM_GPIO1_REG(0x18)
|
||||
#define MSM_GPIO_OE_4 MSM_GPIO1_REG(0x1C)
|
||||
#define MSM_GPIO_OE_5 MSM_GPIO1_REG(0x54)
|
||||
|
||||
/* same pin map as above, input read */
|
||||
#define MSM_GPIO_IN_0 MSM_GPIO1_REG(0x34)
|
||||
#define MSM_GPIO_IN_1 MSM_GPIO2_REG(0x20)
|
||||
#define MSM_GPIO_IN_2 MSM_GPIO1_REG(0x38)
|
||||
#define MSM_GPIO_IN_3 MSM_GPIO1_REG(0x3C)
|
||||
#define MSM_GPIO_IN_4 MSM_GPIO1_REG(0x40)
|
||||
#define MSM_GPIO_IN_5 MSM_GPIO1_REG(0x44)
|
||||
|
||||
/* same pin map as above, 1=edge 0=level interrup */
|
||||
#define MSM_GPIO_INT_EDGE_0 MSM_GPIO1_REG(0x60)
|
||||
#define MSM_GPIO_INT_EDGE_1 MSM_GPIO2_REG(0x50)
|
||||
#define MSM_GPIO_INT_EDGE_2 MSM_GPIO1_REG(0x64)
|
||||
#define MSM_GPIO_INT_EDGE_3 MSM_GPIO1_REG(0x68)
|
||||
#define MSM_GPIO_INT_EDGE_4 MSM_GPIO1_REG(0x6C)
|
||||
#define MSM_GPIO_INT_EDGE_5 MSM_GPIO1_REG(0xC0)
|
||||
|
||||
/* same pin map as above, 1=positive 0=negative */
|
||||
#define MSM_GPIO_INT_POS_0 MSM_GPIO1_REG(0x70)
|
||||
#define MSM_GPIO_INT_POS_1 MSM_GPIO2_REG(0x58)
|
||||
#define MSM_GPIO_INT_POS_2 MSM_GPIO1_REG(0x74)
|
||||
#define MSM_GPIO_INT_POS_3 MSM_GPIO1_REG(0x78)
|
||||
#define MSM_GPIO_INT_POS_4 MSM_GPIO1_REG(0x7C)
|
||||
#define MSM_GPIO_INT_POS_5 MSM_GPIO1_REG(0xBC)
|
||||
|
||||
/* same pin map as above, interrupt enable */
|
||||
#define MSM_GPIO_INT_EN_0 MSM_GPIO1_REG(0x80)
|
||||
#define MSM_GPIO_INT_EN_1 MSM_GPIO2_REG(0x60)
|
||||
#define MSM_GPIO_INT_EN_2 MSM_GPIO1_REG(0x84)
|
||||
#define MSM_GPIO_INT_EN_3 MSM_GPIO1_REG(0x88)
|
||||
#define MSM_GPIO_INT_EN_4 MSM_GPIO1_REG(0x8C)
|
||||
#define MSM_GPIO_INT_EN_5 MSM_GPIO1_REG(0xB8)
|
||||
|
||||
/* same pin map as above, write 1 to clear interrupt */
|
||||
#define MSM_GPIO_INT_CLEAR_0 MSM_GPIO1_REG(0x90)
|
||||
#define MSM_GPIO_INT_CLEAR_1 MSM_GPIO2_REG(0x68)
|
||||
#define MSM_GPIO_INT_CLEAR_2 MSM_GPIO1_REG(0x94)
|
||||
#define MSM_GPIO_INT_CLEAR_3 MSM_GPIO1_REG(0x98)
|
||||
#define MSM_GPIO_INT_CLEAR_4 MSM_GPIO1_REG(0x9C)
|
||||
#define MSM_GPIO_INT_CLEAR_5 MSM_GPIO1_REG(0xB4)
|
||||
|
||||
/* same pin map as above, 1=interrupt pending */
|
||||
#define MSM_GPIO_INT_STATUS_0 MSM_GPIO1_REG(0xA0)
|
||||
#define MSM_GPIO_INT_STATUS_1 MSM_GPIO2_REG(0x70)
|
||||
#define MSM_GPIO_INT_STATUS_2 MSM_GPIO1_REG(0xA4)
|
||||
#define MSM_GPIO_INT_STATUS_3 MSM_GPIO1_REG(0xA8)
|
||||
#define MSM_GPIO_INT_STATUS_4 MSM_GPIO1_REG(0xAC)
|
||||
#define MSM_GPIO_INT_STATUS_5 MSM_GPIO1_REG(0xB0)
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_ARCH_QSD8X50)
|
||||
/* output value */
|
||||
#define MSM_GPIO_OUT_0 MSM_GPIO1_REG(0x00) /* gpio 15-0 */
|
||||
#define MSM_GPIO_OUT_1 MSM_GPIO2_REG(0x00) /* gpio 42-16 */
|
||||
#define MSM_GPIO_OUT_2 MSM_GPIO1_REG(0x04) /* gpio 67-43 */
|
||||
#define MSM_GPIO_OUT_3 MSM_GPIO1_REG(0x08) /* gpio 94-68 */
|
||||
#define MSM_GPIO_OUT_4 MSM_GPIO1_REG(0x0C) /* gpio 103-95 */
|
||||
#define MSM_GPIO_OUT_5 MSM_GPIO1_REG(0x10) /* gpio 121-104 */
|
||||
#define MSM_GPIO_OUT_6 MSM_GPIO1_REG(0x14) /* gpio 152-122 */
|
||||
#define MSM_GPIO_OUT_7 MSM_GPIO1_REG(0x18) /* gpio 164-153 */
|
||||
|
||||
/* same pin map as above, output enable */
|
||||
#define MSM_GPIO_OE_0 MSM_GPIO1_REG(0x20)
|
||||
#define MSM_GPIO_OE_1 MSM_GPIO2_REG(0x08)
|
||||
#define MSM_GPIO_OE_2 MSM_GPIO1_REG(0x24)
|
||||
#define MSM_GPIO_OE_3 MSM_GPIO1_REG(0x28)
|
||||
#define MSM_GPIO_OE_4 MSM_GPIO1_REG(0x2C)
|
||||
#define MSM_GPIO_OE_5 MSM_GPIO1_REG(0x30)
|
||||
#define MSM_GPIO_OE_6 MSM_GPIO1_REG(0x34)
|
||||
#define MSM_GPIO_OE_7 MSM_GPIO1_REG(0x38)
|
||||
|
||||
/* same pin map as above, input read */
|
||||
#define MSM_GPIO_IN_0 MSM_GPIO1_REG(0x50)
|
||||
#define MSM_GPIO_IN_1 MSM_GPIO2_REG(0x20)
|
||||
#define MSM_GPIO_IN_2 MSM_GPIO1_REG(0x54)
|
||||
#define MSM_GPIO_IN_3 MSM_GPIO1_REG(0x58)
|
||||
#define MSM_GPIO_IN_4 MSM_GPIO1_REG(0x5C)
|
||||
#define MSM_GPIO_IN_5 MSM_GPIO1_REG(0x60)
|
||||
#define MSM_GPIO_IN_6 MSM_GPIO1_REG(0x64)
|
||||
#define MSM_GPIO_IN_7 MSM_GPIO1_REG(0x68)
|
||||
|
||||
/* same pin map as above, 1=edge 0=level interrup */
|
||||
#define MSM_GPIO_INT_EDGE_0 MSM_GPIO1_REG(0x70)
|
||||
#define MSM_GPIO_INT_EDGE_1 MSM_GPIO2_REG(0x50)
|
||||
#define MSM_GPIO_INT_EDGE_2 MSM_GPIO1_REG(0x74)
|
||||
#define MSM_GPIO_INT_EDGE_3 MSM_GPIO1_REG(0x78)
|
||||
#define MSM_GPIO_INT_EDGE_4 MSM_GPIO1_REG(0x7C)
|
||||
#define MSM_GPIO_INT_EDGE_5 MSM_GPIO1_REG(0x80)
|
||||
#define MSM_GPIO_INT_EDGE_6 MSM_GPIO1_REG(0x84)
|
||||
#define MSM_GPIO_INT_EDGE_7 MSM_GPIO1_REG(0x88)
|
||||
|
||||
/* same pin map as above, 1=positive 0=negative */
|
||||
#define MSM_GPIO_INT_POS_0 MSM_GPIO1_REG(0x90)
|
||||
#define MSM_GPIO_INT_POS_1 MSM_GPIO2_REG(0x58)
|
||||
#define MSM_GPIO_INT_POS_2 MSM_GPIO1_REG(0x94)
|
||||
#define MSM_GPIO_INT_POS_3 MSM_GPIO1_REG(0x98)
|
||||
#define MSM_GPIO_INT_POS_4 MSM_GPIO1_REG(0x9C)
|
||||
#define MSM_GPIO_INT_POS_5 MSM_GPIO1_REG(0xA0)
|
||||
#define MSM_GPIO_INT_POS_6 MSM_GPIO1_REG(0xA4)
|
||||
#define MSM_GPIO_INT_POS_7 MSM_GPIO1_REG(0xA8)
|
||||
|
||||
/* same pin map as above, interrupt enable */
|
||||
#define MSM_GPIO_INT_EN_0 MSM_GPIO1_REG(0xB0)
|
||||
#define MSM_GPIO_INT_EN_1 MSM_GPIO2_REG(0x60)
|
||||
#define MSM_GPIO_INT_EN_2 MSM_GPIO1_REG(0xB4)
|
||||
#define MSM_GPIO_INT_EN_3 MSM_GPIO1_REG(0xB8)
|
||||
#define MSM_GPIO_INT_EN_4 MSM_GPIO1_REG(0xBC)
|
||||
#define MSM_GPIO_INT_EN_5 MSM_GPIO1_REG(0xC0)
|
||||
#define MSM_GPIO_INT_EN_6 MSM_GPIO1_REG(0xC4)
|
||||
#define MSM_GPIO_INT_EN_7 MSM_GPIO1_REG(0xC8)
|
||||
|
||||
/* same pin map as above, write 1 to clear interrupt */
|
||||
#define MSM_GPIO_INT_CLEAR_0 MSM_GPIO1_REG(0xD0)
|
||||
#define MSM_GPIO_INT_CLEAR_1 MSM_GPIO2_REG(0x68)
|
||||
#define MSM_GPIO_INT_CLEAR_2 MSM_GPIO1_REG(0xD4)
|
||||
#define MSM_GPIO_INT_CLEAR_3 MSM_GPIO1_REG(0xD8)
|
||||
#define MSM_GPIO_INT_CLEAR_4 MSM_GPIO1_REG(0xDC)
|
||||
#define MSM_GPIO_INT_CLEAR_5 MSM_GPIO1_REG(0xE0)
|
||||
#define MSM_GPIO_INT_CLEAR_6 MSM_GPIO1_REG(0xE4)
|
||||
#define MSM_GPIO_INT_CLEAR_7 MSM_GPIO1_REG(0xE8)
|
||||
|
||||
/* same pin map as above, 1=interrupt pending */
|
||||
#define MSM_GPIO_INT_STATUS_0 MSM_GPIO1_REG(0xF0)
|
||||
#define MSM_GPIO_INT_STATUS_1 MSM_GPIO2_REG(0x70)
|
||||
#define MSM_GPIO_INT_STATUS_2 MSM_GPIO1_REG(0xF4)
|
||||
#define MSM_GPIO_INT_STATUS_3 MSM_GPIO1_REG(0xF8)
|
||||
#define MSM_GPIO_INT_STATUS_4 MSM_GPIO1_REG(0xFC)
|
||||
#define MSM_GPIO_INT_STATUS_5 MSM_GPIO1_REG(0x100)
|
||||
#define MSM_GPIO_INT_STATUS_6 MSM_GPIO1_REG(0x104)
|
||||
#define MSM_GPIO_INT_STATUS_7 MSM_GPIO1_REG(0x108)
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_ARCH_MSM7X30)
|
||||
|
||||
/* output value */
|
||||
#define MSM_GPIO_OUT_0 MSM_GPIO1_REG(0x00) /* gpio 15-0 */
|
||||
#define MSM_GPIO_OUT_1 MSM_GPIO2_REG(0x00) /* gpio 43-16 */
|
||||
#define MSM_GPIO_OUT_2 MSM_GPIO1_REG(0x04) /* gpio 67-44 */
|
||||
#define MSM_GPIO_OUT_3 MSM_GPIO1_REG(0x08) /* gpio 94-68 */
|
||||
#define MSM_GPIO_OUT_4 MSM_GPIO1_REG(0x0C) /* gpio 106-95 */
|
||||
#define MSM_GPIO_OUT_5 MSM_GPIO1_REG(0x50) /* gpio 133-107 */
|
||||
#define MSM_GPIO_OUT_6 MSM_GPIO1_REG(0xC4) /* gpio 150-134 */
|
||||
#define MSM_GPIO_OUT_7 MSM_GPIO1_REG(0x214) /* gpio 181-151 */
|
||||
|
||||
/* same pin map as above, output enable */
|
||||
#define MSM_GPIO_OE_0 MSM_GPIO1_REG(0x10)
|
||||
#define MSM_GPIO_OE_1 MSM_GPIO2_REG(0x08)
|
||||
#define MSM_GPIO_OE_2 MSM_GPIO1_REG(0x14)
|
||||
#define MSM_GPIO_OE_3 MSM_GPIO1_REG(0x18)
|
||||
#define MSM_GPIO_OE_4 MSM_GPIO1_REG(0x1C)
|
||||
#define MSM_GPIO_OE_5 MSM_GPIO1_REG(0x54)
|
||||
#define MSM_GPIO_OE_6 MSM_GPIO1_REG(0xC8)
|
||||
#define MSM_GPIO_OE_7 MSM_GPIO1_REG(0x218)
|
||||
|
||||
/* same pin map as above, input read */
|
||||
#define MSM_GPIO_IN_0 MSM_GPIO1_REG(0x34)
|
||||
#define MSM_GPIO_IN_1 MSM_GPIO2_REG(0x20)
|
||||
#define MSM_GPIO_IN_2 MSM_GPIO1_REG(0x38)
|
||||
#define MSM_GPIO_IN_3 MSM_GPIO1_REG(0x3C)
|
||||
#define MSM_GPIO_IN_4 MSM_GPIO1_REG(0x40)
|
||||
#define MSM_GPIO_IN_5 MSM_GPIO1_REG(0x44)
|
||||
#define MSM_GPIO_IN_6 MSM_GPIO1_REG(0xCC)
|
||||
#define MSM_GPIO_IN_7 MSM_GPIO1_REG(0x21C)
|
||||
|
||||
/* same pin map as above, 1=edge 0=level interrup */
|
||||
#define MSM_GPIO_INT_EDGE_0 MSM_GPIO1_REG(0x60)
|
||||
#define MSM_GPIO_INT_EDGE_1 MSM_GPIO2_REG(0x50)
|
||||
#define MSM_GPIO_INT_EDGE_2 MSM_GPIO1_REG(0x64)
|
||||
#define MSM_GPIO_INT_EDGE_3 MSM_GPIO1_REG(0x68)
|
||||
#define MSM_GPIO_INT_EDGE_4 MSM_GPIO1_REG(0x6C)
|
||||
#define MSM_GPIO_INT_EDGE_5 MSM_GPIO1_REG(0xC0)
|
||||
#define MSM_GPIO_INT_EDGE_6 MSM_GPIO1_REG(0xD0)
|
||||
#define MSM_GPIO_INT_EDGE_7 MSM_GPIO1_REG(0x240)
|
||||
|
||||
/* same pin map as above, 1=positive 0=negative */
|
||||
#define MSM_GPIO_INT_POS_0 MSM_GPIO1_REG(0x70)
|
||||
#define MSM_GPIO_INT_POS_1 MSM_GPIO2_REG(0x58)
|
||||
#define MSM_GPIO_INT_POS_2 MSM_GPIO1_REG(0x74)
|
||||
#define MSM_GPIO_INT_POS_3 MSM_GPIO1_REG(0x78)
|
||||
#define MSM_GPIO_INT_POS_4 MSM_GPIO1_REG(0x7C)
|
||||
#define MSM_GPIO_INT_POS_5 MSM_GPIO1_REG(0xBC)
|
||||
#define MSM_GPIO_INT_POS_6 MSM_GPIO1_REG(0xD4)
|
||||
#define MSM_GPIO_INT_POS_7 MSM_GPIO1_REG(0x228)
|
||||
|
||||
/* same pin map as above, interrupt enable */
|
||||
#define MSM_GPIO_INT_EN_0 MSM_GPIO1_REG(0x80)
|
||||
#define MSM_GPIO_INT_EN_1 MSM_GPIO2_REG(0x60)
|
||||
#define MSM_GPIO_INT_EN_2 MSM_GPIO1_REG(0x84)
|
||||
#define MSM_GPIO_INT_EN_3 MSM_GPIO1_REG(0x88)
|
||||
#define MSM_GPIO_INT_EN_4 MSM_GPIO1_REG(0x8C)
|
||||
#define MSM_GPIO_INT_EN_5 MSM_GPIO1_REG(0xB8)
|
||||
#define MSM_GPIO_INT_EN_6 MSM_GPIO1_REG(0xD8)
|
||||
#define MSM_GPIO_INT_EN_7 MSM_GPIO1_REG(0x22C)
|
||||
|
||||
/* same pin map as above, write 1 to clear interrupt */
|
||||
#define MSM_GPIO_INT_CLEAR_0 MSM_GPIO1_REG(0x90)
|
||||
#define MSM_GPIO_INT_CLEAR_1 MSM_GPIO2_REG(0x68)
|
||||
#define MSM_GPIO_INT_CLEAR_2 MSM_GPIO1_REG(0x94)
|
||||
#define MSM_GPIO_INT_CLEAR_3 MSM_GPIO1_REG(0x98)
|
||||
#define MSM_GPIO_INT_CLEAR_4 MSM_GPIO1_REG(0x9C)
|
||||
#define MSM_GPIO_INT_CLEAR_5 MSM_GPIO1_REG(0xB4)
|
||||
#define MSM_GPIO_INT_CLEAR_6 MSM_GPIO1_REG(0xDC)
|
||||
#define MSM_GPIO_INT_CLEAR_7 MSM_GPIO1_REG(0x230)
|
||||
|
||||
/* same pin map as above, 1=interrupt pending */
|
||||
#define MSM_GPIO_INT_STATUS_0 MSM_GPIO1_REG(0xA0)
|
||||
#define MSM_GPIO_INT_STATUS_1 MSM_GPIO2_REG(0x70)
|
||||
#define MSM_GPIO_INT_STATUS_2 MSM_GPIO1_REG(0xA4)
|
||||
#define MSM_GPIO_INT_STATUS_3 MSM_GPIO1_REG(0xA8)
|
||||
#define MSM_GPIO_INT_STATUS_4 MSM_GPIO1_REG(0xAC)
|
||||
#define MSM_GPIO_INT_STATUS_5 MSM_GPIO1_REG(0xB0)
|
||||
#define MSM_GPIO_INT_STATUS_6 MSM_GPIO1_REG(0xE0)
|
||||
#define MSM_GPIO_INT_STATUS_7 MSM_GPIO1_REG(0x234)
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,38 @@
|
||||
/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 and
|
||||
* only version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301, USA.
|
||||
*/
|
||||
#include "gpiomux.h"
|
||||
|
||||
struct msm_gpiomux_config msm_gpiomux_configs[GPIOMUX_NGPIOS] = {
|
||||
#ifdef CONFIG_SERIAL_MSM_CONSOLE
|
||||
[49] = { /* UART2 RFR */
|
||||
.suspended = GPIOMUX_DRV_2MA | GPIOMUX_PULL_DOWN |
|
||||
GPIOMUX_FUNC_2 | GPIOMUX_VALID,
|
||||
},
|
||||
[50] = { /* UART2 CTS */
|
||||
.suspended = GPIOMUX_DRV_2MA | GPIOMUX_PULL_DOWN |
|
||||
GPIOMUX_FUNC_2 | GPIOMUX_VALID,
|
||||
},
|
||||
[51] = { /* UART2 RX */
|
||||
.suspended = GPIOMUX_DRV_2MA | GPIOMUX_PULL_DOWN |
|
||||
GPIOMUX_FUNC_2 | GPIOMUX_VALID,
|
||||
},
|
||||
[52] = { /* UART2 TX */
|
||||
.suspended = GPIOMUX_DRV_2MA | GPIOMUX_PULL_DOWN |
|
||||
GPIOMUX_FUNC_2 | GPIOMUX_VALID,
|
||||
},
|
||||
#endif
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 and
|
||||
* only version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301, USA.
|
||||
*/
|
||||
#include "gpiomux.h"
|
||||
|
||||
struct msm_gpiomux_config msm_gpiomux_configs[GPIOMUX_NGPIOS] = {
|
||||
[86] = { /* UART3 RX */
|
||||
.suspended = GPIOMUX_DRV_2MA | GPIOMUX_PULL_DOWN |
|
||||
GPIOMUX_FUNC_1 | GPIOMUX_VALID,
|
||||
},
|
||||
[87] = { /* UART3 TX */
|
||||
.suspended = GPIOMUX_DRV_2MA | GPIOMUX_PULL_DOWN |
|
||||
GPIOMUX_FUNC_1 | GPIOMUX_VALID,
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,19 @@
|
||||
/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 and
|
||||
* only version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301, USA.
|
||||
*/
|
||||
#include "gpiomux.h"
|
||||
|
||||
struct msm_gpiomux_config msm_gpiomux_configs[GPIOMUX_NGPIOS] = {};
|
||||
@@ -0,0 +1,33 @@
|
||||
/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 and
|
||||
* only version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301, USA.
|
||||
*/
|
||||
#include <linux/kernel.h>
|
||||
#include "gpiomux.h"
|
||||
#include "proc_comm.h"
|
||||
|
||||
void __msm_gpiomux_write(unsigned gpio, gpiomux_config_t val)
|
||||
{
|
||||
unsigned tlmm_config = (val & ~GPIOMUX_CTL_MASK) |
|
||||
((gpio & 0x3ff) << 4);
|
||||
unsigned tlmm_disable = 0;
|
||||
int rc;
|
||||
|
||||
rc = msm_proc_comm(PCOM_RPC_GPIO_TLMM_CONFIG_EX,
|
||||
&tlmm_config, &tlmm_disable);
|
||||
if (rc)
|
||||
pr_err("%s: unexpected proc_comm failure %d: %08x %08x\n",
|
||||
__func__, rc, tlmm_config, tlmm_disable);
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 and
|
||||
* only version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301, USA.
|
||||
*/
|
||||
#ifndef __ARCH_ARM_MACH_MSM_GPIOMUX_V1_H
|
||||
#define __ARCH_ARM_MACH_MSM_GPIOMUX_V1_H
|
||||
|
||||
#if defined(CONFIG_ARCH_MSM7X30)
|
||||
#define GPIOMUX_NGPIOS 182
|
||||
#elif defined(CONFIG_ARCH_QSD8X50)
|
||||
#define GPIOMUX_NGPIOS 165
|
||||
#else
|
||||
#define GPIOMUX_NGPIOS 133
|
||||
#endif
|
||||
|
||||
typedef u32 gpiomux_config_t;
|
||||
|
||||
enum {
|
||||
GPIOMUX_DRV_2MA = 0UL << 17,
|
||||
GPIOMUX_DRV_4MA = 1UL << 17,
|
||||
GPIOMUX_DRV_6MA = 2UL << 17,
|
||||
GPIOMUX_DRV_8MA = 3UL << 17,
|
||||
GPIOMUX_DRV_10MA = 4UL << 17,
|
||||
GPIOMUX_DRV_12MA = 5UL << 17,
|
||||
GPIOMUX_DRV_14MA = 6UL << 17,
|
||||
GPIOMUX_DRV_16MA = 7UL << 17,
|
||||
};
|
||||
|
||||
enum {
|
||||
GPIOMUX_FUNC_GPIO = 0UL,
|
||||
GPIOMUX_FUNC_1 = 1UL,
|
||||
GPIOMUX_FUNC_2 = 2UL,
|
||||
GPIOMUX_FUNC_3 = 3UL,
|
||||
GPIOMUX_FUNC_4 = 4UL,
|
||||
GPIOMUX_FUNC_5 = 5UL,
|
||||
GPIOMUX_FUNC_6 = 6UL,
|
||||
GPIOMUX_FUNC_7 = 7UL,
|
||||
GPIOMUX_FUNC_8 = 8UL,
|
||||
GPIOMUX_FUNC_9 = 9UL,
|
||||
GPIOMUX_FUNC_A = 10UL,
|
||||
GPIOMUX_FUNC_B = 11UL,
|
||||
GPIOMUX_FUNC_C = 12UL,
|
||||
GPIOMUX_FUNC_D = 13UL,
|
||||
GPIOMUX_FUNC_E = 14UL,
|
||||
GPIOMUX_FUNC_F = 15UL,
|
||||
};
|
||||
|
||||
enum {
|
||||
GPIOMUX_PULL_NONE = 0UL << 15,
|
||||
GPIOMUX_PULL_DOWN = 1UL << 15,
|
||||
GPIOMUX_PULL_KEEPER = 2UL << 15,
|
||||
GPIOMUX_PULL_UP = 3UL << 15,
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,25 @@
|
||||
/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 and
|
||||
* only version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301, USA.
|
||||
*/
|
||||
#include <linux/io.h>
|
||||
#include <mach/msm_iomap.h>
|
||||
#include "gpiomux.h"
|
||||
|
||||
void __msm_gpiomux_write(unsigned gpio, gpiomux_config_t val)
|
||||
{
|
||||
writel(val & ~GPIOMUX_CTL_MASK,
|
||||
MSM_TLMM_BASE + 0x1000 + (0x10 * gpio));
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 and
|
||||
* only version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301, USA.
|
||||
*/
|
||||
#ifndef __ARCH_ARM_MACH_MSM_GPIOMUX_V2_H
|
||||
#define __ARCH_ARM_MACH_MSM_GPIOMUX_V2_H
|
||||
|
||||
#define GPIOMUX_NGPIOS 173
|
||||
|
||||
typedef u16 gpiomux_config_t;
|
||||
|
||||
enum {
|
||||
GPIOMUX_DRV_2MA = 0UL << 6,
|
||||
GPIOMUX_DRV_4MA = 1UL << 6,
|
||||
GPIOMUX_DRV_6MA = 2UL << 6,
|
||||
GPIOMUX_DRV_8MA = 3UL << 6,
|
||||
GPIOMUX_DRV_10MA = 4UL << 6,
|
||||
GPIOMUX_DRV_12MA = 5UL << 6,
|
||||
GPIOMUX_DRV_14MA = 6UL << 6,
|
||||
GPIOMUX_DRV_16MA = 7UL << 6,
|
||||
};
|
||||
|
||||
enum {
|
||||
GPIOMUX_FUNC_GPIO = 0UL << 2,
|
||||
GPIOMUX_FUNC_1 = 1UL << 2,
|
||||
GPIOMUX_FUNC_2 = 2UL << 2,
|
||||
GPIOMUX_FUNC_3 = 3UL << 2,
|
||||
GPIOMUX_FUNC_4 = 4UL << 2,
|
||||
GPIOMUX_FUNC_5 = 5UL << 2,
|
||||
GPIOMUX_FUNC_6 = 6UL << 2,
|
||||
GPIOMUX_FUNC_7 = 7UL << 2,
|
||||
GPIOMUX_FUNC_8 = 8UL << 2,
|
||||
GPIOMUX_FUNC_9 = 9UL << 2,
|
||||
GPIOMUX_FUNC_A = 10UL << 2,
|
||||
GPIOMUX_FUNC_B = 11UL << 2,
|
||||
GPIOMUX_FUNC_C = 12UL << 2,
|
||||
GPIOMUX_FUNC_D = 13UL << 2,
|
||||
GPIOMUX_FUNC_E = 14UL << 2,
|
||||
GPIOMUX_FUNC_F = 15UL << 2,
|
||||
};
|
||||
|
||||
enum {
|
||||
GPIOMUX_PULL_NONE = 0UL,
|
||||
GPIOMUX_PULL_DOWN = 1UL,
|
||||
GPIOMUX_PULL_KEEPER = 2UL,
|
||||
GPIOMUX_PULL_UP = 3UL,
|
||||
};
|
||||
|
||||
#endif
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user