Commit 52aa8c53 authored by Tony Lindgren's avatar Tony Lindgren

Merge branch 'ctrl-wip/mux-omap4-v4' of git://gitorious.org/omap-pm/linux into omap-for-linus

parents 55a4e789 032a6424
...@@ -85,6 +85,12 @@ config OMAP_PACKAGE_CUS ...@@ -85,6 +85,12 @@ config OMAP_PACKAGE_CUS
config OMAP_PACKAGE_CBP config OMAP_PACKAGE_CBP
bool bool
config OMAP_PACKAGE_CBL
bool
config OMAP_PACKAGE_CBS
bool
comment "OMAP Board Type" comment "OMAP Board Type"
depends on ARCH_OMAP2PLUS depends on ARCH_OMAP2PLUS
...@@ -282,11 +288,15 @@ config MACH_OMAP_4430SDP ...@@ -282,11 +288,15 @@ config MACH_OMAP_4430SDP
bool "OMAP 4430 SDP board" bool "OMAP 4430 SDP board"
default y default y
depends on ARCH_OMAP4 depends on ARCH_OMAP4
select OMAP_PACKAGE_CBL
select OMAP_PACKAGE_CBS
config MACH_OMAP4_PANDA config MACH_OMAP4_PANDA
bool "OMAP4 Panda Board" bool "OMAP4 Panda Board"
default y default y
depends on ARCH_OMAP4 depends on ARCH_OMAP4
select OMAP_PACKAGE_CBL
select OMAP_PACKAGE_CBS
config OMAP3_EMU config OMAP3_EMU
bool "OMAP3 debugging peripherals" bool "OMAP3 debugging peripherals"
......
...@@ -42,6 +42,7 @@ AFLAGS_sram34xx.o :=-Wa,-march=armv7-a ...@@ -42,6 +42,7 @@ AFLAGS_sram34xx.o :=-Wa,-march=armv7-a
obj-$(CONFIG_ARCH_OMAP2420) += mux2420.o obj-$(CONFIG_ARCH_OMAP2420) += mux2420.o
obj-$(CONFIG_ARCH_OMAP2430) += mux2430.o obj-$(CONFIG_ARCH_OMAP2430) += mux2430.o
obj-$(CONFIG_ARCH_OMAP3) += mux34xx.o obj-$(CONFIG_ARCH_OMAP3) += mux34xx.o
obj-$(CONFIG_ARCH_OMAP4) += mux44xx.o
# SMS/SDRC # SMS/SDRC
obj-$(CONFIG_ARCH_OMAP2) += sdrc2xxx.o obj-$(CONFIG_ARCH_OMAP2) += sdrc2xxx.o
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include <plat/usb.h> #include <plat/usb.h>
#include <plat/mmc.h> #include <plat/mmc.h>
#include "mux.h"
#include "hsmmc.h" #include "hsmmc.h"
#include "timer-gp.h" #include "timer-gp.h"
#include "control.h" #include "control.h"
...@@ -505,9 +506,22 @@ static void __init omap_sfh7741prox_init(void) ...@@ -505,9 +506,22 @@ static void __init omap_sfh7741prox_init(void)
} }
} }
#ifdef CONFIG_OMAP_MUX
static struct omap_board_mux board_mux[] __initdata = {
{ .reg_offset = OMAP_MUX_TERMINATOR },
};
#else
#define board_mux NULL
#endif
static void __init omap_4430sdp_init(void) static void __init omap_4430sdp_init(void)
{ {
int status; int status;
int package = OMAP_PACKAGE_CBS;
if (omap_rev() == OMAP4430_REV_ES1_0)
package = OMAP_PACKAGE_CBL;
omap4_mux_init(board_mux, package);
omap4_i2c_init(); omap4_i2c_init();
omap_sfh7741prox_init(); omap_sfh7741prox_init();
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include "hsmmc.h" #include "hsmmc.h"
#include "control.h" #include "control.h"
#include "mux.h"
#define GPIO_HUB_POWER 1 #define GPIO_HUB_POWER 1
#define GPIO_HUB_NRESET 62 #define GPIO_HUB_NRESET 62
...@@ -368,8 +369,23 @@ static int __init omap4_panda_i2c_init(void) ...@@ -368,8 +369,23 @@ static int __init omap4_panda_i2c_init(void)
omap_register_i2c_bus(4, 400, NULL, 0); omap_register_i2c_bus(4, 400, NULL, 0);
return 0; return 0;
} }
#ifdef CONFIG_OMAP_MUX
static struct omap_board_mux board_mux[] __initdata = {
{ .reg_offset = OMAP_MUX_TERMINATOR },
};
#else
#define board_mux NULL
#endif
static void __init omap4_panda_init(void) static void __init omap4_panda_init(void)
{ {
int package = OMAP_PACKAGE_CBS;
if (omap_rev() == OMAP4430_REV_ES1_0)
package = OMAP_PACKAGE_CBL;
omap4_mux_init(board_mux, package);
omap4_panda_i2c_init(); omap4_panda_i2c_init();
platform_add_devices(panda_devices, ARRAY_SIZE(panda_devices)); platform_add_devices(panda_devices, ARRAY_SIZE(panda_devices));
omap_serial_init(); omap_serial_init();
......
...@@ -293,6 +293,8 @@ static struct omap_board_mux rx51_mmc2_off_mux[] = { ...@@ -293,6 +293,8 @@ static struct omap_board_mux rx51_mmc2_off_mux[] = {
{ .reg_offset = OMAP_MUX_TERMINATOR }, { .reg_offset = OMAP_MUX_TERMINATOR },
}; };
static struct omap_mux_partition *partition;
/* /*
* Current flows to eMMC when eMMC is off and the data lines are pulled up, * Current flows to eMMC when eMMC is off and the data lines are pulled up,
* so pull them down. N.B. we pull 8 lines because we are using 8 lines. * so pull them down. N.B. we pull 8 lines because we are using 8 lines.
...@@ -300,9 +302,9 @@ static struct omap_board_mux rx51_mmc2_off_mux[] = { ...@@ -300,9 +302,9 @@ static struct omap_board_mux rx51_mmc2_off_mux[] = {
static void rx51_mmc2_remux(struct device *dev, int slot, int power_on) static void rx51_mmc2_remux(struct device *dev, int slot, int power_on)
{ {
if (power_on) if (power_on)
omap_mux_write_array(rx51_mmc2_on_mux); omap_mux_write_array(partition, rx51_mmc2_on_mux);
else else
omap_mux_write_array(rx51_mmc2_off_mux); omap_mux_write_array(partition, rx51_mmc2_off_mux);
} }
static struct omap2_hsmmc_info mmc[] __initdata = { static struct omap2_hsmmc_info mmc[] __initdata = {
...@@ -922,7 +924,11 @@ void __init rx51_peripherals_init(void) ...@@ -922,7 +924,11 @@ void __init rx51_peripherals_init(void)
rx51_init_wl1251(); rx51_init_wl1251();
spi_register_board_info(rx51_peripherals_spi_board_info, spi_register_board_info(rx51_peripherals_spi_board_info,
ARRAY_SIZE(rx51_peripherals_spi_board_info)); ARRAY_SIZE(rx51_peripherals_spi_board_info));
omap2_hsmmc_init(mmc);
partition = omap_mux_get("core");
if (partition)
omap2_hsmmc_init(mmc);
platform_device_register(&rx51_charger_device); platform_device_register(&rx51_charger_device);
} }
This diff is collapsed.
/* /*
* Copyright (C) 2009 Nokia * Copyright (C) 2009 Nokia
* Copyright (C) 2009 Texas Instruments * Copyright (C) 2009-2010 Texas Instruments
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "mux2420.h" #include "mux2420.h"
#include "mux2430.h" #include "mux2430.h"
#include "mux34xx.h" #include "mux34xx.h"
#include "mux44xx.h"
#define OMAP_MUX_TERMINATOR 0xffff #define OMAP_MUX_TERMINATOR 0xffff
...@@ -37,6 +38,9 @@ ...@@ -37,6 +38,9 @@
#define OMAP_OFF_PULL_UP (1 << 13) #define OMAP_OFF_PULL_UP (1 << 13)
#define OMAP_WAKEUP_EN (1 << 14) #define OMAP_WAKEUP_EN (1 << 14)
/* 44xx specific mux bit defines */
#define OMAP_WAKEUP_EVENT (1 << 15)
/* Active pin states */ /* Active pin states */
#define OMAP_PIN_OUTPUT 0 #define OMAP_PIN_OUTPUT 0
#define OMAP_PIN_INPUT OMAP_INPUT_EN #define OMAP_PIN_INPUT OMAP_INPUT_EN
...@@ -56,8 +60,10 @@ ...@@ -56,8 +60,10 @@
#define OMAP_MODE_GPIO(x) (((x) & OMAP_MUX_MODE7) == OMAP_MUX_MODE4) #define OMAP_MODE_GPIO(x) (((x) & OMAP_MUX_MODE7) == OMAP_MUX_MODE4)
/* Flags for omap_mux_init */ /* Flags for omapX_mux_init */
#define OMAP_PACKAGE_MASK 0xffff #define OMAP_PACKAGE_MASK 0xffff
#define OMAP_PACKAGE_CBS 8 /* 547-pin 0.40 0.40 */
#define OMAP_PACKAGE_CBL 7 /* 547-pin 0.40 0.40 */
#define OMAP_PACKAGE_CBP 6 /* 515-pin 0.40 0.50 */ #define OMAP_PACKAGE_CBP 6 /* 515-pin 0.40 0.50 */
#define OMAP_PACKAGE_CUS 5 /* 423-pin 0.65 */ #define OMAP_PACKAGE_CUS 5 /* 423-pin 0.65 */
#define OMAP_PACKAGE_CBB 4 /* 515-pin 0.40 0.50 */ #define OMAP_PACKAGE_CBB 4 /* 515-pin 0.40 0.50 */
...@@ -66,14 +72,47 @@ ...@@ -66,14 +72,47 @@
#define OMAP_PACKAGE_ZAF 1 /* 2420 447-pin SIP */ #define OMAP_PACKAGE_ZAF 1 /* 2420 447-pin SIP */
#define OMAP_MUX_NR_MODES 8 /* Available modes */ #define OMAP_MUX_NR_MODES 8 /* Available modes */
#define OMAP_MUX_NR_SIDES 2 /* Bottom & top */ #define OMAP_MUX_NR_SIDES 2 /* Bottom & top */
/*
* omap_mux_init flags definition:
*
* OMAP_MUX_REG_8BIT: Ensure that access to padconf is done in 8 bits.
* The default value is 16 bits.
* OMAP_MUX_GPIO_IN_MODE3: The GPIO is selected in mode3.
* The default is mode4.
*/
#define OMAP_MUX_REG_8BIT (1 << 0)
#define OMAP_MUX_GPIO_IN_MODE3 (1 << 1)
/**
* struct mux_partition - contain partition related information
* @name: name of the current partition
* @flags: flags specific to this partition
* @phys: physical address
* @size: partition size
* @base: virtual address after ioremap
* @muxmodes: list of nodes that belong to a partition
* @node: list node for the partitions linked list
*/
struct omap_mux_partition {
const char *name;
u32 flags;
u32 phys;
u32 size;
void __iomem *base;
struct list_head muxmodes;
struct list_head node;
};
/** /**
* struct omap_mux - data for omap mux register offset and it's value * struct omap_mux - data for omap mux register offset and it's value
* @reg_offset: mux register offset from the mux base * @reg_offset: mux register offset from the mux base
* @gpio: GPIO number * @gpio: GPIO number
* @muxnames: available signal modes for a ball * @muxnames: available signal modes for a ball
* @balls: available balls on the package
* @partition: mux partition
*/ */
struct omap_mux { struct omap_mux {
u16 reg_offset; u16 reg_offset;
...@@ -150,29 +189,40 @@ u16 omap_mux_get_gpio(int gpio); ...@@ -150,29 +189,40 @@ u16 omap_mux_get_gpio(int gpio);
*/ */
void omap_mux_set_gpio(u16 val, int gpio); void omap_mux_set_gpio(u16 val, int gpio);
/**
* omap_mux_get() - get a mux partition by name
* @name: Name of the mux partition
*
*/
struct omap_mux_partition *omap_mux_get(const char *name);
/** /**
* omap_mux_read() - read mux register * omap_mux_read() - read mux register
* @partition: Mux partition
* @mux_offset: Offset of the mux register * @mux_offset: Offset of the mux register
* *
*/ */
u16 omap_mux_read(u16 mux_offset); u16 omap_mux_read(struct omap_mux_partition *p, u16 mux_offset);
/** /**
* omap_mux_write() - write mux register * omap_mux_write() - write mux register
* @partition: Mux partition
* @val: New mux register value * @val: New mux register value
* @mux_offset: Offset of the mux register * @mux_offset: Offset of the mux register
* *
* This should be only needed for dynamic remuxing of non-gpio signals. * This should be only needed for dynamic remuxing of non-gpio signals.
*/ */
void omap_mux_write(u16 val, u16 mux_offset); void omap_mux_write(struct omap_mux_partition *p, u16 val, u16 mux_offset);
/** /**
* omap_mux_write_array() - write an array of mux registers * omap_mux_write_array() - write an array of mux registers
* @partition: Mux partition
* @board_mux: Array of mux registers terminated by MAP_MUX_TERMINATOR * @board_mux: Array of mux registers terminated by MAP_MUX_TERMINATOR
* *
* This should be only needed for dynamic remuxing of non-gpio signals. * This should be only needed for dynamic remuxing of non-gpio signals.
*/ */
void omap_mux_write_array(struct omap_board_mux *board_mux); void omap_mux_write_array(struct omap_mux_partition *p,
struct omap_board_mux *board_mux);
/** /**
* omap2420_mux_init() - initialize mux system with board specific set * omap2420_mux_init() - initialize mux system with board specific set
...@@ -195,11 +245,20 @@ int omap2430_mux_init(struct omap_board_mux *board_mux, int flags); ...@@ -195,11 +245,20 @@ int omap2430_mux_init(struct omap_board_mux *board_mux, int flags);
*/ */
int omap3_mux_init(struct omap_board_mux *board_mux, int flags); int omap3_mux_init(struct omap_board_mux *board_mux, int flags);
/**
* omap4_mux_init() - initialize mux system with board specific set
* @board_mux: Board specific mux table
* @flags: OMAP package type used for the board
*/
int omap4_mux_init(struct omap_board_mux *board_mux, int flags);
/** /**
* omap_mux_init - private mux init function, do not call * omap_mux_init - private mux init function, do not call
*/ */
int omap_mux_init(u32 mux_pbase, u32 mux_size, int omap_mux_init(const char *name, u32 flags,
struct omap_mux *superset, u32 mux_pbase, u32 mux_size,
struct omap_mux *package_subset, struct omap_mux *superset,
struct omap_board_mux *board_mux, struct omap_mux *package_subset,
struct omap_ball *package_balls); struct omap_board_mux *board_mux,
struct omap_ball *package_balls);
...@@ -678,11 +678,13 @@ int __init omap2420_mux_init(struct omap_board_mux *board_subset, int flags) ...@@ -678,11 +678,13 @@ int __init omap2420_mux_init(struct omap_board_mux *board_subset, int flags)
case OMAP_PACKAGE_ZAF: case OMAP_PACKAGE_ZAF:
/* REVISIT: Please add data */ /* REVISIT: Please add data */
default: default:
pr_warning("mux: No ball data available for omap2420 package\n"); pr_warning("%s: No ball data available for omap2420 package\n",
__func__);
} }
return omap_mux_init(OMAP2420_CONTROL_PADCONF_MUX_PBASE, return omap_mux_init("core", OMAP_MUX_REG_8BIT | OMAP_MUX_GPIO_IN_MODE3,
OMAP2420_CONTROL_PADCONF_MUX_PBASE,
OMAP2420_CONTROL_PADCONF_MUX_SIZE, OMAP2420_CONTROL_PADCONF_MUX_SIZE,
omap2420_muxmodes, NULL, board_subset, omap2420_muxmodes, NULL, board_subset,
package_balls); package_balls);
} }
...@@ -781,11 +781,13 @@ int __init omap2430_mux_init(struct omap_board_mux *board_subset, int flags) ...@@ -781,11 +781,13 @@ int __init omap2430_mux_init(struct omap_board_mux *board_subset, int flags)
package_balls = omap2430_pop_ball; package_balls = omap2430_pop_ball;
break; break;
default: default:
pr_warning("mux: No ball data available for omap2420 package\n"); pr_warning("%s: No ball data available for omap2420 package\n",
__func__);
} }
return omap_mux_init(OMAP2430_CONTROL_PADCONF_MUX_PBASE, return omap_mux_init("core", OMAP_MUX_REG_8BIT | OMAP_MUX_GPIO_IN_MODE3,
OMAP2430_CONTROL_PADCONF_MUX_PBASE,
OMAP2430_CONTROL_PADCONF_MUX_SIZE, OMAP2430_CONTROL_PADCONF_MUX_SIZE,
omap2430_muxmodes, NULL, board_subset, omap2430_muxmodes, NULL, board_subset,
package_balls); package_balls);
} }
...@@ -2049,12 +2049,13 @@ int __init omap3_mux_init(struct omap_board_mux *board_subset, int flags) ...@@ -2049,12 +2049,13 @@ int __init omap3_mux_init(struct omap_board_mux *board_subset, int flags)
package_balls = omap36xx_cbp_ball; package_balls = omap36xx_cbp_ball;
break; break;
default: default:
printk(KERN_ERR "mux: Unknown omap package, mux disabled\n"); pr_err("%s Unknown omap package, mux disabled\n", __func__);
return -EINVAL; return -EINVAL;
} }
return omap_mux_init(OMAP3_CONTROL_PADCONF_MUX_PBASE, return omap_mux_init("core", 0,
OMAP3_CONTROL_PADCONF_MUX_PBASE,
OMAP3_CONTROL_PADCONF_MUX_SIZE, OMAP3_CONTROL_PADCONF_MUX_SIZE,
omap3_muxmodes, package_subset, board_subset, omap3_muxmodes, package_subset, board_subset,
package_balls); package_balls);
} }
This diff is collapsed.
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