Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions drivers/gpio/gpio-cadence.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/spinlock.h>
#include <linux/acpi.h>

#define CDNS_GPIO_BYPASS_MODE 0x00
#define CDNS_GPIO_DIRECTION_MODE 0x04
Expand Down Expand Up @@ -284,10 +285,18 @@ static const struct of_device_id cdns_of_ids[] = {
};
MODULE_DEVICE_TABLE(of, cdns_of_ids);

static const struct acpi_device_id cdns_acpi_ids[] = {
{ "CIXH1002", 0 },
{ "CIXH1003", 0 },
{ "", 0 },
};
MODULE_DEVICE_TABLE(acpi, cdns_acpi_ids);

static struct platform_driver cdns_gpio_driver = {
.driver = {
.name = "cdns-gpio",
.of_match_table = cdns_of_ids,
.acpi_match_table = ACPI_PTR(cdns_acpi_ids),
},
.probe = cdns_gpio_probe,
.remove = cdns_gpio_remove,
Expand Down
33 changes: 33 additions & 0 deletions drivers/mfd/syscon.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
#include <linux/reset.h>
#include <linux/mfd/syscon.h>
#include <linux/slab.h>
#include <linux/acpi.h>
#include <linux/property.h>

static struct platform_driver syscon_driver;

Expand Down Expand Up @@ -336,6 +338,30 @@ struct regmap *syscon_regmap_lookup_by_phandle_optional(struct device_node *np,
}
EXPORT_SYMBOL_GPL(syscon_regmap_lookup_by_phandle_optional);

struct regmap *device_syscon_regmap_lookup_by_property(struct device *dev,
const char *property)
{
struct fwnode_handle *fwnode;
struct platform_device *pdev;
struct syscon *syscon;

if (!has_acpi_companion(dev))
return syscon_regmap_lookup_by_phandle(dev->of_node, property);

fwnode = fwnode_find_reference(dev_fwnode(dev), property, 0);
if (IS_ERR_OR_NULL(fwnode))
return ERR_PTR(-ENODEV);

pdev = to_platform_device(fwnode->dev);

syscon = platform_get_drvdata(pdev);
if (!syscon)
return ERR_PTR(-ENODEV);

return syscon->regmap;
}
EXPORT_SYMBOL_GPL(device_syscon_regmap_lookup_by_property);

static int syscon_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
Expand Down Expand Up @@ -378,9 +404,16 @@ static const struct platform_device_id syscon_ids[] = {
{ }
};

static const struct acpi_device_id syscon_acpi_match[] = {
{ "CIXHA018", 0 },
{ }
};
MODULE_DEVICE_TABLE(acpi, syscon_acpi_match);

static struct platform_driver syscon_driver = {
.driver = {
.name = "syscon",
.acpi_match_table = ACPI_PTR(syscon_acpi_match),
},
.probe = syscon_probe,
.id_table = syscon_ids,
Expand Down
1 change: 1 addition & 0 deletions drivers/phy/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,6 @@ source "drivers/phy/tegra/Kconfig"
source "drivers/phy/ti/Kconfig"
source "drivers/phy/intel/Kconfig"
source "drivers/phy/xilinx/Kconfig"
source "drivers/phy/cix/Kconfig"

endmenu
3 changes: 2 additions & 1 deletion drivers/phy/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,5 @@ obj-y += allwinner/ \
sunplus/ \
tegra/ \
ti/ \
xilinx/
xilinx/ \
cix/
25 changes: 25 additions & 0 deletions drivers/phy/cix/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# SPDX-License-Identifier: GPL-2.0-only
#
# Phy drivers for Cix PHYs
#

config PHY_CIX_USBDP
tristate "Cix USBDP PHY Driver"
depends on OF && HAS_IOMEM
select GENERIC_PHY
help
Enable this to support the CIX USBDP PHY for TYPEC Connection

config PHY_CIX_USB2
tristate "Cix USB2 PHY Driver"
depends on OF
select GENERIC_PHY
help
Enable this to support the CIX USB2 PHY

config PHY_CIX_USB3
tristate "Cix USB3 PHY Driver"
depends on OF && HAS_IOMEM
select GENERIC_PHY
help
Enable this to support the CIX USB3 PHY for TYPEA Connection
4 changes: 4 additions & 0 deletions drivers/phy/cix/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# SPDX-License-Identifier: GPL-2.0-only
obj-$(CONFIG_PHY_CIX_USBDP) += phy-cix-usbdp.o
obj-$(CONFIG_PHY_CIX_USB2) += phy-cix-usb2.o
obj-$(CONFIG_PHY_CIX_USB3) += phy-cix-usb3.o
55 changes: 55 additions & 0 deletions drivers/phy/cix/phy-cix-usb2.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// SPDX-License-Identifier: GPL-2.0
/*
* phy driver for cdn_usb2_p_sd10000
*/
#include <linux/acpi.h>
#include <linux/reset.h>
#include <linux/kernel.h>
#include <linux/of_platform.h>

static const struct acpi_device_id cix_usb2phy_acpi_match[] = {
{ "CIXH2032" },
{ },
};
MODULE_DEVICE_TABLE(acpi, cix_usb2phy_acpi_match);

static const struct of_device_id cix_usb2phy_dt_match[] = {
{
.compatible = "cix,sky1-usb2-phy",
.data = NULL
},
{ /* sentinel */ }
};

MODULE_DEVICE_TABLE(of, cix_usb2phy_dt_match);

static int cix_usb2phy_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct reset_control *preset;

preset = devm_reset_control_get(dev, "preset");

if (IS_ERR(preset))
dev_err(dev, "%s: failed to get preset\n", __func__);
else
reset_control_deassert(preset);

return 0;
Comment on lines +31 to +38
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (bug_risk): Revisit error handling for missing reset control.

Currently, if obtaining the reset control fails, an error is logged but the probe continues and returns success. If the reset control is critical to proper operation, consider returning the error code (e.g., PTR_ERR(preset)) to prevent initializing in an invalid state.

Suggested change
preset = devm_reset_control_get(dev, "preset");
if (IS_ERR(preset))
dev_err(dev, "%s: failed to get preset\n", __func__);
else
reset_control_deassert(preset);
return 0;
preset = devm_reset_control_get(dev, "preset");
if (IS_ERR(preset)) {
dev_err(dev, "%s: failed to get preset\n", __func__);
return PTR_ERR(preset);
}
reset_control_deassert(preset);
return 0;

}

static struct platform_driver cix_usb2phy_driver = {
.probe = cix_usb2phy_probe,
.driver = {
.name = "cix,sky1-usb2-phy",
.of_match_table = cix_usb2phy_dt_match,
.acpi_match_table = cix_usb2phy_acpi_match,
.pm = NULL,
},
};

module_platform_driver(cix_usb2phy_driver);

MODULE_AUTHOR("Chao Zeng <[email protected]>");
MODULE_DESCRIPTION("Cix Usb2 PHY driver");
MODULE_LICENSE("GPL");
Loading
Loading