12373f6b9SDirk Brandewie /*
22373f6b9SDirk Brandewie  * Synopsys DesignWare I2C adapter driver (master only).
32373f6b9SDirk Brandewie  *
42373f6b9SDirk Brandewie  * Based on the TI DAVINCI I2C adapter driver.
52373f6b9SDirk Brandewie  *
62373f6b9SDirk Brandewie  * Copyright (C) 2006 Texas Instruments.
72373f6b9SDirk Brandewie  * Copyright (C) 2007 MontaVista Software Inc.
82373f6b9SDirk Brandewie  * Copyright (C) 2009 Provigent Ltd.
92373f6b9SDirk Brandewie  *
102373f6b9SDirk Brandewie  * ----------------------------------------------------------------------------
112373f6b9SDirk Brandewie  *
122373f6b9SDirk Brandewie  * This program is free software; you can redistribute it and/or modify
132373f6b9SDirk Brandewie  * it under the terms of the GNU General Public License as published by
142373f6b9SDirk Brandewie  * the Free Software Foundation; either version 2 of the License, or
152373f6b9SDirk Brandewie  * (at your option) any later version.
162373f6b9SDirk Brandewie  *
172373f6b9SDirk Brandewie  * This program is distributed in the hope that it will be useful,
182373f6b9SDirk Brandewie  * but WITHOUT ANY WARRANTY; without even the implied warranty of
192373f6b9SDirk Brandewie  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
202373f6b9SDirk Brandewie  * GNU General Public License for more details.
212373f6b9SDirk Brandewie  * ----------------------------------------------------------------------------
222373f6b9SDirk Brandewie  *
232373f6b9SDirk Brandewie  */
242373f6b9SDirk Brandewie #include <linux/kernel.h>
252373f6b9SDirk Brandewie #include <linux/module.h>
262373f6b9SDirk Brandewie #include <linux/delay.h>
272373f6b9SDirk Brandewie #include <linux/i2c.h>
282373f6b9SDirk Brandewie #include <linux/clk.h>
29a445900cSCarl Peng #include <linux/clk-provider.h>
302373f6b9SDirk Brandewie #include <linux/errno.h>
312373f6b9SDirk Brandewie #include <linux/sched.h>
322373f6b9SDirk Brandewie #include <linux/err.h>
332373f6b9SDirk Brandewie #include <linux/interrupt.h>
349803f868SChristian Ruppert #include <linux/of.h>
352373f6b9SDirk Brandewie #include <linux/platform_device.h>
363bf3b289SDeepak Sikri #include <linux/pm.h>
377272194eSMika Westerberg #include <linux/pm_runtime.h>
382373f6b9SDirk Brandewie #include <linux/io.h>
392373f6b9SDirk Brandewie #include <linux/slab.h>
40b61b1415SMika Westerberg #include <linux/acpi.h>
414bcfda09STan, Raymond #include <linux/platform_data/i2c-designware.h>
422373f6b9SDirk Brandewie #include "i2c-designware-core.h"
432373f6b9SDirk Brandewie 
441d31b58fSDirk Brandewie static u32 i2c_dw_get_clk_rate_khz(struct dw_i2c_dev *dev)
451d31b58fSDirk Brandewie {
461d31b58fSDirk Brandewie 	return clk_get_rate(dev->clk)/1000;
471d31b58fSDirk Brandewie }
482373f6b9SDirk Brandewie 
49b61b1415SMika Westerberg #ifdef CONFIG_ACPI
5057cd1e30SMika Westerberg static void dw_i2c_acpi_params(struct platform_device *pdev, char method[],
5157cd1e30SMika Westerberg 			       u16 *hcnt, u16 *lcnt, u32 *sda_hold)
5257cd1e30SMika Westerberg {
5357cd1e30SMika Westerberg 	struct acpi_buffer buf = { ACPI_ALLOCATE_BUFFER };
5457cd1e30SMika Westerberg 	acpi_handle handle = ACPI_HANDLE(&pdev->dev);
5557cd1e30SMika Westerberg 	union acpi_object *obj;
5657cd1e30SMika Westerberg 
5757cd1e30SMika Westerberg 	if (ACPI_FAILURE(acpi_evaluate_object(handle, method, NULL, &buf)))
5857cd1e30SMika Westerberg 		return;
5957cd1e30SMika Westerberg 
6057cd1e30SMika Westerberg 	obj = (union acpi_object *)buf.pointer;
6157cd1e30SMika Westerberg 	if (obj->type == ACPI_TYPE_PACKAGE && obj->package.count == 3) {
6257cd1e30SMika Westerberg 		const union acpi_object *objs = obj->package.elements;
6357cd1e30SMika Westerberg 
6457cd1e30SMika Westerberg 		*hcnt = (u16)objs[0].integer.value;
6557cd1e30SMika Westerberg 		*lcnt = (u16)objs[1].integer.value;
6657cd1e30SMika Westerberg 		if (sda_hold)
6757cd1e30SMika Westerberg 			*sda_hold = (u32)objs[2].integer.value;
6857cd1e30SMika Westerberg 	}
6957cd1e30SMika Westerberg 
7057cd1e30SMika Westerberg 	kfree(buf.pointer);
7157cd1e30SMika Westerberg }
7257cd1e30SMika Westerberg 
73b61b1415SMika Westerberg static int dw_i2c_acpi_configure(struct platform_device *pdev)
74b61b1415SMika Westerberg {
75b61b1415SMika Westerberg 	struct dw_i2c_dev *dev = platform_get_drvdata(pdev);
76a445900cSCarl Peng 	const struct acpi_device_id *id;
77b61b1415SMika Westerberg 
78b61b1415SMika Westerberg 	dev->adapter.nr = -1;
79b61b1415SMika Westerberg 	dev->tx_fifo_depth = 32;
80b61b1415SMika Westerberg 	dev->rx_fifo_depth = 32;
8157cd1e30SMika Westerberg 
8257cd1e30SMika Westerberg 	/*
8357cd1e30SMika Westerberg 	 * Try to get SDA hold time and *CNT values from an ACPI method if
8457cd1e30SMika Westerberg 	 * it exists for both supported speed modes.
8557cd1e30SMika Westerberg 	 */
860b26c845SMika Westerberg 	dw_i2c_acpi_params(pdev, "SSCN", &dev->ss_hcnt, &dev->ss_lcnt, NULL);
8757cd1e30SMika Westerberg 	dw_i2c_acpi_params(pdev, "FMCN", &dev->fs_hcnt, &dev->fs_lcnt,
880b26c845SMika Westerberg 			   &dev->sda_hold_time);
8957cd1e30SMika Westerberg 
90a445900cSCarl Peng 	/*
91a445900cSCarl Peng 	 * Provide a way for Designware I2C host controllers that are not
92a445900cSCarl Peng 	 * based on Intel LPSS to specify their input clock frequency via
93a445900cSCarl Peng 	 * id->driver_data.
94a445900cSCarl Peng 	 */
95a445900cSCarl Peng 	id = acpi_match_device(pdev->dev.driver->acpi_match_table, &pdev->dev);
96a445900cSCarl Peng 	if (id && id->driver_data)
97a445900cSCarl Peng 		clk_register_fixed_rate(&pdev->dev, dev_name(&pdev->dev), NULL,
98a445900cSCarl Peng 					CLK_IS_ROOT, id->driver_data);
99a445900cSCarl Peng 
100b61b1415SMika Westerberg 	return 0;
101b61b1415SMika Westerberg }
102b61b1415SMika Westerberg 
103a445900cSCarl Peng static void dw_i2c_acpi_unconfigure(struct platform_device *pdev)
104a445900cSCarl Peng {
105a445900cSCarl Peng 	struct dw_i2c_dev *dev = platform_get_drvdata(pdev);
106a445900cSCarl Peng 	const struct acpi_device_id *id;
107a445900cSCarl Peng 
108a445900cSCarl Peng 	id = acpi_match_device(pdev->dev.driver->acpi_match_table, &pdev->dev);
109a445900cSCarl Peng 	if (id && id->driver_data)
110a445900cSCarl Peng 		clk_unregister(dev->clk);
111a445900cSCarl Peng }
112a445900cSCarl Peng 
113b61b1415SMika Westerberg static const struct acpi_device_id dw_i2c_acpi_match[] = {
114b61b1415SMika Westerberg 	{ "INT33C2", 0 },
115b61b1415SMika Westerberg 	{ "INT33C3", 0 },
11625b3dfc8SMika Westerberg 	{ "INT3432", 0 },
11725b3dfc8SMika Westerberg 	{ "INT3433", 0 },
1185a7e6bd8SMika Westerberg 	{ "80860F41", 0 },
1190409516aSAlan Cox 	{ "808622C1", 0 },
120a445900cSCarl Peng 	{ "AMD0010", 133 * 1000 * 1000 },
121b61b1415SMika Westerberg 	{ }
122b61b1415SMika Westerberg };
123b61b1415SMika Westerberg MODULE_DEVICE_TABLE(acpi, dw_i2c_acpi_match);
124b61b1415SMika Westerberg #else
125b61b1415SMika Westerberg static inline int dw_i2c_acpi_configure(struct platform_device *pdev)
126b61b1415SMika Westerberg {
127b61b1415SMika Westerberg 	return -ENODEV;
128b61b1415SMika Westerberg }
129a445900cSCarl Peng static inline void dw_i2c_acpi_unconfigure(struct platform_device *pdev) { }
130b61b1415SMika Westerberg #endif
131b61b1415SMika Westerberg 
1326ad6fde3SJarkko Nikula static int dw_i2c_plat_probe(struct platform_device *pdev)
1332373f6b9SDirk Brandewie {
1342373f6b9SDirk Brandewie 	struct dw_i2c_dev *dev;
1352373f6b9SDirk Brandewie 	struct i2c_adapter *adap;
1361cb715caSAndy Shevchenko 	struct resource *mem;
1374bcfda09STan, Raymond 	struct dw_i2c_platform_data *pdata;
1382373f6b9SDirk Brandewie 	int irq, r;
139925ddb24SMika Westerberg 	u32 clk_freq, ht = 0;
1402373f6b9SDirk Brandewie 
1412373f6b9SDirk Brandewie 	irq = platform_get_irq(pdev, 0);
142b20d3864SAlexey Brodkin 	if (irq < 0)
143b20d3864SAlexey Brodkin 		return irq;
1442373f6b9SDirk Brandewie 
1451cb715caSAndy Shevchenko 	dev = devm_kzalloc(&pdev->dev, sizeof(struct dw_i2c_dev), GFP_KERNEL);
1461cb715caSAndy Shevchenko 	if (!dev)
1471cb715caSAndy Shevchenko 		return -ENOMEM;
1482373f6b9SDirk Brandewie 
1493cc2d009SWolfram Sang 	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1501cb715caSAndy Shevchenko 	dev->base = devm_ioremap_resource(&pdev->dev, mem);
1511cb715caSAndy Shevchenko 	if (IS_ERR(dev->base))
1521cb715caSAndy Shevchenko 		return PTR_ERR(dev->base);
1532373f6b9SDirk Brandewie 
1541cb715caSAndy Shevchenko 	dev->dev = &pdev->dev;
1552373f6b9SDirk Brandewie 	dev->irq = irq;
1562373f6b9SDirk Brandewie 	platform_set_drvdata(pdev, dev);
1572373f6b9SDirk Brandewie 
1588e5f6b2aSRomain Baeriswyl 	/* fast mode by default because of legacy reasons */
1598e5f6b2aSRomain Baeriswyl 	clk_freq = 400000;
1608e5f6b2aSRomain Baeriswyl 
161ca5b74d2SRafael J. Wysocki 	if (has_acpi_companion(&pdev->dev)) {
162925ddb24SMika Westerberg 		dw_i2c_acpi_configure(pdev);
163925ddb24SMika Westerberg 	} else if (pdev->dev.of_node) {
1649803f868SChristian Ruppert 		of_property_read_u32(pdev->dev.of_node,
1659803f868SChristian Ruppert 					"i2c-sda-hold-time-ns", &ht);
1666468276bSRomain Baeriswyl 
1676468276bSRomain Baeriswyl 		of_property_read_u32(pdev->dev.of_node,
1686468276bSRomain Baeriswyl 				     "i2c-sda-falling-time-ns",
1696468276bSRomain Baeriswyl 				     &dev->sda_falling_time);
1706468276bSRomain Baeriswyl 		of_property_read_u32(pdev->dev.of_node,
1716468276bSRomain Baeriswyl 				     "i2c-scl-falling-time-ns",
1726468276bSRomain Baeriswyl 				     &dev->scl_falling_time);
1738e5f6b2aSRomain Baeriswyl 
1748e5f6b2aSRomain Baeriswyl 		of_property_read_u32(pdev->dev.of_node, "clock-frequency",
1758e5f6b2aSRomain Baeriswyl 				     &clk_freq);
1768e5f6b2aSRomain Baeriswyl 
1778e5f6b2aSRomain Baeriswyl 		/* Only standard mode at 100kHz and fast mode at 400kHz
1788e5f6b2aSRomain Baeriswyl 		 * are supported.
1798e5f6b2aSRomain Baeriswyl 		 */
1808e5f6b2aSRomain Baeriswyl 		if (clk_freq != 100000 && clk_freq != 400000) {
1818e5f6b2aSRomain Baeriswyl 			dev_err(&pdev->dev, "Only 100kHz and 400kHz supported");
1828e5f6b2aSRomain Baeriswyl 			return -EINVAL;
1838e5f6b2aSRomain Baeriswyl 		}
1844bcfda09STan, Raymond 	} else {
1854bcfda09STan, Raymond 		pdata = dev_get_platdata(&pdev->dev);
1864bcfda09STan, Raymond 		if (pdata)
1874bcfda09STan, Raymond 			clk_freq = pdata->i2c_scl_freq;
1889803f868SChristian Ruppert 	}
1899803f868SChristian Ruppert 
190894acb2fSDavid Box 	r = i2c_dw_eval_lock_support(dev);
191894acb2fSDavid Box 	if (r)
192894acb2fSDavid Box 		return r;
193894acb2fSDavid Box 
1942fa8326bSDirk Brandewie 	dev->functionality =
1952fa8326bSDirk Brandewie 		I2C_FUNC_I2C |
1962fa8326bSDirk Brandewie 		I2C_FUNC_10BIT_ADDR |
1972fa8326bSDirk Brandewie 		I2C_FUNC_SMBUS_BYTE |
1982fa8326bSDirk Brandewie 		I2C_FUNC_SMBUS_BYTE_DATA |
1992fa8326bSDirk Brandewie 		I2C_FUNC_SMBUS_WORD_DATA |
2002fa8326bSDirk Brandewie 		I2C_FUNC_SMBUS_I2C_BLOCK;
2018e5f6b2aSRomain Baeriswyl 	if (clk_freq == 100000)
2028e5f6b2aSRomain Baeriswyl 		dev->master_cfg =  DW_IC_CON_MASTER | DW_IC_CON_SLAVE_DISABLE |
2038e5f6b2aSRomain Baeriswyl 			DW_IC_CON_RESTART_EN | DW_IC_CON_SPEED_STD;
2048e5f6b2aSRomain Baeriswyl 	else
205e18563fcSDirk Brandewie 		dev->master_cfg =  DW_IC_CON_MASTER | DW_IC_CON_SLAVE_DISABLE |
206e18563fcSDirk Brandewie 			DW_IC_CON_RESTART_EN | DW_IC_CON_SPEED_FAST;
2072fa8326bSDirk Brandewie 
208925ddb24SMika Westerberg 	dev->clk = devm_clk_get(&pdev->dev, NULL);
209925ddb24SMika Westerberg 	dev->get_clk_rate_khz = i2c_dw_get_clk_rate_khz;
210925ddb24SMika Westerberg 	if (IS_ERR(dev->clk))
211925ddb24SMika Westerberg 		return PTR_ERR(dev->clk);
212925ddb24SMika Westerberg 	clk_prepare_enable(dev->clk);
213925ddb24SMika Westerberg 
214925ddb24SMika Westerberg 	if (!dev->sda_hold_time && ht) {
215925ddb24SMika Westerberg 		u32 ic_clk = dev->get_clk_rate_khz(dev);
216925ddb24SMika Westerberg 
217925ddb24SMika Westerberg 		dev->sda_hold_time = div_u64((u64)ic_clk * ht + 500000,
218925ddb24SMika Westerberg 					     1000000);
219925ddb24SMika Westerberg 	}
220925ddb24SMika Westerberg 
221925ddb24SMika Westerberg 	if (!dev->tx_fifo_depth) {
222f3fa9f3dSDirk Brandewie 		u32 param1 = i2c_dw_read_comp_param(dev);
2232373f6b9SDirk Brandewie 
2242373f6b9SDirk Brandewie 		dev->tx_fifo_depth = ((param1 >> 16) & 0xff) + 1;
2252373f6b9SDirk Brandewie 		dev->rx_fifo_depth = ((param1 >> 8)  & 0xff) + 1;
226b61b1415SMika Westerberg 		dev->adapter.nr = pdev->id;
2272373f6b9SDirk Brandewie 	}
2282373f6b9SDirk Brandewie 
2292373f6b9SDirk Brandewie 	adap = &dev->adapter;
2302373f6b9SDirk Brandewie 	adap->owner = THIS_MODULE;
23170fba830SWolfram Sang 	adap->class = I2C_CLASS_DEPRECATED;
232af71100cSRob Herring 	adap->dev.of_node = pdev->dev.of_node;
2332373f6b9SDirk Brandewie 
234d80d1341SJarkko Nikula 	r = i2c_dw_probe(dev);
235d80d1341SJarkko Nikula 	if (r)
2361cb715caSAndy Shevchenko 		return r;
2372373f6b9SDirk Brandewie 
238894acb2fSDavid Box 	if (dev->pm_runtime_disabled) {
239894acb2fSDavid Box 		pm_runtime_forbid(&pdev->dev);
240894acb2fSDavid Box 	} else {
24143452335SMika Westerberg 		pm_runtime_set_autosuspend_delay(&pdev->dev, 1000);
24243452335SMika Westerberg 		pm_runtime_use_autosuspend(&pdev->dev);
2437272194eSMika Westerberg 		pm_runtime_set_active(&pdev->dev);
2447272194eSMika Westerberg 		pm_runtime_enable(&pdev->dev);
245894acb2fSDavid Box 	}
2467272194eSMika Westerberg 
2472373f6b9SDirk Brandewie 	return 0;
2482373f6b9SDirk Brandewie }
2492373f6b9SDirk Brandewie 
2506ad6fde3SJarkko Nikula static int dw_i2c_plat_remove(struct platform_device *pdev)
2512373f6b9SDirk Brandewie {
2522373f6b9SDirk Brandewie 	struct dw_i2c_dev *dev = platform_get_drvdata(pdev);
2532373f6b9SDirk Brandewie 
2547272194eSMika Westerberg 	pm_runtime_get_sync(&pdev->dev);
2557272194eSMika Westerberg 
2562373f6b9SDirk Brandewie 	i2c_del_adapter(&dev->adapter);
2572373f6b9SDirk Brandewie 
258f3fa9f3dSDirk Brandewie 	i2c_dw_disable(dev);
2592373f6b9SDirk Brandewie 
260edfc3901SMika Westerberg 	pm_runtime_dont_use_autosuspend(&pdev->dev);
261edfc3901SMika Westerberg 	pm_runtime_put_sync(&pdev->dev);
2627272194eSMika Westerberg 	pm_runtime_disable(&pdev->dev);
2637272194eSMika Westerberg 
264ca5b74d2SRafael J. Wysocki 	if (has_acpi_companion(&pdev->dev))
265a445900cSCarl Peng 		dw_i2c_acpi_unconfigure(pdev);
266a445900cSCarl Peng 
2672373f6b9SDirk Brandewie 	return 0;
2682373f6b9SDirk Brandewie }
2692373f6b9SDirk Brandewie 
270af71100cSRob Herring #ifdef CONFIG_OF
271af71100cSRob Herring static const struct of_device_id dw_i2c_of_match[] = {
272af71100cSRob Herring 	{ .compatible = "snps,designware-i2c", },
273af71100cSRob Herring 	{},
274af71100cSRob Herring };
275af71100cSRob Herring MODULE_DEVICE_TABLE(of, dw_i2c_of_match);
276af71100cSRob Herring #endif
277af71100cSRob Herring 
2788503ff16SJisheng Zhang #ifdef CONFIG_PM_SLEEP
2796ad6fde3SJarkko Nikula static int dw_i2c_plat_prepare(struct device *dev)
2808503ff16SJisheng Zhang {
2818503ff16SJisheng Zhang 	return pm_runtime_suspended(dev);
2828503ff16SJisheng Zhang }
2838503ff16SJisheng Zhang 
2846ad6fde3SJarkko Nikula static void dw_i2c_plat_complete(struct device *dev)
2858503ff16SJisheng Zhang {
2868503ff16SJisheng Zhang 	if (dev->power.direct_complete)
2878503ff16SJisheng Zhang 		pm_request_resume(dev);
2888503ff16SJisheng Zhang }
2898503ff16SJisheng Zhang #else
2908503ff16SJisheng Zhang #define dw_i2c_prepare	NULL
2918503ff16SJisheng Zhang #define dw_i2c_complete	NULL
2928503ff16SJisheng Zhang #endif
2938503ff16SJisheng Zhang 
2941fc2fe20SMika Westerberg #ifdef CONFIG_PM
2956ad6fde3SJarkko Nikula static int dw_i2c_plat_suspend(struct device *dev)
2963bf3b289SDeepak Sikri {
2973bf3b289SDeepak Sikri 	struct platform_device *pdev = to_platform_device(dev);
2983bf3b289SDeepak Sikri 	struct dw_i2c_dev *i_dev = platform_get_drvdata(pdev);
2993bf3b289SDeepak Sikri 
300f537295aSMika Westerberg 	i2c_dw_disable(i_dev);
301e1fac69fSViresh Kumar 	clk_disable_unprepare(i_dev->clk);
3023bf3b289SDeepak Sikri 
3033bf3b289SDeepak Sikri 	return 0;
3043bf3b289SDeepak Sikri }
3053bf3b289SDeepak Sikri 
3066ad6fde3SJarkko Nikula static int dw_i2c_plat_resume(struct device *dev)
3073bf3b289SDeepak Sikri {
3083bf3b289SDeepak Sikri 	struct platform_device *pdev = to_platform_device(dev);
3093bf3b289SDeepak Sikri 	struct dw_i2c_dev *i_dev = platform_get_drvdata(pdev);
3103bf3b289SDeepak Sikri 
311e1fac69fSViresh Kumar 	clk_prepare_enable(i_dev->clk);
312894acb2fSDavid Box 
313894acb2fSDavid Box 	if (!i_dev->pm_runtime_disabled)
3143bf3b289SDeepak Sikri 		i2c_dw_init(i_dev);
3153bf3b289SDeepak Sikri 
3163bf3b289SDeepak Sikri 	return 0;
3173bf3b289SDeepak Sikri }
3183bf3b289SDeepak Sikri 
3198503ff16SJisheng Zhang static const struct dev_pm_ops dw_i2c_dev_pm_ops = {
3206ad6fde3SJarkko Nikula 	.prepare = dw_i2c_plat_prepare,
3216ad6fde3SJarkko Nikula 	.complete = dw_i2c_plat_complete,
3226ad6fde3SJarkko Nikula 	SET_SYSTEM_SLEEP_PM_OPS(dw_i2c_plat_suspend, dw_i2c_plat_resume)
3236ad6fde3SJarkko Nikula 	SET_RUNTIME_PM_OPS(dw_i2c_plat_suspend, dw_i2c_plat_resume, NULL)
3248503ff16SJisheng Zhang };
3258503ff16SJisheng Zhang 
3268503ff16SJisheng Zhang #define DW_I2C_DEV_PMOPS (&dw_i2c_dev_pm_ops)
3278503ff16SJisheng Zhang #else
3288503ff16SJisheng Zhang #define DW_I2C_DEV_PMOPS NULL
3298503ff16SJisheng Zhang #endif
3301fc2fe20SMika Westerberg 
3312373f6b9SDirk Brandewie /* work with hotplug and coldplug */
3322373f6b9SDirk Brandewie MODULE_ALIAS("platform:i2c_designware");
3332373f6b9SDirk Brandewie 
3342373f6b9SDirk Brandewie static struct platform_driver dw_i2c_driver = {
3356ad6fde3SJarkko Nikula 	.probe = dw_i2c_plat_probe,
3366ad6fde3SJarkko Nikula 	.remove = dw_i2c_plat_remove,
3372373f6b9SDirk Brandewie 	.driver		= {
3382373f6b9SDirk Brandewie 		.name	= "i2c_designware",
339af71100cSRob Herring 		.of_match_table = of_match_ptr(dw_i2c_of_match),
340b61b1415SMika Westerberg 		.acpi_match_table = ACPI_PTR(dw_i2c_acpi_match),
3418503ff16SJisheng Zhang 		.pm	= DW_I2C_DEV_PMOPS,
3422373f6b9SDirk Brandewie 	},
3432373f6b9SDirk Brandewie };
3442373f6b9SDirk Brandewie 
3452373f6b9SDirk Brandewie static int __init dw_i2c_init_driver(void)
3462373f6b9SDirk Brandewie {
347cccdcea1SWolfram Sang 	return platform_driver_register(&dw_i2c_driver);
3482373f6b9SDirk Brandewie }
34910452280SPratyush Anand subsys_initcall(dw_i2c_init_driver);
3502373f6b9SDirk Brandewie 
3512373f6b9SDirk Brandewie static void __exit dw_i2c_exit_driver(void)
3522373f6b9SDirk Brandewie {
3532373f6b9SDirk Brandewie 	platform_driver_unregister(&dw_i2c_driver);
3542373f6b9SDirk Brandewie }
3552373f6b9SDirk Brandewie module_exit(dw_i2c_exit_driver);
3562373f6b9SDirk Brandewie 
3572373f6b9SDirk Brandewie MODULE_AUTHOR("Baruch Siach <baruch@tkos.co.il>");
3582373f6b9SDirk Brandewie MODULE_DESCRIPTION("Synopsys DesignWare I2C bus adapter");
3592373f6b9SDirk Brandewie MODULE_LICENSE("GPL");
360