diff options
author | lonkaars <loek@pipeframe.xyz> | 2024-05-12 15:00:54 +0200 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2024-05-12 15:00:54 +0200 |
commit | dfc09d8b14d15015b4afa5d674786ec74f616772 (patch) | |
tree | b3c5955ecb2f970c306a2c0441c19d518547ebd2 /1/main.c | |
parent | 480640799470b4465d62348aaf73154423ddb896 (diff) |
get pin 19 working
Diffstat (limited to '1/main.c')
-rw-r--r-- | 1/main.c | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -1,6 +1,7 @@ #include <linux/cdev.h> #include <linux/init.h> #include <linux/module.h> +#include <linux/io.h> #include "fopdrv.h" #include "config.h" @@ -63,6 +64,26 @@ static int mod_init(void) { printk("%s() -> 0 (%d:%d)\n", __PRETTY_FUNCTION__, MAJOR(node), MINOR(node)); printk("one = %d, two = %d\n", one, not_named_two); + + // configure gpio mux + uint32_t* conf_gpmc_a3 = ioremap(TI_AM335X_CM_GPMC_A3_ADDR, sizeof(ti_am335x_word_t)); + if (conf_gpmc_a3 == NULL) + return -EINVAL; + barrier(); + uint32_t val = ioread32(conf_gpmc_a3); rmb(); + val &= ~0x7; + val |= 0x7; + iowrite32(val, conf_gpmc_a3); wmb(); + iounmap(conf_gpmc_a3); + + // configure output pin + ti_am335x_word_t* gpio1 = ioremap(TI_AM335X_GPIO1_ADDR, GPIO_REG_SIZE); + barrier(); + ti_am335x_word_t oe_reg = ioread32(gpio1 + GPIO_OE); rmb(); + oe_reg &= ~(1<<PIN); // 0=output + iowrite32(oe_reg, gpio1 + GPIO_OE); wmb(); + iounmap(gpio1); + return 0; free_device: |