Skip to contentSkip to conversation

smc911x: introduce platform data flags

PATCH In review [email protected] 1 participant 1 message Jun 9, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 10/13 smc911x: introduce platform data flags

From: Magnus Damm <[email protected]>

This patch adds a new header file for platform data information together with code that adds run time bus width and irq flag support.

---

 drivers/net/smc911x.c   |   17 +++++++
 drivers/net/smc911x.h   |   81 ++++++++++++++++++++++++++++++++++++++
 include/linux/smc911x.h |   12 +++++
 3 files changed, 109 insertions(+), 1 deletion(-)
drivers/net/smc911x.c renamed from drivers/net/smc911x.c~smc911x-introduce-platform-data-flags +16 -1
diff -puN drivers/net/smc911x.c~smc911x-introduce-platform-data-flags drivers/net/smc911x.c
@@ -1819,6 +1819,7 @@ static int __init smc911x_probe(struct n
 	int i, retval;
 	unsigned int val, chip_id, revision;
 	const char *version_string;
+	unsigned long irq_flags;
 
 	DBG(SMC_DEBUG_FUNC, "%s: --> %s\n", dev->name, __FUNCTION__);
 
@@ -1985,9 +1986,15 @@ static int __init smc911x_probe(struct n
 	lp->ctl_rfduplx = 1;
 	lp->ctl_rspeed = 100;
 
+#ifdef SMC_DYNAMIC_BUS_CONFIG
+	irq_flags = lp->cfg.irq_flags;
+#else
+	irq_flags = IRQF_SHARED | SMC_IRQ_SENSE;
+#endif
+
 	/* Grab the IRQ */
 	retval = request_irq(dev->irq, &smc911x_interrupt,
-			IRQF_SHARED | SMC_IRQ_SENSE, dev->name, dev);
+			     irq_flags, dev->name, dev);
 	if (retval)
 		goto err_out;
 
@@ -2057,6 +2064,7 @@ err_out:
  */
 static int smc911x_drv_probe(struct platform_device *pdev)
 {
+	struct smc91x_platdata *pd = pdev->dev.platform_data;
 	struct net_device *ndev;
 	struct resource *res;
 	struct smc911x_local *lp;
@@ -2090,6 +2098,13 @@ static int smc911x_drv_probe(struct plat
 	ndev->irq = platform_get_irq(pdev, 0);
 	lp = netdev_priv(ndev);
 	lp->netdev = ndev;
+#ifdef SMC_DYNAMIC_BUS_CONFIG
+	if (!pd) {
+		ret = -EINVAL;
+		goto release_both;
+	}
+	memcpy(&lp->cfg, pd, sizeof(lp->cfg));
+#endif
 
 	addr = ioremap(res->start, SMC911X_IO_EXTENT);
 	if (!addr) {
drivers/net/smc911x.h renamed from drivers/net/smc911x.h~smc911x-introduce-platform-data-flags +81 -0

111 lines not on this page · raw message

include/linux/smc911x.h new file +12 -0
diff -puN /dev/null include/linux/smc911x.h
@@ -0,0 +1,12 @@
+#ifndef __SMC911X_H__
+#define __SMC911X_H__
+
+#define SMC911X_USE_16BIT (1 << 0)
+#define SMC911X_USE_32BIT (1 << 1)
+
+struct smc911x_platdata {
+	unsigned long flags;
+	unsigned long irq_flags; /* IRQF_... */
+};
+
+#endif /* __SMC911X_H__ */

_