#ifndef __mach_avm_h__ #define __mach_avm_h__ #if defined(CONFIG_X86_PUMA7) #include #include #include #include typedef enum _hw_gpio_function { GPIO_PIN = 0, FUNCTIONAL_PIN = 1, FUNCTIONAL2_PIN = 2, FUNCTIONAL3_PIN = 3, FUNCTIONAL4_PIN = 4, FUNCTIONAL5_PIN = 5, } GPIO_MODE; typedef enum _hw_gpio_direction { GPIO_OUTPUT_PIN = 0, GPIO_INPUT_PIN = 1 }GPIO_DIR; typedef enum _hw_gpio_pinctrl { OPENDRAIN_PINCTRL = 0, PULLUP_PINCTRL = 1, PULLDOWN_PINCTRL = 2, CFG_TXRX_EN_PINCTRL = 3, CFG_TX_EN_PINCTRL = 4, CFG_RX_EN_PINCTRL = 5, CFG_HI_Z_PINCTRL = 6, LIGHTMODE_PINCTRL = 7, INTSEL_PINCTRL = 8, INTCFG_PINCTRL = 9, INVERT_RXTX_PINCTRL = 10, } GPIO_PINCTRL; int x86_gpio_ctrl(unsigned int gpio_pin, enum _hw_gpio_function pin_mode, enum _hw_gpio_direction pin_dir); int x86_gpio_out_bit(unsigned int gpio_pin, int value); int x86_gpio_in_bit(unsigned int gpio_pin); int x86_gpio_pinctrl(unsigned int gpio_pin, enum _hw_gpio_pinctrl pinctrl, int input); /**--------------------------------------------------------------------------------**\ * Do not change configuration after call * only use for x86_gpio_bitbang_in_bit() or x86_gpio_bitbang_out_bit() * you know what you do ! \**--------------------------------------------------------------------------------**/ void *x86_gpio_get_bitbang_handle(unsigned int gpio_pin); /**--------------------------------------------------------------------------------**\ * free handle \**--------------------------------------------------------------------------------**/ void x86_gpio_put_bitbang_handle(void *handle); /**--------------------------------------------------------------------------------**\ * Attention! unlocked and unsaved - you know what you do ! \**--------------------------------------------------------------------------------**/ int x86_gpio_bitbang_in_bit(void *handle); /**--------------------------------------------------------------------------------**\ * Attention! unlocked and unsaved - you know what you do ! * background-knowledge: if you use intelce2700_readl() -> change -> intelce2700_writel() * the maximum gpio-setting rate reduced to 300 KHz instead 3 MHz \**--------------------------------------------------------------------------------**/ void x86_gpio_bitbang_out_bit(void *handle, unsigned int set); unsigned int avm_gpio_interpret_value(unsigned int gpio_nr, int value); #define avm_gpio_ctrl x86_gpio_ctrl #define avm_gpio_out_bit x86_gpio_out_bit #define avm_gpio_in_bit x86_gpio_in_bit #define avm_gpioin_regbase x86_gpioin_regbase #define avm_gpio_pinctrl x86_gpio_pinctrl #define avm_gpio_get_bitbang_handle x86_gpio_get_bitbang_handle #define avm_gpio_put_bitbang_handle x86_gpio_put_bitbang_handle #define avm_gpio_bitbang_in_bit x86_gpio_bitbang_in_bit #define avm_gpio_bitbang_out_bit x86_gpio_bitbang_out_bit #define avm_gpio_out_bit_no_sched avm_gpio_out_bit enum _avm_clock_id { avm_clock_id_cpu = 0x01, }; /**--------------------------------------------------------------------------------**\ \**--------------------------------------------------------------------------------**/ static inline unsigned int x86_get_clock(enum _avm_clock_id clock_id){ unsigned int cpufreq = 0; if(clock_id == avm_clock_id_cpu) { cpufreq = cpufreq_quick_get(raw_smp_processor_id()); if(cpufreq == 0) { cpufreq= cpu_khz; } cpufreq *= 1000; } return cpufreq; } /**--------------------------------------------------------------------------------**\ \**--------------------------------------------------------------------------------**/ static inline unsigned int x86_set_clock(enum _avm_clock_id clock_id __attribute__((unused)), unsigned int clk __attribute__((unused))){ return -1;} #define avm_get_clock x86_get_clock #define avm_set_clock x86_set_clock /**--------------------------------------------------------------------------------**\ \**--------------------------------------------------------------------------------**/ static inline unsigned int avm_get_cycles(void) { return (unsigned int)rdtsc(); } /* we know, that puma7 supports X86_FEATURE_CONSTANT_TSC */ #define avm_get_cyclefreq() (tsc_khz * 1000) #define avm_cycles_cpuclock_depend() 0 #endif /*--- #if defined(CONFIG_X86_PUMA7) ---*/ #endif/*--- #ifndef __mach_avm_h__ ---*/