void lcd5510_init( void ){ // configure the pins as GPUIO GPIO_CONFIG( &LPC_IOCON->R_PIO1_0, 0x01 ); GPIO_CONFIG( &LPC_IOCON->R_PIO1_1, 0x01 ); GPIO_CONFIG( &LPC_IOCON->R_PIO1_2, 0x01 ); GPIO_CONFIG( &LPC_IOCON->SWDIO_PIO1_3, 0x01 ); GPIO_CONFIG( &LPC_IOCON->PIO1_4, 0x00 ); LPC_GPIO1->DIR = LPC_GPIO1->DIR | 0x1F; sclk_set( 0 ); wait( 1 ); sce_set( 1 ); wait( 1 ); res_set( 0 ); wait( 1 ); res_set( 1 ); wait( 1 ); // initialization according to // https://www.sparkfun.com/products/10168 - nee, andere lcd5510_command( 0x21 ); // select exteded instructions lcd5510_command( 0xC8 ); // Vop = 110000b lcd5510_command( 0x06 ); // TCx = 00b lcd5510_command( 0x13 ); // BSx = 100b lcd5510_command( 0x20 ); // select basic instructions, horizontal addressing lcd5510_command( 0x0C ); // normal mode }
void __msm_gpio_set_config_direction(unsigned gpio, int input, int val) { if (input) clr_gpio_bits(BIT(GPIO_OE_BIT), GPIO_CONFIG(gpio)); else { __msm_gpio_set_inout(gpio, val); set_gpio_bits(BIT(GPIO_OE_BIT), GPIO_CONFIG(gpio)); } }
void __msm_gpio_install_direct_irq(unsigned gpio, unsigned irq, unsigned int input_polarity) { uint32_t bits; __raw_writel(__raw_readl(GPIO_CONFIG(gpio)) | BIT(GPIO_OE_BIT), GPIO_CONFIG(gpio)); __raw_writel(__raw_readl(GPIO_INTR_CFG(gpio)) & ~(INTR_RAW_STATUS_EN | INTR_ENABLE), GPIO_INTR_CFG(gpio)); __raw_writel(DC_IRQ_ENABLE | TARGET_PROC_NONE, GPIO_INTR_CFG_SU(gpio)); bits = TARGET_PROC_SCORPION | (gpio << 3); if (input_polarity) bits |= DC_POLARITY_HI; __raw_writel(bits, DIR_CONN_INTR_CFG_SU(irq)); }
void __gpio_tlmm_config(unsigned config) { uint32_t flags; unsigned gpio = GPIO_PIN(config); flags = ((GPIO_DIR(config) << 9) & (0x1 << 9)) | ((GPIO_DRVSTR(config) << 6) & (0x7 << 6)) | ((GPIO_FUNC(config) << 2) & (0xf << 2)) | ((GPIO_PULL(config) & 0x3)); __raw_writel(flags, GPIO_CONFIG(gpio)); }
void __msm_gpio_get_dump_info(unsigned gpio, struct msm_gpio_dump_info *data) { unsigned flags; flags = __raw_readl(GPIO_CONFIG(gpio)); data->pull = flags & 0x3; data->func_sel = (flags >> 2) & 0xf; data->drv = (flags >> 6) & 0x7; data->dir = (flags >> 9) & 0x1; if (data->dir) data->value = (__raw_readl(GPIO_IN_OUT(gpio)) >> 1) & 0x1; else {
int msm_gpio_install_direct_irq(unsigned gpio, unsigned irq) { unsigned long irq_flags; if (gpio >= NR_MSM_GPIOS || irq >= NR_TLMM_SCSS_DIR_CONN_IRQ) return -EINVAL; spin_lock_irqsave(&tlmm_lock, irq_flags); writel(readl(GPIO_CONFIG(gpio)) | BIT(GPIO_OE_BIT), GPIO_CONFIG(gpio)); writel(readl(GPIO_INTR_CFG(gpio)) & ~(INTR_RAW_STATUS_EN | INTR_ENABLE), GPIO_INTR_CFG(gpio)); writel(DC_IRQ_ENABLE | TARGET_PROC_NONE, GPIO_INTR_CFG_SU(gpio)); writel(DC_POLARITY_HI | TARGET_PROC_SCORPION | (gpio << 3), DIR_CONN_INTR_CFG_SU(irq)); spin_unlock_irqrestore(&tlmm_lock, irq_flags); return 0; }
void __msm_gpio_install_direct_irq(unsigned gpio, unsigned irq, unsigned int input_polarity) { unsigned cfg; set_gpio_bits(BIT(GPIO_OE_BIT), GPIO_CONFIG(gpio)); cfg = __raw_readl(GPIO_INTR_CFG(gpio)); cfg &= ~(INTR_TARGET_PROC_NONE | INTR_RAW_STATUS_EN | INTR_ENABLE); cfg |= INTR_TARGET_PROC_APPS | INTR_DIR_CONN_EN; __raw_writel(cfg, GPIO_INTR_CFG(gpio)); cfg = gpio; if (input_polarity) cfg |= DC_POLARITY_HI; __raw_writel(cfg, GPIO_DIR_CONN_INTR(irq)); }
int gpio_tlmm_config(unsigned config, unsigned disable) { uint32_t flags; unsigned gpio = GPIO_PIN(config); if (gpio > NR_MSM_GPIOS) return -EINVAL; flags = ((GPIO_DIR(config) << 9) & (0x1 << 9)) | ((GPIO_DRVSTR(config) << 6) & (0x7 << 6)) | ((GPIO_FUNC(config) << 2) & (0xf << 2)) | ((GPIO_PULL(config) & 0x3)); writel(flags, GPIO_CONFIG(gpio)); return 0; }
int gpio_tlmm_config(unsigned config, unsigned disable) { uint32_t v2flags; unsigned long irq_flags; unsigned gpio = GPIO_PIN(config); if (gpio > NR_MSM_GPIOS) return -EINVAL; v2flags = ((GPIO_DIR(config) << 9) & (0x1 << 9)) | ((GPIO_DRVSTR(config) << 6) & (0x7 << 6)) | ((GPIO_FUNC(config) << 2) & (0xf << 2)) | ((GPIO_PULL(config) & 0x3)); spin_lock_irqsave(&gpio_lock, irq_flags); writel(v2flags, GPIO_CONFIG(gpio)); spin_unlock_irqrestore(&gpio_lock, irq_flags); return 0; }
static int tlmm_get_cfg(unsigned gpio, unsigned* cfg) { unsigned flags; BUG_ON(gpio >= TLMM_NUM_GPIO); //printk("%s(), gpio=%d, addr=0x%08x\n", __func__, gpio, (unsigned int)GPIO_CONFIG(gpio)); #if 0 flags = ((GPIO_DIR(config) << 9) & (0x1 << 9)) | ((GPIO_DRVSTR(config) << 6) & (0x7 << 6)) | ((GPIO_FUNC(config) << 2) & (0xf << 2)) | ((GPIO_PULL(config) & 0x3)); #else flags = __raw_readl(GPIO_CONFIG(gpio)); #endif *cfg = GPIO_CFG(gpio, (flags >> 2) & 0xf, (flags >> 9) & 0x1, flags & 0x3, (flags >> 6) & 0x7); return 0; }
void __msm_gpiomux_write(unsigned gpio, gpiomux_config_t val) { writel(val & ~GPIOMUX_CTL_MASK, GPIO_CONFIG(gpio)); }