From e85bc74b307365e9a7b4adab51d646638db12fbd Mon Sep 17 00:00:00 2001 From: Aidan MacDonald Date: Sat, 5 Jun 2021 00:12:01 +0100 Subject: 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 --- firmware/target/mips/ingenic_x1000/msc-x1000.h | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'firmware/target/mips/ingenic_x1000/msc-x1000.h') diff --git a/firmware/target/mips/ingenic_x1000/msc-x1000.h b/firmware/target/mips/ingenic_x1000/msc-x1000.h index 53a5b301f0..70f67a70d6 100644 --- a/firmware/target/mips/ingenic_x1000/msc-x1000.h +++ b/firmware/target/mips/ingenic_x1000/msc-x1000.h @@ -83,18 +83,13 @@ #define MSC_SPEED_FAST 25000000 #define MSC_SPEED_HIGH 50000000 -typedef struct msc_gpio_data { - int port; - int pin; - int active_level; -} msc_gpio_data; - typedef struct msc_config { int msc_nr; int msc_type; int bus_width; const char* label; - struct msc_gpio_data cd_gpio; + int cd_gpio; + int cd_active_level; } msc_config; typedef struct msc_req { -- cgit v1.2.3