airoha: en7581: clk cleanup + USB support
Subsystems (7)
cover airoha: en7581: clk cleanup + USB support
This series implement all the changes required to correctly handle USB support for the Airoha EN7581 SoC.
The first few patch are cleanup for the clock driver and the introduction of the SCU SSR SoC driver.
The SoC always support USB 2.0 but for USB 3.0 it needs additional configuration for the Serdes port. Such port can be either configured for USB usage or for PCIe lines or HSGMII and these are configured in the SCU space.
To correctly handle this, the SCU is changed to a simple-mfd implemenetation and the clock controller updated to follow this new node structure. Both implementation are supported to handle old binding.
The xHCI USB is based on the Mediatek implementation but the PHY handling although conceptually similar, is indded different compared to Mediatek due to SSR checks and different port power up.
The SSR driver expose an API to poll the current status of the Serdes port and the USB PHY driver validates it. Refer to the specific commit for additional info.
Consider that there is currently an inconsistency as AN7581 and EN7581 refer to the same thing. This is due to the fact that the SoC born under EcoNet but then was acquired by Airoha.
Christian Marangi (13):
clk: en7523: convert driver to regmap API
clk: en7523: generalize register clocks function
dt-bindings: soc: airoha: add SCU SSR Serdes port binding
dt-bindings: soc: airoha: add Documentation for Airoha AN7581 SCU SSR
dt-bindings: mfd: add Documentation for Airoha EN7581 SCU
dt-bindings: clock: airoha: make reg optional for Airoha EN7581
clk: en7523: support getting regmap from parent node for EN7581
soc: airoha: add support for configuring SCU SSR Serdes port
dt-bindings: phy: Add documentation for Airoha AN7581 USB PHY
phy: airoha: Add support for Airoha AN7581 USB PHY
usb: host: add ARCH_AIROHA in XHCI MTK dependency
arm64: dts: airoha: en7581: convert SCU clock node to MFD
implementation
arm64: dts: airoha: en7581: add USB and SCU SSR nodes
.../bindings/clock/airoha,en7523-scu.yaml | 13 +- .../mfd/airoha,en7581-scu-sysctl.yaml | 68 +++ .../bindings/phy/airoha,an7581-usb-phy.yaml | 106 ++++ .../soc/airoha/airoha,an7581-scu-ssr.yaml | 106 ++++ MAINTAINERS | 15 + arch/arm64/boot/dts/airoha/en7581.dtsi | 74 ++- drivers/clk/clk-en7523.c | 258 ++++---- drivers/phy/Kconfig | 1 + drivers/phy/Makefile | 3 +- drivers/phy/airoha/Kconfig | 13 + drivers/phy/airoha/Makefile | 3 + drivers/phy/airoha/phy-airoha-usb.c | 554 ++++++++++++++++++ drivers/soc/Kconfig | 1 + drivers/soc/Makefile | 1 + drivers/soc/airoha/Kconfig | 18 + drivers/soc/airoha/Makefile | 3 + drivers/soc/airoha/airoha-scu-ssr.c | 195 ++++++ drivers/usb/host/Kconfig | 2 +- include/dt-bindings/soc/airoha,scu-ssr.h | 24 + include/linux/soc/airoha/airoha-scu-ssr.h | 17 + include/linux/soc/soc/airoha-scu-ssr.h | 17 + 21 files changed, 1355 insertions(+), 137 deletions(-) create mode 100644 Documentation/devicetree/bindings/mfd/airoha,en7581-scu-sysctl.yaml create mode 100644 Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml create mode 100644 Documentation/devicetree/bindings/soc/airoha/airoha,an7581-scu-ssr.yaml create mode 100644 drivers/phy/airoha/Kconfig create mode 100644 drivers/phy/airoha/Makefile create mode 100644 drivers/phy/airoha/phy-airoha-usb.c create mode 100644 drivers/soc/airoha/Kconfig create mode 100644 drivers/soc/airoha/Makefile create mode 100644 drivers/soc/airoha/airoha-scu-ssr.c create mode 100644 include/dt-bindings/soc/airoha,scu-ssr.h create mode 100644 include/linux/soc/airoha/airoha-scu-ssr.h create mode 100644 include/linux/soc/soc/airoha-scu-ssr.h
Signature · 1 line
2.48.1
PATCH 1/13 clk: en7523: convert driver to regmap API
Convert driver to regmap API, in preparation for support of Airoha AN7583 as the SCU will be an MFD and the regmap will be provided in the parent node. Also Airoha EN7581 benefits from this in preparation of USB support that required checking and configuring SCU SSR bits.
While at it also cleanup some register mask and use bitfield macro.
--- drivers/clk/clk-en7523.c | 137 ++++++++++++++++++++++----------------- 1 file changed, 76 insertions(+), 61 deletions(-)
drivers/clk/clk-en7523.c +76 -61
@@ -1,5 +1,6 @@// SPDX-License-Identifier: GPL-2.0-only +#include <linux/bitfield.h> #include <linux/delay.h> #include <linux/clk-provider.h> #include <linux/io.h>
@@ -34,6 +35,7 @@#define REG_RESET_CONTROL_PCIE2 BIT(26)/* EN7581 */ #define REG_NP_SCU_PCIC 0x88 +#define REG_PCIE_CTRL GENMASK(7, 0)#define REG_NP_SCU_SSTR 0x9c#define REG_PCIE_XSI0_SEL_MASK GENMASK(14, 13)#define REG_PCIE_XSI1_SEL_MASK GENMASK(12, 11)
@@ -63,14 +65,14 @@ struct en_clk_desc { };struct en_clk_gate { -void __iomem *base; +struct regmap *map;struct clk_hw hw; };struct en_rst_data {const u16 *bank_ofs;const u16 *idx_map; -void __iomem *base; +struct regmap *map;struct reset_controller_dev rcdev; };
@@ -388,44 +390,44 @@ static u32 en7523_get_div(const struct en_clk_desc *desc, u32 val)static int en7523_pci_is_enabled (struct clk_hw *hw) { struct en_clk_gate *cg = container_of(hw, struct en_clk_gate, hw); +u32 val; -return !!(readl (cg->base +REG_PCI_CONTROL ) ®_PCI_CONTROL_REFCLK_EN1 ); +regmap_read (cg->map,REG_PCI_CONTROL , &val); +return !!(val ®_PCI_CONTROL_REFCLK_EN1 ); }static int en7523_pci_prepare (struct clk_hw *hw) { struct en_clk_gate *cg = container_of(hw, struct en_clk_gate, hw); -void __iomem *np_base = cg->base; -u32 val, mask; +struct regmap *map = cg->map; +u32 mask;/* Need to pull device low before reset */ - val =readl (np_base +REG_PCI_CONTROL ); - val &= ~(REG_PCI_CONTROL_PERSTOUT1 |REG_PCI_CONTROL_PERSTOUT ); -writel (val, np_base +REG_PCI_CONTROL ); +regmap_clear_bits (map,REG_PCI_CONTROL , +REG_PCI_CONTROL_PERSTOUT1 | +REG_PCI_CONTROL_PERSTOUT );usleep_range (1000 ,2000 );/* Enable PCIe port 1 */ - val |=REG_PCI_CONTROL_REFCLK_EN1 ; -writel (val, np_base +REG_PCI_CONTROL ); +regmap_set_bits (map,REG_PCI_CONTROL , +REG_PCI_CONTROL_REFCLK_EN1 );usleep_range (1000 ,2000 );/* Reset to default */ - val =readl (np_base +REG_RESET_CONTROL1 ); mask =REG_RESET_CONTROL_PCIE1 |REG_RESET_CONTROL_PCIE2 |REG_RESET_CONTROL_PCIEHB ; -writel (val & ~mask, np_base +REG_RESET_CONTROL1 ); +regmap_clear_bits (map,REG_RESET_CONTROL1 , mask);usleep_range (1000 ,2000 ); -writel (val | mask, np_base +REG_RESET_CONTROL1 ); +regmap_set_bits (map,REG_RESET_CONTROL1 , mask);msleep (100 ); -writel (val & ~mask, np_base +REG_RESET_CONTROL1 ); +regmap_clear_bits (map,REG_RESET_CONTROL1 , mask);usleep_range (5000 ,10000 );/* Release device */ mask =REG_PCI_CONTROL_PERSTOUT1 |REG_PCI_CONTROL_PERSTOUT ; - val =readl (np_base +REG_PCI_CONTROL ); -writel (val & ~mask, np_base +REG_PCI_CONTROL ); +regmap_clear_bits (map,REG_PCI_CONTROL , mask);usleep_range (1000 ,2000 ); -writel (val | mask, np_base +REG_PCI_CONTROL ); +regmap_set_bits (map,REG_PCI_CONTROL , mask);msleep (250 );return 0 ;
@@ -434,16 +436,13 @@ static int en7523_pci_prepare(struct clk_hw *hw)static void en7523_pci_unprepare (struct clk_hw *hw) { struct en_clk_gate *cg = container_of(hw, struct en_clk_gate, hw); -void __iomem *np_base = cg->base; -u32 val; +struct regmap *map = cg->map; - val =readl (np_base +REG_PCI_CONTROL ); - val &= ~REG_PCI_CONTROL_REFCLK_EN1 ; -writel (val, np_base +REG_PCI_CONTROL ); +regmap_clear_bits (map,REG_PCI_CONTROL ,REG_PCI_CONTROL_REFCLK_EN1 ); }static struct clk_hw *en7523_register_pcie_clk (struct device *dev, -void __iomem *np_base) +struct regmap *clk_map) {const struct en_clk_soc_data *soc_data =device_get_match_data (dev);struct clk_init_data init = {
@@ -456,7 +455,7 @@ static struct clk_hw *en7523_register_pcie_clk(struct device *dev,if (!cg)return NULL ; - cg->base = np_base; + cg->map = clk_map; cg->hw.init = &init;if (init.ops->unprepare)
@@ -474,21 +473,20 @@ static int en7581_pci_is_enabled(struct clk_hw *hw)u32 val, mask; mask =REG_PCI_CONTROL_REFCLK_EN0 |REG_PCI_CONTROL_REFCLK_EN1 ; - val =readl (cg->base +REG_PCI_CONTROL ); +regmap_read (cg->map,REG_PCI_CONTROL , &val);return (val & mask) == mask; }static int en7581_pci_enable (struct clk_hw *hw) { struct en_clk_gate *cg = container_of(hw, struct en_clk_gate, hw); -void __iomem *np_base = cg->base; -u32 val, mask; +struct regmap *map = cg->map; +u32 mask; mask =REG_PCI_CONTROL_REFCLK_EN0 |REG_PCI_CONTROL_REFCLK_EN1 |REG_PCI_CONTROL_PERSTOUT1 |REG_PCI_CONTROL_PERSTOUT2 |REG_PCI_CONTROL_PERSTOUT ; - val =readl (np_base +REG_PCI_CONTROL ); -writel (val | mask, np_base +REG_PCI_CONTROL ); +regmap_set_bits (map,REG_PCI_CONTROL , mask);return 0 ; }
@@ -496,19 +494,18 @@ static int en7581_pci_enable(struct clk_hw *hw)static void en7581_pci_disable (struct clk_hw *hw) { struct en_clk_gate *cg = container_of(hw, struct en_clk_gate, hw); -void __iomem *np_base = cg->base; -u32 val, mask; +struct regmap *map = cg->map; +u32 mask; mask =REG_PCI_CONTROL_REFCLK_EN0 |REG_PCI_CONTROL_REFCLK_EN1 |REG_PCI_CONTROL_PERSTOUT1 |REG_PCI_CONTROL_PERSTOUT2 |REG_PCI_CONTROL_PERSTOUT ; - val =readl (np_base +REG_PCI_CONTROL ); -writel (val & ~mask, np_base +REG_PCI_CONTROL ); +regmap_clear_bits (map,REG_PCI_CONTROL , mask);usleep_range (1000 ,2000 ); }static void en7523_register_clocks (struct device *dev,struct clk_hw_onecell_data *clk_data, -void __iomem *base,void __iomem *np_base) +struct regmap *map,struct regmap *clk_map) {struct clk_hw *hw;u32 rate;
@@ -517,10 +514,12 @@ static void en7523_register_clocks(struct device *dev, struct clk_hw_onecell_datfor (i =0 ; i <ARRAY_SIZE (en7523_base_clks); i++) {const struct en_clk_desc *desc = &en7523_base_clks[i];u32 reg = desc->div_reg ? desc->div_reg : desc->base_reg; -u32 val =readl (base + desc->base_reg); +u32 val; + +regmap_read (map, desc->base_reg, &val); rate =en7523_get_base_rate (desc, val); - val =readl (base + reg); +regmap_read (map, reg, &val); rate /=en7523_get_div (desc, val); hw =clk_hw_register_fixed_rate (dev, desc->name,NULL ,0 , rate);
@@ -533,30 +532,47 @@ static void en7523_register_clocks(struct device *dev, struct clk_hw_onecell_dat clk_data->hws[desc->id] = hw; } - hw =en7523_register_pcie_clk (dev, np_base); + hw =en7523_register_pcie_clk (dev, clk_map); clk_data->hws[EN7523_CLK_PCIE ] = hw; } +static const struct regmap_config en7523_clk_regmap_config = { + .reg_bits =32 , + .val_bits =32 , + .reg_stride =4 , +}; +static int en7523_clk_hw_init (struct platform_device *pdev,struct clk_hw_onecell_data *clk_data) {void __iomem *base, *np_base; +struct regmap *map, *clk_map; base =devm_platform_ioremap_resource (pdev,0 );if (IS_ERR (base))return PTR_ERR (base); + map =devm_regmap_init_mmio (&pdev->dev, base, + &en7523_clk_regmap_config); +if (IS_ERR (map)) +return PTR_ERR (map); + np_base =devm_platform_ioremap_resource (pdev,1 );if (IS_ERR (np_base))return PTR_ERR (np_base); -en7523_register_clocks (&pdev->dev, clk_data, base, np_base); + clk_map =devm_regmap_init_mmio (&pdev->dev, np_base, + &en7523_clk_regmap_config); +if (IS_ERR (clk_map)) +return PTR_ERR (clk_map); + +en7523_register_clocks (&pdev->dev, clk_data, map, clk_map);return 0 ; }static void en7581_register_clocks (struct device *dev,struct clk_hw_onecell_data *clk_data, -struct regmap *map,void __iomem *base) +struct regmap *map,struct regmap *clk_map) {struct clk_hw *hw;u32 rate;
@@ -593,7 +609,7 @@ static void en7581_register_clocks(struct device *dev, struct clk_hw_onecell_dat clk_data->hws[desc->id] = hw; } - hw =en7523_register_pcie_clk (dev, base); + hw =en7523_register_pcie_clk (dev, clk_map); clk_data->hws[EN7523_CLK_PCIE ] = hw; }
@@ -601,15 +617,10 @@ static int en7523_reset_update(struct reset_controller_dev *rcdev, unsigned long id, bool assert) { struct en_rst_data *rst_data = container_of(rcdev, struct en_rst_data, rcdev); -void __iomem *addr = rst_data->base + rst_data->bank_ofs[id /RST_NR_PER_BANK ]; -u32 val; +u32 addr = rst_data->bank_ofs[id /RST_NR_PER_BANK ]; - val =readl (addr); -if (assert) - val |=BIT (id %RST_NR_PER_BANK ); -else - val &= ~BIT (id %RST_NR_PER_BANK ); -writel (val, addr); +regmap_update_bits (rst_data->map, addr,BIT (id %RST_NR_PER_BANK ), + assert ?BIT (id %RST_NR_PER_BANK ) :0 );return 0 ; }
@@ -630,9 +641,11 @@ static int en7523_reset_status(struct reset_controller_dev *rcdev, unsigned long id) { struct en_rst_data *rst_data = container_of(rcdev, struct en_rst_data, rcdev); -void __iomem *addr = rst_data->base + rst_data->bank_ofs[id /RST_NR_PER_BANK ]; +u32 addr = rst_data->bank_ofs[id /RST_NR_PER_BANK ]; +u32 val; -return !!(readl (addr) &BIT (id %RST_NR_PER_BANK )); +regmap_read (rst_data->map, addr, &val); +return !!(val &BIT (id %RST_NR_PER_BANK )); } static int en7523_reset_xlate(struct reset_controller_dev *rcdev,
@@ -652,7 +665,7 @@ static const struct reset_control_ops en7581_reset_ops = { .status = en7523_reset_status, }; -static int en7581_reset_register (struct device *dev,void __iomem *base) +static int en7581_reset_register (struct device *dev,struct regmap *map) {struct en_rst_data *rst_data;
@@ -662,7 +675,7 @@ static int en7581_reset_register(struct device *dev, void __iomem *base) rst_data->bank_ofs = en7581_rst_ofs; rst_data->idx_map = en7581_rst_map; - rst_data->base = base; + rst_data->map = map; rst_data->rcdev.nr_resets =ARRAY_SIZE (en7581_rst_map); rst_data->rcdev.of_xlate = en7523_reset_xlate;
@@ -678,9 +691,8 @@ static int en7581_reset_register(struct device *dev, void __iomem *base)static int en7581_clk_hw_init (struct platform_device *pdev,struct clk_hw_onecell_data *clk_data) { -struct regmap *map; +struct regmap *map, *clk_map;void __iomem *base; -u32 val; map =syscon_regmap_lookup_by_compatible ("airoha,en7581-chip-scu" );if (IS_ERR (map))
@@ -690,15 +702,18 @@ static int en7581_clk_hw_init(struct platform_device *pdev,if (IS_ERR (base))return PTR_ERR (base); -en7581_register_clocks (&pdev->dev, clk_data, map, base); + clk_map =devm_regmap_init_mmio (&pdev->dev, base, &en7523_clk_regmap_config); +if (IS_ERR (clk_map)) +return PTR_ERR (clk_map); + +en7581_register_clocks (&pdev->dev, clk_data, map, clk_map); - val =readl (base +REG_NP_SCU_SSTR ); - val &= ~(REG_PCIE_XSI0_SEL_MASK |REG_PCIE_XSI1_SEL_MASK ); -writel (val, base +REG_NP_SCU_SSTR ); - val =readl (base +REG_NP_SCU_PCIC ); -writel (val |3 , base +REG_NP_SCU_PCIC ); +regmap_clear_bits (clk_map,REG_NP_SCU_SSTR , +REG_PCIE_XSI0_SEL_MASK |REG_PCIE_XSI1_SEL_MASK ); +regmap_update_bits (clk_map,REG_NP_SCU_PCIC ,REG_PCIE_CTRL , +FIELD_PREP (REG_PCIE_CTRL ,3 )); -return en7581_reset_register (&pdev->dev, base); +return en7581_reset_register (&pdev->dev, clk_map); }static int en7523_clk_probe (struct platform_device *pdev)
Signature · 1 line
2.48.1
PATCH 2/13 clk: en7523: generalize register clocks function
In reply to Christian MarangiGeneralize register clocks function for Airoha EN7523 and EN7581 clocks driver. The same logic is applied for both clock hence code can be reduced and simplified by putting the base_clocks struct in the soc_data and passing that to a generic register clocks function.
There is always the pattern where the last clock is always the PCIe one.
--- drivers/clk/clk-en7523.c | 130 ++++++++++++++++----------------------- 1 file changed, 53 insertions(+), 77 deletions(-)
drivers/clk/clk-en7523.c +53 -77
@@ -78,8 +78,10 @@ struct en_rst_data {struct en_clk_soc_data {u32 num_clocks; +const struct en_clk_desc *base_clks;const struct clk_ops pcie_ops;int (*hw_init)(struct platform_device *pdev, +const struct en_clk_soc_data *soc_data,struct clk_hw_onecell_data *clk_data); };
@@ -467,6 +469,50 @@ static struct clk_hw *en7523_register_pcie_clk(struct device *dev,return &cg->hw; } +static void en75xx_register_clocks (struct device *dev, +const struct en_clk_soc_data *soc_data, +struct clk_hw_onecell_data *clk_data, +struct regmap *map,struct regmap *clk_map) +{ +struct clk_hw *hw; +u32 rate; +int i; + +for (i =0 ; i < soc_data->num_clocks -1 ; i++) { +const struct en_clk_desc *desc = &soc_data->base_clks[i]; +u32 val, reg = desc->div_reg ? desc->div_reg : desc->base_reg; +int err; + + err =regmap_read (map, desc->base_reg, &val); +if (err) { +pr_err ("Failed reading fixed clk rate %s: %d\n" , + desc->name, err); +continue ; + } + rate =en7523_get_base_rate (desc, val); + + err =regmap_read (map, reg, &val); +if (err) { +pr_err ("Failed reading fixed clk div %s: %d\n" , + desc->name, err); +continue ; + } + rate /=en7523_get_div (desc, val); + + hw =clk_hw_register_fixed_rate (dev, desc->name,NULL ,0 , rate); +if (IS_ERR (hw)) { +pr_err ("Failed to register clk %s: %ld\n" , + desc->name,PTR_ERR (hw)); +continue ; + } + + clk_data->hws[desc->id] = hw; + } + + hw =en7523_register_pcie_clk (dev, clk_map); + clk_data->hws[soc_data->num_clocks] = hw; +} +static int en7581_pci_is_enabled (struct clk_hw *hw) { struct en_clk_gate *cg = container_of(hw, struct en_clk_gate, hw);
@@ -504,38 +550,6 @@ static void en7581_pci_disable(struct clk_hw *hw)usleep_range (1000 ,2000 ); } -static void en7523_register_clocks (struct device *dev,struct clk_hw_onecell_data *clk_data, -struct regmap *map,struct regmap *clk_map) -{ -struct clk_hw *hw; -u32 rate; -int i; - -for (i =0 ; i <ARRAY_SIZE (en7523_base_clks); i++) { -const struct en_clk_desc *desc = &en7523_base_clks[i]; -u32 reg = desc->div_reg ? desc->div_reg : desc->base_reg; -u32 val; - -regmap_read (map, desc->base_reg, &val); - - rate =en7523_get_base_rate (desc, val); -regmap_read (map, reg, &val); - rate /=en7523_get_div (desc, val); - - hw =clk_hw_register_fixed_rate (dev, desc->name,NULL ,0 , rate); -if (IS_ERR (hw)) { -pr_err ("Failed to register clk %s: %ld\n" , - desc->name,PTR_ERR (hw)); -continue ; - } - - clk_data->hws[desc->id] = hw; - } - - hw =en7523_register_pcie_clk (dev, clk_map); - clk_data->hws[EN7523_CLK_PCIE ] = hw; -} -static const struct regmap_config en7523_clk_regmap_config = { .reg_bits =32 , .val_bits =32 ,
@@ -543,6 +557,7 @@ static const struct regmap_config en7523_clk_regmap_config = { };static int en7523_clk_hw_init (struct platform_device *pdev, +const struct en_clk_soc_data *soc_data,struct clk_hw_onecell_data *clk_data) {void __iomem *base, *np_base;
@@ -566,53 +581,11 @@ static int en7523_clk_hw_init(struct platform_device *pdev,if (IS_ERR (clk_map))return PTR_ERR (clk_map); -en7523_register_clocks (&pdev->dev, clk_data, map, clk_map); +en75xx_register_clocks (&pdev->dev, soc_data, clk_data, map, clk_map);return 0 ; } -static void en7581_register_clocks (struct device *dev,struct clk_hw_onecell_data *clk_data, -struct regmap *map,struct regmap *clk_map) -{ -struct clk_hw *hw; -u32 rate; -int i; - -for (i =0 ; i <ARRAY_SIZE (en7581_base_clks); i++) { -const struct en_clk_desc *desc = &en7581_base_clks[i]; -u32 val, reg = desc->div_reg ? desc->div_reg : desc->base_reg; -int err; - - err =regmap_read (map, desc->base_reg, &val); -if (err) { -pr_err ("Failed reading fixed clk rate %s: %d\n" , - desc->name, err); -continue ; - } - rate =en7523_get_base_rate (desc, val); - - err =regmap_read (map, reg, &val); -if (err) { -pr_err ("Failed reading fixed clk div %s: %d\n" , - desc->name, err); -continue ; - } - rate /=en7523_get_div (desc, val); - - hw =clk_hw_register_fixed_rate (dev, desc->name,NULL ,0 , rate); -if (IS_ERR (hw)) { -pr_err ("Failed to register clk %s: %ld\n" , - desc->name,PTR_ERR (hw)); -continue ; - } - - clk_data->hws[desc->id] = hw; - } - - hw =en7523_register_pcie_clk (dev, clk_map); - clk_data->hws[EN7523_CLK_PCIE ] = hw; -} -static int en7523_reset_update (struct reset_controller_dev *rcdev,unsigned long id,bool assert) {
@@ -689,6 +662,7 @@ static int en7581_reset_register(struct device *dev, struct regmap *map) }static int en7581_clk_hw_init (struct platform_device *pdev, +const struct en_clk_soc_data *soc_data,struct clk_hw_onecell_data *clk_data) {struct regmap *map, *clk_map;
@@ -706,7 +680,7 @@ static int en7581_clk_hw_init(struct platform_device *pdev,if (IS_ERR (clk_map))return PTR_ERR (clk_map); -en7581_register_clocks (&pdev->dev, clk_data, map, clk_map); +en75xx_register_clocks (&pdev->dev, soc_data, clk_data, map, clk_map);regmap_clear_bits (clk_map,REG_NP_SCU_SSTR ,REG_PCIE_XSI0_SEL_MASK |REG_PCIE_XSI1_SEL_MASK );
@@ -732,7 +706,7 @@ static int en7523_clk_probe(struct platform_device *pdev)return -ENOMEM ; clk_data->num = soc_data->num_clocks; - r = soc_data->hw_init (pdev, clk_data); + r = soc_data->hw_init (pdev, soc_data, clk_data);if (r)return r;
@@ -740,6 +714,7 @@ static int en7523_clk_probe(struct platform_device *pdev) }static const struct en_clk_soc_data en7523_data = { + .base_clks = en7523_base_clks, .num_clocks =ARRAY_SIZE (en7523_base_clks) +1 , .pcie_ops = { .is_enabled = en7523_pci_is_enabled,
@@ -750,6 +725,7 @@ static const struct en_clk_soc_data en7523_data = { };static const struct en_clk_soc_data en7581_data = { + .base_clks = en7581_base_clks,/* We increment num_clocks by 1 to account for additional PCIe clock */ .num_clocks =ARRAY_SIZE (en7581_base_clks) +1 , .pcie_ops = {
Signature · 1 line
2.48.1
PATCH 3/13 dt-bindings: soc: airoha: add SCU SSR Serdes port binding
In reply to Christian MarangiAdd Airoha AN7581 SCU SSR Serdes port binding to define what mode is supported by each Serdes port. These special binding are needed to identify and provide the port mode from any user driver.
These modes are mutually exclusive and driver needs to correctly validate the current mode for the Serdes port in use.
--- MAINTAINERS | 6 ++++++ include/dt-bindings/soc/airoha,scu-ssr.h | 24 ++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 include/dt-bindings/soc/airoha,scu-ssr.h
MAINTAINERS +6 -0
@@ -736,6 +736,12 @@ F: Documentation/devicetree/bindings/phy/airoha,en7581-pcie-phy.yaml F: drivers/phy/phy-airoha-pcie-regs.h F: drivers/phy/phy-airoha-pcie.c +AIROHA SCU SSR DRIVER +M: Christian Marangi <[email protected]> +L: [email protected] (moderated for non-subscribers) +S: Maintained +F: include/dt-bindings/soc/airoha,scu-ssr.h + AIROHA SPI SNFI DRIVER M: Lorenzo Bianconi <[email protected]> M: Ray Liu <[email protected]>
include/dt-bindings/soc/airoha,scu-ssr.h new file +24 -0
@@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */ + +#ifndef __DT_BINDINGS_AIROHA_SCU_SSR_H +#define __DT_BINDINGS_AIROHA_SCU_SSR_H + +/* WiFi1 port can be PCIe0 2 line, PCIe0 1 line or Ethernet (USXGMII/HSGMII) */ +#define AIROHA_SCU_SSR_WIFI1_PCIE0_2LINE 0 +#define AIROHA_SCU_SSR_WIFI1_PCIE0 1 +#define AIROHA_SCU_SSR_WIFI1_ETHERNET 2 + +/* WiFi2 port can be PCIe0 2 line, PCIe1 1 line or Ethernet (USXGMII/HSGMII) */ +#define AIROHA_SCU_SSR_WIFI2_PCIE0_2LINE 0 +#define AIROHA_SCU_SSR_WIFI2_PCIE1 1 +#define AIROHA_SCU_SSR_WIFI2_ETHERNET 2 + +/* USB1 port can be USB 3.0 port or Ethernet (HSGMII) */ +#define AIROHA_SCU_SSR_USB1_USB 0 +#define AIROHA_SCU_SSR_USB1_ETHERNET 1 + +/* USB2 port can be USB 3.0 port or PCIe2 1 line */ +#define AIROHA_SCU_SSR_USB2_USB 0 +#define AIROHA_SCU_SSR_USB2_PCIE2 1 + +#endif /* __DT_BINDINGS_AIROHA_SCU_SSR_H */
Signature · 1 line
2.48.1
PATCH 4/13 dt-bindings: soc: airoha: add Documentation for Airoha AN7581 SCU SSR
In reply to Christian MarangiThe Airoha AN7581 SoC have in the SCU register space particular address that control how some peripheral are configured.
These are toggeled in the System Status Register and are used to toggle Serdes port for USB 3.0 mode or HSGMII, USB 3.0 mode or PCIe2 or setup port for PCIe mode or Ethrnet mode (HSGMII/USXGMII).
Modes are mutually exclusive and selecting one mode cause the other feature to not work (example a mode in USB 3.0 cause PCIe port 2 to not work) This depends also on what is physically connected to the Hardware and needs to correctly reflect the System Status Register bits.
Special care is needed for PCIe port 0 in 2 line mode that requires both WiFi1 and WiFi2 Serdes port set to PCIe0 2 Line mode.
--- .../soc/airoha/airoha,an7581-scu-ssr.yaml | 106 ++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 107 insertions(+) create mode 100644 Documentation/devicetree/bindings/soc/airoha/airoha,an7581-scu-ssr.yaml
Documentation/devicetree/bindings/soc/airoha/airoha,an7581-scu-ssr.yaml new file +106 -0
@@ -0,0 +1,106 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/soc/airoha/airoha,an7581-scu-ssr.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Airoha AN7581 SCU System Status Register + +maintainers: + - Christian Marangi <[email protected]> + +description: > + The Airoha AN7581 SoC have in the SCU register space particular + address that control how some peripheral are configured. + + These are toggeled in the System Status Register and are used to + toggle Serdes port for USB 3.0 mode or HSGMII, USB 3.0 mode or PCIe2 + or setup port for PCIe mode or Ethrnet mode (HSGMII/USXGMII). + + Modes are mutually exclusive and selecting one mode cause the + other feature to not work (example a mode in USB 3.0 cause PCIe + port 2 to not work) This depends also on what is physically + connected to the Hardware and needs to correctly reflect the + System Status Register bits. + + Special care is needed for PCIe port 0 in 2 line mode that + requires both WiFi1 and WiFi2 Serdes port set to PCIe0 2 Line + mode. + +properties: + compatible: + const: airoha,an7581-scu-ssr + + airoha,serdes-wifi1: + description: | + Configure the Wifi1 Serdes port for: + - 0: PCIe0 2 Line + - 1: PCIe0 1 Line + - 2: Ethernet modes (HSGMII/USXGMII) + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [0, 1, 2] + default: 1 + + airoha,serdes-wifi2: + description: | + Configure the Wifi2 Serdes port for: + - 0: PCIe0 2 Line + - 1: PCIe1 1 Line + - 2: Ethernet modes (HSGMII/USXGMII) + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [0, 1, 2] + default: 1 + + airoha,serdes-usb1: + description: | + Configure the USB1 Serdes port for: + - 0: USB 3.0 + - 1: Ethernet modes (HSGMII) + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [0, 1] + default: 0 + + airoha,serdes-usb2: + description: | + Configure the USB2 Serdes port for: + - 0: USB 3.0 + - 1: PCIe2 1 Line + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [0, 1] + default: 0 + +required: + - compatible + +allOf: + - if: + properties: + airoha,serdes-wifi1: + const: 0 + then: + properties: + airoha,serdes-wifi2: + const: 0 + + - if: + properties: + airoha,serdes-wifi2: + const: 0 + then: + properties: + airoha,serdes-wifi1: + const: 0 + +additionalProperties: false + +examples: + - | + #include <dt-bindings/soc/airoha,scu-ssr.h> + + system-controller { + compatible = "airoha,an7581-scu-ssr"; + + airoha,serdes-wifi1 = <AIROHA_SCU_SSR_WIFI1_PCIE0_2LINE>; + airoha,serdes-wifi2 = <AIROHA_SCU_SSR_WIFI2_PCIE0_2LINE>; + airoha,serdes-usb2 = <AIROHA_SCU_SSR_USB2_PCIE2>; + };
MAINTAINERS +1 -0
@@ -740,6 +740,7 @@ AIROHA SCU SSR DRIVER M: Christian Marangi <[email protected]> L: [email protected] (moderated for non-subscribers) S: Maintained +F: Documentation/devicetree/bindings/soc/airoha/airoha,an7581-scu-ssr.yaml F: include/dt-bindings/soc/airoha,scu-ssr.h AIROHA SPI SNFI DRIVER
Signature · 1 line
2.48.1
PATCH 5/13 dt-bindings: mfd: add Documentation for Airoha EN7581 SCU
In reply to Christian MarangiAdd Documentation for Airoha EN7581 SCU.
Airoha EN7581 SoC expose registers to control miscellaneous pheriperals via the SCU (System Controller Unit).
Example of these pheriperals are reset-controller, clock-controller, PCIe line speed controller and bits to configure different Serdes ports for USB or Ethernet usage.
--- .../mfd/airoha,en7581-scu-sysctl.yaml | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/airoha,en7581-scu-sysctl.yaml
Documentation/devicetree/bindings/mfd/airoha,en7581-scu-sysctl.yaml new file +68 -0
@@ -0,0 +1,68 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mfd/airoha,en7581-scu-sysctl.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Airoha EN7581 SCU (System Controller Unit) + +maintainers: + - Christian Marangi <[email protected]> + +description: + Airoha EN7581 SoC expose registers to control miscellaneous + pheriperals via the SCU (System Controller Unit). + + Example of these pheriperals are reset-controller, clock-controller, + PCIe line speed controller and bits to configure different Serdes ports + for USB or Ethernet usage. + +properties: + compatible: + items: + - const: airoha,en7581-scu-sysctl + - const: syscon + - const: simple-mfd + + reg: + maxItems: 1 + + clock-controller: + type: object + $ref: /schemas/clock/airoha,en7523-scu.yaml + description: + Child node definition for EN7581 Clock controller + + system-controller: + type: object + $ref: /schemas/soc/airoha/airoha,an7581-scu-ssr.yaml + description: + Child node definition for EN7581 System Status Register + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + #include <dt-bindings/soc/airoha,scu-ssr.h> + + system-controller@1fb00000 { + compatible = "airoha,en7581-scu-sysctl", "syscon", "simple-mfd"; + reg = <0x1fb00000 0x970>; + + clock-controller { + compatible = "airoha,en7581-scu"; + + #clock-cells = <1>; + #reset-cells = <1>; + }; + + system-controller { + compatible = "airoha,an7581-scu-ssr"; + + airoha,serdes-usb2 = <AIROHA_SCU_SSR_USB2_PCIE2>; + }; + };
Signature · 1 line
2.48.1
PATCH 6/13 dt-bindings: clock: airoha: make reg optional for Airoha EN7581
In reply to Christian MarangiThe Airoha EN7581 clock-controller registers are placed in the SCU (System Controller Unit). Now that additional pheriperals are supported for the SCU, a dedicated SCU node is created and the clock-controller is moved as a child of such node hence the register property is taken from the parent node.
To support this, make the reg property optional and provide an additional example for this case.
Driver supports both old and new implementation by checking the presence of the reg property and parsing the register accordingly.
--- .../bindings/clock/airoha,en7523-scu.yaml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/clock/airoha,en7523-scu.yaml +12 -1
@@ -51,7 +51,6 @@ properties: required: - compatible - - reg - '#clock-cells' allOf:
@@ -66,6 +65,9 @@ allOf: '#reset-cells': false + required: + - reg + - if: properties: compatible:
@@ -99,3 +101,12 @@ examples: #reset-cells = <1>; }; }; + + # Example with clock-controller in SCU MFD + - | + clock-controller { + compatible = "airoha,en7581-scu"; + + #clock-cells = <1>; + #reset-cells = <1>; + };
Signature · 1 line
2.48.1
PATCH 7/13 clk: en7523: support getting regmap from parent node for EN7581
In reply to Christian MarangiAdd support for getting clock regmap from parent node for Airoha EN7581.
This is needed to support new implementation with SCU (System Controller Unit) as an MFD and clock-controller node as a child node of it.
In such implementation the register regmap is provided as a syscon from the parent node.
--- drivers/clk/clk-en7523.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-)
drivers/clk/clk-en7523.c +16 -9
@@ -665,6 +665,7 @@ static int en7581_clk_hw_init(struct platform_device *pdev,const struct en_clk_soc_data *soc_data, struct clk_hw_onecell_data *clk_data) { + struct device *dev = &pdev->dev;struct regmap *map, *clk_map;void __iomem *base;
@@ -672,22 +673,28 @@ static int en7581_clk_hw_init(struct platform_device *pdev,if (IS_ERR (map))return PTR_ERR (map); - base =devm_platform_ioremap_resource (pdev,0 ); -if (IS_ERR (base)) -return PTR_ERR (base); - - clk_map =devm_regmap_init_mmio (&pdev->dev, base, &en7523_clk_regmap_config); -if (IS_ERR (clk_map)) -return PTR_ERR (clk_map); +if (of_property_present (dev->of_node,"reg" )) { + base =devm_platform_ioremap_resource (pdev,0 ); +if (IS_ERR (base)) +return PTR_ERR (base); + + clk_map =devm_regmap_init_mmio (dev, base, &en7523_clk_regmap_config); +if (IS_ERR (clk_map)) +return PTR_ERR (clk_map); + }else { + clk_map =device_node_to_regmap (dev->parent->of_node); +if (IS_ERR (clk_map)) +return PTR_ERR (clk_map); + } -en75xx_register_clocks (&pdev->dev, soc_data, clk_data, map, clk_map); +en75xx_register_clocks (dev, soc_data, clk_data, map, clk_map);regmap_clear_bits (clk_map,REG_NP_SCU_SSTR ,REG_PCIE_XSI0_SEL_MASK |REG_PCIE_XSI1_SEL_MASK );regmap_update_bits (clk_map,REG_NP_SCU_PCIC ,REG_PCIE_CTRL ,FIELD_PREP (REG_PCIE_CTRL ,3 )); -return en7581_reset_register (&pdev->dev, clk_map); +return en7581_reset_register (dev, clk_map); }static int en7523_clk_probe (struct platform_device *pdev)
Signature · 1 line
2.48.1
PATCH 8/13 soc: airoha: add support for configuring SCU SSR Serdes port
In reply to Christian MarangiAdd support for configuring SCU SSR Serdes port. Airoha AN7581 SoC can configure the different Serdes port by toggling bits in the SCU register space.
Port Serdes mode are mutually exclusive, force example the USB2 Serdes port can either used for USB 3.0 or PCIe 2 port. Enabling USB 3.0 makes the PCIe 2 to not work.
The current supported Serdes port are:
- WiFi 1 and defaults to PCIe0 1 line mode
- Wifi 2 and defaults to PCIe1 1 line mode
- USB 1 and defaults to USB 3.0 mode
- USB 2 and defaults to USB 3.0 mode
WiFi 1, WiFi 2 and USB 1 also support a particular Ethernet mode that can toggle between USXGMII or HSGMII mode (USB 1 only to HSGMII) Such mode doesn't configure bits as specific Ethernet PCS driver will take care of configuring the Serdes mode based on what is required.
This driver is to correctly setup these bits and provide an API to read the current status of the Serdes port. Single driver can't independently set the Serdes port mode as that would cause a conflict if someone declare, for example, in DT (and enable) PCIe 2 port and USB2 3.0 port.
Drivers will use the airoha_scu_ssr_get_serdes_mode function and will validate the Serdes port is the expected one and fail if it's not.
Each driver will have to define in DT the phandle airoha,scu-ssr pointing to the SCU SSR node.
--- MAINTAINERS | 1 + drivers/soc/Kconfig | 1 + drivers/soc/Makefile | 1 + drivers/soc/airoha/Kconfig | 18 ++ drivers/soc/airoha/Makefile | 3 + drivers/soc/airoha/airoha-scu-ssr.c | 195 ++++++++++++++++++++++ include/linux/soc/airoha/airoha-scu-ssr.h | 17 ++ include/linux/soc/soc/airoha-scu-ssr.h | 17 ++ 8 files changed, 253 insertions(+) create mode 100644 drivers/soc/airoha/Kconfig create mode 100644 drivers/soc/airoha/Makefile create mode 100644 drivers/soc/airoha/airoha-scu-ssr.c create mode 100644 include/linux/soc/airoha/airoha-scu-ssr.h create mode 100644 include/linux/soc/soc/airoha-scu-ssr.h
MAINTAINERS +1 -0
@@ -741,6 +741,7 @@ M: Christian Marangi <[email protected]> L: [email protected] (moderated for non-subscribers) S: Maintained F: Documentation/devicetree/bindings/soc/airoha/airoha,an7581-scu-ssr.yaml +F: drivers/soc/airoha/airoha-scu-ssr.c F: include/dt-bindings/soc/airoha,scu-ssr.h AIROHA SPI SNFI DRIVER
drivers/soc/Kconfig +1 -0
@@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only menu "SOC (System On Chip) specific Drivers" +source "drivers/soc/airoha/Kconfig" source "drivers/soc/amlogic/Kconfig" source "drivers/soc/apple/Kconfig" source "drivers/soc/aspeed/Kconfig"
drivers/soc/Makefile +1 -0
@@ -3,6 +3,7 @@ # Makefile for the Linux Kernel SOC specific device drivers. # +obj-$(CONFIG_ARCH_AIROHA) += airoha/ obj-y += apple/ obj-y += aspeed/ obj-$(CONFIG_ARCH_AT91) += atmel/
drivers/soc/airoha/Kconfig new file +18 -0
@@ -0,0 +1,18 @@ +# SPDX-License-Identifier: GPL-2.0-only + +config AIROHA_SCU_SSR + tristate "Airoha SCU SSR Driver" + depends on ARCH_AIROHA || COMPILE_TEST + depends on OF + help + Say 'Y' here to add support for Airoha SCU SSR driver. + + Airoha SoC pheriperal (like USB/PCIe/Ethernet port) are + selected by toggling specific bit. Serdes Port line + are mutually exclusive such as selecting PCIe port 2 + disable support for USB port 2 3.0 mode. + + This driver is used to configure such bit and expose + an API to read the current status from a user of such + Serdes lines. +
drivers/soc/airoha/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0 + +obj-$(CONFIG_AIROHA_SCU_SSR) += airoha-scu-ssr.o
drivers/soc/airoha/airoha-scu-ssr.c new file +195 -0
195 lines not on this page · raw message
include/linux/soc/airoha/airoha-scu-ssr.h new file +17 -0
@@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __AIROHA_SCU_SSR__ +#define __AIROHA_SCU_SSR__ + +enum airoha_scu_serdes_port { +AIROHA_SCU_SERDES_WIFI1 =0 , +AIROHA_SCU_SERDES_WIFI2 , +AIROHA_SCU_SERDES_USB1 , +AIROHA_SCU_SERDES_USB2 , + +AIROHA_SCU_MAX_SERDES_PORT , +}; + +int airoha_scu_ssr_get_serdes_mode (struct device *dev, +enum airoha_scu_serdes_port port); + +#endif
include/linux/soc/soc/airoha-scu-ssr.h new file +17 -0
@@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __AIROHA_SCU_SSR__ +#define __AIROHA_SCU_SSR__ + +enum airoha_scu_serdes_port { +AIROHA_SCU_SERDES_WIFI1 =0 , +AIROHA_SCU_SERDES_WIFI2 , +AIROHA_SCU_SERDES_USB1 , +AIROHA_SCU_SERDES_USB2 , + +AIROHA_SCU_MAX_SERDES_PORT , +}; + +int airoha_scu_ssr_get_serdes_mode (struct device *dev, +enum airoha_scu_serdes_port port); + +#endif
Signature · 1 line
2.48.1
PATCH 9/13 dt-bindings: phy: Add documentation for Airoha AN7581 USB PHY
In reply to Christian MarangiAdd documentation for Airoha AN7581 USB PHY that describe the USB PHY for the USB controller.
Airoha AN7581 SoC support a maximum of 2 USB port. The USB 2.0 mode is always supported. The USB 3.0 mode is optional and depends on the Serdes mode currently configured on the system for the USB port. If USB 3.0 node is defined, then airoha,scu-ssr property is required for Serdes mode validation.
--- .../bindings/phy/airoha,an7581-usb-phy.yaml | 106 ++++++++++++++++++ MAINTAINERS | 6 + 2 files changed, 112 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml
Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml new file +106 -0
@@ -0,0 +1,106 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/phy/airoha,an7581-usb-phy.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Airoha AN7581 SoC USB PHY + +maintainers: + - Christian Marangi <[email protected]> + +description: > + The Airoha AN7581 SoC USB PHY describes the USB PHY for the USB controller. + + Airoha AN7581 SoC support a maximum of 2 USB port. The USB 2.0 mode is + always supported. The USB 3.0 mode is optional and depends on the Serdes + mode currently configured on the system for the USB port. If USB 3.0 node + is defined, then airoha,scu-ssr property is required for Serdes mode + validation. + +properties: + compatible: + const: airoha,an7581-usb-phy + + reg: + maxItems: 1 + + airoha,port-id: + description: Describe the physical port this USB PHY refer to. A dedicated + osciallator is used for each port for the USB 2.0 Slew Rate calibration. + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [0, 1] + + airoha,scu-ssr: + description: Phandle to the SCU SSR node for USB 3.0 Serdes mode validation. + $ref: /schemas/types.yaml#/definitions/phandle + + usb2-phy: + type: object + + properties: + '#phy-cells': + const: 1 + + required: + - '#phy-cells' + + additionalProperties: false + + usb3-phy: + type: object + + properties: + '#phy-cells': + const: 1 + + required: + - '#phy-cells' + + additionalProperties: false + +required: + - compatible + - reg + - airoha,port-id + - usb2-phy + +if: + required: + - usb3-phy +then: + required: + - airoha,scu-ssr + +additionalProperties: false + +examples: + - | + phy@1fac0000 { + compatible = "airoha,an7581-usb-phy"; + reg = <0x1fac0000 0x10000>; + + airoha,port-id = <0>; + airoha,scu-ssr = <&scu_ssr>; + + usb0_u2: usb2-phy { + #phy-cells = <1>; + }; + + usb0_u3: usb3-phy { + #phy-cells = <1>; + }; + }; + + - | + phy@1fae0000 { + compatible = "airoha,an7581-usb-phy"; + reg = <0x1fae0000 0x10000>; + + airoha,port-id = <1>; + + usb1_u2: usb2-phy { + #phy-cells = <1>; + }; + }; +
MAINTAINERS +6 -0
@@ -753,6 +753,12 @@ S: Maintained F: Documentation/devicetree/bindings/spi/airoha,en7581-snand.yaml F: drivers/spi/spi-airoha-snfi.c +AIROHA USB PHY DRIVER +M: Christian Marangi <[email protected]> +L: [email protected] (moderated for non-subscribers) +S: Maintained +F: Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yam + AIRSPY MEDIA DRIVER L: [email protected] S: Orphan
Signature · 1 line
2.48.1
PATCH 10/13 phy: airoha: Add support for Airoha AN7581 USB PHY
In reply to Christian MarangiAdd support for Airoha AN7581 USB PHY driver. AN7581 supports up to 2 USB port with USB 2.0 mode always supported and USB 3.0 mode available only if the Serdes port is correctly configured for USB 3.0.
On xLate probe, the Serdes mode is validated and the driver return error if the Serdes mode doesn't reflect the expected mode. This is required as Serdes mode are controlled by the SCU SSR bits and can be either USB 3.0 mode or HSGMII or PCIe 2. In such case USB 3.0 won't work.
If the USB 3.0 mode is not supported, the modes needs to be also disabled in the xHCI node or the driver will report unsable clock and fail probe.
--- MAINTAINERS | 1 + drivers/phy/Kconfig | 1 + drivers/phy/Makefile | 3 +- drivers/phy/airoha/Kconfig | 13 + drivers/phy/airoha/Makefile | 3 + drivers/phy/airoha/phy-airoha-usb.c | 554 ++++++++++++++++++++++++++++ 6 files changed, 574 insertions(+), 1 deletion(-) create mode 100644 drivers/phy/airoha/Kconfig create mode 100644 drivers/phy/airoha/Makefile create mode 100644 drivers/phy/airoha/phy-airoha-usb.c
MAINTAINERS +1 -0
@@ -758,6 +758,7 @@ M: Christian Marangi <[email protected]> L: [email protected] (moderated for non-subscribers) S: Maintained F: Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yam +F: drivers/phy/airoha/phy-airoha-usb.c AIRSPY MEDIA DRIVER L: [email protected]
drivers/phy/Kconfig +1 -0
@@ -93,6 +93,7 @@ config PHY_NXP_PTN3222 schemes. It supports all three USB 2.0 data rates: Low Speed, Full Speed and High Speed. +source "drivers/phy/airoha/Kconfig" source "drivers/phy/allwinner/Kconfig" source "drivers/phy/amlogic/Kconfig" source "drivers/phy/broadcom/Kconfig"
drivers/phy/Makefile +2 -1
@@ -12,7 +12,8 @@ obj-$(CONFIG_PHY_PISTACHIO_USB) += phy-pistachio-usb.o obj-$(CONFIG_USB_LGM_PHY) += phy-lgm-usb.o obj-$(CONFIG_PHY_AIROHA_PCIE) += phy-airoha-pcie.o obj-$(CONFIG_PHY_NXP_PTN3222) += phy-nxp-ptn3222.o -obj-y += allwinner/ \ +obj-y += airoha/ \ + allwinner/ \ amlogic/ \ broadcom/ \ cadence/ \
drivers/phy/airoha/Kconfig new file +13 -0
@@ -0,0 +1,13 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# Phy drivers for Mediatek devices +# +config PHY_AIROHA_USB + tristate "Airoha USB PHY Driver" + depends on ARCH_AIROHA || COMPILE_TEST + depends on OF + select GENERIC_PHY + help + Say 'Y' here to add support for Airoha USB PHY driver. + This driver create the basic PHY instance and provides initialize + callback for USB port.
drivers/phy/airoha/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0 + +obj-$(CONFIG_PHY_AIROHA_USB) += phy-airoha-usb.o
drivers/phy/airoha/phy-airoha-usb.c new file +554 -0
554 lines not on this page · raw message
Signature · 1 line
2.48.1
PATCH 11/13 usb: host: add ARCH_AIROHA in XHCI MTK dependency
In reply to Christian MarangiAiroha SoC use the same register map a logic of the Mediatek xHCI driver, hence add it to the dependency list to permit compilation also on this ARCH.
--- drivers/usb/host/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/Kconfig +1 -1
@@ -71,7 +71,7 @@ config USB_XHCI_HISTB config USB_XHCI_MTK tristate "xHCI support for MediaTek SoCs" select MFD_SYSCON - depends on (MIPS && SOC_MT7621) || ARCH_MEDIATEK || COMPILE_TEST + depends on (MIPS && SOC_MT7621) || ARCH_MEDIATEK || ARCH_AIROHA || COMPILE_TEST help Say 'Y' to enable the support for the xHCI host controller found in MediaTek SoCs.
Signature · 1 line
2.48.1
PATCH 12/13 arm64: dts: airoha: en7581: convert SCU clock node to MFD implementation
In reply to Christian MarangiConvert SCU clock node for Airoha EN7581 to MFD implementation in preparation for USB support.
--- arch/arm64/boot/dts/airoha/en7581.dtsi | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/airoha/en7581.dtsi +9 -4
@@ -173,11 +173,16 @@ spi_nand: nand@0 { }; }; - scuclk: clock-controller@1fb00000 { - compatible = "airoha,en7581-scu"; + system-controller@1fb00000 { + compatible = "airoha,en7581-scu-sysctl", "syscon", "simple-mfd"; reg = <0x0 0x1fb00000 0x0 0x970>; - #clock-cells = <1>; - #reset-cells = <1>; + + scuclk: clock-controller { + compatible = "airoha,en7581-scu"; + + #clock-cells = <1>; + #reset-cells = <1>; + }; }; uart1: serial@1fbf0000 {
Signature · 1 line
2.48.1
PATCH 13/13 arm64: dts: airoha: en7581: add USB and SCU SSR nodes
In reply to Christian MarangiAdd SCU SSR and USB nodes required for USB support of Airoha EN7581. SCU SSR node is required to read and configure the current Serdes mode of the USB PHYs.
--- arch/arm64/boot/dts/airoha/en7581.dtsi | 61 ++++++++++++++++++++++++++ 1 file changed, 61 insertions(+)
arch/arm64/boot/dts/airoha/en7581.dtsi +61 -0
@@ -3,6 +3,7 @@ #include <dt-bindings/interrupt-controller/irq.h> #include <dt-bindings/interrupt-controller/arm-gic.h> #include <dt-bindings/clock/en7523-clk.h> +#include <dt-bindings/phy/phy.h> #include <dt-bindings/reset/airoha,en7581-reset.h> / {
@@ -183,6 +184,10 @@ scuclk: clock-controller { #clock-cells = <1>; #reset-cells = <1>; }; + + scu_ssr: system-controller { + compatible = "airoha,an7581-scu-ssr"; + }; }; uart1: serial@1fbf0000 {
@@ -200,6 +205,62 @@ rng@1faa1000 { interrupts = <GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>; }; + usb0: usb@1fab0000 { + compatible = "mediatek,mtk-xhci"; + reg = <0x0 0x1fab0000 0x0 0x3e00>, + <0x0 0x1fab3e00 0x0 0x100>; + reg-names = "mac", "ippc"; + interrupts = <GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>; + + phys = <&usb0_u2 PHY_TYPE_USB2>, <&usb0_u3 PHY_TYPE_USB3>; + + status = "disabled"; + }; + + phy@1fac0000 { + compatible = "airoha,an7581-usb-phy"; + reg = <0x0 0x1fac0000 0x0 0x10000>; + + airoha,port-id = <0>; + airoha,scu-ssr = <&scu_ssr>; + + usb0_u2: usb2-phy { + #phy-cells = <1>; + }; + + usb0_u3: usb3-phy { + #phy-cells = <1>; + }; + }; + + usb1: usb@1fad0000 { + compatible = "mediatek,mtk-xhci"; + reg = <0x0 0x1fad0000 0x0 0x3e00>, + <0x0 0x1fad3e00 0x0 0x100>; + reg-names = "mac", "ippc"; + interrupts = <GIC_SPI 150 IRQ_TYPE_LEVEL_HIGH>; + + phys = <&usb1_u2 PHY_TYPE_USB2>, <&usb0_u3 PHY_TYPE_USB3>; + + status = "disabled"; + }; + + phy@1fae0000 { + compatible = "airoha,an7581-usb-phy"; + reg = <0x0 0x1fae0000 0x0 0x10000>; + + airoha,port-id = <1>; + airoha,scu-ssr = <&scu_ssr>; + + usb1_u2: usb2-phy { + #phy-cells = <1>; + }; + + usb1_u3: usb3-phy { + #phy-cells = <1>; + }; + }; + system-controller@1fbf0200 { compatible = "airoha,en7581-gpio-sysctl", "syscon", "simple-mfd";
Signature · 1 line
2.48.1
Rob Herring (Arm)
maintainerRe: [PATCH 05/13] dt-bindings: mfd: add Documentation for Airoha EN7581 SCU
In reply to Christian MarangiQuoted 9 lines · Christian Marangi
Add Documentation for Airoha EN7581 SCU.
Airoha EN7581 SoC expose registers to control miscellaneous pheriperals via the SCU (System Controller Unit).
Example of these pheriperals are reset-controller, clock-controller, PCIe line speed controller and bits to configure different Serdes ports for USB or Ethernet usage.
Quoted 6 lines
Signed-off-by Christian Marangi <[email protected]>--- .../mfd/airoha,en7581-scu-sysctl.yaml | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/airoha,en7581-scu-sysctl.yaml
My bot found errors running 'make dt_binding_check' on your patch:
yamllint warnings/errors:
dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/mfd/airoha,en7581-scu-sysctl.example.dtb: system-controller@1fb00000: clock-controller: 'reg' is a required property
from schema $id: http://devicetree.org/schemas/mfd/airoha,en7581-scu-sysctl.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/mfd/airoha,en7581-scu-sysctl.example.dtb: clock-controller: 'reg' is a required property
from schema $id: http://devicetree.org/schemas/clock/airoha,en7523-scu.yaml#
doc reference errors (make refcheckdocs):
See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]
The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.
If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:
pip3 install dtschema --upgrade
Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.
kernel test robot
build botRe: [PATCH 09/13] dt-bindings: phy: Add documentation for Airoha AN7581 USB PHY
In reply to Christian Marangikernel test robot noticed the following build warnings:
Hi Christian,
kernel test robot noticed the following build warnings:
[auto build test WARNING on next-20250307]
[also build test WARNING on v6.14-rc5]
[cannot apply to clk/clk-next robh/for-next usb/usb-testing usb/usb-next usb/usb-linus linus/master v6.14-rc5 v6.14-rc4 v6.14-rc3] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Christian-Marangi/clk-en7523-convert-driver-to-regmap-API/20250309-213623 base: next-20250307 patch link: https://lore.kernel.org/r/20250309132959.19045-10-ansuelsmth%40gmail.com patch subject: [PATCH 09/13] dt-bindings: phy: Add documentation for Airoha AN7581 USB PHY reproduce: (https://download.01.org/0day-ci/archive/20250309/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
Warning: Documentation/translations/ja_JP/process/submit-checklist.rst references a file that doesn't exist: Documentation/translations/ja_JP/SubmitChecklist
Warning: Documentation/translations/zh_CN/admin-guide/README.rst references a file that doesn't exist: Documentation/dev-tools/kgdb.rst
Warning: Documentation/translations/zh_CN/dev-tools/gdb-kernel-debugging.rst references a file that doesn't exist: Documentation/dev-tools/gdb-kernel-debugging.rst
Warning: Documentation/translations/zh_TW/admin-guide/README.rst references a file that doesn't exist: Documentation/dev-tools/kgdb.rst
Warning: Documentation/translations/zh_TW/dev-tools/gdb-kernel-debugging.rst references a file that doesn't exist: Documentation/dev-tools/gdb-kernel-debugging.rst
>> Warning: MAINTAINERS references a file that doesn't exist: Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yam
Warning: MAINTAINERS references a file that doesn't exist: Documentation/devicetree/bindings/misc/fsl,qoriq-mc.txt
Warning: MAINTAINERS references a file that doesn't exist: Documentation/devicetree/bindings/leds/backlight/ti,lp8864.yaml Can't build as 1 mandatory dependency is missing at ./scripts/sphinx-pre-install line 984.
make[2]: *** [Documentation/Makefile:121: htmldocs] Error 255
make[1]: *** [Makefile:1792: htmldocs] Error 2
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Re: [PATCH 03/13] dt-bindings: soc: airoha: add SCU SSR Serdes port binding
In reply to Christian MarangiQuoted 11 lines · Christian Marangi
Add Airoha AN7581 SCU SSR Serdes port binding to define what mode is supported by each Serdes port. These special binding are needed to identify and provide the port mode from any user driver.
These modes are mutually exclusive and driver needs to correctly validate the current mode for the Serdes port in use.
Signed-off-by Christian Marangi <[email protected]>--- MAINTAINERS | 6 ++++++ include/dt-bindings/soc/airoha,scu-ssr.h | 24 ++++++++++++++++++++++++
This should be squashed with the binding for the device.
Best regards,
Krzysztof
Re: [PATCH 04/13] dt-bindings: soc: airoha: add Documentation for Airoha AN7581 SCU SSR
In reply to Christian MarangiQuoted 38 lines · Christian Marangi
The Airoha AN7581 SoC have in the SCU register space particular address that control how some peripheral are configured.
These are toggeled in the System Status Register and are used to toggle Serdes port for USB 3.0 mode or HSGMII, USB 3.0 mode or PCIe2 or setup port for PCIe mode or Ethrnet mode (HSGMII/USXGMII).
Modes are mutually exclusive and selecting one mode cause the other feature to not work (example a mode in USB 3.0 cause PCIe port 2 to not work) This depends also on what is physically connected to the Hardware and needs to correctly reflect the System Status Register bits.
Special care is needed for PCIe port 0 in 2 line mode that requires both WiFi1 and WiFi2 Serdes port set to PCIe0 2 Line mode.
Signed-off-by Christian Marangi <[email protected]>--- .../soc/airoha/airoha,an7581-scu-ssr.yaml | 106 ++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 107 insertions(+) create mode 100644 Documentation/devicetree/bindings/soc/airoha/airoha,an7581-scu-ssr.yamlDocumentation/devicetree/bindings/soc/airoha/airoha,an7581-scu-ssr.yaml new file +8
-0@@ -0,0 +1,106 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/soc/airoha/airoha,an7581-scu-ssr.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Airoha AN7581 SCU System Status Register +
Documentation/devicetree/bindings/soc/airoha/airoha,an7581-scu-ssr.yaml line 18
Quoted 10 lines
Documentation/devicetree/bindings/soc/airoha/airoha,an7581-scu-ssr.yaml new file +10
-0+maintainers: + - Christian Marangi <[email protected]> + +description: > + The Airoha AN7581 SoC have in the SCU register space particular + address that control how some peripheral are configured. + + These are toggeled in the System Status Register and are used to + toggle Serdes port for USB 3.0 mode or HSGMII, USB 3.0 mode or PCIe2 + or setup port for PCIe mode or Ethrnet mode (HSGMII/USXGMII).
typo, Ethernet
Quoted 4 lines
Documentation/devicetree/bindings/soc/airoha/airoha,an7581-scu-ssr.yaml new file +4
-0+ + Modes are mutually exclusive and selecting one mode cause the + other feature to not work (example a mode in USB 3.0 cause PCIe + port 2 to not work) This depends also on what is physically
Documentation/devicetree/bindings/soc/airoha/airoha,an7581-scu-ssr.yaml line 32
Quoted 10 lines
Documentation/devicetree/bindings/soc/airoha/airoha,an7581-scu-ssr.yaml new file +10
-0+ connected to the Hardware and needs to correctly reflect the + System Status Register bits. + + Special care is needed for PCIe port 0 in 2 line mode that + requires both WiFi1 and WiFi2 Serdes port set to PCIe0 2 Line + mode. + +properties: + compatible: + const: airoha,an7581-scu-ssr
That's not a separate device, but part of the SCU.
But more important - such definition of choice of serial engines is really not flexible, not reabable and not helping integrating into DTS. Are you going to grow this for next chip airoha,serdes-wifi20, then airoha,serdes-wifi21, 22... ? And then how the if:then: would look like?
Assuming you do not have here child-parent relationship, like usually for serial engines, so then this should be somehow list of devices (strings) you want to run.
Best regards,
Krzysztof
Re: [PATCH 05/13] dt-bindings: mfd: add Documentation for Airoha EN7581 SCU
In reply to Christian MarangiDocumentation/devicetree/bindings/mfd/airoha,en7581-scu-sysctl.yaml line 58
Quoted 12 lines · Christian Marangi
Documentation/devicetree/bindings/mfd/airoha,en7581-scu-sysctl.yaml new file +12
-0+ +examples: + - | + #include <dt-bindings/soc/airoha,scu-ssr.h> + + system-controller@1fb00000 { + compatible = "airoha,en7581-scu-sysctl", "syscon", "simple-mfd"; + reg = <0x1fb00000 0x970>; + + clock-controller { + compatible = "airoha,en7581-scu"; +
No resources here, so this is part of the parent.
Documentation/devicetree/bindings/mfd/airoha,en7581-scu-sysctl.yaml line 64
Quoted 6 lines
Documentation/devicetree/bindings/mfd/airoha,en7581-scu-sysctl.yaml new file +6
-0+ #clock-cells = <1>; + #reset-cells = <1>; + }; + + system-controller { + compatible = "airoha,an7581-scu-ssr";
No, this was told many times - you do not have resources here, so no chhild.
Best regards,
Krzysztof
Re: [PATCH 06/13] dt-bindings: clock: airoha: make reg optional for Airoha EN7581
In reply to Christian MarangiQuoted 1 line · Christian Marangi
The Airoha EN7581 clock-controller registers are placed in the SCU
I don't understand. The registers moved?
Quoted 7 lines
(System Controller Unit). Now that additional pheriperals are supported for the SCU, a dedicated SCU node is created and the clock-controller is moved as a child of such node hence the register property is taken from the parent node.
To support this, make the reg property optional and provide an additional example for this case.
No, post complete binding instead of adding some sort of stubs and then later totally reworking them to match different Linux drivers.
Best regards,
Krzysztof
Re: [PATCH 12/13] arm64: dts: airoha: en7581: convert SCU clock node to MFD implementation
In reply to Christian MarangiQuoted 13 lines · Christian Marangi
Convert SCU clock node for Airoha EN7581 to MFD implementation in preparation for USB support.
Signed-off-by Christian Marangi <[email protected]>--- arch/arm64/boot/dts/airoha/en7581.dtsi | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)arch/arm64/boot/dts/airoha/en7581.dtsi +0
-0
arch/arm64/boot/dts/airoha/en7581.dtsi spi_nand: nand@0 { · line 178
Quoted 8 lines
arch/arm64/boot/dts/airoha/en7581.dtsi +2
-2@@ -173,11 +173,16 @@ spi_nand: nand@0 { }; }; - scuclk: clock-controller@1fb00000 { - compatible = "airoha,en7581-scu"; + system-controller@1fb00000 { + compatible = "airoha,en7581-scu-sysctl", "syscon", "simple-mfd"; reg = <0x0 0x1fb00000 0x0 0x970>;
Hardware did not change and you do not explain why any conversion affecting users is justified.
Best regards,
Krzysztof
Re: [PATCH 05/13] dt-bindings: mfd: add Documentation for Airoha EN7581 SCU
In reply to Christian MarangiQuoted 26 lines · Christian Marangi
Add Documentation for Airoha EN7581 SCU.
Airoha EN7581 SoC expose registers to control miscellaneous pheriperals via the SCU (System Controller Unit).
Example of these pheriperals are reset-controller, clock-controller, PCIe line speed controller and bits to configure different Serdes ports for USB or Ethernet usage.
Signed-off-by Christian Marangi <[email protected]>--- .../mfd/airoha,en7581-scu-sysctl.yaml | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/airoha,en7581-scu-sysctl.yamlDocumentation/devicetree/bindings/mfd/airoha,en7581-scu-sysctl.yaml new file +5
-0@@ -0,0 +1,68 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mfd/airoha,en7581-scu-sysctl.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml#
Documentation/devicetree/bindings/mfd/airoha,en7581-scu-sysctl.yaml line 15
Quoted 10 lines
Documentation/devicetree/bindings/mfd/airoha,en7581-scu-sysctl.yaml new file +10
-0+ +title: Airoha EN7581 SCU (System Controller Unit) + +maintainers: + - Christian Marangi <[email protected]> + +description: + Airoha EN7581 SoC expose registers to control miscellaneous + pheriperals via the SCU (System Controller Unit). +
One more comment - there is no such thing as "sysctl" in your hardware. Look at the SCU binding which clearly says that it is the hardware you are duplicating here, so the "System Control Unit".
So you have existing "This node defines the System Control Unit of the EN7523 SoC" and you add one more node which defines the "System Control Unit", so you have two "System Control Unit" device nodes?
Look also what Stephen asked for:
https://lore.kernel.org/all/[email protected]/
so how system-controller can now became clock-controller? Now, it was the system controller since the beginning.
Best regards,
Krzysztof
Re: [PATCH 03/13] dt-bindings: soc: airoha: add SCU SSR Serdes port binding
In reply to Krzysztof KozlowskiQuoted 8 lines · Krzysztof Kozlowski
Quoted 7 lines · Christian Marangi
Add Airoha AN7581 SCU SSR Serdes port binding to define what mode is supported by each Serdes port. These special binding are needed to identify and provide the port mode from any user driver.
These modes are mutually exclusive and driver needs to correctly validate the current mode for the Serdes port in use.
Quoted 7 lines
Quoted 4 lines
Signed-off-by Christian Marangi <[email protected]>--- MAINTAINERS | 6 ++++++ include/dt-bindings/soc/airoha,scu-ssr.h | 24 ++++++++++++++++++++++++This should be squashed with the binding for the device.
I split them to mute checkpatch warning
"DT binding docs and includes should be a separate patch. See:Documentation/devicetree/bindings/submitting-patches.rst"
But I think I always took it wrong and with "docs and includes" it's intended in a single patch.
Ok will squash!
Signature · 1 line
Ansuel
Re: [PATCH 04/13] dt-bindings: soc: airoha: add Documentation for Airoha AN7581 SCU SSR
In reply to Krzysztof KozlowskiQuoted 52 lines · Krzysztof Kozlowski
Quoted 38 lines · Christian Marangi
The Airoha AN7581 SoC have in the SCU register space particular address that control how some peripheral are configured.
These are toggeled in the System Status Register and are used to toggle Serdes port for USB 3.0 mode or HSGMII, USB 3.0 mode or PCIe2 or setup port for PCIe mode or Ethrnet mode (HSGMII/USXGMII).
Modes are mutually exclusive and selecting one mode cause the other feature to not work (example a mode in USB 3.0 cause PCIe port 2 to not work) This depends also on what is physically connected to the Hardware and needs to correctly reflect the System Status Register bits.
Special care is needed for PCIe port 0 in 2 line mode that requires both WiFi1 and WiFi2 Serdes port set to PCIe0 2 Line mode.
Signed-off-by Christian Marangi <[email protected]>--- .../soc/airoha/airoha,an7581-scu-ssr.yaml | 106 ++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 107 insertions(+) create mode 100644 Documentation/devicetree/bindings/soc/airoha/airoha,an7581-scu-ssr.yamlDocumentation/devicetree/bindings/soc/airoha/airoha,an7581-scu-ssr.yaml new file +8
-0@@ -0,0 +1,106 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/soc/airoha/airoha,an7581-scu-ssr.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Airoha AN7581 SCU System Status Register +Documentation/devicetree/bindings/soc/airoha/airoha,an7581-scu-ssr.yaml line 18
Quoted 10 lines
Documentation/devicetree/bindings/soc/airoha/airoha,an7581-scu-ssr.yaml new file +10
-0+maintainers: + - Christian Marangi <[email protected]> + +description: > + The Airoha AN7581 SoC have in the SCU register space particular + address that control how some peripheral are configured. + + These are toggeled in the System Status Register and are used to + toggle Serdes port for USB 3.0 mode or HSGMII, USB 3.0 mode or PCIe2 + or setup port for PCIe mode or Ethrnet mode (HSGMII/USXGMII).typo, Ethernet
Quoted 17 lines
Quoted 4 lines
Documentation/devicetree/bindings/soc/airoha/airoha,an7581-scu-ssr.yaml new file +4
-0+ + Modes are mutually exclusive and selecting one mode cause the + other feature to not work (example a mode in USB 3.0 cause PCIe + port 2 to not work) This depends also on what is physicallyDocumentation/devicetree/bindings/soc/airoha/airoha,an7581-scu-ssr.yaml line 32
Quoted 10 lines
Documentation/devicetree/bindings/soc/airoha/airoha,an7581-scu-ssr.yaml new file +10
-0+ connected to the Hardware and needs to correctly reflect the + System Status Register bits. + + Special care is needed for PCIe port 0 in 2 line mode that + requires both WiFi1 and WiFi2 Serdes port set to PCIe0 2 Line + mode. + +properties: + compatible: + const: airoha,an7581-scu-ssrThat's not a separate device, but part of the SCU.
More comments on this in the MFD patch.
Quoted 9 lines
But more important - such definition of choice of serial engines is really not flexible, not reabable and not helping integrating into DTS. Are you going to grow this for next chip airoha,serdes-wifi20, then airoha,serdes-wifi21, 22... ? And then how the if:then: would look like?
Assuming you do not have here child-parent relationship, like usually for serial engines, so then this should be somehow list of devices (strings) you want to run.
You are right, string is more flexible and I don't need the include file.
Signature · 1 line
Ansuel
Re: [PATCH 05/13] dt-bindings: mfd: add Documentation for Airoha EN7581 SCU
In reply to Krzysztof KozlowskiQuoted 45 lines · Krzysztof Kozlowski
Quoted 26 lines · Christian Marangi
Add Documentation for Airoha EN7581 SCU.
Airoha EN7581 SoC expose registers to control miscellaneous pheriperals via the SCU (System Controller Unit).
Example of these pheriperals are reset-controller, clock-controller, PCIe line speed controller and bits to configure different Serdes ports for USB or Ethernet usage.
Signed-off-by Christian Marangi <[email protected]>--- .../mfd/airoha,en7581-scu-sysctl.yaml | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/airoha,en7581-scu-sysctl.yamlDocumentation/devicetree/bindings/mfd/airoha,en7581-scu-sysctl.yaml new file +5
-0@@ -0,0 +1,68 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mfd/airoha,en7581-scu-sysctl.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml#Documentation/devicetree/bindings/mfd/airoha,en7581-scu-sysctl.yaml line 15
Quoted 10 lines
Documentation/devicetree/bindings/mfd/airoha,en7581-scu-sysctl.yaml new file +10
-0+ +title: Airoha EN7581 SCU (System Controller Unit) + +maintainers: + - Christian Marangi <[email protected]> + +description: + Airoha EN7581 SoC expose registers to control miscellaneous + pheriperals via the SCU (System Controller Unit). +One more comment - there is no such thing as "sysctl" in your hardware. Look at the SCU binding which clearly says that it is the hardware you are duplicating here, so the "System Control Unit".
So you have existing "This node defines the System Control Unit of the EN7523 SoC" and you add one more node which defines the "System Control Unit", so you have two "System Control Unit" device nodes?
Quoted 7 lines
Look also what Stephen asked for:
https://lore.kernel.org/all/[email protected]/
so how system-controller can now became clock-controller? Now, it was the system controller since the beginning.
The main problem here (and we had a similar problem with GPIO and PWM) is that the Vendor (Airoha) wasn't so bright in placing the different registers for the SoC so we have case where everything is mixed and not one after another...
Example we have
- CLK register part 1
- Some bits that configure PCIe
- CLK register part 2
- GPIO
- CLK register part 3
- ...
The driver solution for this is syscon and the simple-mfd node structure.
Now the main problem is how to modle this in DT. There are lots of case where the simple-mfd model is used (like the one proposed) but probably this is not accepted anymore. But again this should be clearly stated or we have a chicken-egg problem when other devs implement similar thing and have to implement simple MFD driver to handle this. (and driver maintainers say "Use the simple-mfd model like it was already done)
For this specific case (and to give an answer to the clock patch after this) the problem is that this register space was originally used only to control the clock and I wasn't aware that it was also used to control USB. Now that I'm implementing support for it, the disaster happened.
So In short SCU is lots of thing, both a system-controller, a clock-controller and even a reset-controller.
To make it short, 2 different solution:
1. We can keep the current node structure of the node-controller and add a child node for the SSR part (with a dedicated compatible).
2. Those property need to be be defined in the clock-controller node?
The ideal solution is 1. Does it work for you?
Sorry for the long post and hope you understand why this mess of reworking the binding.
Signature · 1 line
Ansuel
Re: [PATCH 05/13] dt-bindings: mfd: add Documentation for Airoha EN7581 SCU
Quoted 59 lines · Christian Marangi
Quoted 45 lines · Krzysztof Kozlowski
Quoted 26 lines · Christian Marangi
Add Documentation for Airoha EN7581 SCU.
Airoha EN7581 SoC expose registers to control miscellaneous pheriperals via the SCU (System Controller Unit).
Example of these pheriperals are reset-controller, clock-controller, PCIe line speed controller and bits to configure different Serdes ports for USB or Ethernet usage.
Signed-off-by Christian Marangi <[email protected]>--- .../mfd/airoha,en7581-scu-sysctl.yaml | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/airoha,en7581-scu-sysctl.yamlDocumentation/devicetree/bindings/mfd/airoha,en7581-scu-sysctl.yaml new file +5
-0@@ -0,0 +1,68 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mfd/airoha,en7581-scu-sysctl.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml#Documentation/devicetree/bindings/mfd/airoha,en7581-scu-sysctl.yaml line 15
Quoted 10 lines
Documentation/devicetree/bindings/mfd/airoha,en7581-scu-sysctl.yaml new file +10
-0+ +title: Airoha EN7581 SCU (System Controller Unit) + +maintainers: + - Christian Marangi <[email protected]> + +description: + Airoha EN7581 SoC expose registers to control miscellaneous + pheriperals via the SCU (System Controller Unit). +One more comment - there is no such thing as "sysctl" in your hardware. Look at the SCU binding which clearly says that it is the hardware you are duplicating here, so the "System Control Unit".
So you have existing "This node defines the System Control Unit of the EN7523 SoC" and you add one more node which defines the "System Control Unit", so you have two "System Control Unit" device nodes?
Quoted 7 lines
Look also what Stephen asked for:
https://lore.kernel.org/all/[email protected]/
so how system-controller can now became clock-controller? Now, it was the system controller since the beginning.
The main problem here (and we had a similar problem with GPIO and PWM) is that the Vendor (Airoha) wasn't so bright in placing the different registers for the SoC so we have case where everything is mixed and not one after another...
Quoted 7 lines
Example we have
- CLK register part 1
- Some bits that configure PCIe
- CLK register part 2
- GPIO
- CLK register part 3
- ...
This does not explain that binding said "This node defines the System Control Unit".
So what are you adding here if not SCU?
Quoted 3 lines
The driver solution for this is syscon and the simple-mfd node structure.
Let's keep driver entirely separate, we don't talk about them and mixing arguments won't make it easier.
Quoted 7 lines
Now the main problem is how to modle this in DT. There are lots of case where the simple-mfd model is used (like the one proposed) but probably this is not accepted anymore. But again this should be clearly stated or we have a chicken-egg problem when other devs implement similar thing and have to implement simple MFD driver to handle this. (and driver maintainers say "Use the simple-mfd model like it was already done)
simple-mfd has nothing to do here. Describe the hardware - what is the SCU?
Quoted 8 lines
For this specific case (and to give an answer to the clock patch after this) the problem is that this register space was originally used only to control the clock and I wasn't aware that it was also used to control USB. Now that I'm implementing support for it, the disaster happened.
So In short SCU is lots of thing, both a system-controller, a clock-controller and even a reset-controller.
And you have bindings for that already. Done.
Quoted 4 lines
To make it short, 2 different solution:
1. We can keep the current node structure of the node-controller and add a child node for the SSR part (with a dedicated compatible).
No, you do not add child nodes just because you want some drivers.
What is SSR? How is it a device?
Quoted 1 line
2. Those property need to be be defined in the clock-controller node?
In the SCU node. Do you have only one SCU or more?
Quoted 6 lines
The ideal solution is 1. Does it work for you?
Sorry for the long post and hope you understand why this mess of reworking the binding.
Best regards,
Krzysztof
Rob Herring (Arm)
maintainerQuoted 79 lines · Christian Marangi
This series implement all the changes required to correctly handle USB support for the Airoha EN7581 SoC.
The first few patch are cleanup for the clock driver and the introduction of the SCU SSR SoC driver.
The SoC always support USB 2.0 but for USB 3.0 it needs additional configuration for the Serdes port. Such port can be either configured for USB usage or for PCIe lines or HSGMII and these are configured in the SCU space.
To correctly handle this, the SCU is changed to a simple-mfd implemenetation and the clock controller updated to follow this new node structure. Both implementation are supported to handle old binding.
The xHCI USB is based on the Mediatek implementation but the PHY handling although conceptually similar, is indded different compared to Mediatek due to SSR checks and different port power up.
The SSR driver expose an API to poll the current status of the Serdes port and the USB PHY driver validates it. Refer to the specific commit for additional info.
Consider that there is currently an inconsistency as AN7581 and EN7581 refer to the same thing. This is due to the fact that the SoC born under EcoNet but then was acquired by Airoha.
Christian Marangi (13):
clk: en7523: convert driver to regmap API
clk: en7523: generalize register clocks function
dt-bindings: soc: airoha: add SCU SSR Serdes port binding
dt-bindings: soc: airoha: add Documentation for Airoha AN7581 SCU SSR
dt-bindings: mfd: add Documentation for Airoha EN7581 SCU
dt-bindings: clock: airoha: make reg optional for Airoha EN7581
clk: en7523: support getting regmap from parent node for EN7581
soc: airoha: add support for configuring SCU SSR Serdes port
dt-bindings: phy: Add documentation for Airoha AN7581 USB PHY
phy: airoha: Add support for Airoha AN7581 USB PHY
usb: host: addARCH_AIROHAin XHCI MTK dependency
arm64: dts: airoha: en7581: convert SCU clock node to MFD
implementation
arm64: dts: airoha: en7581: add USB and SCU SSR nodes.../bindings/clock/airoha,en7523-scu.yaml | 13 +- .../mfd/airoha,en7581-scu-sysctl.yaml | 68 +++ .../bindings/phy/airoha,an7581-usb-phy.yaml | 106 ++++ .../soc/airoha/airoha,an7581-scu-ssr.yaml | 106 ++++ MAINTAINERS | 15 + arch/arm64/boot/dts/airoha/en7581.dtsi | 74 ++- drivers/clk/clk-en7523.c | 258 ++++---- drivers/phy/Kconfig | 1 + drivers/phy/Makefile | 3 +- drivers/phy/airoha/Kconfig | 13 + drivers/phy/airoha/Makefile | 3 + drivers/phy/airoha/phy-airoha-usb.c | 554 ++++++++++++++++++ drivers/soc/Kconfig | 1 + drivers/soc/Makefile | 1 + drivers/soc/airoha/Kconfig | 18 + drivers/soc/airoha/Makefile | 3 + drivers/soc/airoha/airoha-scu-ssr.c | 195 ++++++ drivers/usb/host/Kconfig | 2 +- include/dt-bindings/soc/airoha,scu-ssr.h | 24 + include/linux/soc/airoha/airoha-scu-ssr.h | 17 + include/linux/soc/soc/airoha-scu-ssr.h | 17 + 21 files changed, 1355 insertions(+), 137 deletions(-) create mode 100644 Documentation/devicetree/bindings/mfd/airoha,en7581-scu-sysctl.yaml create mode 100644 Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml create mode 100644 Documentation/devicetree/bindings/soc/airoha/airoha,an7581-scu-ssr.yaml create mode 100644 drivers/phy/airoha/Kconfig create mode 100644 drivers/phy/airoha/Makefile create mode 100644 drivers/phy/airoha/phy-airoha-usb.c create mode 100644 drivers/soc/airoha/Kconfig create mode 100644 drivers/soc/airoha/Makefile create mode 100644 drivers/soc/airoha/airoha-scu-ssr.c create mode 100644 include/dt-bindings/soc/airoha,scu-ssr.h create mode 100644 include/linux/soc/airoha/airoha-scu-ssr.h create mode 100644 include/linux/soc/soc/airoha-scu-ssr.h
Quoted 5 lines
--
2.48.1
My bot found new DTB warnings on the .dts files added or changed in this series.
Some warnings may be from an existing SoC .dtsi. Or perhaps the warnings are fixed by another series. Ultimately, it is up to the platform maintainer whether these warnings are acceptable or not. No need to reply unless the platform maintainer has comments.
If you already ran DT checks and didn't see these error(s), then make sure dt-schema is up to date:
pip3 install dtschema --upgrade
New warnings running 'make CHECK_DTBS=y for arch/arm64/boot/dts/airoha/' for [email protected]:
arch/arm64/boot/dts/airoha/en7581-evb.dtb: usb@1fab0000: compatible:0: 'mediatek,mtk-xhci' is not one of ['mediatek,mt2701-xhci', 'mediatek,mt2712-xhci', 'mediatek,mt7622-xhci', 'mediatek,mt7623-xhci', 'mediatek,mt7629-xhci', 'mediatek,mt7986-xhci', 'mediatek,mt7988-xhci', 'mediatek,mt8173-xhci', 'mediatek,mt8183-xhci', 'mediatek,mt8186-xhci', 'mediatek,mt8188-xhci', 'mediatek,mt8192-xhci', 'mediatek,mt8195-xhci', 'mediatek,mt8365-xhci']
from schema $id: http://devicetree.org/schemas/usb/mediatek,mtk-xhci.yaml#arch/arm64/boot/dts/airoha/en7581-evb.dtb: usb@1fab0000: compatible: ['mediatek,mtk-xhci'] is too short
from schema $id: http://devicetree.org/schemas/usb/mediatek,mtk-xhci.yaml#arch/arm64/boot/dts/airoha/en7581-evb.dtb: usb@1fad0000: compatible:0: 'mediatek,mtk-xhci' is not one of ['mediatek,mt2701-xhci', 'mediatek,mt2712-xhci', 'mediatek,mt7622-xhci', 'mediatek,mt7623-xhci', 'mediatek,mt7629-xhci', 'mediatek,mt7986-xhci', 'mediatek,mt7988-xhci', 'mediatek,mt8173-xhci', 'mediatek,mt8183-xhci', 'mediatek,mt8186-xhci', 'mediatek,mt8188-xhci', 'mediatek,mt8192-xhci', 'mediatek,mt8195-xhci', 'mediatek,mt8365-xhci']
from schema $id: http://devicetree.org/schemas/usb/mediatek,mtk-xhci.yaml#arch/arm64/boot/dts/airoha/en7581-evb.dtb: usb@1fad0000: compatible: ['mediatek,mtk-xhci'] is too short
from schema $id: http://devicetree.org/schemas/usb/mediatek,mtk-xhci.yaml#
Re: [PATCH 09/13] dt-bindings: phy: Add documentation for Airoha AN7581 USB PHY
In reply to Christian MarangiQuoted 42 lines · Christian Marangi
Add documentation for Airoha AN7581 USB PHY that describe the USB PHY for the USB controller.
Airoha AN7581 SoC support a maximum of 2 USB port. The USB 2.0 mode is always supported. The USB 3.0 mode is optional and depends on the Serdes mode currently configured on the system for the USB port. If USB 3.0 node is defined, then airoha,scu-ssr property is required for Serdes mode validation.
Signed-off-by Christian Marangi <[email protected]>--- .../bindings/phy/airoha,an7581-usb-phy.yaml | 106 ++++++++++++++++++ MAINTAINERS | 6 + 2 files changed, 112 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yamlDocumentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml new file +20
-0@@ -0,0 +1,106 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/phy/airoha,an7581-usb-phy.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Airoha AN7581 SoC USB PHY + +maintainers: + - Christian Marangi <[email protected]> + +description: > + The Airoha AN7581 SoC USB PHY describes the USB PHY for the USB controller. + + Airoha AN7581 SoC support a maximum of 2 USB port. The USB 2.0 mode is + always supported. The USB 3.0 mode is optional and depends on the Serdes + mode currently configured on the system for the USB port. If USB 3.0 node + is defined, then airoha,scu-ssr property is required for Serdes mode + validation. +
Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml line 30
Quoted 10 lines
Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml new file +10
-0+properties: + compatible: + const: airoha,an7581-usb-phy + + reg: + maxItems: 1 + + airoha,port-id: + description: Describe the physical port this USB PHY refer to. A dedicated + osciallator is used for each port for the USB 2.0 Slew Rate calibration.
typo
Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml line 32
Quoted 2 lines
Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml new file +2
-0+ $ref: /schemas/types.yaml#/definitions/uint32 + enum: [0, 1]
I don't understand why do you need index property here (which are usually not allowed).
Quoted 6 lines
Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml new file +6
-0+ + airoha,scu-ssr: + description: Phandle to the SCU SSR node for USB 3.0 Serdes mode validation. + $ref: /schemas/types.yaml#/definitions/phandle + + usb2-phy:
Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml line 48
Quoted 10 lines
Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml new file +10
-0+ type: object + + properties: + '#phy-cells': + const: 1 + + required: + - '#phy-cells' + + additionalProperties: false
Also no resources in usb[23]-phy, so this goes to the parent level and you have phy-cells=2. Your DTS gives some hint that devices actually differ but the commit msg contradicts it, so I don't get. Do you have same IP block here or two different?
Quoted 6 lines
Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml new file +1
-0+MAINTAINERS +0
-0
MAINTAINERS S: Maintained · line 760
Quoted 8 lines
MAINTAINERS +5
-0@@ -753,6 +753,12 @@ S: Maintained F: Documentation/devicetree/bindings/spi/airoha,en7581-snand.yaml F: drivers/spi/spi-airoha-snfi.c +AIROHA USB PHY DRIVER +M: Christian Marangi <[email protected]> +L: [email protected] (moderated for non-subscribers) +S: Maintained +F: Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yam
Typo in extension/missing l.
Best regards,
Krzysztof
Vinod Koul
maintainerRe: [PATCH 10/13] phy: airoha: Add support for Airoha AN7581 USB PHY
In reply to Christian MarangiQuoted 55 lines · Christian Marangi
Add support for Airoha AN7581 USB PHY driver. AN7581 supports up to 2 USB port with USB 2.0 mode always supported and USB 3.0 mode available only if the Serdes port is correctly configured for USB 3.0.
On xLate probe, the Serdes mode is validated and the driver return error if the Serdes mode doesn't reflect the expected mode. This is required as Serdes mode are controlled by the SCU SSR bits and can be either USB 3.0 mode or HSGMII or PCIe 2. In such case USB 3.0 won't work.
If the USB 3.0 mode is not supported, the modes needs to be also disabled in the xHCI node or the driver will report unsable clock and fail probe.
Signed-off-by Christian Marangi <[email protected]>--- MAINTAINERS | 1 + drivers/phy/Kconfig | 1 + drivers/phy/Makefile | 3 +- drivers/phy/airoha/Kconfig | 13 + drivers/phy/airoha/Makefile | 3 + drivers/phy/airoha/phy-airoha-usb.c | 554 ++++++++++++++++++++++++++++ 6 files changed, 574 insertions(+), 1 deletion(-) create mode 100644 drivers/phy/airoha/Kconfig create mode 100644 drivers/phy/airoha/Makefile create mode 100644 drivers/phy/airoha/phy-airoha-usb.cMAINTAINERS +1
-0@@ -758,6 +758,7 @@ M: Christian Marangi <[email protected]> L: [email protected] (moderated for non-subscribers) S: Maintained F: Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yam +F: drivers/phy/airoha/phy-airoha-usb.c AIRSPY MEDIA DRIVER L: [email protected]drivers/phy/Kconfig +1
-0@@ -93,6 +93,7 @@ config PHY_NXP_PTN3222 schemes. It supports all three USB 2.0 data rates: Low Speed, Full Speed and High Speed. +source "drivers/phy/airoha/Kconfig" source "drivers/phy/allwinner/Kconfig" source "drivers/phy/amlogic/Kconfig" source "drivers/phy/broadcom/Kconfig"drivers/phy/Makefile +0
-0
drivers/phy/Makefile obj-$(CONFIG_PHY_PISTACHIO_USB) += phy-pistachio-usb.o · line 15
Quoted 5 lines
drivers/phy/Makefile +1
-1@@ -12,7 +12,8 @@ obj-$(CONFIG_PHY_PISTACHIO_USB) += phy-pistachio-usb.o obj-$(CONFIG_USB_LGM_PHY) += phy-lgm-usb.o obj-$(CONFIG_PHY_AIROHA_PCIE) += phy-airoha-pcie.o obj-$(CONFIG_PHY_NXP_PTN3222) += phy-nxp-ptn3222.o -obj-y += allwinner/ \ +obj-y += airoha/ \
Directory for a single driver? Also move the PCIe driver in, if you really want to do this
drivers/phy/Makefile obj-$(CONFIG_PHY_PISTACHIO_USB) += phy-pistachio-usb.o
Quoted 8 lines
drivers/phy/Makefile +8
-0+struct airoha_usb_phy_priv { + struct device *dev; + + struct regmap *regmap; + + unsigned int id; + + struct airoha_usb_phy_instance *phys[AIROHA_USB_PHY_MAX_INSTANCE];
No need for empty lines here?
Quoted 43 lines
drivers/phy/Makefile +43
-0+static int airoha_usb_phy_u2_slew_rate_calibration(struct airoha_usb_phy_priv *priv) +{ + u32 fm_out; + u32 srctrl; + + /* Enable HS TX SR calibration */ + regmap_set_bits(priv->regmap, AIROHA_USB_PHY_USBPHYACR5, + AIROHA_USB_PHY_USB20_HSTX_SRCAL_EN); + + usleep_range(1000, 1500); + + /* Enable Free run clock */ + regmap_set_bits(priv->regmap, AIROHA_USB_PHY_FMMONR1, + AIROHA_USB_PHY_FRCK_EN); + + /* Select Monitor Clock */ + regmap_update_bits(priv->regmap, AIROHA_USB_PHY_FMCR0, + AIROHA_USB_PHY_MONCLK_SEL, + priv->id == 0 ? AIROHA_USB_PHY_MONCLK_SEL0 : + AIROHA_USB_PHY_MONCLK_SEL1); + + /* Set cyclecnt */ + regmap_update_bits(priv->regmap, AIROHA_USB_PHY_FMCR0, + AIROHA_USB_PHY_CYCLECNT, + FIELD_PREP(AIROHA_USB_PHY_CYCLECNT, + AIROHA_USB_PHY_U2_FM_DET_CYCLE_CNT)); + + /* Enable Frequency meter */ + regmap_set_bits(priv->regmap, AIROHA_USB_PHY_FMCR0, + AIROHA_USB_PHY_FREQDET_EN); + + /* Timeout can happen and we will apply workaround at the end */ + regmap_read_poll_timeout(priv->regmap, AIROHA_USB_PHY_FMMONR0, fm_out, + fm_out, AIROHA_USB_PHY_FREQDET_SLEEP, + AIROHA_USB_PHY_FREQDET_TIMEOUT); + + /* Disable Frequency meter */ + regmap_clear_bits(priv->regmap, AIROHA_USB_PHY_FMCR0, + AIROHA_USB_PHY_FREQDET_EN); + + /* Disable Free run clock */ + regmap_clear_bits(priv->regmap, AIROHA_USB_PHY_FMMONR1, + AIROHA_USB_PHY_FRCK_EN);
drivers/phy/Makefile
Quoted 10 lines
drivers/phy/Makefile +10
-0+ + /* Disable HS TX SR calibration */ + regmap_clear_bits(priv->regmap, AIROHA_USB_PHY_USBPHYACR5, + AIROHA_USB_PHY_USB20_HSTX_SRCAL_EN); + + usleep_range(1000, 1500); + + /* Frequency was not detected, use default SR calibration value */ + if (!fm_out) { + srctrl = 0x5;
magic?
Quoted 4 lines
drivers/phy/Makefile +4
-0+ dev_err(priv->dev, "Frequency not detected, using default SR calibration.\n"); + /* (1024 / FM_OUT) * REF_CK * U2_SR_COEF (round to the nearest digits) */ + } else { + srctrl = AIROHA_USB_PHY_REF_CK * AIROHA_USB_PHY_U2_SR_COEF;
drivers/phy/Makefile
Quoted 10 lines
drivers/phy/Makefile +10
-0+ srctrl = (srctrl * AIROHA_USB_PHY_U2_FM_DET_CYCLE_CNT) / fm_out; + srctrl = DIV_ROUND_CLOSEST(srctrl, AIROHA_USB_PHY_U2_SR_COEF_DIVISOR); + dev_dbg(priv->dev, "SR calibration applied: %x\n", srctrl); + } + + regmap_update_bits(priv->regmap, AIROHA_USB_PHY_USBPHYACR5, + AIROHA_USB_PHY_USB20_HSTX_SRCTRL, + FIELD_PREP(AIROHA_USB_PHY_USB20_HSTX_SRCTRL, srctrl)); + + return 0;
This is the only return... consider making it void return then? Here and other places
drivers/phy/Makefile
Quoted 4 lines
drivers/phy/Makefile +4
-0+static int airoha_usb_phy_exit(struct phy *phy) +{ + return 0; +}
you can drop this
drivers/phy/Makefile
Quoted 9 lines
drivers/phy/Makefile +9
-0+static int airoha_usb_phy_power_on(struct phy *phy) +{ + struct airoha_usb_phy_instance *instance = phy_get_drvdata(phy); + struct airoha_usb_phy_priv *priv = dev_get_drvdata(phy->dev.parent); + + if (instance->type == PHY_TYPE_USB2) + return airoha_usb_phy_u2_power_on(priv); + + return airoha_usb_phy_u3_power_on(priv);
for non USB2, you power both why?
Quoted 9 lines
drivers/phy/Makefile +9
-0+static int airoha_usb_phy_u2_set_mode(struct airoha_usb_phy_priv *priv, + enum phy_mode mode) +{ + u32 val = 0; + + /* + * For Device and Host mode, enable force IDDIG. + * For Device set IDDIG, for Host clear IDDIG. + * For OTG disable force and clear IDDIG bit while at it.
drivers/phy/Makefile
Quoted 10 lines
drivers/phy/Makefile +10
-0+ */ + switch (mode) { + case PHY_MODE_USB_DEVICE: + val |= AIROHA_USB_PHY_IDDIG; + fallthrough; + case PHY_MODE_USB_HOST: + val |= AIROHA_USB_PHY_FORCE_IDDIG; + break; + case PHY_MODE_USB_OTG: + break;
Not expecting to set this?
Signature · 1 line
~Vinod
Vinod Koul
maintainerRe: [PATCH 10/13] phy: airoha: Add support for Airoha AN7581 USB PHY
Quoted 5 lines · Vinod Koul
Quoted 4 lines · Christian Marangi
Add support for Airoha AN7581 USB PHY driver. AN7581 supports up to 2 USB port with USB 2.0 mode always supported and USB 3.0 mode available only if the Serdes port is correctly configured for USB 3.0.
Quoted 8 lines
Quoted 8 lines
On xLate probe, the Serdes mode is validated and the driver return error if the Serdes mode doesn't reflect the expected mode. This is required as Serdes mode are controlled by the SCU SSR bits and can be either USB 3.0 mode or HSGMII or PCIe 2. In such case USB 3.0 won't work.
If the USB 3.0 mode is not supported, the modes needs to be also disabled in the xHCI node or the driver will report unsable clock and fail probe.
Also I dont see phy depends on rest. Please split this and post phy bits separately at least..
Signature · 1 line
~Vinod
Re: [PATCH 10/13] phy: airoha: Add support for Airoha AN7581 USB PHY
Quoted 11 lines · Vinod Koul
Quoted 10 lines · Vinod Koul
Quoted 9 lines · Christian Marangi
Add support for Airoha AN7581 USB PHY driver. AN7581 supports up to 2 USB port with USB 2.0 mode always supported and USB 3.0 mode available only if the Serdes port is correctly configured for USB 3.0.
On xLate probe, the Serdes mode is validated and the driver return error if the Serdes mode doesn't reflect the expected mode. This is required as Serdes mode are controlled by the SCU SSR bits and can be either USB 3.0 mode or HSGMII or PCIe 2. In such case USB 3.0 won't work.
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines
If the USB 3.0 mode is not supported, the modes needs to be also disabled in the xHCI node or the driver will report unsable clock and fail probe.
Also I dont see phy depends on rest. Please split this and post phy bits separately at least..
Well USB doesn't work without this driver so they are indirectly dependent. Will split and address all the other comments.
Quoted 3 lines
Signature · 2 lines
-- ~Vinod
Signature · 1 line
Ansuel
Re: [PATCH 09/13] dt-bindings: phy: Add documentation for Airoha AN7581 USB PHY
In reply to Krzysztof KozlowskiQuoted 56 lines · Krzysztof Kozlowski
Quoted 42 lines · Christian Marangi
Add documentation for Airoha AN7581 USB PHY that describe the USB PHY for the USB controller.
Airoha AN7581 SoC support a maximum of 2 USB port. The USB 2.0 mode is always supported. The USB 3.0 mode is optional and depends on the Serdes mode currently configured on the system for the USB port. If USB 3.0 node is defined, then airoha,scu-ssr property is required for Serdes mode validation.
Signed-off-by Christian Marangi <[email protected]>--- .../bindings/phy/airoha,an7581-usb-phy.yaml | 106 ++++++++++++++++++ MAINTAINERS | 6 + 2 files changed, 112 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yamlDocumentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml new file +20
-0@@ -0,0 +1,106 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/phy/airoha,an7581-usb-phy.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Airoha AN7581 SoC USB PHY + +maintainers: + - Christian Marangi <[email protected]> + +description: > + The Airoha AN7581 SoC USB PHY describes the USB PHY for the USB controller. + + Airoha AN7581 SoC support a maximum of 2 USB port. The USB 2.0 mode is + always supported. The USB 3.0 mode is optional and depends on the Serdes + mode currently configured on the system for the USB port. If USB 3.0 node + is defined, then airoha,scu-ssr property is required for Serdes mode + validation. +Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml line 30
Quoted 10 lines
Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml new file +10
-0+properties: + compatible: + const: airoha,an7581-usb-phy + + reg: + maxItems: 1 + + airoha,port-id: + description: Describe the physical port this USB PHY refer to. A dedicated + osciallator is used for each port for the USB 2.0 Slew Rate calibration.typo
Quoted 6 lines
Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml line 32
Quoted 2 lines
Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml new file +2
-0+ $ref: /schemas/types.yaml#/definitions/uint32 + enum: [0, 1]I don't understand why do you need index property here (which are usually not allowed).
Eh... As said in the description this is really to differentiate the 2 different physical port...
Each port have a dedicated oscillator for calibration and these calibration are identified by an offset (all placed one after another in a separate register space).
Oscillator 0 for physical port 0
Oscillator 1 for physcial port 1
And model this is a bit problematic without an additional property, any hint for this?
Quoted 13 lines
Quoted 13 lines
Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml new file +13
-0+ + airoha,scu-ssr: + description: Phandle to the SCU SSR node for USB 3.0 Serdes mode validation. + $ref: /schemas/types.yaml#/definitions/phandle + + usb2-phy: + type: object + + properties: + '#phy-cells': + const: 1 + + required:
Quoted 9 lines
Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml line 48
Quoted 3 lines
Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml new file +3
-0+ - '#phy-cells' + + additionalProperties: falseAlso no resources in usb[23]-phy, so this goes to the parent level and you have phy-cells=2. Your DTS gives some hint that devices actually differ but the commit msg contradicts it, so I don't get. Do you have same IP block here or two different?
SoC have 2 physical USB port.
Physical port 0 on address: 0x1fab0000
Physcial port 1 on address: 0x1fad0000
In those space there are registers to configure USB 2.0 mode and USB 3.0 mode for each physical port.
So yes no child node, phy-cells 2 and reference with phys = <&usb_phy 0 PHY_TYPE_USB2>, <&usb_phy 1 PHY_TYPE_USB3>; that totally works and hope now the HW is more clear.
The real problematic part is the one above with identify the 2 physical port.
Quoted 21 lines
Quoted 6 lines
Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml new file +1
-0+MAINTAINERS +0
-0MAINTAINERS S: Maintained · line 760
Quoted 8 lines
MAINTAINERS +5
-0@@ -753,6 +753,12 @@ S: Maintained F: Documentation/devicetree/bindings/spi/airoha,en7581-snand.yaml F: drivers/spi/spi-airoha-snfi.c +AIROHA USB PHY DRIVER +M: Christian Marangi <[email protected]> +L: [email protected] (moderated for non-subscribers) +S: Maintained +F: Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yamTypo in extension/missing l.
Best regards,
Krzysztof
Signature · 1 line
Ansuel
Re: [PATCH 05/13] dt-bindings: mfd: add Documentation for Airoha EN7581 SCU
In reply to Krzysztof KozlowskiQuoted 68 lines · Krzysztof Kozlowski
Quoted 59 lines · Christian Marangi
Quoted 45 lines · Krzysztof Kozlowski
Quoted 26 lines · Christian Marangi
Add Documentation for Airoha EN7581 SCU.
Airoha EN7581 SoC expose registers to control miscellaneous pheriperals via the SCU (System Controller Unit).
Example of these pheriperals are reset-controller, clock-controller, PCIe line speed controller and bits to configure different Serdes ports for USB or Ethernet usage.
Signed-off-by Christian Marangi <[email protected]>--- .../mfd/airoha,en7581-scu-sysctl.yaml | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/airoha,en7581-scu-sysctl.yamlDocumentation/devicetree/bindings/mfd/airoha,en7581-scu-sysctl.yaml new file +5
-0@@ -0,0 +1,68 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mfd/airoha,en7581-scu-sysctl.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml#Documentation/devicetree/bindings/mfd/airoha,en7581-scu-sysctl.yaml line 15
Quoted 10 lines
Documentation/devicetree/bindings/mfd/airoha,en7581-scu-sysctl.yaml new file +10
-0+ +title: Airoha EN7581 SCU (System Controller Unit) + +maintainers: + - Christian Marangi <[email protected]> + +description: + Airoha EN7581 SoC expose registers to control miscellaneous + pheriperals via the SCU (System Controller Unit). +One more comment - there is no such thing as "sysctl" in your hardware. Look at the SCU binding which clearly says that it is the hardware you are duplicating here, so the "System Control Unit".
So you have existing "This node defines the System Control Unit of the EN7523 SoC" and you add one more node which defines the "System Control Unit", so you have two "System Control Unit" device nodes?
Quoted 7 lines
Look also what Stephen asked for:
https://lore.kernel.org/all/[email protected]/
so how system-controller can now became clock-controller? Now, it was the system controller since the beginning.
The main problem here (and we had a similar problem with GPIO and PWM) is that the Vendor (Airoha) wasn't so bright in placing the different registers for the SoC so we have case where everything is mixed and not one after another...
Quoted 7 lines
Example we have
- CLK register part 1
- Some bits that configure PCIe
- CLK register part 2
- GPIO
- CLK register part 3
- ...
Quoted 5 lines
This does not explain that binding said "This node defines the System Control Unit".
So what are you adding here if not SCU?
With "This node defines the System Control Unit" I mean, the entire register space of the IP block is defined and each child specifically define each part of the IP block.
Quoted 7 lines
Quoted 3 lines
The driver solution for this is syscon and the simple-mfd node structure.
Let's keep driver entirely separate, we don't talk about them and mixing arguments won't make it easier.
Ok.
Quoted 11 lines
Quoted 7 lines
Now the main problem is how to modle this in DT. There are lots of case where the simple-mfd model is used (like the one proposed) but probably this is not accepted anymore. But again this should be clearly stated or we have a chicken-egg problem when other devs implement similar thing and have to implement simple MFD driver to handle this. (and driver maintainers say "Use the simple-mfd model like it was already done)
simple-mfd has nothing to do here. Describe the hardware - what is the SCU?
As I said below, SCU is just the name used in Airoha Documentation for this IP block. In this register space there are multiple things so it's not strictly a clock-controller (as it's currently defined)
It was proposed as clock-controller previously as we weren't aware this IP block was used also for other usage that a strict clock controller.
Quoted 11 lines
Quoted 8 lines
For this specific case (and to give an answer to the clock patch after this) the problem is that this register space was originally used only to control the clock and I wasn't aware that it was also used to control USB. Now that I'm implementing support for it, the disaster happened.
So In short SCU is lots of thing, both a system-controller, a clock-controller and even a reset-controller.
And you have bindings for that already. Done.
It's currently defined in DTS as clock-controller, should we change it to system-controller to make it more clear?
Quoted 8 lines
Quoted 4 lines
To make it short, 2 different solution:
1. We can keep the current node structure of the node-controller and add a child node for the SSR part (with a dedicated compatible).No, you do not add child nodes just because you want some drivers.
What is SSR? How is it a device?
SSR is the name used in Documentation for the register used to configure the Serdes and PCIe port.
Quoted 4 lines
Quoted 2 lines
2. Those property need to be be defined in the clock-controller node?
In the SCU node. Do you have only one SCU or more?
Strictly speaking it's one register space. One clock-controller, one reset-controller and one set of SSR registers, and from what I can understand it's ALWAYS "One device/compatible for Register space"
The simple-mfd pattern can't really work for case like this where in one register space there are multiple stuff.
Is everything clear now?
To summarize:
- no child nodes
- add additional property for SSR in the SCU .yaml
Quoted 11 lines
Quoted 7 lines
The ideal solution is 1. Does it work for you?
Sorry for the long post and hope you understand why this mess of reworking the binding.
Best regards,
Krzysztof
Signature · 1 line
Ansuel
Re: [PATCH 09/13] dt-bindings: phy: Add documentation for Airoha AN7581 USB PHY
In reply to Christian MarangiQuoted 8 lines · Christian Marangi
Quoted 7 lines
Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml line 32
Quoted 3 lines
Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml new file +2
-0+ $ref: /schemas/types.yaml#/definitions/uint32 + enum: [0, 1]I don't understand why do you need index property here (which are usually not allowed).
Quoted 6 lines
Eh... As said in the description this is really to differentiate the 2 different physical port...
Each port have a dedicated oscillator for calibration and these calibration are identified by an offset (all placed one after another in a separate register space).
So different oscillators? Then describe the oscillator and its differences.
Different programing model? Different compatible.
Other difference? Depending what is the difference.
But there is no such thing as "different port ID" based on your description above. You just claimed that they are different, but you do not put that difference to hardware description. Instead you encode that difference in the drivers and it should be opposite. The DTS, so the hardware description, should tell you the difference. And I am sorry, but in 99% of cases "I am the first phy" and "I am the second" is not the actual difference we are interested in.
Quoted 7 lines
Oscillator 0 for physical port 0
Oscillator 1 for physcial port 1And model this is a bit problematic without an additional property, any hint for this?
Best regards,
Krzysztof
Re: [PATCH 05/13] dt-bindings: mfd: add Documentation for Airoha EN7581 SCU
In reply to Christian MarangiQuoted 10 lines · Christian Marangi
Quoted 6 lines
This does not explain that binding said "This node defines the System Control Unit".
So what are you adding here if not SCU?
With "This node defines the System Control Unit" I mean, the entire register space of the IP block is defined and each child specifically define each part of the IP block.
And the binding said - "this is the SCU". Now you claim that the binding which said "this is the SCU" is not the SCU but a part of it.
Quoted 23 lines
Quoted 8 lines
Quoted 4 lines
The driver solution for this is syscon and the simple-mfd node structure.
Let's keep driver entirely separate, we don't talk about them and mixing arguments won't make it easier.
Ok.
Quoted 11 lines
Quoted 7 lines
Now the main problem is how to modle this in DT. There are lots of case where the simple-mfd model is used (like the one proposed) but probably this is not accepted anymore. But again this should be clearly stated or we have a chicken-egg problem when other devs implement similar thing and have to implement simple MFD driver to handle this. (and driver maintainers say "Use the simple-mfd model like it was already done)
simple-mfd has nothing to do here. Describe the hardware - what is the SCU?
Quoted 6 lines
As I said below, SCU is just the name used in Airoha Documentation for this IP block. In this register space there are multiple things so it's not strictly a clock-controller (as it's currently defined)
It was proposed as clock-controller previously as we weren't aware this IP block was used also for other usage that a strict clock controller.
I am pretty sure everyone was, just drivers were developed for current needs and then binding was adjusted to match drivers.
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
For this specific case (and to give an answer to the clock patch after this) the problem is that this register space was originally used only to control the clock and I wasn't aware that it was also used to control USB. Now that I'm implementing support for it, the disaster happened.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
So In short SCU is lots of thing, both a system-controller, a clock-controller and even a reset-controller.
And you have bindings for that already. Done.
It's currently defined in DTS as clock-controller, should we change it to system-controller to make it more clear?
It does not matter for this discussion about bindings, it is just a name. You can rename it, sure, although also a bit of a churn since this device has a "clock controller" as one of its main features. And "system controller" is also way generic.
BTW, it is frequent (e.g. all Qcom platforms, many Allwiner and Mediatek) that clock controller is also reset or power domain controllers.
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
To make it short, 2 different solution:
1. We can keep the current node structure of the node-controller and add a child node for the SSR part (with a dedicated compatible).
Quoted 6 lines
Quoted 3 lines
No, you do not add child nodes just because you want some drivers.
What is SSR? How is it a device?
SSR is the name used in Documentation for the register used to configure the Serdes and PCIe port.
Register(s) for configuring something is not a device.
Quoted 9 lines
Quoted 5 lines
Quoted 3 lines
2. Those property need to be be defined in the clock-controller node?
In the SCU node. Do you have only one SCU or more?
Strictly speaking it's one register space. One clock-controller, one reset-controller and one set of SSR registers, and from what I can understand it's ALWAYS "One device/compatible for Register space"
No, it's not the reason. You define children if they are distinctive. By distinction I mean some sort of controllable resources which they need independently of parent. No resources here, except address space, which seems superficial choice.
Quoted 3 lines
The simple-mfd pattern can't really work for case like this where in one register space there are multiple stuff.
We agreed not to talk about simple-mfd, but answering this: yes, but because your split is neither necessary nor really accurate.
Quoted 6 lines
Is everything clear now?
To summarize:
- no child nodes
- add additional property for SSR in the SCU .yaml
Yes.
Unless I made mistake here in the judgement, but that will be easier to spot after seeing entire binding/DTS for this device.
Best regards,
Krzysztof
Re: [PATCH 09/13] dt-bindings: phy: Add documentation for Airoha AN7581 USB PHY
In reply to Krzysztof KozlowskiQuoted 22 lines · Krzysztof Kozlowski
Quoted 8 lines · Christian Marangi
Quoted 7 lines
Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml line 32
Quoted 3 lines
Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml new file +2
-0+ $ref: /schemas/types.yaml#/definitions/uint32 + enum: [0, 1]I don't understand why do you need index property here (which are usually not allowed).
Quoted 6 lines
Eh... As said in the description this is really to differentiate the 2 different physical port...
Each port have a dedicated oscillator for calibration and these calibration are identified by an offset (all placed one after another in a separate register space).
So different oscillators? Then describe the oscillator and its differences.
Different programing model? Different compatible.
Other difference? Depending what is the difference.
Quoted 8 lines
But there is no such thing as "different port ID" based on your description above. You just claimed that they are different, but you do not put that difference to hardware description. Instead you encode that difference in the drivers and it should be opposite. The DTS, so the hardware description, should tell you the difference. And I am sorry, but in 99% of cases "I am the first phy" and "I am the second" is not the actual difference we are interested in.
Ok to make it as clear as possible. (hope I don't contraddict with the previous statement) (actually yes the "separate register space statement was wrong and sorry for the confusion")
- 2 USB port
- USB 2.0 needs to be calibrated with an oscillator
- Each USB port have his own dedicated oscillator somewhere in the HW
- Each USB port have at the same offset a register to SELECT the oscillator. This register refer to the same oscillator selection in the HW.
Example:
reg 0x1fac0100 MASK 27:26 can be set to source out of oscillator 0,1,2 reg 0x1fae0100 MASK 27:26 can be set to source out of oscillator 0,1,2
Both register refer to the same oscillators in hardware (hence each port should select the correct one)
Selecting oscillator 0 for both USB port is problematic.
With this in mind is it ok if I describe this with something like
airoha,usb2-monitor-clk-sel = <AIROHA_USB2_MONCLK_SEL0>;
and some dt-bindings include
#define AIROHA_USB2_MONCLK_SEL0 0
#define AIROHA_USB2_MONCLK_SEL1 1
#define AIROHA_USB2_MONCLK_SEL2 2
#define AIROHA_USB2_MONCLK_SEL3 3
Or an enum of string like "osc0", "osc1", "osc2"...?
Quoted 9 lines
Quoted 7 lines
Oscillator 0 for physical port 0
Oscillator 1 for physcial port 1And model this is a bit problematic without an additional property, any hint for this?
Best regards,
Krzysztof
Signature · 1 line
Ansuel
Re: [PATCH 09/13] dt-bindings: phy: Add documentation for Airoha AN7581 USB PHY
Quoted 43 lines · Christian Marangi
Quoted 22 lines · Krzysztof Kozlowski
Quoted 8 lines · Christian Marangi
Quoted 7 lines
Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml line 32
Quoted 3 lines
Documentation/devicetree/bindings/phy/airoha,an7581-usb-phy.yaml new file +2
-0+ $ref: /schemas/types.yaml#/definitions/uint32 + enum: [0, 1]I don't understand why do you need index property here (which are usually not allowed).
Quoted 6 lines
Eh... As said in the description this is really to differentiate the 2 different physical port...
Each port have a dedicated oscillator for calibration and these calibration are identified by an offset (all placed one after another in a separate register space).
So different oscillators? Then describe the oscillator and its differences.
Different programing model? Different compatible.
Other difference? Depending what is the difference.
Quoted 8 lines
But there is no such thing as "different port ID" based on your description above. You just claimed that they are different, but you do not put that difference to hardware description. Instead you encode that difference in the drivers and it should be opposite. The DTS, so the hardware description, should tell you the difference. And I am sorry, but in 99% of cases "I am the first phy" and "I am the second" is not the actual difference we are interested in.
Ok to make it as clear as possible. (hope I don't contraddict with the previous statement) (actually yes the "separate register space statement was wrong and sorry for the confusion")
- 2 USB port
- USB 2.0 needs to be calibrated with an oscillator
- Each USB port have his own dedicated oscillator somewhere in the HW
- Each USB port have at the same offset a register to SELECT the oscillator. This register refer to the same oscillator selection in the HW.
Quoted 3 lines
Example:
reg0x1fac0100MASK 27:26 can be set to source out of oscillator 0,1,2 reg0x1fae0100MASK 27:26 can be set to source out of oscillator 0,1,2
So that's your difference between devices - you choose the oscillator.
Quoted 9 lines
Both register refer to the same oscillators in hardware (hence each port should select the correct one)
Selecting oscillator 0 for both USB port is problematic.With this in mind is it ok if I describe this with something like
airoha,usb2-monitor-clk-sel = <
AIROHA_USB2_MONCLK_SEL0>;
Quoted 8 lines
and some dt-bindings include
#define
AIROHA_USB2_MONCLK_SEL00
#defineAIROHA_USB2_MONCLK_SEL11
#defineAIROHA_USB2_MONCLK_SEL22
#defineAIROHA_USB2_MONCLK_SEL33Or an enum of string like "osc0", "osc1", "osc2"...?
Both are fine.
Best regards,
Krzysztof