162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci *
462306a36Sopenharmony_ci *  Copyright (C) 2012 John Crispin <john@phrozen.org>
562306a36Sopenharmony_ci */
662306a36Sopenharmony_ci
762306a36Sopenharmony_ci#include <linux/platform_device.h>
862306a36Sopenharmony_ci#include <linux/slab.h>
962306a36Sopenharmony_ci#include <linux/init.h>
1062306a36Sopenharmony_ci#include <linux/module.h>
1162306a36Sopenharmony_ci#include <linux/types.h>
1262306a36Sopenharmony_ci#include <linux/of.h>
1362306a36Sopenharmony_ci#include <linux/mutex.h>
1462306a36Sopenharmony_ci#include <linux/gpio/driver.h>
1562306a36Sopenharmony_ci#include <linux/io.h>
1662306a36Sopenharmony_ci#include <linux/clk.h>
1762306a36Sopenharmony_ci#include <linux/err.h>
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ci/*
2062306a36Sopenharmony_ci * The Serial To Parallel (STP) is found on MIPS based Lantiq socs. It is a
2162306a36Sopenharmony_ci * peripheral controller used to drive external shift register cascades. At most
2262306a36Sopenharmony_ci * 3 groups of 8 bits can be driven. The hardware is able to allow the DSL modem
2362306a36Sopenharmony_ci * to drive the 2 LSBs of the cascade automatically.
2462306a36Sopenharmony_ci */
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ci/* control register 0 */
2762306a36Sopenharmony_ci#define XWAY_STP_CON0		0x00
2862306a36Sopenharmony_ci/* control register 1 */
2962306a36Sopenharmony_ci#define XWAY_STP_CON1		0x04
3062306a36Sopenharmony_ci/* data register 0 */
3162306a36Sopenharmony_ci#define XWAY_STP_CPU0		0x08
3262306a36Sopenharmony_ci/* data register 1 */
3362306a36Sopenharmony_ci#define XWAY_STP_CPU1		0x0C
3462306a36Sopenharmony_ci/* access register */
3562306a36Sopenharmony_ci#define XWAY_STP_AR		0x10
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ci/* software or hardware update select bit */
3862306a36Sopenharmony_ci#define XWAY_STP_CON_SWU	BIT(31)
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ci/* automatic update rates */
4162306a36Sopenharmony_ci#define XWAY_STP_2HZ		0
4262306a36Sopenharmony_ci#define XWAY_STP_4HZ		BIT(23)
4362306a36Sopenharmony_ci#define XWAY_STP_8HZ		BIT(24)
4462306a36Sopenharmony_ci#define XWAY_STP_10HZ		(BIT(24) | BIT(23))
4562306a36Sopenharmony_ci#define XWAY_STP_SPEED_MASK	(BIT(23) | BIT(24) | BIT(25) | BIT(26) | BIT(27))
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ci#define XWAY_STP_FPIS_VALUE	BIT(21)
4862306a36Sopenharmony_ci#define XWAY_STP_FPIS_MASK	(BIT(20) | BIT(21))
4962306a36Sopenharmony_ci
5062306a36Sopenharmony_ci/* clock source for automatic update */
5162306a36Sopenharmony_ci#define XWAY_STP_UPD_FPI	BIT(31)
5262306a36Sopenharmony_ci#define XWAY_STP_UPD_MASK	(BIT(31) | BIT(30))
5362306a36Sopenharmony_ci
5462306a36Sopenharmony_ci/* let the adsl core drive the 2 LSBs */
5562306a36Sopenharmony_ci#define XWAY_STP_ADSL_SHIFT	24
5662306a36Sopenharmony_ci#define XWAY_STP_ADSL_MASK	0x3
5762306a36Sopenharmony_ci
5862306a36Sopenharmony_ci/* 2 groups of 3 bits can be driven by the phys */
5962306a36Sopenharmony_ci#define XWAY_STP_PHY_MASK	0x7
6062306a36Sopenharmony_ci#define XWAY_STP_PHY1_SHIFT	27
6162306a36Sopenharmony_ci#define XWAY_STP_PHY2_SHIFT	3
6262306a36Sopenharmony_ci#define XWAY_STP_PHY3_SHIFT	6
6362306a36Sopenharmony_ci#define XWAY_STP_PHY4_SHIFT	15
6462306a36Sopenharmony_ci
6562306a36Sopenharmony_ci/* STP has 3 groups of 8 bits */
6662306a36Sopenharmony_ci#define XWAY_STP_GROUP0		BIT(0)
6762306a36Sopenharmony_ci#define XWAY_STP_GROUP1		BIT(1)
6862306a36Sopenharmony_ci#define XWAY_STP_GROUP2		BIT(2)
6962306a36Sopenharmony_ci#define XWAY_STP_GROUP_MASK	(0x7)
7062306a36Sopenharmony_ci
7162306a36Sopenharmony_ci/* Edge configuration bits */
7262306a36Sopenharmony_ci#define XWAY_STP_FALLING	BIT(26)
7362306a36Sopenharmony_ci#define XWAY_STP_EDGE_MASK	BIT(26)
7462306a36Sopenharmony_ci
7562306a36Sopenharmony_ci#define xway_stp_r32(m, reg)		__raw_readl(m + reg)
7662306a36Sopenharmony_ci#define xway_stp_w32(m, val, reg)	__raw_writel(val, m + reg)
7762306a36Sopenharmony_ci#define xway_stp_w32_mask(m, clear, set, reg) \
7862306a36Sopenharmony_ci		xway_stp_w32(m, (xway_stp_r32(m, reg) & ~(clear)) | (set), reg)
7962306a36Sopenharmony_ci
8062306a36Sopenharmony_cistruct xway_stp {
8162306a36Sopenharmony_ci	struct gpio_chip gc;
8262306a36Sopenharmony_ci	void __iomem *virt;
8362306a36Sopenharmony_ci	u32 edge;	/* rising or falling edge triggered shift register */
8462306a36Sopenharmony_ci	u32 shadow;	/* shadow the shift registers state */
8562306a36Sopenharmony_ci	u8 groups;	/* we can drive 1-3 groups of 8bit each */
8662306a36Sopenharmony_ci	u8 dsl;		/* the 2 LSBs can be driven by the dsl core */
8762306a36Sopenharmony_ci	u8 phy1;	/* 3 bits can be driven by phy1 */
8862306a36Sopenharmony_ci	u8 phy2;	/* 3 bits can be driven by phy2 */
8962306a36Sopenharmony_ci	u8 phy3;	/* 3 bits can be driven by phy3 */
9062306a36Sopenharmony_ci	u8 phy4;	/* 3 bits can be driven by phy4 */
9162306a36Sopenharmony_ci	u8 reserved;	/* mask out the hw driven bits in gpio_request */
9262306a36Sopenharmony_ci};
9362306a36Sopenharmony_ci
9462306a36Sopenharmony_ci/**
9562306a36Sopenharmony_ci * xway_stp_get() - gpio_chip->get - get gpios.
9662306a36Sopenharmony_ci * @gc:     Pointer to gpio_chip device structure.
9762306a36Sopenharmony_ci * @gpio:   GPIO signal number.
9862306a36Sopenharmony_ci *
9962306a36Sopenharmony_ci * Gets the shadow value.
10062306a36Sopenharmony_ci */
10162306a36Sopenharmony_cistatic int xway_stp_get(struct gpio_chip *gc, unsigned int gpio)
10262306a36Sopenharmony_ci{
10362306a36Sopenharmony_ci	struct xway_stp *chip = gpiochip_get_data(gc);
10462306a36Sopenharmony_ci
10562306a36Sopenharmony_ci	return (xway_stp_r32(chip->virt, XWAY_STP_CPU0) & BIT(gpio));
10662306a36Sopenharmony_ci}
10762306a36Sopenharmony_ci
10862306a36Sopenharmony_ci/**
10962306a36Sopenharmony_ci * xway_stp_set() - gpio_chip->set - set gpios.
11062306a36Sopenharmony_ci * @gc:     Pointer to gpio_chip device structure.
11162306a36Sopenharmony_ci * @gpio:   GPIO signal number.
11262306a36Sopenharmony_ci * @val:    Value to be written to specified signal.
11362306a36Sopenharmony_ci *
11462306a36Sopenharmony_ci * Set the shadow value and call ltq_ebu_apply.
11562306a36Sopenharmony_ci */
11662306a36Sopenharmony_cistatic void xway_stp_set(struct gpio_chip *gc, unsigned gpio, int val)
11762306a36Sopenharmony_ci{
11862306a36Sopenharmony_ci	struct xway_stp *chip = gpiochip_get_data(gc);
11962306a36Sopenharmony_ci
12062306a36Sopenharmony_ci	if (val)
12162306a36Sopenharmony_ci		chip->shadow |= BIT(gpio);
12262306a36Sopenharmony_ci	else
12362306a36Sopenharmony_ci		chip->shadow &= ~BIT(gpio);
12462306a36Sopenharmony_ci	xway_stp_w32(chip->virt, chip->shadow, XWAY_STP_CPU0);
12562306a36Sopenharmony_ci	if (!chip->reserved)
12662306a36Sopenharmony_ci		xway_stp_w32_mask(chip->virt, 0, XWAY_STP_CON_SWU, XWAY_STP_CON0);
12762306a36Sopenharmony_ci}
12862306a36Sopenharmony_ci
12962306a36Sopenharmony_ci/**
13062306a36Sopenharmony_ci * xway_stp_dir_out() - gpio_chip->dir_out - set gpio direction.
13162306a36Sopenharmony_ci * @gc:     Pointer to gpio_chip device structure.
13262306a36Sopenharmony_ci * @gpio:   GPIO signal number.
13362306a36Sopenharmony_ci * @val:    Value to be written to specified signal.
13462306a36Sopenharmony_ci *
13562306a36Sopenharmony_ci * Same as xway_stp_set, always returns 0.
13662306a36Sopenharmony_ci */
13762306a36Sopenharmony_cistatic int xway_stp_dir_out(struct gpio_chip *gc, unsigned gpio, int val)
13862306a36Sopenharmony_ci{
13962306a36Sopenharmony_ci	xway_stp_set(gc, gpio, val);
14062306a36Sopenharmony_ci
14162306a36Sopenharmony_ci	return 0;
14262306a36Sopenharmony_ci}
14362306a36Sopenharmony_ci
14462306a36Sopenharmony_ci/**
14562306a36Sopenharmony_ci * xway_stp_request() - gpio_chip->request
14662306a36Sopenharmony_ci * @gc:     Pointer to gpio_chip device structure.
14762306a36Sopenharmony_ci * @gpio:   GPIO signal number.
14862306a36Sopenharmony_ci *
14962306a36Sopenharmony_ci * We mask out the HW driven pins
15062306a36Sopenharmony_ci */
15162306a36Sopenharmony_cistatic int xway_stp_request(struct gpio_chip *gc, unsigned gpio)
15262306a36Sopenharmony_ci{
15362306a36Sopenharmony_ci	struct xway_stp *chip = gpiochip_get_data(gc);
15462306a36Sopenharmony_ci
15562306a36Sopenharmony_ci	if ((gpio < 8) && (chip->reserved & BIT(gpio))) {
15662306a36Sopenharmony_ci		dev_err(gc->parent, "GPIO %d is driven by hardware\n", gpio);
15762306a36Sopenharmony_ci		return -ENODEV;
15862306a36Sopenharmony_ci	}
15962306a36Sopenharmony_ci
16062306a36Sopenharmony_ci	return 0;
16162306a36Sopenharmony_ci}
16262306a36Sopenharmony_ci
16362306a36Sopenharmony_ci/**
16462306a36Sopenharmony_ci * xway_stp_hw_init() - Configure the STP unit and enable the clock gate
16562306a36Sopenharmony_ci * @chip: Pointer to the xway_stp chip structure
16662306a36Sopenharmony_ci */
16762306a36Sopenharmony_cistatic void xway_stp_hw_init(struct xway_stp *chip)
16862306a36Sopenharmony_ci{
16962306a36Sopenharmony_ci	/* sane defaults */
17062306a36Sopenharmony_ci	xway_stp_w32(chip->virt, 0, XWAY_STP_AR);
17162306a36Sopenharmony_ci	xway_stp_w32(chip->virt, 0, XWAY_STP_CPU0);
17262306a36Sopenharmony_ci	xway_stp_w32(chip->virt, 0, XWAY_STP_CPU1);
17362306a36Sopenharmony_ci	xway_stp_w32(chip->virt, XWAY_STP_CON_SWU, XWAY_STP_CON0);
17462306a36Sopenharmony_ci	xway_stp_w32(chip->virt, 0, XWAY_STP_CON1);
17562306a36Sopenharmony_ci
17662306a36Sopenharmony_ci	/* apply edge trigger settings for the shift register */
17762306a36Sopenharmony_ci	xway_stp_w32_mask(chip->virt, XWAY_STP_EDGE_MASK,
17862306a36Sopenharmony_ci				chip->edge, XWAY_STP_CON0);
17962306a36Sopenharmony_ci
18062306a36Sopenharmony_ci	/* apply led group settings */
18162306a36Sopenharmony_ci	xway_stp_w32_mask(chip->virt, XWAY_STP_GROUP_MASK,
18262306a36Sopenharmony_ci				chip->groups, XWAY_STP_CON1);
18362306a36Sopenharmony_ci
18462306a36Sopenharmony_ci	/* tell the hardware which pins are controlled by the dsl modem */
18562306a36Sopenharmony_ci	xway_stp_w32_mask(chip->virt,
18662306a36Sopenharmony_ci			XWAY_STP_ADSL_MASK << XWAY_STP_ADSL_SHIFT,
18762306a36Sopenharmony_ci			chip->dsl << XWAY_STP_ADSL_SHIFT,
18862306a36Sopenharmony_ci			XWAY_STP_CON0);
18962306a36Sopenharmony_ci
19062306a36Sopenharmony_ci	/* tell the hardware which pins are controlled by the phys */
19162306a36Sopenharmony_ci	xway_stp_w32_mask(chip->virt,
19262306a36Sopenharmony_ci			XWAY_STP_PHY_MASK << XWAY_STP_PHY1_SHIFT,
19362306a36Sopenharmony_ci			chip->phy1 << XWAY_STP_PHY1_SHIFT,
19462306a36Sopenharmony_ci			XWAY_STP_CON0);
19562306a36Sopenharmony_ci	xway_stp_w32_mask(chip->virt,
19662306a36Sopenharmony_ci			XWAY_STP_PHY_MASK << XWAY_STP_PHY2_SHIFT,
19762306a36Sopenharmony_ci			chip->phy2 << XWAY_STP_PHY2_SHIFT,
19862306a36Sopenharmony_ci			XWAY_STP_CON1);
19962306a36Sopenharmony_ci
20062306a36Sopenharmony_ci	if (of_machine_is_compatible("lantiq,grx390")
20162306a36Sopenharmony_ci	    || of_machine_is_compatible("lantiq,ar10")) {
20262306a36Sopenharmony_ci		xway_stp_w32_mask(chip->virt,
20362306a36Sopenharmony_ci				XWAY_STP_PHY_MASK << XWAY_STP_PHY3_SHIFT,
20462306a36Sopenharmony_ci				chip->phy3 << XWAY_STP_PHY3_SHIFT,
20562306a36Sopenharmony_ci				XWAY_STP_CON1);
20662306a36Sopenharmony_ci	}
20762306a36Sopenharmony_ci
20862306a36Sopenharmony_ci	if (of_machine_is_compatible("lantiq,grx390")) {
20962306a36Sopenharmony_ci		xway_stp_w32_mask(chip->virt,
21062306a36Sopenharmony_ci				XWAY_STP_PHY_MASK << XWAY_STP_PHY4_SHIFT,
21162306a36Sopenharmony_ci				chip->phy4 << XWAY_STP_PHY4_SHIFT,
21262306a36Sopenharmony_ci				XWAY_STP_CON1);
21362306a36Sopenharmony_ci	}
21462306a36Sopenharmony_ci
21562306a36Sopenharmony_ci	/* mask out the hw driven bits in gpio_request */
21662306a36Sopenharmony_ci	chip->reserved = (chip->phy4 << 11) | (chip->phy3 << 8) | (chip->phy2 << 5)
21762306a36Sopenharmony_ci		| (chip->phy1 << 2) | chip->dsl;
21862306a36Sopenharmony_ci
21962306a36Sopenharmony_ci	/*
22062306a36Sopenharmony_ci	 * if we have pins that are driven by hw, we need to tell the stp what
22162306a36Sopenharmony_ci	 * clock to use as a timer.
22262306a36Sopenharmony_ci	 */
22362306a36Sopenharmony_ci	if (chip->reserved) {
22462306a36Sopenharmony_ci		xway_stp_w32_mask(chip->virt, XWAY_STP_UPD_MASK,
22562306a36Sopenharmony_ci			XWAY_STP_UPD_FPI, XWAY_STP_CON1);
22662306a36Sopenharmony_ci		xway_stp_w32_mask(chip->virt, XWAY_STP_SPEED_MASK,
22762306a36Sopenharmony_ci			XWAY_STP_10HZ, XWAY_STP_CON1);
22862306a36Sopenharmony_ci		xway_stp_w32_mask(chip->virt, XWAY_STP_FPIS_MASK,
22962306a36Sopenharmony_ci			XWAY_STP_FPIS_VALUE, XWAY_STP_CON1);
23062306a36Sopenharmony_ci	}
23162306a36Sopenharmony_ci}
23262306a36Sopenharmony_ci
23362306a36Sopenharmony_cistatic int xway_stp_probe(struct platform_device *pdev)
23462306a36Sopenharmony_ci{
23562306a36Sopenharmony_ci	u32 shadow, groups, dsl, phy;
23662306a36Sopenharmony_ci	struct xway_stp *chip;
23762306a36Sopenharmony_ci	struct clk *clk;
23862306a36Sopenharmony_ci	int ret = 0;
23962306a36Sopenharmony_ci
24062306a36Sopenharmony_ci	chip = devm_kzalloc(&pdev->dev, sizeof(*chip), GFP_KERNEL);
24162306a36Sopenharmony_ci	if (!chip)
24262306a36Sopenharmony_ci		return -ENOMEM;
24362306a36Sopenharmony_ci
24462306a36Sopenharmony_ci	chip->virt = devm_platform_ioremap_resource(pdev, 0);
24562306a36Sopenharmony_ci	if (IS_ERR(chip->virt))
24662306a36Sopenharmony_ci		return PTR_ERR(chip->virt);
24762306a36Sopenharmony_ci
24862306a36Sopenharmony_ci	chip->gc.parent = &pdev->dev;
24962306a36Sopenharmony_ci	chip->gc.label = "stp-xway";
25062306a36Sopenharmony_ci	chip->gc.direction_output = xway_stp_dir_out;
25162306a36Sopenharmony_ci	chip->gc.get = xway_stp_get;
25262306a36Sopenharmony_ci	chip->gc.set = xway_stp_set;
25362306a36Sopenharmony_ci	chip->gc.request = xway_stp_request;
25462306a36Sopenharmony_ci	chip->gc.base = -1;
25562306a36Sopenharmony_ci	chip->gc.owner = THIS_MODULE;
25662306a36Sopenharmony_ci
25762306a36Sopenharmony_ci	/* store the shadow value if one was passed by the devicetree */
25862306a36Sopenharmony_ci	if (!of_property_read_u32(pdev->dev.of_node, "lantiq,shadow", &shadow))
25962306a36Sopenharmony_ci		chip->shadow = shadow;
26062306a36Sopenharmony_ci
26162306a36Sopenharmony_ci	/* find out which gpio groups should be enabled */
26262306a36Sopenharmony_ci	if (!of_property_read_u32(pdev->dev.of_node, "lantiq,groups", &groups))
26362306a36Sopenharmony_ci		chip->groups = groups & XWAY_STP_GROUP_MASK;
26462306a36Sopenharmony_ci	else
26562306a36Sopenharmony_ci		chip->groups = XWAY_STP_GROUP0;
26662306a36Sopenharmony_ci	chip->gc.ngpio = fls(chip->groups) * 8;
26762306a36Sopenharmony_ci
26862306a36Sopenharmony_ci	/* find out which gpios are controlled by the dsl core */
26962306a36Sopenharmony_ci	if (!of_property_read_u32(pdev->dev.of_node, "lantiq,dsl", &dsl))
27062306a36Sopenharmony_ci		chip->dsl = dsl & XWAY_STP_ADSL_MASK;
27162306a36Sopenharmony_ci
27262306a36Sopenharmony_ci	/* find out which gpios are controlled by the phys */
27362306a36Sopenharmony_ci	if (of_machine_is_compatible("lantiq,ar9") ||
27462306a36Sopenharmony_ci			of_machine_is_compatible("lantiq,gr9") ||
27562306a36Sopenharmony_ci			of_machine_is_compatible("lantiq,vr9") ||
27662306a36Sopenharmony_ci			of_machine_is_compatible("lantiq,ar10") ||
27762306a36Sopenharmony_ci			of_machine_is_compatible("lantiq,grx390")) {
27862306a36Sopenharmony_ci		if (!of_property_read_u32(pdev->dev.of_node, "lantiq,phy1", &phy))
27962306a36Sopenharmony_ci			chip->phy1 = phy & XWAY_STP_PHY_MASK;
28062306a36Sopenharmony_ci		if (!of_property_read_u32(pdev->dev.of_node, "lantiq,phy2", &phy))
28162306a36Sopenharmony_ci			chip->phy2 = phy & XWAY_STP_PHY_MASK;
28262306a36Sopenharmony_ci	}
28362306a36Sopenharmony_ci
28462306a36Sopenharmony_ci	if (of_machine_is_compatible("lantiq,ar10") ||
28562306a36Sopenharmony_ci			of_machine_is_compatible("lantiq,grx390")) {
28662306a36Sopenharmony_ci		if (!of_property_read_u32(pdev->dev.of_node, "lantiq,phy3", &phy))
28762306a36Sopenharmony_ci			chip->phy3 = phy & XWAY_STP_PHY_MASK;
28862306a36Sopenharmony_ci	}
28962306a36Sopenharmony_ci
29062306a36Sopenharmony_ci	if (of_machine_is_compatible("lantiq,grx390")) {
29162306a36Sopenharmony_ci		if (!of_property_read_u32(pdev->dev.of_node, "lantiq,phy4", &phy))
29262306a36Sopenharmony_ci			chip->phy4 = phy & XWAY_STP_PHY_MASK;
29362306a36Sopenharmony_ci	}
29462306a36Sopenharmony_ci
29562306a36Sopenharmony_ci	/* check which edge trigger we should use, default to a falling edge */
29662306a36Sopenharmony_ci	if (!of_property_read_bool(pdev->dev.of_node, "lantiq,rising"))
29762306a36Sopenharmony_ci		chip->edge = XWAY_STP_FALLING;
29862306a36Sopenharmony_ci
29962306a36Sopenharmony_ci	clk = devm_clk_get(&pdev->dev, NULL);
30062306a36Sopenharmony_ci	if (IS_ERR(clk)) {
30162306a36Sopenharmony_ci		dev_err(&pdev->dev, "Failed to get clock\n");
30262306a36Sopenharmony_ci		return PTR_ERR(clk);
30362306a36Sopenharmony_ci	}
30462306a36Sopenharmony_ci
30562306a36Sopenharmony_ci	ret = clk_prepare_enable(clk);
30662306a36Sopenharmony_ci	if (ret)
30762306a36Sopenharmony_ci		return ret;
30862306a36Sopenharmony_ci
30962306a36Sopenharmony_ci	xway_stp_hw_init(chip);
31062306a36Sopenharmony_ci
31162306a36Sopenharmony_ci	ret = devm_gpiochip_add_data(&pdev->dev, &chip->gc, chip);
31262306a36Sopenharmony_ci	if (ret) {
31362306a36Sopenharmony_ci		clk_disable_unprepare(clk);
31462306a36Sopenharmony_ci		return ret;
31562306a36Sopenharmony_ci	}
31662306a36Sopenharmony_ci
31762306a36Sopenharmony_ci	dev_info(&pdev->dev, "Init done\n");
31862306a36Sopenharmony_ci
31962306a36Sopenharmony_ci	return 0;
32062306a36Sopenharmony_ci}
32162306a36Sopenharmony_ci
32262306a36Sopenharmony_cistatic const struct of_device_id xway_stp_match[] = {
32362306a36Sopenharmony_ci	{ .compatible = "lantiq,gpio-stp-xway" },
32462306a36Sopenharmony_ci	{},
32562306a36Sopenharmony_ci};
32662306a36Sopenharmony_ciMODULE_DEVICE_TABLE(of, xway_stp_match);
32762306a36Sopenharmony_ci
32862306a36Sopenharmony_cistatic struct platform_driver xway_stp_driver = {
32962306a36Sopenharmony_ci	.probe = xway_stp_probe,
33062306a36Sopenharmony_ci	.driver = {
33162306a36Sopenharmony_ci		.name = "gpio-stp-xway",
33262306a36Sopenharmony_ci		.of_match_table = xway_stp_match,
33362306a36Sopenharmony_ci	},
33462306a36Sopenharmony_ci};
33562306a36Sopenharmony_ci
33662306a36Sopenharmony_cistatic int __init xway_stp_init(void)
33762306a36Sopenharmony_ci{
33862306a36Sopenharmony_ci	return platform_driver_register(&xway_stp_driver);
33962306a36Sopenharmony_ci}
34062306a36Sopenharmony_ci
34162306a36Sopenharmony_cisubsys_initcall(xway_stp_init);
342