Skip to content

Commit

Permalink
ARM: 5666/1: Revamped U300 padmux API
Browse files Browse the repository at this point in the history
This abstracts the hackish padmux API on the U300 platform into
something more manageable. It provides a way for drivers to
activate/deactivate a certain padmux setting. It will also switch
the users of the old API over to using the new style, pushing
muxing into the apropriate setup files.

Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
  • Loading branch information
Linus Walleij authored and Russell King committed Aug 15, 2009
1 parent 5ad73d0 commit df1e052
Show file tree
Hide file tree
Showing 4 changed files with 392 additions and 60 deletions.
13 changes: 0 additions & 13 deletions arch/arm/mach-u300/gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@
#include <linux/platform_device.h>
#include <linux/gpio.h>

/* Need access to SYSCON registers for PADmuxing */
#include <mach/syscon.h>

#include "padmux.h"

/* Reference to GPIO block clock */
static struct clk *clk;

Expand Down Expand Up @@ -606,14 +601,6 @@ static int __init gpio_probe(struct platform_device *pdev)
writel(U300_GPIO_CR_BLOCK_CLKRQ_ENABLE, virtbase + U300_GPIO_CR);
#endif

/* Set up some padmuxing here */
#ifdef CONFIG_MMC
pmx_set_mission_mode_mmc();
#endif
#ifdef CONFIG_SPI_PL022
pmx_set_mission_mode_spi();
#endif

gpio_set_initial_values();

for (num_irqs = 0 ; num_irqs < U300_GPIO_NUM_PORTS; num_irqs++) {
Expand Down
16 changes: 16 additions & 0 deletions arch/arm/mach-u300/mmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

#include <asm/mach/mmc.h>
#include "mmc.h"
#include "padmux.h"

struct mmci_card_event {
struct input_dev *mmc_input;
Expand Down Expand Up @@ -146,6 +147,7 @@ int __devinit mmc_init(struct amba_device *adev)
{
struct mmci_card_event *mmci_card;
struct device *mmcsd_device = &adev->dev;
struct pmx *pmx;
int ret = 0;

mmci_card = kzalloc(sizeof(struct mmci_card_event), GFP_KERNEL);
Expand Down Expand Up @@ -205,6 +207,20 @@ int __devinit mmc_init(struct amba_device *adev)

input_set_drvdata(mmci_card->mmc_input, mmci_card);

/*
* Setup padmuxing for MMC. Since this must always be
* compiled into the kernel, pmx is never released.
*/
pmx = pmx_get(mmcsd_device, U300_APP_PMX_MMC_SETTING);

if (IS_ERR(pmx))
pr_warning("Could not get padmux handle\n");
else {
ret = pmx_activate(mmcsd_device, pmx);
if (IS_ERR_VALUE(ret))
pr_warning("Could not activate padmuxing\n");
}

ret = gpio_register_callback(U300_GPIO_PIN_MMC_CD, mmci_callback,
mmci_card);

Expand Down
Loading

0 comments on commit df1e052

Please sign in to comment.