Commit 5e4646fa authored by Tony Lindgren's avatar Tony Lindgren

ARM: OMAP: Split pin mux to omap1 and omap2, added support for 24xx

Split pin multiplexing tables from mux.h into mux.c files in omap1 and
omap2. Also added support for some 24xx pins.
parent 9ed0a00e
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# #
# Common support # Common support
obj-y := io.o id.o irq.o time.o serial.o devices.o obj-y := io.o id.o irq.o time.o mux.o serial.o devices.o
led-y := leds.o led-y := leds.o
# Specific board support # Specific board support
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <asm/mach/map.h> #include <asm/mach/map.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/arch/mux.h>
#include <asm/arch/tc.h> #include <asm/arch/tc.h>
extern int clk_init(void); extern int clk_init(void);
...@@ -95,7 +96,9 @@ static void __init _omap_map_io(void) ...@@ -95,7 +96,9 @@ static void __init _omap_map_io(void)
*/ */
void __init omap_map_common_io(void) void __init omap_map_common_io(void)
{ {
if (!initialized) if (!initialized) {
_omap_map_io(); _omap_map_io();
omap1_mux_init();
}
} }
This diff is collapsed.
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# #
# Common support # Common support
obj-y := irq.o io.o serial.o obj-y := irq.o io.o mux.o serial.o
obj-$(CONFIG_OMAP_MPU_TIMER) += timer-gp.o obj-$(CONFIG_OMAP_MPU_TIMER) += timer-gp.o
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <asm/mach/map.h> #include <asm/mach/map.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/arch/mux.h>
/* /*
* The machine specific code may provide the extra mapping besides the * The machine specific code may provide the extra mapping besides the
...@@ -30,4 +31,5 @@ static struct map_desc omap2_io_desc[] __initdata = { ...@@ -30,4 +31,5 @@ static struct map_desc omap2_io_desc[] __initdata = {
void __init omap_map_common_io(void) void __init omap_map_common_io(void)
{ {
iotable_init(omap2_io_desc, ARRAY_SIZE(omap2_io_desc)); iotable_init(omap2_io_desc, ARRAY_SIZE(omap2_io_desc));
omap2_mux_init();
} }
/*
* linux/arch/arm/mach-omap2/mux.c
*
* OMAP1 pin multiplexing configurations
*
* Copyright (C) 2003 - 2005 Nokia Corporation
*
* Written by Tony Lindgren <tony.lindgren@nokia.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <linux/config.h>
#include <linux/module.h>
#include <linux/init.h>
#include <asm/system.h>
#include <asm/io.h>
#include <linux/spinlock.h>
#include <asm/arch/mux.h>
#ifdef CONFIG_OMAP_MUX
struct pin_config __initdata_or_module omap24xx_pins[] = {
/*
* description mux mux pull pull debug
* offset mode ena type
*/
/* 24xx I2C */
OMAP2_MUX_CFG("M19_24XX_I2C1_SCL", 0x111, 0, 0, 0, 1)
OMAP2_MUX_CFG("L15_24XX_I2C1_SDA", 0x112, 0, 0, 0, 1)
OMAP2_MUX_CFG("J15_24XX_I2C2_SCL", 0x113, 0, 0, 0, 1)
OMAP2_MUX_CFG("H19_24XX_I2C2_SDA", 0x114, 0, 0, 0, 1)
OMAP2_MUX_CFG("W19_24XX_SYS_NIRQ", 0x12c, 0, 1, 1, 1)
};
int __init omap2_mux_init(void)
{
omap_mux_register(omap24xx_pins, ARRAY_SIZE(omap24xx_pins));
return 0;
}
#endif
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Utility to set the Omap MUX and PULL_DWN registers from a table in mux.h * Utility to set the Omap MUX and PULL_DWN registers from a table in mux.h
* *
* Copyright (C) 2003 Nokia Corporation * Copyright (C) 2003 - 2005 Nokia Corporation
* *
* Written by Tony Lindgren <tony.lindgren@nokia.com> * Written by Tony Lindgren <tony.lindgren@nokia.com>
* *
...@@ -28,32 +28,69 @@ ...@@ -28,32 +28,69 @@
#include <asm/system.h> #include <asm/system.h>
#include <asm/io.h> #include <asm/io.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#define __MUX_C__
#include <asm/arch/mux.h> #include <asm/arch/mux.h>
#ifdef CONFIG_OMAP_MUX #ifdef CONFIG_OMAP_MUX
#define OMAP24XX_L4_BASE 0x48000000
#define OMAP24XX_PULL_ENA (1 << 3)
#define OMAP24XX_PULL_UP (1 << 4)
static struct pin_config * pin_table;
static unsigned long pin_table_sz;
extern struct pin_config * omap730_pins;
extern struct pin_config * omap1xxx_pins;
extern struct pin_config * omap24xx_pins;
int __init omap_mux_register(struct pin_config * pins, unsigned long size)
{
pin_table = pins;
pin_table_sz = size;
return 0;
}
/* /*
* Sets the Omap MUX and PULL_DWN registers based on the table * Sets the Omap MUX and PULL_DWN registers based on the table
*/ */
int __init_or_module int __init_or_module omap_cfg_reg(const unsigned long index)
omap_cfg_reg(const reg_cfg_t reg_cfg)
{ {
static DEFINE_SPINLOCK(mux_spin_lock); static DEFINE_SPINLOCK(mux_spin_lock);
unsigned long flags; unsigned long flags;
reg_cfg_set *cfg; struct pin_config *cfg;
unsigned int reg_orig = 0, reg = 0, pu_pd_orig = 0, pu_pd = 0, unsigned int reg_orig = 0, reg = 0, pu_pd_orig = 0, pu_pd = 0,
pull_orig = 0, pull = 0; pull_orig = 0, pull = 0;
unsigned int mask, warn = 0; unsigned int mask, warn = 0;
if (reg_cfg > ARRAY_SIZE(reg_cfg_table)) { if (!pin_table)
printk(KERN_ERR "MUX: reg_cfg %d\n", reg_cfg); BUG();
return -EINVAL;
if (index >= pin_table_sz) {
printk(KERN_ERR "Invalid pin mux index: %lu (%lu)\n",
index, pin_table_sz);
return -ENODEV;
} }
cfg = (reg_cfg_set *)&reg_cfg_table[reg_cfg]; cfg = (struct pin_config *)&pin_table[index];
if (cpu_is_omap24xx()) {
u8 reg = 0;
reg |= cfg->mask & 0x7;
if (cfg->pull_val)
reg |= OMAP24XX_PULL_ENA;
if(cfg->pu_pd_val)
reg |= OMAP24XX_PULL_UP;
#ifdef CONFIG_OMAP_MUX_DEBUG
printk("Muxing %s: (0x%08x) 0x%02x -> 0x%02x\n",
cfg->name, OMAP24XX_L4_BASE + cfg->mux_reg,
omap_readb(OMAP24XX_L4_BASE + cfg->mux_reg), reg);
#endif
omap_writeb(reg, OMAP24XX_L4_BASE + cfg->mux_reg);
return 0;
}
/* Check the mux register in question */ /* Check the mux register in question */
if (cfg->mux_reg) { if (cfg->mux_reg) {
...@@ -154,7 +191,8 @@ omap_cfg_reg(const reg_cfg_t reg_cfg) ...@@ -154,7 +191,8 @@ omap_cfg_reg(const reg_cfg_t reg_cfg)
return 0; return 0;
#endif #endif
} }
EXPORT_SYMBOL(omap_cfg_reg); EXPORT_SYMBOL(omap_cfg_reg);
#else
#define omap_mux_init() do {} while(0)
#define omap_cfg_reg(x) do {} while(0)
#endif /* CONFIG_OMAP_MUX */ #endif /* CONFIG_OMAP_MUX */
This diff is collapsed.
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