i2c-hix5hd2.c (a4721ced760684d1776bf31f7925aa41bb3f4846) | i2c-hix5hd2.c (e0442d76213981ab48e8ea0874bb6c47e3af5a36) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-or-later 2/* 3 * Copyright (c) 2014 Linaro Ltd. 4 * Copyright (c) 2014 Hisilicon Limited. 5 * 6 * Now only support 7 bit address. 7 */ 8 --- 374 unchanged lines hidden (view full) --- 383 .master_xfer = hix5hd2_i2c_xfer, 384 .functionality = hix5hd2_i2c_func, 385}; 386 387static int hix5hd2_i2c_probe(struct platform_device *pdev) 388{ 389 struct device_node *np = pdev->dev.of_node; 390 struct hix5hd2_i2c_priv *priv; | 1// SPDX-License-Identifier: GPL-2.0-or-later 2/* 3 * Copyright (c) 2014 Linaro Ltd. 4 * Copyright (c) 2014 Hisilicon Limited. 5 * 6 * Now only support 7 bit address. 7 */ 8 --- 374 unchanged lines hidden (view full) --- 383 .master_xfer = hix5hd2_i2c_xfer, 384 .functionality = hix5hd2_i2c_func, 385}; 386 387static int hix5hd2_i2c_probe(struct platform_device *pdev) 388{ 389 struct device_node *np = pdev->dev.of_node; 390 struct hix5hd2_i2c_priv *priv; |
391 struct resource *mem; | |
392 unsigned int freq; 393 int irq, ret; 394 395 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); 396 if (!priv) 397 return -ENOMEM; 398 399 if (of_property_read_u32(np, "clock-frequency", &freq)) { --- 4 unchanged lines hidden (view full) --- 404 priv->freq = I2C_MAX_FAST_MODE_FREQ; 405 dev_warn(priv->dev, "use max freq %d instead\n", 406 I2C_MAX_FAST_MODE_FREQ); 407 } else { 408 priv->freq = freq; 409 } 410 } 411 | 391 unsigned int freq; 392 int irq, ret; 393 394 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); 395 if (!priv) 396 return -ENOMEM; 397 398 if (of_property_read_u32(np, "clock-frequency", &freq)) { --- 4 unchanged lines hidden (view full) --- 403 priv->freq = I2C_MAX_FAST_MODE_FREQ; 404 dev_warn(priv->dev, "use max freq %d instead\n", 405 I2C_MAX_FAST_MODE_FREQ); 406 } else { 407 priv->freq = freq; 408 } 409 } 410 |
412 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); 413 priv->regs = devm_ioremap_resource(&pdev->dev, mem); | 411 priv->regs = devm_platform_ioremap_resource(pdev, 0); |
414 if (IS_ERR(priv->regs)) 415 return PTR_ERR(priv->regs); 416 417 irq = platform_get_irq(pdev, 0); 418 if (irq <= 0) { 419 dev_err(&pdev->dev, "cannot find HS-I2C IRQ\n"); 420 return irq; 421 } --- 110 unchanged lines hidden --- | 412 if (IS_ERR(priv->regs)) 413 return PTR_ERR(priv->regs); 414 415 irq = platform_get_irq(pdev, 0); 416 if (irq <= 0) { 417 dev_err(&pdev->dev, "cannot find HS-I2C IRQ\n"); 418 return irq; 419 } --- 110 unchanged lines hidden --- |