tgpio_imx6q.h 3.06 KB
/**    
    @file     tgpio_imx6.c
    @date     2013/7/22
    @author   오재경 freefrug@falinux.com  FALinux.Co.,Ltd.
    @brief    gpio 를 드라이버없이 mmap를 이용하여 제어한다.
              Ver 0.7.0
             
              
    @modify   
    @todo     
    @bug     
    @remark   
    @warning 
*/
//----------------------------------------------------------------------------


#ifndef _TGPIO_IMUX6Q_HEADER_
#define _TGPIO_IMUX6Q_HEADER_

#define MX6Q_IOMUXC_BASE_ADDR		0x020e0000
#define MX6Q_IOMUXC_SIZE			0x4000


#include <fa-types.h>
typedef u64 iomux_v3_cfg_t;



#define MUX_CTRL_OFS_SHIFT			0
#define MUX_CTRL_OFS_MASK			((iomux_v3_cfg_t)0xfff << MUX_CTRL_OFS_SHIFT)
#define MUX_PAD_CTRL_OFS_SHIFT		12
#define MUX_PAD_CTRL_OFS_MASK		((iomux_v3_cfg_t)0xfff << MUX_PAD_CTRL_OFS_SHIFT)
#define MUX_SEL_INPUT_OFS_SHIFT		24
#define MUX_SEL_INPUT_OFS_MASK		((iomux_v3_cfg_t)0xfff << MUX_SEL_INPUT_OFS_SHIFT)

#define MUX_MODE_SHIFT				36
#define MUX_MODE_MASK				((iomux_v3_cfg_t)0x1f << MUX_MODE_SHIFT)
#define MUX_PAD_CTRL_SHIFT			41
#define MUX_PAD_CTRL_MASK			((iomux_v3_cfg_t)0x3ffff << MUX_PAD_CTRL_SHIFT)
#define MUX_SEL_INPUT_SHIFT			59
#define MUX_SEL_INPUT_MASK			((iomux_v3_cfg_t)0xf << MUX_SEL_INPUT_SHIFT)
                            		
#define MUX_PAD_CTRL(x)				((iomux_v3_cfg_t)(x) << MUX_PAD_CTRL_SHIFT)

#define IOMUX_PAD(_pad_ctrl_ofs, _mux_ctrl_ofs, _mux_mode, _sel_input_ofs, _sel_input, _pad_ctrl) \
		(((iomux_v3_cfg_t)(_mux_ctrl_ofs) << MUX_CTRL_OFS_SHIFT) |	\
		((iomux_v3_cfg_t)(_mux_mode) << MUX_MODE_SHIFT) |	\
		((iomux_v3_cfg_t)(_pad_ctrl_ofs) << MUX_PAD_CTRL_OFS_SHIFT) | \
		((iomux_v3_cfg_t)(_pad_ctrl) << MUX_PAD_CTRL_SHIFT) |	\
		((iomux_v3_cfg_t)(_sel_input_ofs) << MUX_SEL_INPUT_OFS_SHIFT) | \
		((iomux_v3_cfg_t)(_sel_input) << MUX_SEL_INPUT_SHIFT))

#define NEW_PAD_CTRL(cfg, pad)		(((cfg) & ~MUX_PAD_CTRL_MASK) | MUX_PAD_CTRL(pad))


// pull-up, pull-dn
#define NO_PAD_CTRL					(1 << 17)
#define PAD_CTL_HYS					(1 << 16)

#define PAD_CTL_PUS_100K_DOWN		(0 << 14)
#define PAD_CTL_PUS_47K_UP			(1 << 14)
#define PAD_CTL_PUS_100K_UP			(2 << 14)
#define PAD_CTL_PUS_22K_UP			(3 << 14)

#define PAD_CTL_PUE					(1 << 13)
#define PAD_CTL_PKE					(1 << 12)
#define PAD_CTL_ODE					(1 << 11)

#define PAD_CTL_SPEED_LOW			(1 << 6)
#define PAD_CTL_SPEED_MED			(2 << 6)
#define PAD_CTL_SPEED_HIGH			(3 << 6)
                                	
#define PAD_CTL_DSE_DISABLE			(0 << 3)
#define PAD_CTL_DSE_240ohm			(1 << 3)
#define PAD_CTL_DSE_120ohm			(2 << 3)
#define PAD_CTL_DSE_80ohm			(3 << 3)
#define PAD_CTL_DSE_60ohm			(4 << 3)
#define PAD_CTL_DSE_48ohm			(5 << 3)
#define PAD_CTL_DSE_40ohm			(6 << 3)
#define PAD_CTL_DSE_34ohm			(7 << 3)
                                	
#define PAD_CTL_SRE_FAST			(1 << 0)
#define PAD_CTL_SRE_SLOW			(0 << 0)


#endif	// _TGPIO_IMUX6Q_HEADER_


#ifdef __cplusplus 
extern "C" { 
#endif 	

/// @{
/// @brief   tgpio_imx6q.h 에서 제공하는 함수 리스트 
extern void  imx6_gpio_open( int  mcu_nr );

/// @}

#ifdef __cplusplus 
}
#endif