summaryrefslogtreecommitdiff
path: root/util/pinmap
diff options
context:
space:
mode:
authorBoris Mittelberg <bmbm@google.com>2022-04-14 11:38:33 -0700
committerBoris Mittelberg <bmbm@google.com>2022-04-14 11:38:33 -0700
commit10cf54860dc2f7ac36610799919f1a0cf1d501bb (patch)
treeac982e3f9c46d97c7ec713ac5e15ee284179fec7 /util/pinmap
parent59ede6b1714c313de3e003c0497c70725bf625d5 (diff)
parent265691a2fe290e0fa54ecccba151a5c63dd73e47 (diff)
downloadchrome-ec-firmware-brya-14505.71.B-main.tar.gz
Merge remote-tracking branch cros/main into firmware-brya-14505.B-mainfirmware-brya-14505.71.B-main
Generated by: util/update_release_branch.py --baseboard brya --relevant_paths_file baseboard/brya/relevant-paths.txt firmware-brya-14505.B-main Relevant changes: git log --oneline 59ede6b17..265691a2f -- baseboard/brya board/agah board/anahera board/banshee board/brya board/crota board/felwinter board/gimble board/kano board/primus board/redrix board/taeko board/taniks board/vell board/volmar driver/bc12/pi3usb9201_public.* driver/charger/bq25710.* driver/ppc/nx20p348x.* driver/ppc/syv682x_public.* driver/retimer/bb_retimer_public.* driver/tcpm/nct38xx.* driver/tcpm/ps8xxx_public.* driver/tcpm/tcpci.* include/power/alderlake* include/intel_x86.h power/alderlake* power/intel_x86.c util/getversion.sh 98493ee98 crota: remove type-c port 2 to avoid confusion 88a19dd1b anahera: Tune USBA retimer EQ revision 2 37d45dd56 kano: Support 28w cpu fan table BRANCH=None BUG=b:228775653 b:203837657 b:219176652 TEST=`make -j buildall` Signed-off-by: Boris Mittelberg <bmbm@google.com> Change-Id: Ia775339f54ad90ecdbc81ce1543b1b38f94f3b3b
Diffstat (limited to 'util/pinmap')
-rw-r--r--util/pinmap/README.md12
-rw-r--r--util/pinmap/chips/it81302.go18
-rw-r--r--util/pinmap/chips/npcx993.go18
-rw-r--r--util/pinmap/chips/npcx993_test.go10
-rw-r--r--util/pinmap/pm/chip.go5
-rw-r--r--util/pinmap/pm/chip_test.go5
-rw-r--r--util/pinmap/pm/generate.go27
-rw-r--r--util/pinmap/pm/generate_test.go27
-rw-r--r--util/pinmap/pm/pins.go3
-rw-r--r--util/pinmap/readers/csv/csv.go10
-rw-r--r--util/pinmap/readers/csv/csv_test.go5
-rw-r--r--util/pinmap/readers/csv/testdata/data.csv2
12 files changed, 9 insertions, 133 deletions
diff --git a/util/pinmap/README.md b/util/pinmap/README.md
index 0246ed47cd..7ac924e09a 100644
--- a/util/pinmap/README.md
+++ b/util/pinmap/README.md
@@ -5,13 +5,13 @@
This program reads a CSV (comma separated values) file and generates
Zephyr Device Tree entries for GPIOs and other configuration.
-A basic Device Tree configuration is generated for I2C buses, ADC pins, GPIO pins
-and PWM pins, with labels and nodes generated for each of the signals in the
+A basic Device Tree configuration is generated for I2C buses, ADC pins and GPIO
+pins with labels and nodes generated for each of the signals in the
spreadsheet.
-A separate overlay Device Tree file can be used to modify the generated DTS
-to allow specific properties and parameters to be set e.g bus speeds for I2C, conversion parameters
-for ADCs, frequencies for PWM etc.
+A separate overlay Device Tree file can be used to modify the generated DTS to
+allow specific properties and parameters to be set e.g bus speeds for I2C,
+conversion parameters for ADCs etc.
## Building
@@ -70,8 +70,6 @@ generate the GPIO or other configuration flags in the DTS.
| Type Name | Description |
| ----------- | ----------- |
| `ADC` | An analogue to digital converter signal |
-| `PWM` | A pulse width modulator signal |
-| `PWM_INVERT` | A pulse width modulator signal with inverted output |
| `I2C_CLOCK` | The clock signal for an I2C bus |
| `I2C_DATA` | The data signal for an I2C bus (ignored) |
| `INPUT` | A GPIO input signal |
diff --git a/util/pinmap/chips/it81302.go b/util/pinmap/chips/it81302.go
index e7c8cf697d..6e593a2c5e 100644
--- a/util/pinmap/chips/it81302.go
+++ b/util/pinmap/chips/it81302.go
@@ -228,21 +228,3 @@ func (c *It81302) I2c(p string) string {
return ""
}
}
-
-// Pwm returns the configuration of this pin as a PWM.
-func (c *It81302) Pwm(p string) string {
- s, ok := it81302_pins[p]
- if ok {
- // Found the pin, now find the PWM name.
- for _, ss := range strings.Split(s, "/") {
- if strings.HasPrefix(ss, "PWM") && len(ss) > 3 {
- pwm := fmt.Sprintf("pwm%s", ss[3:])
- c.okay = append(c.okay, pwm)
- return fmt.Sprintf("%s %s", pwm, ss[3:])
- }
- }
- return ""
- } else {
- return ""
- }
-}
diff --git a/util/pinmap/chips/npcx993.go b/util/pinmap/chips/npcx993.go
index 58ee312d20..7a865c115d 100644
--- a/util/pinmap/chips/npcx993.go
+++ b/util/pinmap/chips/npcx993.go
@@ -228,21 +228,3 @@ func (c *Npcx993) I2c(p string) string {
return ""
}
}
-
-// Pwm returns the PWM config associated with this pin.
-func (c *Npcx993) Pwm(p string) string {
- s, ok := npcx993_pins[p]
- if ok {
- // Found the pin, now find the PWM name.
- for _, ss := range strings.Split(s, ",") {
- if strings.HasPrefix(ss, "PWM") && len(ss) > 3 {
- ch := ss[3:]
- c.okay = append(c.okay, fmt.Sprintf("pwm%s", ch))
- return fmt.Sprintf("pwm%s %s", ch, ch)
- }
- }
- return ""
- } else {
- return ""
- }
-}
diff --git a/util/pinmap/chips/npcx993_test.go b/util/pinmap/chips/npcx993_test.go
index fbed838804..6ed4bf2357 100644
--- a/util/pinmap/chips/npcx993_test.go
+++ b/util/pinmap/chips/npcx993_test.go
@@ -33,9 +33,6 @@ func TestMissing(t *testing.T) {
if gc != "" {
t.Errorf("Expected empty string, got %s %d for Gpio()", gc, gp)
}
- if n.Pwm(none) != "" {
- t.Errorf("Expected empty string, got %s for Pwm()", n.Pwm(none))
- }
if n.I2c(none) != "" {
t.Errorf("Expected empty string, got %s for I2c()", n.I2c(none))
}
@@ -52,16 +49,9 @@ func TestMulti(t *testing.T) {
if gc != "gpioe" || gp != 0 {
t.Errorf("Expected \"gpioe 0\", got %s %d for Gpio()", gc, gp)
}
- if n.Pwm(pin) != "" {
- t.Errorf("Expected empty string, got %s for Pwm()", n.Pwm(pin))
- }
if n.I2c(pin) != "" {
t.Errorf("Expected empty string, got %s for I2c()", n.I2c(pin))
}
- pin = "L9"
- if n.Pwm(pin) != "pwm4 4" {
- t.Errorf("Expected \"pwm4 4\", got %s for Pwm()", n.Pwm(pin))
- }
pin = "F8"
if n.I2c(pin) != "i2c3_0" {
t.Errorf("Expected \"i2c3_0\", got %s for I2c()", n.I2c(pin))
diff --git a/util/pinmap/pm/chip.go b/util/pinmap/pm/chip.go
index bb9d783c60..a940e7c5fe 100644
--- a/util/pinmap/pm/chip.go
+++ b/util/pinmap/pm/chip.go
@@ -36,11 +36,6 @@ type Chip interface {
* the I2C clock pin of the 2 wire bus.
*/
I2c(pin string) string
- /*
- * Pwm will return a DTS reference to the appropriate PWM
- * that is connected to this pin.
- */
- Pwm(pin string) string
}
// chipList contains a list of registered chips.
diff --git a/util/pinmap/pm/chip_test.go b/util/pinmap/pm/chip_test.go
index ac65695755..0bfe601093 100644
--- a/util/pinmap/pm/chip_test.go
+++ b/util/pinmap/pm/chip_test.go
@@ -20,7 +20,6 @@ type testChip struct {
gc string
gp int
i2c string
- pwm string
}
func (c *testChip) Name() string {
@@ -43,10 +42,6 @@ func (c *testChip) I2c(pin string) string {
return c.i2c
}
-func (c *testChip) Pwm(pin string) string {
- return c.pwm
-}
-
func TestName(t *testing.T) {
n1 := "Test1"
n2 := "Test2"
diff --git a/util/pinmap/pm/generate.go b/util/pinmap/pm/generate.go
index afa23ed7c5..835206ad7b 100644
--- a/util/pinmap/pm/generate.go
+++ b/util/pinmap/pm/generate.go
@@ -46,7 +46,6 @@ func Generate(out io.Writer, pins *Pins, chip Chip, names bool) {
gpioConfig(out, pin, chip, lineNameMap)
})
pinConfig(out, "named-i2c-ports", pins.I2c, chip, sortI2c, i2cConfig)
- pinConfig(out, "named-pwms", pins.Pwm, chip, sortSignal, pwmConfig)
fmt.Fprintf(out, "};\n")
// Retrieve the enabled nodes, sort, de-dup and
// generate overlays.
@@ -159,32 +158,6 @@ func i2cConfig(out io.Writer, pin *Pin, chip Chip) {
fmt.Fprintf(out, "\t\t};\n")
}
-// pwmConfig is the handler for PWM pins.
-func pwmConfig(out io.Writer, pin *Pin, chip Chip) {
- var inv string
- switch pin.PinType {
- default:
- fmt.Printf("Unknown PWM type (%d) for pin %s, ignored\n", pin.PinType, pin.Pin)
- return
- case PWM:
- inv = "0"
- case PWM_INVERT:
- inv = "1"
- }
- c := chip.Pwm(pin.Pin)
- if len(c) == 0 {
- fmt.Printf("No matching PWM for pin %s, ignored\n", pin.Pin)
- return
- }
- lc := strings.ToLower(pin.Signal)
- fmt.Fprintf(out, "\t\tpwm_%s: %s {\n", lc, lc)
- fmt.Fprintf(out, "\t\t\tpwms = <&%s %s>;\n", c, inv)
- if len(pin.Enum) > 0 {
- fmt.Fprintf(out, "\t\t\tenum-name = \"%s\";\n", pin.Enum)
- }
- fmt.Fprintf(out, "\t\t};\n")
-}
-
// generateEnabledNodes generates a "status = okay"
// property for the list of nodes passed.
func generateEnabledNodes(out io.Writer, nodes []string) {
diff --git a/util/pinmap/pm/generate_test.go b/util/pinmap/pm/generate_test.go
index 0a6eaca99d..3903180b1b 100644
--- a/util/pinmap/pm/generate_test.go
+++ b/util/pinmap/pm/generate_test.go
@@ -23,7 +23,7 @@ func (c *genChip) Name() string {
}
func (c *genChip) EnabledNodes() []string {
- return []string{"adc0", "i2c0", "i2c1", "i2c2", "pwm1"}
+ return []string{"adc0", "i2c0", "i2c1", "i2c2"}
}
func (c *genChip) Adc(pin string) string {
@@ -47,10 +47,6 @@ func (c *genChip) I2c(pin string) string {
panic(fmt.Sprintf("Unknown I2C: %s", pin))
}
-func (c *genChip) Pwm(pin string) string {
- return "pwm1"
-}
-
func TestGenerate(t *testing.T) {
pins := &pm.Pins{
Adc: []*pm.Pin{
@@ -67,10 +63,6 @@ func TestGenerate(t *testing.T) {
&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"},
- &pm.Pin{pm.PWM_INVERT, "F6", "EC_LED_2", "ENUM_LED_2"},
- },
}
var out bytes.Buffer
pm.Generate(&out, pins, &genChip{}, true)
@@ -136,19 +128,6 @@ func TestGenerate(t *testing.T) {
enum-name = "ENUM_I2C_2";
};
};
-
- named-pwms {
- compatible = "named-pwms";
-
- pwm_ec_led_1: ec_led_1 {
- pwms = <&pwm1 0>;
- enum-name = "ENUM_LED_1";
- };
- pwm_ec_led_2: ec_led_2 {
- pwms = <&pwm1 1>;
- enum-name = "ENUM_LED_2";
- };
- };
};
&adc0 {
@@ -167,10 +146,6 @@ func TestGenerate(t *testing.T) {
status = "okay";
};
-&pwm1 {
- status = "okay";
-};
-
&gpioC {
gpio-line-names =
"",
diff --git a/util/pinmap/pm/pins.go b/util/pinmap/pm/pins.go
index ea9282ab5d..cb749eb166 100644
--- a/util/pinmap/pm/pins.go
+++ b/util/pinmap/pm/pins.go
@@ -7,8 +7,6 @@ package pm
// Pin types enum constants
const (
ADC = iota
- PWM
- PWM_INVERT
I2C
Input
InputL
@@ -34,5 +32,4 @@ type Pins struct {
Adc []*Pin // Analogue to digital converters
I2c []*Pin // I2C busses
Gpio []*Pin // GPIO pins
- Pwm []*Pin // Pwm pins
}
diff --git a/util/pinmap/readers/csv/csv.go b/util/pinmap/readers/csv/csv.go
index 3f541f5da6..562b5c6383 100644
--- a/util/pinmap/readers/csv/csv.go
+++ b/util/pinmap/readers/csv/csv.go
@@ -82,20 +82,16 @@ func (r *CSVReader) Read(columnKey, filepath string) (*pm.Pins, error) {
p := new(pm.Pin)
switch row[ptype] {
default:
- fmt.Printf("%s:%d: Unknown signal type (%s) - ignored", filepath, i+1, row[ptype])
+ fmt.Printf("%s:%d: Unknown signal type (%s) - ignored\n", filepath, i+1, row[ptype])
continue
case "OTHER":
+ case "PWM":
+ case "PWM_INVERT":
// Skipped
continue
case "ADC":
p.PinType = pm.ADC
pins.Adc = append(pins.Adc, p)
- case "PWM":
- p.PinType = pm.PWM
- pins.Pwm = append(pins.Pwm, p)
- case "PWM_INVERT":
- p.PinType = pm.PWM_INVERT
- pins.Pwm = append(pins.Pwm, p)
case "I2C_DATA":
// Only the clock pin is used for the config
continue
diff --git a/util/pinmap/readers/csv/csv_test.go b/util/pinmap/readers/csv/csv_test.go
index 639ec4f8fe..c0a79ba784 100644
--- a/util/pinmap/readers/csv/csv_test.go
+++ b/util/pinmap/readers/csv/csv_test.go
@@ -38,15 +38,10 @@ func TestName(t *testing.T) {
&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"},
- &pm.Pin{pm.PWM_INVERT, "J9", "EC_PWM_2", "LED_1"},
- },
}
check(t, "ADc", exp.Adc, pins.Adc)
check(t, "I2c", exp.I2c, pins.I2c)
check(t, "Gpio", exp.Gpio, pins.Gpio)
- check(t, "Pwm", exp.Pwm, pins.Pwm)
}
func check(t *testing.T, name string, exp, got []*pm.Pin) {
diff --git a/util/pinmap/readers/csv/testdata/data.csv b/util/pinmap/readers/csv/testdata/data.csv
index 6c7ac5ace9..8f1be84801 100644
--- a/util/pinmap/readers/csv/testdata/data.csv
+++ b/util/pinmap/readers/csv/testdata/data.csv
@@ -1,8 +1,6 @@
Signal Name,MyCHIP,Type,Enum
EC_ADC_1,A1,ADC,ENUM_ADC_1
EC_IGNORED_1,B2,OTHER,
-EC_PWM_1,C3,PWM,FAN_1
-EC_PWM_2,J9,PWM_INVERT,LED_1
EC_GPIO_1,D4,INPUT,GPIO1
EC_GPIO_2,E5,OUTPUT,GPIO2
EC_GPIO_3,F6,OUTPUT_ODL,