Repository navigation
PENDING: PCI: qcom: pwrctrl: tc9563: Add embedded GPIO controller and reset-gpios support #1521
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Hariharan Sreedhar (hariharan-sree)
wants to merge
19
commits into
qualcomm-linux:qcom-6.18.y
Choose a base branch
from
hariharan-sree:lyra-tc9563-gpio
base: qcom-6.18.y
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+452
−203
Open
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
c77ee2c
BACKPORT: gpio: tc9563: Add support for the embedded GPIO controller
alexelder ccd9b3f
BACKPORT: dt-bindings: PCI: toshiba,tc9563: Document embedded GPIO co…
LorenzoBianconi af24aa0
BACKPORT: PCI/pwrctrl: tc9563: Take i2c adapter module reference
jhovold 386da38
BACKPORT: PCI/pwrctrl: tc9563: Fix parsing the integrated Ethernet MA…
Mani-Sadhasivam c7f2ffa
BACKPORT: PCI/pwrctrl: tc9563: Power off only the external ports in t…
Mani-Sadhasivam 9e9ee26
BACKPORT: PCI/pwrctrl: tc9563: Skip Tx amplitude and DFE tuning for DSP3
Mani-Sadhasivam 148ea9f
BACKPORT: PCI/pwrctrl: tc9563: Rename DSP3 to VDSP
Mani-Sadhasivam cc5b80a
BACKPORT: dt-bindings: Fix phandle-array constraints, again
robherring c7ede54
BACKPORT: PCI/pwrctrl: tc9563: Move Integrated MAC Endpoint out of 't…
Mani-Sadhasivam b0e677b
BACKPORT: PCI/pwrctrl: tc9563: Rely on regmap APIs
LorenzoBianconi a9297b7
BACKPORT: PCI/pwrctrl: tc9563: Use devm-managed I2C dummy device allo…
LorenzoBianconi 7abafc5
BACKPORT: PCI/pwrctrl: tc9563: Allow RESX reset assertion to sleep
528d12f
BACKPORT: PCI/pwrctrl: tc9563: Add GPIO auxiliary device support
LorenzoBianconi 554dd6a
PENDING: PCI/pwrctrl: tc9563: Re-sync endpoint reset GPIO direction a…
hariharan-sree c96bedf
PENDING: PCI: qcom: Allow downstream PCIe devices to provide PERST# G…
hariharan-sree ecf1c31
PENDING: arm64: configs: qcom: Enable TC9563 embedded GPIO controller
hariharan-sree b5f2181
PENDING: arm64: dts: qcom: talos-lyra-evk: Use TC9563 embedded GPIO c…
hariharan-sree eb0fa9c
PENDING: dt-bindings: PCI: toshiba,tc9563: Document reset-gpios and g…
hariharan-sree e402fca
PENDING: arm64: dts: qcom: talos-lyra-evk: Disable ASPM L1 for TC9563…
hariharan-sree File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -292,11 +292,14 @@ | |
| reg = <0x10000 0x0 0x0 0x0 0x0>; | ||
| #address-cells = <3>; | ||
| #size-cells = <2>; | ||
| gpio-controller; | ||
| #gpio-cells = <2>; | ||
| device_type = "pci"; | ||
| ranges; | ||
| bus-range = <0x2 0xff>; | ||
|
|
||
| aspm-no-l1; | ||
|
|
||
| vddc-supply = <&vreg_0p9>; | ||
| vdd18-supply = <&vreg_1p8>; | ||
| vdd09-supply = <&vreg_0p9>; | ||
|
|
@@ -320,8 +323,10 @@ | |
| ranges; | ||
| bus-range = <0x3 0xff>; | ||
|
|
||
| aspm-no-l1; | ||
|
|
||
| ep-pwr-en-gpio = <&tc9563 2 GPIO_ACTIVE_HIGH>; | ||
| ep-reset-gpio = <&tc9563 5 GPIO_ACTIVE_HIGH>; | ||
| reset-gpios = <&tc9563 5 GPIO_ACTIVE_LOW>; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are there two GPIO specs using the same GPIO and opposite active flags?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. removed redundant ep-reset-gpio |
||
|
|
||
| port { | ||
| tc9563_pcie1_ep: endpoint {}; | ||
|
|
@@ -336,8 +341,11 @@ | |
| ranges; | ||
| bus-range = <0x4 0xff>; | ||
|
|
||
| aspm-no-l1; | ||
|
|
||
| ep-pwr-en-gpio = <&tc9563 4 GPIO_ACTIVE_HIGH>; | ||
| ep-reset-gpio = <&tc9563 3 GPIO_ACTIVE_HIGH>; | ||
| reset-gpios = <&tc9563 3 GPIO_ACTIVE_LOW>; | ||
| }; | ||
|
|
||
| pcie@3,0 { | ||
|
|
@@ -348,6 +356,8 @@ | |
| ranges; | ||
| bus-range = <0x5 0xff>; | ||
|
|
||
| aspm-no-l1; | ||
|
|
||
| pci@0,0 { | ||
| reg = <0x50000 0x0 0x0 0x0 0x0>; | ||
| #address-cells = <3>; | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| // SPDX-License-Identifier: GPL-2.0 | ||
| /* | ||
| * Copyright (C) 2026 by RISCstar Solutions Corporation. All rights reserved. | ||
| */ | ||
|
|
||
| /* | ||
| * The Toshiba TC9563 implements a PCIe Gen 3 switch that connects an | ||
| * upstream x4 port to two downstream PCIe x2 ports. It incorporates | ||
| * an internal endpoint on a internal PCIe port that implements two | ||
| * Synopsys XGMAC Ethernet interfaces. | ||
| * | ||
| * 37 GPIOs are also implemented by an embedded GPIO controller. Three | ||
| * registers control the first 32 GPIOs (other than 20 and 21, which are | ||
| * reserved). Three other registers control GPIOs 32 through 36. GPIOs | ||
| * 22-24, 27-28, 31, and 34 are treated as "input only". | ||
| * | ||
| */ | ||
|
|
||
| #include <linux/auxiliary_bus.h> | ||
| #include <linux/gpio/driver.h> | ||
| #include <linux/gpio/regmap.h> | ||
| #include <linux/platform_device.h> | ||
| #include <linux/regmap.h> | ||
| #include <linux/soc/qcom/tc9563.h> | ||
|
|
||
| /* | ||
| * There are two sets of registers, each representing (up to) 32 GPIOs with a | ||
| * stride of 4 bytes (IN1 is 4 bytes past IN0, EN1 is 4 bytes past EN0, etc.). | ||
| */ | ||
| #define TC9563_GPIO_COUNT 37 | ||
| #define TC9563_GPIO_PER_REG 32 | ||
| #define TC9563_GPIO_REG_STRIDE 4 | ||
|
|
||
| static int tc9563_gpio_init_valid_mask(struct gpio_chip *gc, | ||
| unsigned long *valid_mask, | ||
| unsigned int ngpios) | ||
| { | ||
| /* GPIOs 20 and 21 are reserved */ | ||
| bitmap_fill(valid_mask, ngpios); | ||
| bitmap_clear(valid_mask, 20, 2); | ||
|
|
||
| return 0; | ||
| } | ||
|
|
||
| static int tc9563_gpio_probe(struct auxiliary_device *adev, | ||
| const struct auxiliary_device_id *id) | ||
| { | ||
| struct gpio_regmap_config config = { | ||
| .parent = &adev->dev, | ||
| .ngpio = TC9563_GPIO_COUNT, | ||
| .reg_stride = TC9563_GPIO_REG_STRIDE, | ||
| .ngpio_per_reg = TC9563_GPIO_PER_REG, | ||
| .reg_dat_base = GPIO_REGMAP_ADDR(TC9563_GPIO_IN0_OFFSET), | ||
| .reg_set_base = GPIO_REGMAP_ADDR(TC9563_GPIO_OUT0_OFFSET), | ||
| .reg_dir_in_base = GPIO_REGMAP_ADDR(TC9563_GPIO_EN0_OFFSET), | ||
| .init_valid_mask = tc9563_gpio_init_valid_mask, | ||
| }; | ||
|
|
||
| config.regmap = dev_get_platdata(&adev->dev); | ||
| if (!config.regmap) | ||
| return -EINVAL; | ||
|
|
||
| /* | ||
| * GPIOs 22, 23, 24, 27, 28, 31, and 34 are input-only, but this | ||
| * kernel's gpio-regmap core only supports a single, chip-wide | ||
| * fixed_direction_output bitmap, with no way to leave the | ||
| * remaining GPIOs under reg_dir_in_base control. Rely on | ||
| * reg_dir_in_base for direction on all valid GPIOs instead; | ||
| * the input-only lines simply never get switched to output. | ||
| */ | ||
|
|
||
| return PTR_ERR_OR_ZERO(devm_gpio_regmap_register(&adev->dev, &config)); | ||
| }; | ||
|
|
||
| static const struct auxiliary_device_id tc9563_gpio_ids[] = { | ||
| { "pci_pwrctrl_tc9563." TC9563_GPIO_DEV_NAME }, | ||
| { /* sentinel */ } | ||
| }; | ||
| MODULE_DEVICE_TABLE(auxiliary, tc9563_gpio_ids); | ||
|
|
||
| static struct auxiliary_driver tc9563_gpio_driver = { | ||
| .name = TC9563_GPIO_DEV_NAME, | ||
| .probe = tc9563_gpio_probe, | ||
| .id_table = tc9563_gpio_ids, | ||
| }; | ||
| module_auxiliary_driver(tc9563_gpio_driver); | ||
|
|
||
| MODULE_AUTHOR("Alex Elder <elder@riscstar.com>"); | ||
| MODULE_AUTHOR("Daniel Thompson <daniel@riscstar.com>"); | ||
| MODULE_AUTHOR("Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>"); | ||
| MODULE_DESCRIPTION("Toshiba TC9563 GPIO Driver"); | ||
| MODULE_LICENSE("GPL"); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Split into logical atomic commits. This is a mixture of everything.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed the whole changes into atomic commits