[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZElPAnXAM-EwbUNe@surfacebook>
Date: Wed, 26 Apr 2023 19:19:14 +0300
From: andy.shevchenko@...il.com
To: Jiawen Wu <jiawenwu@...stnetic.com>
Cc: netdev@...r.kernel.org, jarkko.nikula@...ux.intel.com,
andriy.shevchenko@...ux.intel.com, mika.westerberg@...ux.intel.com,
jsd@...ihalf.com, ose.Abreu@...opsys.com, andrew@...n.ch,
hkallweit1@...il.com, linux@...linux.org.uk,
linux-i2c@...r.kernel.org, linux-gpio@...r.kernel.org,
mengyuanlou@...-swift.com
Subject: Re: [RFC PATCH net-next v5 4/9] net: txgbe: Register I2C platform
device
Wed, Apr 26, 2023 at 03:14:29PM +0800, Jiawen Wu kirjoitti:
> Register the platform device to use Designware I2C bus master driver.
...
> +static int txgbe_i2c_register(struct txgbe *txgbe)
> +{
> + struct pci_dev *pdev = txgbe->wx->pdev;
> + struct platform_device_info info = {};
> + struct platform_device *i2c_dev;
> + struct resource res[2] = {};
> +
> + info.parent = &pdev->dev;
> + info.fwnode = software_node_fwnode(txgbe->nodes.group[SWNODE_I2C]);
> + info.name = "i2c_designware";
> + info.id = (pdev->bus->number << 8) | pdev->devfn;
> + res[0].start = pci_resource_start(pdev, 0) + TXGBE_I2C_BASE;
> + res[0].end = pci_resource_start(pdev, 0) + TXGBE_I2C_BASE + 0x100 - 1;
> + res[0].flags = IORESOURCE_MEM;
DEFINE_RES_MEM()
> + res[1].start = pdev->irq;
> + res[1].end = pdev->irq;
> + res[1].flags = IORESOURCE_IRQ;
DEFINE_RES_IRQ()
> + info.res = res;
> + info.num_res = 2;
ARRAY_SIZE()
> + i2c_dev = platform_device_register_full(&info);
> + if (IS_ERR(i2c_dev))
> + return PTR_ERR(i2c_dev);
> +
> + txgbe->i2c_dev = i2c_dev;
> +
> + return 0;
> +}
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists