diff options
author | Andrew McRae <amcrae@google.com> | 2022-01-05 17:26:07 +1100 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2022-01-06 03:53:26 +0000 |
commit | cb05487c07466c020d7a8d239e029adb49cce322 (patch) | |
tree | 60d9ff48de7483d173c265897b58b6f8fa3ec6cc | |
parent | 318dcc1cf3540c2ab3092a10aee57c12cebd73e9 (diff) | |
download | chrome-ec-cb05487c07466c020d7a8d239e029adb49cce322.tar.gz |
pinmap: Remove interrupts, add pull up/down
Remove interrupt inputs. Previously, pins could be identified
as interrupts, which were considered inputs. Interrupts could be
identified as being triggered on rising, falling or both edges.
However, for the purposes of generating the DTS, interrupts are
considered exactly the same as inputs - the interrupt configuration is
treated completely separately. So there is no need to separately
deal with interrupts, they can all be made normal inputs.
Add pull up and pull down inputs. This is required so that the
hardware configuration can be correctly done for each GPIO.
BUG=none
TEST=go test ./...
BRANCH=none
Signed-off-by: Andrew McRae <amcrae@google.com>
Change-Id: I03082a1fe21060a5c0eaf421ffb8d806da8a83d0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3367363
Reviewed-by: Eizan Miyamoto <eizan@chromium.org>
Commit-Queue: Eizan Miyamoto <eizan@chromium.org>
-rw-r--r-- | util/pinmap/README.md | 5 | ||||
-rw-r--r-- | util/pinmap/pm/generate.go | 4 | ||||
-rw-r--r-- | util/pinmap/pm/generate_test.go | 12 | ||||
-rw-r--r-- | util/pinmap/pm/pins.go | 2 | ||||
-rw-r--r-- | util/pinmap/readers/csv/csv.go | 11 | ||||
-rw-r--r-- | util/pinmap/readers/csv/csv_test.go | 1 | ||||
-rw-r--r-- | util/pinmap/readers/csv/testdata/data.csv | 1 |
7 files changed, 29 insertions, 7 deletions
diff --git a/util/pinmap/README.md b/util/pinmap/README.md index a721a588e4..a0b4823b2b 100644 --- a/util/pinmap/README.md +++ b/util/pinmap/README.md @@ -73,12 +73,11 @@ generate the GPIO or other configuration flags in the DTS. | `I2C_CLOCK` | The clock signal for an I2C bus | | `I2C_DATA` | The data signal for an I2C bus (ignored) | | `INPUT` | A GPIO input signal | +| `INPUT_PU` | A GPIO input signal with internal pull-up | +| `INPUT_PD` | A GPIO input signal with internal pull-down | | `OUTPUT` | A GPIO output signal | | `OUTPUT_ODR` | A GPIO output open drain signal | | `OUTPUT_ODL` | A GPIO output open drain signal (default low) | -| `INTERRUPT_FALLING` | A GPIO input signal used as an interrupt (triggered when falling) | -| `INTERRUPT_RISING` | A GPIO input signal used as an interrupt (triggered when rising) | -| `INTERRUPT_BOTH` | A GPIO input signal used as an interrupt (triggered both directions) | | `OTHER` | This signal is ignored, and no DTS configuration is generated for this pin | For the I2C signals, only the `I2C_CLOCK` signal is used to determine which I2C diff --git a/util/pinmap/pm/generate.go b/util/pinmap/pm/generate.go index b4d384ac2a..0548a4a4db 100644 --- a/util/pinmap/pm/generate.go +++ b/util/pinmap/pm/generate.go @@ -103,6 +103,10 @@ func gpioConfig(out io.Writer, pin *Pin, chip Chip) { return case Input: gtype = "GPIO_INPUT" + case InputPU: + gtype = "GPIO_INPUT_PULL_UP" + case InputPD: + gtype = "GPIO_INPUT_PULL_DOWN" case Output: gtype = "GPIO_OUTPUT" case OutputOD: diff --git a/util/pinmap/pm/generate_test.go b/util/pinmap/pm/generate_test.go index 085ca68218..e899e7fa28 100644 --- a/util/pinmap/pm/generate_test.go +++ b/util/pinmap/pm/generate_test.go @@ -53,6 +53,8 @@ func TestGenerate(t *testing.T) { Gpio: []*pm.Pin{ &pm.Pin{pm.Input, "C3", "EC_IN_1", "ENUM_IN_1"}, &pm.Pin{pm.Output, "D4", "EC_OUT_2", "ENUM_OUT_2"}, + &pm.Pin{pm.InputPU, "G7", "EC_IN_3", "ENUM_IN_3"}, + &pm.Pin{pm.InputPD, "H8", "EC_IN_4", "ENUM_IN_4"}, }, Pwm: []*pm.Pin{ &pm.Pin{pm.PWM, "E5", "EC_LED_1", "ENUM_LED_1"}, @@ -94,6 +96,16 @@ func TestGenerate(t *testing.T) { gpios = <&gpio C3 GPIO_INPUT>; enum-name = "ENUM_IN_1"; }; + gpio_ec_in_3: ec_in_3 { + #gpio-cells = <0>; + gpios = <&gpio G7 GPIO_INPUT_PULL_UP>; + enum-name = "ENUM_IN_3"; + }; + gpio_ec_in_4: ec_in_4 { + #gpio-cells = <0>; + gpios = <&gpio H8 GPIO_INPUT_PULL_DOWN>; + enum-name = "ENUM_IN_4"; + }; gpio_ec_out_2: ec_out_2 { #gpio-cells = <0>; gpios = <&gpio D4 GPIO_OUTPUT>; diff --git a/util/pinmap/pm/pins.go b/util/pinmap/pm/pins.go index 9c8b13589d..bb48fa8b92 100644 --- a/util/pinmap/pm/pins.go +++ b/util/pinmap/pm/pins.go @@ -11,6 +11,8 @@ const ( PWM_INVERT I2C Input + InputPU + InputPD Output OutputOD OutputODL diff --git a/util/pinmap/readers/csv/csv.go b/util/pinmap/readers/csv/csv.go index 47ef73295e..e7677671de 100644 --- a/util/pinmap/readers/csv/csv.go +++ b/util/pinmap/readers/csv/csv.go @@ -89,12 +89,15 @@ func (r *CSVReader) Read(chipName, arg string) (*pm.Pins, error) { case "I2C_CLOCK": p.PinType = pm.I2C pins.I2c = append(pins.I2c, p) - case "INPUT", - "INTERRUPT_FALLING", - "INTERRUPT_RISING", - "INTERRUPT_BOTH": + case "INPUT": p.PinType = pm.Input pins.Gpio = append(pins.Gpio, p) + case "INPUT_PU": + p.PinType = pm.InputPU + pins.Gpio = append(pins.Gpio, p) + case "INPUT_PD": + p.PinType = pm.InputPD + pins.Gpio = append(pins.Gpio, p) case "OUTPUT": p.PinType = pm.Output pins.Gpio = append(pins.Gpio, p) diff --git a/util/pinmap/readers/csv/csv_test.go b/util/pinmap/readers/csv/csv_test.go index 9f204848a3..94b134ee79 100644 --- a/util/pinmap/readers/csv/csv_test.go +++ b/util/pinmap/readers/csv/csv_test.go @@ -36,6 +36,7 @@ func TestName(t *testing.T) { &pm.Pin{pm.Input, "D4", "EC_GPIO_1", "GPIO1"}, &pm.Pin{pm.Output, "E5", "EC_GPIO_2", "GPIO2"}, &pm.Pin{pm.OutputODL, "F6", "EC_GPIO_3", ""}, + &pm.Pin{pm.InputPU, "K10", "EC_GPIO_4", ""}, }, Pwm: []*pm.Pin{ &pm.Pin{pm.PWM, "C3", "EC_PWM_1", "FAN_1"}, diff --git a/util/pinmap/readers/csv/testdata/data.csv b/util/pinmap/readers/csv/testdata/data.csv index c7200e1431..6c7ac5ace9 100644 --- a/util/pinmap/readers/csv/testdata/data.csv +++ b/util/pinmap/readers/csv/testdata/data.csv @@ -8,3 +8,4 @@ EC_GPIO_2,E5,OUTPUT,GPIO2 EC_GPIO_3,F6,OUTPUT_ODL, EC_I2C_CLK_0,G7,I2C_CLOCK,SENSOR EC_I2C_DATA_0,H8,I2C_DATA, +EC_GPIO_4,K10,INPUT_PU, |