2019-05-27 08:55:05 +02:00
/* SPDX-License-Identifier: GPL-2.0-or-later */
2005-04-16 15:20:36 -07:00
/*
* Table of the Omap register configurations for the FUNC_MUX and
* PULL_DWN combinations .
*
2008-01-24 17:24:15 -08:00
* Copyright ( C ) 2004 - 2008 Texas Instruments Inc .
* Copyright ( C ) 2003 - 2008 Nokia Corporation
2005-04-16 15:20:36 -07:00
*
2008-01-24 17:24:15 -08:00
* Written by Tony Lindgren
2005-04-16 15:20:36 -07:00
*
* NOTE : Please use the following naming style for new pin entries .
* For example , W8_1610_MMC2_DAT0 , where :
* - W8 = ball
* - 1610 = 1510 or 1610 , none if common for both 1510 and 1610
* - MMC2_DAT0 = function
*/
# ifndef __ASM_ARCH_MUX_H
# define __ASM_ARCH_MUX_H
2019-08-06 15:24:58 +02:00
# include <linux/soc/ti/omap1-mux.h>
2005-04-16 15:20:36 -07:00
# define PU_PD_SEL_NA 0 /* No pu_pd reg available */
# define PULL_DWN_CTRL_NA 0 /* No pull-down control needed */
# ifdef CONFIG_OMAP_MUX_DEBUG
# define MUX_REG(reg, mode_offset, mode) .mux_reg_name = "FUNC_MUX_CTRL_"#reg, \
. mux_reg = FUNC_MUX_CTRL_ # # reg , \
. mask_offset = mode_offset , \
. mask = mode ,
# define PULL_REG(reg, bit, status) .pull_name = "PULL_DWN_CTRL_"#reg, \
. pull_reg = PULL_DWN_CTRL_ # # reg , \
. pull_bit = bit , \
. pull_val = status ,
# define PU_PD_REG(reg, status) .pu_pd_name = "PU_PD_SEL_"#reg, \
. pu_pd_reg = PU_PD_SEL_ # # reg , \
. pu_pd_val = status ,
2009-09-22 10:02:58 +01:00
# define MUX_REG_7XX(reg, mode_offset, mode) .mux_reg_name = "OMAP7XX_IO_CONF_"#reg, \
2009-09-22 07:34:13 +01:00
. mux_reg = OMAP7XX_IO_CONF_ # # reg , \
2005-11-10 14:26:53 +00:00
. mask_offset = mode_offset , \
. mask = mode ,
2009-09-22 10:02:58 +01:00
# define PULL_REG_7XX(reg, bit, status) .pull_name = "OMAP7XX_IO_CONF_"#reg, \
2009-09-22 07:34:13 +01:00
. pull_reg = OMAP7XX_IO_CONF_ # # reg , \
2005-11-10 14:26:53 +00:00
. pull_bit = bit , \
. pull_val = status ,
2005-04-16 15:20:36 -07:00
# else
# define MUX_REG(reg, mode_offset, mode) .mux_reg = FUNC_MUX_CTRL_##reg, \
. mask_offset = mode_offset , \
. mask = mode ,
# define PULL_REG(reg, bit, status) .pull_reg = PULL_DWN_CTRL_##reg, \
. pull_bit = bit , \
. pull_val = status ,
# define PU_PD_REG(reg, status) .pu_pd_reg = PU_PD_SEL_##reg, \
. pu_pd_val = status ,
2009-09-22 10:02:58 +01:00
# define MUX_REG_7XX(reg, mode_offset, mode) \
2009-09-22 07:34:13 +01:00
. mux_reg = OMAP7XX_IO_CONF_ # # reg , \
2005-11-10 14:26:53 +00:00
. mask_offset = mode_offset , \
. mask = mode ,
2009-09-22 10:02:58 +01:00
# define PULL_REG_7XX(reg, bit, status) .pull_reg = OMAP7XX_IO_CONF_##reg, \
2005-11-10 14:26:53 +00:00
. pull_bit = bit , \
. pull_val = status ,
2005-04-16 15:20:36 -07:00
# endif /* CONFIG_OMAP_MUX_DEBUG */
# define MUX_CFG(desc, mux_reg, mode_offset, mode, \
pull_reg , pull_bit , pull_status , \
pu_pd_reg , pu_pd_status , debug_status ) \
{ \
. name = desc , \
. debug = debug_status , \
MUX_REG ( mux_reg , mode_offset , mode ) \
PULL_REG ( pull_reg , pull_bit , pull_status ) \
PU_PD_REG ( pu_pd_reg , pu_pd_status ) \
} ,
2005-11-10 14:26:53 +00:00
/*
2009-03-23 18:07:40 -07:00
* OMAP730 / 850 has a slightly different config for the pin mux .
2012-06-28 00:08:10 -07:00
* - config regs are the OMAP7XX_IO_CONF_x regs ( see omap7xx . h ) regs and
2005-11-10 14:26:53 +00:00
* not the FUNC_MUX_CTRL_x regs from hardware . h
2020-07-25 17:22:12 -07:00
* - for pull - up / down , only has one enable bit which is in the same register
2005-11-10 14:26:53 +00:00
* as mux config
*/
2009-09-22 10:02:58 +01:00
# define MUX_CFG_7XX(desc, mux_reg, mode_offset, mode, \
2006-04-02 17:46:22 +01:00
pull_bit , pull_status , debug_status ) \
2005-11-10 14:26:53 +00:00
{ \
. name = desc , \
. debug = debug_status , \
2009-09-22 10:02:58 +01:00
MUX_REG_7XX ( mux_reg , mode_offset , mode ) \
PULL_REG_7XX ( mux_reg , pull_bit , pull_status ) \
2006-04-02 17:46:22 +01:00
PU_PD_REG ( NA , 0 ) \
2005-11-10 14:26:53 +00:00
} ,
struct pin_config {
2008-10-06 15:49:16 +03:00
char * name ;
const unsigned int mux_reg ;
unsigned char debug ;
2005-04-16 15:20:36 -07:00
const unsigned char mask_offset ;
const unsigned char mask ;
const char * pull_name ;
const unsigned int pull_reg ;
const unsigned char pull_val ;
const unsigned char pull_bit ;
const char * pu_pd_name ;
const unsigned int pu_pd_reg ;
const unsigned char pu_pd_val ;
2008-10-06 15:49:16 +03:00
# if defined(CONFIG_OMAP_MUX_DEBUG) || defined(CONFIG_OMAP_MUX_WARNINGS)
const char * mux_reg_name ;
# endif
2005-11-10 14:26:53 +00:00
} ;
2005-04-16 15:20:36 -07:00
2008-01-25 00:42:48 -08:00
struct omap_mux_cfg {
struct pin_config * pins ;
unsigned long size ;
int ( * cfg_reg ) ( const struct pin_config * cfg ) ;
} ;
2005-04-16 15:20:36 -07:00
# ifdef CONFIG_OMAP_MUX
/* setup pin muxing in Linux */
2005-11-10 14:26:53 +00:00
extern int omap1_mux_init ( void ) ;
2008-01-25 00:42:48 -08:00
extern int omap_mux_register ( struct omap_mux_cfg * ) ;
2005-04-16 15:20:36 -07:00
# else
/* boot loader does it all (no warnings from CONFIG_OMAP_MUX_WARNINGS) */
2005-11-10 14:26:53 +00:00
static inline int omap1_mux_init ( void ) { return 0 ; }
2005-04-16 15:20:36 -07:00
# endif
2009-12-11 16:16:33 -08:00
extern int omap2_mux_init ( void ) ;
2005-04-16 15:20:36 -07:00
# endif