diff options
author | Aidan MacDonald <amachronic@protonmail.com> | 2021-06-05 00:12:01 +0100 |
---|---|---|
committer | Aidan MacDonald <amachronic@protonmail.com> | 2021-06-06 11:06:14 +0000 |
commit | e85bc74b307365e9a7b4adab51d646638db12fbd (patch) | |
tree | c45ba9079344b5cc0ea48a77b6aa77aacd71cdc5 /firmware/target/mips/ingenic_x1000/i2c-x1000.c | |
parent | 695d1701cdd1bb4539f652c2204f7787097b2715 (diff) | |
download | rockbox-e85bc74b307365e9a7b4adab51d646638db12fbd.tar.gz rockbox-e85bc74b307365e9a7b4adab51d646638db12fbd.zip |
x1000: GPIO refactor
The GPIO API was pretty clunky and pin settings were decentralized,
making it hard to see what was happening and making GPIO stuff look
like a mess, frankly.
Instead of passing clunky (port, pin) pairs everywhere, GPIOs are now
identified with a single int. The extra overhead should be minimal as
GPIO configuration is generally not on a performance-critical path.
Pin assignments are now mostly consolidated in gpio-target.h and put
in various tables so gpio_init() can assign most pins at boot time.
Most drivers no longer need to touch GPIOs and basic pin I/O stuff
can happen without config since pins are put into the right state.
IRQ pins still need to be configured manually before use.
Change-Id: Ic5326284b0b2a2f613e9e76a41cb50e24af3aa47
Diffstat (limited to 'firmware/target/mips/ingenic_x1000/i2c-x1000.c')
-rw-r--r-- | firmware/target/mips/ingenic_x1000/i2c-x1000.c | 18 |
1 files changed, 0 insertions, 18 deletions
diff --git a/firmware/target/mips/ingenic_x1000/i2c-x1000.c b/firmware/target/mips/ingenic_x1000/i2c-x1000.c index 8bf606227b..6a5d2e08d2 100644 --- a/firmware/target/mips/ingenic_x1000/i2c-x1000.c +++ b/firmware/target/mips/ingenic_x1000/i2c-x1000.c | |||
@@ -25,7 +25,6 @@ | |||
25 | #include "kernel.h" | 25 | #include "kernel.h" |
26 | #include "panic.h" | 26 | #include "panic.h" |
27 | #include "logf.h" | 27 | #include "logf.h" |
28 | #include "gpio-x1000.h" | ||
29 | #include "clk-x1000.h" | 28 | #include "clk-x1000.h" |
30 | #include "irq-x1000.h" | 29 | #include "irq-x1000.h" |
31 | #include "x1000/i2c.h" | 30 | #include "x1000/i2c.h" |
@@ -375,18 +374,6 @@ void i2c_init(void) | |||
375 | /* Stuff only required during initialization is below, basically the same as | 374 | /* Stuff only required during initialization is below, basically the same as |
376 | * the old driver except for how the IRQs are initially set up. */ | 375 | * the old driver except for how the IRQs are initially set up. */ |
377 | 376 | ||
378 | static const struct { | ||
379 | int port; | ||
380 | unsigned pins; | ||
381 | int func; | ||
382 | } i2c_x1000_gpio_data[] = { | ||
383 | {GPIO_B, 3 << 23, GPIO_DEVICE(0)}, | ||
384 | {GPIO_C, 3 << 26, GPIO_DEVICE(0)}, | ||
385 | /* Note: I2C1 is also on the following pins (normally used by LCD) */ | ||
386 | /* {GPIO_A, 3 << 0, GPIO_DEVICE(2)}, */ | ||
387 | {GPIO_D, 3 << 0, GPIO_DEVICE(1)}, | ||
388 | }; | ||
389 | |||
390 | static void i2c_x1000_gate(int chn, int gate) | 377 | static void i2c_x1000_gate(int chn, int gate) |
391 | { | 378 | { |
392 | switch(chn) { | 379 | switch(chn) { |
@@ -468,11 +455,6 @@ void i2c_x1000_set_freq(int chn, int freq) | |||
468 | jz_write(I2C_FHCNT(chn), t_HIGH); | 455 | jz_write(I2C_FHCNT(chn), t_HIGH); |
469 | } | 456 | } |
470 | 457 | ||
471 | /* Claim pins */ | ||
472 | gpio_config(i2c_x1000_gpio_data[chn].port, | ||
473 | i2c_x1000_gpio_data[chn].pins, | ||
474 | i2c_x1000_gpio_data[chn].func); | ||
475 | |||
476 | /* Enable the controller */ | 458 | /* Enable the controller */ |
477 | i2c_x1000_enable(chn); | 459 | i2c_x1000_enable(chn); |
478 | } | 460 | } |