diff options
author | lonkaars <loek@pipeframe.xyz> | 2024-05-15 12:57:42 +0200 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2024-05-15 12:57:42 +0200 |
commit | f8d802918da5f898f6466bd59bc15f6a4157d514 (patch) | |
tree | 0881f76a04248d50629be5ac2f16301952032ec5 /driver | |
parent | a8bab1509e795f367db2e374fe600ecacf66e26b (diff) |
uncomment some stuffweek-3
Diffstat (limited to 'driver')
-rw-r--r-- | driver/platform.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/driver/platform.c b/driver/platform.c index c41d47b..73d691f 100644 --- a/driver/platform.c +++ b/driver/platform.c @@ -24,23 +24,23 @@ int lork_probe(struct platform_device* dev) { printk("lork: configure pin %u w/ mode 0x%02x\n", pin, gpio_mode); // find the multiplexer that controls pin - // size_t len = of_property_count_u32_elems(gpio1, "gpio-ranges"); - // struct device_node* am33xx_pinmux = NULL; - // for (size_t i = 0; i < len; i += 4) { - // uint32_t phandle, pin_start, pin_offset, pin_size; - // of_property_read_u32_index(gpio1, "gpio-ranges", i+0, &phandle); - // of_property_read_u32_index(gpio1, "gpio-ranges", i+1, &pin_start); - // of_property_read_u32_index(gpio1, "gpio-ranges", i+2, &pin_offset); - // of_property_read_u32_index(gpio1, "gpio-ranges", i+3, &pin_size); + size_t len = of_property_count_u32_elems(gpio1, "gpio-ranges"); + struct device_node* am33xx_pinmux = NULL; + for (size_t i = 0; i < len; i += 4) { + uint32_t phandle, pin_start, pin_offset, pin_size; + of_property_read_u32_index(gpio1, "gpio-ranges", i+0, &phandle); + of_property_read_u32_index(gpio1, "gpio-ranges", i+1, &pin_start); + of_property_read_u32_index(gpio1, "gpio-ranges", i+2, &pin_offset); + of_property_read_u32_index(gpio1, "gpio-ranges", i+3, &pin_size); - // // get phandle for multiplexer corresponding to configured pin number - // if (pin_start > pin || pin >= pin_start + pin_size) continue; + // get phandle for multiplexer corresponding to configured pin number + if (pin_start > pin || pin >= pin_start + pin_size) continue; - // am33xx_pinmux = of_find_node_by_phandle(phandle); - // printk("0x%02x, %u -> %u + %u\n", phandle, pin_start, pin_offset, pin_size); - // break; - // } - // if (am33xx_pinmux == NULL) return EINVAL; + am33xx_pinmux = of_find_node_by_phandle(phandle); + printk("0x%02x, %u -> %u + %u\n", phandle, pin_start, pin_offset, pin_size); + break; + } + if (am33xx_pinmux == NULL) return EINVAL; // TODO: ??? |