1ad7d142fSJuergen Fitschen // SPDX-License-Identifier: GPL-2.0 2ad7d142fSJuergen Fitschen /* 3ad7d142fSJuergen Fitschen * i2c Support for Atmel's AT91 Two-Wire Interface (TWI) 4ad7d142fSJuergen Fitschen * 5ad7d142fSJuergen Fitschen * Copyright (C) 2011 Weinmann Medical GmbH 6ad7d142fSJuergen Fitschen * Author: Nikolaus Voss <n.voss@weinmann.de> 7ad7d142fSJuergen Fitschen * 8ad7d142fSJuergen Fitschen * Evolved from original work by: 9ad7d142fSJuergen Fitschen * Copyright (C) 2004 Rick Bronson 10ad7d142fSJuergen Fitschen * Converted to 2.6 by Andrew Victor <andrew@sanpeople.com> 11ad7d142fSJuergen Fitschen * 12ad7d142fSJuergen Fitschen * Borrowed heavily from original work by: 13ad7d142fSJuergen Fitschen * Copyright (C) 2000 Philip Edelbrock <phil@stimpy.netroedge.com> 14ad7d142fSJuergen Fitschen */ 15ad7d142fSJuergen Fitschen 16ad7d142fSJuergen Fitschen #include <linux/clk.h> 17ad7d142fSJuergen Fitschen #include <linux/err.h> 18ad7d142fSJuergen Fitschen #include <linux/i2c.h> 19ad7d142fSJuergen Fitschen #include <linux/io.h> 20ad7d142fSJuergen Fitschen #include <linux/module.h> 21ad7d142fSJuergen Fitschen #include <linux/of.h> 22ad7d142fSJuergen Fitschen #include <linux/platform_device.h> 23ad7d142fSJuergen Fitschen #include <linux/pm_runtime.h> 24ad7d142fSJuergen Fitschen #include <linux/pinctrl/consumer.h> 25ad7d142fSJuergen Fitschen 26ad7d142fSJuergen Fitschen #include "i2c-at91.h" 27ad7d142fSJuergen Fitschen 28ad7d142fSJuergen Fitschen unsigned at91_twi_read(struct at91_twi_dev *dev, unsigned reg) 29ad7d142fSJuergen Fitschen { 30ad7d142fSJuergen Fitschen return readl_relaxed(dev->base + reg); 31ad7d142fSJuergen Fitschen } 32ad7d142fSJuergen Fitschen 33ad7d142fSJuergen Fitschen void at91_twi_write(struct at91_twi_dev *dev, unsigned reg, unsigned val) 34ad7d142fSJuergen Fitschen { 35ad7d142fSJuergen Fitschen writel_relaxed(val, dev->base + reg); 36ad7d142fSJuergen Fitschen } 37ad7d142fSJuergen Fitschen 38ad7d142fSJuergen Fitschen void at91_disable_twi_interrupts(struct at91_twi_dev *dev) 39ad7d142fSJuergen Fitschen { 40ad7d142fSJuergen Fitschen at91_twi_write(dev, AT91_TWI_IDR, AT91_TWI_INT_MASK); 41ad7d142fSJuergen Fitschen } 42ad7d142fSJuergen Fitschen 43ad7d142fSJuergen Fitschen void at91_twi_irq_save(struct at91_twi_dev *dev) 44ad7d142fSJuergen Fitschen { 45ad7d142fSJuergen Fitschen dev->imr = at91_twi_read(dev, AT91_TWI_IMR) & AT91_TWI_INT_MASK; 46ad7d142fSJuergen Fitschen at91_disable_twi_interrupts(dev); 47ad7d142fSJuergen Fitschen } 48ad7d142fSJuergen Fitschen 49ad7d142fSJuergen Fitschen void at91_twi_irq_restore(struct at91_twi_dev *dev) 50ad7d142fSJuergen Fitschen { 51ad7d142fSJuergen Fitschen at91_twi_write(dev, AT91_TWI_IER, dev->imr); 52ad7d142fSJuergen Fitschen } 53ad7d142fSJuergen Fitschen 54ad7d142fSJuergen Fitschen void at91_init_twi_bus(struct at91_twi_dev *dev) 55ad7d142fSJuergen Fitschen { 56ad7d142fSJuergen Fitschen at91_disable_twi_interrupts(dev); 57ad7d142fSJuergen Fitschen at91_twi_write(dev, AT91_TWI_CR, AT91_TWI_SWRST); 589d3ca54bSJuergen Fitschen if (dev->slave_detected) 599d3ca54bSJuergen Fitschen at91_init_twi_bus_slave(dev); 609d3ca54bSJuergen Fitschen else 61ad7d142fSJuergen Fitschen at91_init_twi_bus_master(dev); 62ad7d142fSJuergen Fitschen } 63ad7d142fSJuergen Fitschen 64ad7d142fSJuergen Fitschen static struct at91_twi_pdata at91rm9200_config = { 65ad7d142fSJuergen Fitschen .clk_max_div = 5, 66ad7d142fSJuergen Fitschen .clk_offset = 3, 67ad7d142fSJuergen Fitschen .has_unre_flag = true, 68ad7d142fSJuergen Fitschen }; 69ad7d142fSJuergen Fitschen 70ad7d142fSJuergen Fitschen static struct at91_twi_pdata at91sam9261_config = { 71ad7d142fSJuergen Fitschen .clk_max_div = 5, 72ad7d142fSJuergen Fitschen .clk_offset = 4, 73ad7d142fSJuergen Fitschen }; 74ad7d142fSJuergen Fitschen 75ad7d142fSJuergen Fitschen static struct at91_twi_pdata at91sam9260_config = { 76ad7d142fSJuergen Fitschen .clk_max_div = 7, 77ad7d142fSJuergen Fitschen .clk_offset = 4, 78ad7d142fSJuergen Fitschen }; 79ad7d142fSJuergen Fitschen 80ad7d142fSJuergen Fitschen static struct at91_twi_pdata at91sam9g20_config = { 81ad7d142fSJuergen Fitschen .clk_max_div = 7, 82ad7d142fSJuergen Fitschen .clk_offset = 4, 83ad7d142fSJuergen Fitschen }; 84ad7d142fSJuergen Fitschen 85ad7d142fSJuergen Fitschen static struct at91_twi_pdata at91sam9g10_config = { 86ad7d142fSJuergen Fitschen .clk_max_div = 7, 87ad7d142fSJuergen Fitschen .clk_offset = 4, 88ad7d142fSJuergen Fitschen }; 89ad7d142fSJuergen Fitschen 90ad7d142fSJuergen Fitschen static const struct platform_device_id at91_twi_devtypes[] = { 91ad7d142fSJuergen Fitschen { 92ad7d142fSJuergen Fitschen .name = "i2c-at91rm9200", 93ad7d142fSJuergen Fitschen .driver_data = (unsigned long) &at91rm9200_config, 94ad7d142fSJuergen Fitschen }, { 95ad7d142fSJuergen Fitschen .name = "i2c-at91sam9261", 96ad7d142fSJuergen Fitschen .driver_data = (unsigned long) &at91sam9261_config, 97ad7d142fSJuergen Fitschen }, { 98ad7d142fSJuergen Fitschen .name = "i2c-at91sam9260", 99ad7d142fSJuergen Fitschen .driver_data = (unsigned long) &at91sam9260_config, 100ad7d142fSJuergen Fitschen }, { 101ad7d142fSJuergen Fitschen .name = "i2c-at91sam9g20", 102ad7d142fSJuergen Fitschen .driver_data = (unsigned long) &at91sam9g20_config, 103ad7d142fSJuergen Fitschen }, { 104ad7d142fSJuergen Fitschen .name = "i2c-at91sam9g10", 105ad7d142fSJuergen Fitschen .driver_data = (unsigned long) &at91sam9g10_config, 106ad7d142fSJuergen Fitschen }, { 107ad7d142fSJuergen Fitschen /* sentinel */ 108ad7d142fSJuergen Fitschen } 109ad7d142fSJuergen Fitschen }; 110ad7d142fSJuergen Fitschen 111ad7d142fSJuergen Fitschen #if defined(CONFIG_OF) 112ad7d142fSJuergen Fitschen static struct at91_twi_pdata at91sam9x5_config = { 113ad7d142fSJuergen Fitschen .clk_max_div = 7, 114ad7d142fSJuergen Fitschen .clk_offset = 4, 115ad7d142fSJuergen Fitschen }; 116ad7d142fSJuergen Fitschen 117ad7d142fSJuergen Fitschen static struct at91_twi_pdata sama5d4_config = { 118ad7d142fSJuergen Fitschen .clk_max_div = 7, 119ad7d142fSJuergen Fitschen .clk_offset = 4, 120ad7d142fSJuergen Fitschen .has_hold_field = true, 1212989b459SEugen Hristev .has_dig_filtr = true, 122ad7d142fSJuergen Fitschen }; 123ad7d142fSJuergen Fitschen 124ad7d142fSJuergen Fitschen static struct at91_twi_pdata sama5d2_config = { 125ad7d142fSJuergen Fitschen .clk_max_div = 7, 126b1ac6704SMichał Mirosław .clk_offset = 3, 127ad7d142fSJuergen Fitschen .has_unre_flag = true, 128ad7d142fSJuergen Fitschen .has_alt_cmd = true, 129ad7d142fSJuergen Fitschen .has_hold_field = true, 1302989b459SEugen Hristev .has_dig_filtr = true, 1312be357afSEugen Hristev .has_adv_dig_filtr = true, 132dda96713SEugen Hristev .has_ana_filtr = true, 13373371d5fSCodrin Ciubotariu .has_clear_cmd = false, /* due to errata, CLEAR cmd is not working */ 134ad7d142fSJuergen Fitschen }; 135ad7d142fSJuergen Fitschen 136b0027792SEugen Hristev static struct at91_twi_pdata sam9x60_config = { 137b0027792SEugen Hristev .clk_max_div = 7, 138b7169a57SEugen Hristev .clk_offset = 3, 139b0027792SEugen Hristev .has_unre_flag = true, 140b0027792SEugen Hristev .has_alt_cmd = true, 141b0027792SEugen Hristev .has_hold_field = true, 1422989b459SEugen Hristev .has_dig_filtr = true, 1432be357afSEugen Hristev .has_adv_dig_filtr = true, 144dda96713SEugen Hristev .has_ana_filtr = true, 14573371d5fSCodrin Ciubotariu .has_clear_cmd = true, 146b0027792SEugen Hristev }; 147b0027792SEugen Hristev 148ad7d142fSJuergen Fitschen static const struct of_device_id atmel_twi_dt_ids[] = { 149ad7d142fSJuergen Fitschen { 150ad7d142fSJuergen Fitschen .compatible = "atmel,at91rm9200-i2c", 151ad7d142fSJuergen Fitschen .data = &at91rm9200_config, 152ad7d142fSJuergen Fitschen }, { 153ad7d142fSJuergen Fitschen .compatible = "atmel,at91sam9260-i2c", 154ad7d142fSJuergen Fitschen .data = &at91sam9260_config, 155ad7d142fSJuergen Fitschen }, { 156ad7d142fSJuergen Fitschen .compatible = "atmel,at91sam9261-i2c", 157ad7d142fSJuergen Fitschen .data = &at91sam9261_config, 158ad7d142fSJuergen Fitschen }, { 159ad7d142fSJuergen Fitschen .compatible = "atmel,at91sam9g20-i2c", 160ad7d142fSJuergen Fitschen .data = &at91sam9g20_config, 161ad7d142fSJuergen Fitschen }, { 162ad7d142fSJuergen Fitschen .compatible = "atmel,at91sam9g10-i2c", 163ad7d142fSJuergen Fitschen .data = &at91sam9g10_config, 164ad7d142fSJuergen Fitschen }, { 165ad7d142fSJuergen Fitschen .compatible = "atmel,at91sam9x5-i2c", 166ad7d142fSJuergen Fitschen .data = &at91sam9x5_config, 167ad7d142fSJuergen Fitschen }, { 168ad7d142fSJuergen Fitschen .compatible = "atmel,sama5d4-i2c", 169ad7d142fSJuergen Fitschen .data = &sama5d4_config, 170ad7d142fSJuergen Fitschen }, { 171ad7d142fSJuergen Fitschen .compatible = "atmel,sama5d2-i2c", 172ad7d142fSJuergen Fitschen .data = &sama5d2_config, 173ad7d142fSJuergen Fitschen }, { 174b0027792SEugen Hristev .compatible = "microchip,sam9x60-i2c", 175b0027792SEugen Hristev .data = &sam9x60_config, 176b0027792SEugen Hristev }, { 177ad7d142fSJuergen Fitschen /* sentinel */ 178ad7d142fSJuergen Fitschen } 179ad7d142fSJuergen Fitschen }; 180ad7d142fSJuergen Fitschen MODULE_DEVICE_TABLE(of, atmel_twi_dt_ids); 181ad7d142fSJuergen Fitschen #endif 182ad7d142fSJuergen Fitschen 183ad7d142fSJuergen Fitschen static struct at91_twi_pdata *at91_twi_get_driver_data( 184ad7d142fSJuergen Fitschen struct platform_device *pdev) 185ad7d142fSJuergen Fitschen { 186ad7d142fSJuergen Fitschen if (pdev->dev.of_node) { 187ad7d142fSJuergen Fitschen const struct of_device_id *match; 188ad7d142fSJuergen Fitschen match = of_match_node(atmel_twi_dt_ids, pdev->dev.of_node); 189ad7d142fSJuergen Fitschen if (!match) 190ad7d142fSJuergen Fitschen return NULL; 191ad7d142fSJuergen Fitschen return (struct at91_twi_pdata *)match->data; 192ad7d142fSJuergen Fitschen } 193ad7d142fSJuergen Fitschen return (struct at91_twi_pdata *) platform_get_device_id(pdev)->driver_data; 194ad7d142fSJuergen Fitschen } 195ad7d142fSJuergen Fitschen 196ad7d142fSJuergen Fitschen static int at91_twi_probe(struct platform_device *pdev) 197ad7d142fSJuergen Fitschen { 198ad7d142fSJuergen Fitschen struct at91_twi_dev *dev; 199ad7d142fSJuergen Fitschen struct resource *mem; 200ad7d142fSJuergen Fitschen int rc; 201ad7d142fSJuergen Fitschen u32 phy_addr; 202ad7d142fSJuergen Fitschen 203ad7d142fSJuergen Fitschen dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL); 204ad7d142fSJuergen Fitschen if (!dev) 205ad7d142fSJuergen Fitschen return -ENOMEM; 206ad7d142fSJuergen Fitschen 207ad7d142fSJuergen Fitschen dev->dev = &pdev->dev; 208ad7d142fSJuergen Fitschen 209*0a310eefSYangtao Li dev->base = devm_platform_get_and_ioremap_resource(pdev, 0, &mem); 210*0a310eefSYangtao Li if (IS_ERR(dev->base)) 211*0a310eefSYangtao Li return PTR_ERR(dev->base); 212ad7d142fSJuergen Fitschen phy_addr = mem->start; 213ad7d142fSJuergen Fitschen 214ad7d142fSJuergen Fitschen dev->pdata = at91_twi_get_driver_data(pdev); 215ad7d142fSJuergen Fitschen if (!dev->pdata) 216ad7d142fSJuergen Fitschen return -ENODEV; 217ad7d142fSJuergen Fitschen 218ad7d142fSJuergen Fitschen dev->irq = platform_get_irq(pdev, 0); 219ad7d142fSJuergen Fitschen if (dev->irq < 0) 220ad7d142fSJuergen Fitschen return dev->irq; 221ad7d142fSJuergen Fitschen 222ad7d142fSJuergen Fitschen platform_set_drvdata(pdev, dev); 223ad7d142fSJuergen Fitschen 224ad7d142fSJuergen Fitschen dev->clk = devm_clk_get(dev->dev, NULL); 225ad7d142fSJuergen Fitschen if (IS_ERR(dev->clk)) { 226ad7d142fSJuergen Fitschen dev_err(dev->dev, "no clock defined\n"); 227ad7d142fSJuergen Fitschen return -ENODEV; 228ad7d142fSJuergen Fitschen } 229ad7d142fSJuergen Fitschen clk_prepare_enable(dev->clk); 230ad7d142fSJuergen Fitschen 231ad7d142fSJuergen Fitschen snprintf(dev->adapter.name, sizeof(dev->adapter.name), "AT91"); 232ad7d142fSJuergen Fitschen i2c_set_adapdata(&dev->adapter, dev); 233ad7d142fSJuergen Fitschen dev->adapter.owner = THIS_MODULE; 234ad7d142fSJuergen Fitschen dev->adapter.class = I2C_CLASS_DEPRECATED; 235ad7d142fSJuergen Fitschen dev->adapter.dev.parent = dev->dev; 236ad7d142fSJuergen Fitschen dev->adapter.nr = pdev->id; 237ad7d142fSJuergen Fitschen dev->adapter.timeout = AT91_I2C_TIMEOUT; 238ad7d142fSJuergen Fitschen dev->adapter.dev.of_node = pdev->dev.of_node; 239ad7d142fSJuergen Fitschen 2409d3ca54bSJuergen Fitschen dev->slave_detected = i2c_detect_slave_mode(&pdev->dev); 2419d3ca54bSJuergen Fitschen 2429d3ca54bSJuergen Fitschen if (dev->slave_detected) 2439d3ca54bSJuergen Fitschen rc = at91_twi_probe_slave(pdev, phy_addr, dev); 2449d3ca54bSJuergen Fitschen else 245ad7d142fSJuergen Fitschen rc = at91_twi_probe_master(pdev, phy_addr, dev); 246ad7d142fSJuergen Fitschen if (rc) 247ad7d142fSJuergen Fitschen return rc; 248ad7d142fSJuergen Fitschen 249ad7d142fSJuergen Fitschen at91_init_twi_bus(dev); 250ad7d142fSJuergen Fitschen 251ad7d142fSJuergen Fitschen pm_runtime_set_autosuspend_delay(dev->dev, AUTOSUSPEND_TIMEOUT); 252ad7d142fSJuergen Fitschen pm_runtime_use_autosuspend(dev->dev); 253ad7d142fSJuergen Fitschen pm_runtime_set_active(dev->dev); 254ad7d142fSJuergen Fitschen pm_runtime_enable(dev->dev); 255ad7d142fSJuergen Fitschen 256ad7d142fSJuergen Fitschen rc = i2c_add_numbered_adapter(&dev->adapter); 257ad7d142fSJuergen Fitschen if (rc) { 258ad7d142fSJuergen Fitschen clk_disable_unprepare(dev->clk); 259ad7d142fSJuergen Fitschen 260ad7d142fSJuergen Fitschen pm_runtime_disable(dev->dev); 261ad7d142fSJuergen Fitschen pm_runtime_set_suspended(dev->dev); 262ad7d142fSJuergen Fitschen 263ad7d142fSJuergen Fitschen return rc; 264ad7d142fSJuergen Fitschen } 265ad7d142fSJuergen Fitschen 266ad7d142fSJuergen Fitschen dev_info(dev->dev, "AT91 i2c bus driver (hw version: %#x).\n", 267ad7d142fSJuergen Fitschen at91_twi_read(dev, AT91_TWI_VER)); 268ad7d142fSJuergen Fitschen return 0; 269ad7d142fSJuergen Fitschen } 270ad7d142fSJuergen Fitschen 271e190a0c3SUwe Kleine-König static void at91_twi_remove(struct platform_device *pdev) 272ad7d142fSJuergen Fitschen { 273ad7d142fSJuergen Fitschen struct at91_twi_dev *dev = platform_get_drvdata(pdev); 274ad7d142fSJuergen Fitschen 275ad7d142fSJuergen Fitschen i2c_del_adapter(&dev->adapter); 276ad7d142fSJuergen Fitschen clk_disable_unprepare(dev->clk); 277ad7d142fSJuergen Fitschen 278ad7d142fSJuergen Fitschen pm_runtime_disable(dev->dev); 279ad7d142fSJuergen Fitschen pm_runtime_set_suspended(dev->dev); 280ad7d142fSJuergen Fitschen } 281ad7d142fSJuergen Fitschen 282dab4b0e8SClaudiu Beznea static int __maybe_unused at91_twi_runtime_suspend(struct device *dev) 283ad7d142fSJuergen Fitschen { 284ad7d142fSJuergen Fitschen struct at91_twi_dev *twi_dev = dev_get_drvdata(dev); 285ad7d142fSJuergen Fitschen 286ad7d142fSJuergen Fitschen clk_disable_unprepare(twi_dev->clk); 287ad7d142fSJuergen Fitschen 288ad7d142fSJuergen Fitschen pinctrl_pm_select_sleep_state(dev); 289ad7d142fSJuergen Fitschen 290ad7d142fSJuergen Fitschen return 0; 291ad7d142fSJuergen Fitschen } 292ad7d142fSJuergen Fitschen 293dab4b0e8SClaudiu Beznea static int __maybe_unused at91_twi_runtime_resume(struct device *dev) 294ad7d142fSJuergen Fitschen { 295ad7d142fSJuergen Fitschen struct at91_twi_dev *twi_dev = dev_get_drvdata(dev); 296ad7d142fSJuergen Fitschen 297ad7d142fSJuergen Fitschen pinctrl_pm_select_default_state(dev); 298ad7d142fSJuergen Fitschen 299ad7d142fSJuergen Fitschen return clk_prepare_enable(twi_dev->clk); 300ad7d142fSJuergen Fitschen } 301ad7d142fSJuergen Fitschen 302dab4b0e8SClaudiu Beznea static int __maybe_unused at91_twi_suspend_noirq(struct device *dev) 303ad7d142fSJuergen Fitschen { 304ad7d142fSJuergen Fitschen if (!pm_runtime_status_suspended(dev)) 305ad7d142fSJuergen Fitschen at91_twi_runtime_suspend(dev); 306ad7d142fSJuergen Fitschen 307ad7d142fSJuergen Fitschen return 0; 308ad7d142fSJuergen Fitschen } 309ad7d142fSJuergen Fitschen 310dab4b0e8SClaudiu Beznea static int __maybe_unused at91_twi_resume_noirq(struct device *dev) 311ad7d142fSJuergen Fitschen { 312ad7d142fSJuergen Fitschen struct at91_twi_dev *twi_dev = dev_get_drvdata(dev); 313ad7d142fSJuergen Fitschen int ret; 314ad7d142fSJuergen Fitschen 315ad7d142fSJuergen Fitschen if (!pm_runtime_status_suspended(dev)) { 316ad7d142fSJuergen Fitschen ret = at91_twi_runtime_resume(dev); 317ad7d142fSJuergen Fitschen if (ret) 318ad7d142fSJuergen Fitschen return ret; 319ad7d142fSJuergen Fitschen } 320ad7d142fSJuergen Fitschen 321ad7d142fSJuergen Fitschen pm_runtime_mark_last_busy(dev); 322ad7d142fSJuergen Fitschen pm_request_autosuspend(dev); 323ad7d142fSJuergen Fitschen 324ad7d142fSJuergen Fitschen at91_init_twi_bus(twi_dev); 325ad7d142fSJuergen Fitschen 326ad7d142fSJuergen Fitschen return 0; 327ad7d142fSJuergen Fitschen } 328ad7d142fSJuergen Fitschen 329a2c21668SWolfram Sang static const struct dev_pm_ops __maybe_unused at91_twi_pm = { 330ad7d142fSJuergen Fitschen .suspend_noirq = at91_twi_suspend_noirq, 331ad7d142fSJuergen Fitschen .resume_noirq = at91_twi_resume_noirq, 332ad7d142fSJuergen Fitschen .runtime_suspend = at91_twi_runtime_suspend, 333ad7d142fSJuergen Fitschen .runtime_resume = at91_twi_runtime_resume, 334ad7d142fSJuergen Fitschen }; 335ad7d142fSJuergen Fitschen 336ad7d142fSJuergen Fitschen static struct platform_driver at91_twi_driver = { 337ad7d142fSJuergen Fitschen .probe = at91_twi_probe, 338e190a0c3SUwe Kleine-König .remove_new = at91_twi_remove, 339ad7d142fSJuergen Fitschen .id_table = at91_twi_devtypes, 340ad7d142fSJuergen Fitschen .driver = { 341ad7d142fSJuergen Fitschen .name = "at91_i2c", 342ad7d142fSJuergen Fitschen .of_match_table = of_match_ptr(atmel_twi_dt_ids), 343dab4b0e8SClaudiu Beznea .pm = pm_ptr(&at91_twi_pm), 344ad7d142fSJuergen Fitschen }, 345ad7d142fSJuergen Fitschen }; 346ad7d142fSJuergen Fitschen 347ad7d142fSJuergen Fitschen static int __init at91_twi_init(void) 348ad7d142fSJuergen Fitschen { 349ad7d142fSJuergen Fitschen return platform_driver_register(&at91_twi_driver); 350ad7d142fSJuergen Fitschen } 351ad7d142fSJuergen Fitschen 352ad7d142fSJuergen Fitschen static void __exit at91_twi_exit(void) 353ad7d142fSJuergen Fitschen { 354ad7d142fSJuergen Fitschen platform_driver_unregister(&at91_twi_driver); 355ad7d142fSJuergen Fitschen } 356ad7d142fSJuergen Fitschen 357ad7d142fSJuergen Fitschen subsys_initcall(at91_twi_init); 358ad7d142fSJuergen Fitschen module_exit(at91_twi_exit); 359ad7d142fSJuergen Fitschen 360ad7d142fSJuergen Fitschen MODULE_AUTHOR("Nikolaus Voss <n.voss@weinmann.de>"); 361ad7d142fSJuergen Fitschen MODULE_DESCRIPTION("I2C (TWI) driver for Atmel AT91"); 362ad7d142fSJuergen Fitschen MODULE_LICENSE("GPL"); 363ad7d142fSJuergen Fitschen MODULE_ALIAS("platform:at91_i2c"); 364