Skip to contentSkip to conversation

8xx: PQ SoC IRDA support

PATCH In review Vitaly Bordug 3 participants 6 messages May 8, 2007 – May 9, 2007

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

PATCH 1/1 8xx: PQ SoC IRDA support

Adds support of IRDA transceiver residing on PowerQUICC processors and enabling such on mpc885ads reference board. The driver is implemented using of_device concept, hereby implies arch/powerpc support of the target.

---

 arch/powerpc/Kconfig                         |    1 
 arch/powerpc/boot/dts/mpc885ads.dts          |   10 
 arch/powerpc/platforms/8xx/mpc885ads_setup.c |   39 +
 arch/powerpc/sysdev/fsl_soc.c                |   58 ++
 drivers/net/irda/Kconfig                     |    4 
 drivers/net/irda/Makefile                    |    1 
 drivers/net/irda/m8xx-sir.c                  |  715 ++++++++++++++++++++++++++
 include/asm-ppc/commproc.h                   |   67 ++
 8 files changed, 895 insertions(+), 0 deletions(-)
arch/powerpc/Kconfig +1 -0
index 808d2ef..9e48c80 100644
@@ -629,6 +629,7 @@ endmenu
 config ISA_DMA_API
 	bool
 	default y
+	depends on !PPC_8xx
 
 menu "Bus options"
 
arch/powerpc/boot/dts/mpc885ads.dts +10 -0
index 110bf61..0d4286a 100644
@@ -178,6 +178,16 @@
 				interrupt-parent = <930>;
 				phy-handle = <e8002>;
 			};
+
+			scc@a20 {
+				device_type = "network";
+				compatible = "fsl,pq-irda";
+				model = "SCC";
+				device-id = <2>;
+				reg = <a20 18 3d00 80>;
+				interrupts = <1d 3>;
+				interrupt-parent = <930>;
+			};
 		};
 	};
 };
arch/powerpc/platforms/8xx/mpc885ads_setup.c +39 -0
index a57b577..8611318 100644
@@ -50,6 +50,7 @@ extern unsigned int mpc8xx_get_irq(void);
 static void init_smc1_uart_ioports(struct fs_uart_platform_info* fpi);
 static void init_smc2_uart_ioports(struct fs_uart_platform_info* fpi);
 static void init_scc3_ioports(struct fs_platform_info* ptr);
+static void init_irda_ioports(void);
 
 void __init mpc885ads_board_setup(void)
 {
@@ -115,6 +116,10 @@ void __init mpc885ads_board_setup(void)
 	immr_unmap(io_port);
 
 #endif
+
+#ifdef CONFIG_8XX_SIR
+	init_irda_ioports();
+#endif
 }
 
 
@@ -322,6 +327,40 @@ void init_smc_ioports(struct fs_uart_platform_info *data)
 	}
 }
 
+static void init_irda_ioports()
+{
+	iop8xx_t *io_port;
+	cpm8xx_t *cp;
+	unsigned *bcsr_io;
+
+	bcsr_io = ioremap(BCSR1, sizeof(unsigned long));
+
+	if (bcsr_io == NULL) {
+		printk(KERN_CRIT "Could not remap BCSR1\n");
+		return;
+	}
+
+	/* Enable the IRDA. */
+	clrbits32(bcsr_io,BCSR1_IRDAEN);
+	iounmap(bcsr_io);
+
+	io_port = (iop8xx_t *)immr_map(im_ioport);
+	cp = (cpm8xx_t *)immr_map(im_cpm);
+
+	/* Configure port A pins. */
+	setbits16(&io_port->iop_papar, 0x000c);
+	clrbits16(&io_port->iop_padir, 0x000c);
+
+	/* Configure Serial Interface clock routing.
+	 * First, clear all SCC bits to zero, then set the ones we want.
+	 */
+	clrbits32(&cp->cp_sicr, 0x0000ff00);
+	setbits32(&cp->cp_sicr, 0x00001200);
+
+	immr_unmap(io_port);
+	immr_unmap(cp);
+}
+
 int platform_device_skip(const char *model, int id)
 {
 #ifdef CONFIG_MPC8xx_SECOND_ETH_SCC3
arch/powerpc/sysdev/fsl_soc.c +58 -0

62 lines not on this page · raw message

drivers/net/irda/Kconfig +4 -0
index 7c8ccc0..b3681e7 100644
@@ -17,6 +17,10 @@ config IRTTY_SIR
 
 	  If unsure, say Y.
 
+config 8XX_SIR
+	  tristate "mpc8xx SIR"
+	  depends on 8xx && IRDA
+
 comment "Dongle support"
 
 config DONGLE
drivers/net/irda/Makefile +1 -0
index 5be09f1..fc7c0fd 100644
@@ -34,6 +34,7 @@ obj-$(CONFIG_EP7211_IR)		+= ep7211_ir.o
 obj-$(CONFIG_AU1000_FIR)	+= au1k_ir.o
 # New SIR drivers
 obj-$(CONFIG_IRTTY_SIR)		+= irtty-sir.o	sir-dev.o
+obj-$(CONFIG_8XX_SIR)		+= m8xx-sir.o
 # New dongles drivers for new SIR drivers
 obj-$(CONFIG_ESI_DONGLE)	+= esi-sir.o
 obj-$(CONFIG_TEKRAM_DONGLE)	+= tekram-sir.o
drivers/net/irda/m8xx-sir.c new file +715 -0

715 lines not on this page · raw message

include/asm-ppc/commproc.h +67 -0

73 lines not on this page · raw message

#1 lore raw

Hi Vitaly,

Quoted 6 lines · Vitaly Bordug

Adds support of IRDA transceiver residing on PowerQUICC processors and enabling such on mpc885ads reference board. The driver is implemented using of_device concept, hereby implies arch/powerpc support of the target.

I'd really prefer this patch to be splitted in 2 parts: The PPC specific bits, and the IrDA driver that would apply on top of it. Meanwhile, I can comment on the IrDA driver code:

drivers/net/irda/Kconfig config IRTTY_SIR · line 23

Quoted 12 lines
drivers/net/irda/Kconfig +0 -0
index 7c8ccc0..b3681e7 100644
@@ -17,6 +17,10 @@ config IRTTY_SIR
 

=09 If unsure, say Y.

drivers/net/irda/Kconfig +4 -0
+config 8XX_SIR
+=09  tristate "mpc8xx SIR"
+=09  depends on 8xx && IRDA
+

Some "help" field here wouldn't hurt.

Quoted 36 lines
drivers/net/irda/Kconfig +36 -0
+static void mpc8xx_irda_rx(struct net_device *dev)
+{
+=09struct mpc8xx_irda *si =3D dev->priv;
+=09cbd_t *bdp;
+=09struct sk_buff *skb;
+=09int len;
+=09ushort status;
+
+=09bdp =3D si->cur_rx;
+
+=09for (;;) {
+=09=09if (bdp->cbd_sc & BD_AHDLC_RX_EMPTY)
+=09=09=09break;
+=09=09status =3D bdp->cbd_sc;
+
+=09=09if (status & BD_AHDLC_RX_STATS) {
+=09=09=09/* process errors
+=09=09=09 */
+=09=09=09if (bdp->cbd_sc & BD_AHDLC_RX_AB)
+=09=09=09=09si->stats.rx_length_errors++;
+=09=09=09if (bdp->cbd_sc & BD_AHDLC_RX_CR)=09/* CRC Error */
+=09=09=09=09si->stats.rx_crc_errors++;
+=09=09=09if (bdp->cbd_sc & BD_AHDLC_RX_OV)=09/* FIFO overrun */
+=09=09=09=09si->stats.rx_over_errors++;
+=09=09} else {
+=09=09=09/* Process the incoming frame.
+=09=09=09 */
+=09=09=09len =3D bdp->cbd_datlen;
+
+=09=09=09skb =3D dev_alloc_skb(len + 1);
+=09=09=09if (skb =3D=3D NULL) {
+=09=09=09=09printk(KERN_INFO
+=09=09=09=09       "%s: Memory squeeze, dropping packet.\n",
+=09=09=09=09       dev->name);
+=09=09=09=09si->stats.rx_dropped++;
+=09=09=09} else {

drivers/net/irda/Kconfig

Quoted 10 lines
drivers/net/irda/Kconfig +10 -0
+=09=09=09=09skb->dev =3D dev;
+=09=09=09=09skb_reserve(skb, 1);
+=09=09=09=09memcpy(skb_put(skb, len),
+=09=09=09=09       si->rx_vaddr[bdp - si->rx_bd_base], len);
+=09=09=09=09skb_trim(skb, skb->len - 2);
+
+=09=09=09=09si->stats.rx_packets++;
+=09=09=09=09si->stats.rx_bytes +=3D len;
+
+=09=09=09=09skb->mac.raw =3D skb->data;

This should be
+=09=09=09=09skb_reset_mac_header(skb);

Quoted 67 lines
drivers/net/irda/Kconfig +67 -0
+static irqreturn_t mpc8xx_irda_irq(int irq, void *dev_id)
+{
+=09struct net_device *dev =3D dev_id;
+=09struct mpc8xx_irda *si =3D dev->priv;
+=09scc_t *sccp =3D si->sccp;
+=09cbd_t *bdp;
+=09ushort int_events;
+=09int must_restart =3D 0;
+
+=09/* Get the interrupt events that caused us to be here.
+=09 */
+=09int_events =3D in_be16(&sccp->scc_scce);
+=09out_be16(&sccp->scc_scce, int_events);
+
+=09/* Handle receive event in its own function.
+=09 */
+=09if (int_events & SCC_AHDLC_RXF)
+=09=09mpc8xx_irda_rx(dev);
+
+=09spin_lock(&si->lock);
+
+=09/* Transmit OK, or non-fatal error.  Update the buffer descriptors.
+=09 */
+=09if (int_events & (SCC_AHDLC_TXE | SCC_AHDLC_TXB)) {
+=09=09bdp =3D si->dirty_tx;
+
+=09=09while ((bdp->cbd_sc & BD_AHDLC_TX_READY) =3D=3D 0) {
+=09=09=09if (si->tx_free =3D=3D TX_RING_SIZE)
+=09=09=09=09break;
+
+=09=09=09if (bdp->cbd_sc & BD_AHDLC_TX_CTS)
+=09=09=09=09must_restart =3D 1;
+
+=09=09=09si->stats.tx_packets++;
+
+=09=09=09/* Free the sk buffer associated with this last transmit.
+=09=09=09 */
+=09=09=09dev_kfree_skb_irq(si->tx_skbuff[si->skb_dirty]);
+=09=09=09si->skb_dirty =3D (si->skb_dirty + 1) & TX_RING_MOD_MASK;
+
+=09=09=09/* Update pointer to next buffer descriptor to be transmitted.
+=09=09=09 */
+=09=09=09if (bdp->cbd_sc & BD_AHDLC_TX_WRAP)
+=09=09=09=09bdp =3D si->tx_bd_base;
+=09=09=09else
+=09=09=09=09bdp++;
+
+=09=09=09/* Since we have freed up a buffer, the ring is no longer full.
+=09=09=09 */
+=09=09=09if (!si->tx_free++) {
+=09=09=09=09if (netif_queue_stopped(dev))
+=09=09=09=09=09netif_wake_queue(dev);
+=09=09=09}
+
+=09=09=09si->dirty_tx =3D (cbd_t *) bdp;
+
+=09=09=09if (si->newspeed) {
+=09=09=09=09mpc8xx_irda_set_speed(dev, si->newspeed);
+=09=09=09=09si->speed =3D si->newspeed;
+=09=09=09=09si->newspeed =3D 0;
+=09=09=09}
+=09=09}
+
+=09=09if (must_restart) {
+=09=09=09cpm8xx_t *cp =3D immr_map(im_cpm);
+=09=09=09printk(KERN_INFO "restart TX\n");
+

drivers/net/irda/Kconfig

Quoted 10 lines
drivers/net/irda/Kconfig +10 -0
+=09=09=09/* Some transmit errors cause the transmitter to shut
+=09=09=09 * down.  We now issue a restart transmit.  Since the
+=09=09=09 * errors close the BD and update the pointers, the restart
+=09=09=09 * _should_ pick up without having to reset any of our
+=09=09=09 * pointers either.
+=09=09=09 */
+=09=09=09out_be16(&cp->cp_cpcr,
+=09=09=09    mk_cr_cmd(CPM_CR_CH_SCC2,
+=09=09=09=09      CPM_CR_RESTART_TX) | CPM_CR_FLG);
+=09=09=09while (in_be16(&cp->cp_cpcr) & CPM_CR_FLG) ;

You're busy looping in an interrupt handler, that's not really nice. In general, I think this interrupt handler would deserve a bottom half split since it looks quite busy.

drivers/net/irda/Kconfig

Quoted 6 lines
drivers/net/irda/Kconfig +6 -0
+static struct device_driver m8xxir_driver =3D {
+=09.name =3D "fsl-cpm-scc:irda",
+=09.bus =3D &platform_bus_type,
+=09.probe =3D mpc8xx_irda_probe,
+=09.remove =3D mpc8xx_irda_remove,
+};

Why not a platform driver ?

Cheers,
Samuel.

#2 lore raw
Quoted 11 lines · On 9 May 2007 08:42:44 -0000 Samuel Ortiz wrote:

Hi Vitaly,

Quoted 6 lines · Vitaly Bordug

Adds support of IRDA transceiver residing on PowerQUICC processors and enabling such on mpc885ads reference board. The driver is implemented using of_device concept, hereby implies arch/powerpc support of the target.

Quoted 5 lines
Quoted 1 line

I'd really prefer this patch to be splitted in 2 parts: The PPC specific bits, and the IrDA driver that would apply on top of it. Meanwhile, I can comment on the IrDA driver code:

I used to do such before with network drivers but it may result in badly breakage since stuff is heading through different routes. The most productive way seems to acquire ACK from both driver-wise and arch-wise areas, and have Andrew to merge it. IOW, separating stuff that cannot live one without other is error-prone.

Of course, there's np do do that for your convenience - I'm just against pushing it through different trees.

Quoted 7 lines
Quoted 7 lines
drivers/net/irda/Kconfig +0 -0
index 7c8ccc0..b3681e7 100644
@@ -17,6 +17,10 @@ config IRTTY_SIR
 
Quoted 8 lines

drivers/net/irda/Kconfig config IRTTY_SIR · line 23

Quoted 6 lines
drivers/net/irda/Kconfig +4 -0
 	  If unsure, say Y.
 
+config 8XX_SIR
+	  tristate "mpc8xx SIR"
+	  depends on 8xx && IRDA
+

Some "help" field here wouldn't hurt.

OK

Quoted 54 lines
Quoted 46 lines
drivers/net/irda/Kconfig +21 -0
+static void mpc8xx_irda_rx(struct net_device *dev)
+{
+	struct mpc8xx_irda *si = dev->priv;
+	cbd_t *bdp;
+	struct sk_buff *skb;
+	int len;
+	ushort status;
+
+	bdp = si->cur_rx;
+
+	for (;;) {
+		if (bdp->cbd_sc & BD_AHDLC_RX_EMPTY)
+			break;
+		status = bdp->cbd_sc;
+
+		if (status & BD_AHDLC_RX_STATS) {
+			/* process errors
+			 */
+			if (bdp->cbd_sc & BD_AHDLC_RX_AB)
+				si->stats.rx_length_errors++;
+			if (bdp->cbd_sc & BD_AHDLC_RX_CR)	/*

CRC Error */

drivers/net/irda/Kconfig +2 -0
+				si->stats.rx_crc_errors++;
+			if (bdp->cbd_sc & BD_AHDLC_RX_OV)	/*

FIFO overrun */

drivers/net/irda/Kconfig +10 -0
+				si->stats.rx_over_errors++;
+		} else {
+			/* Process the incoming frame.
+			 */
+			len = bdp->cbd_datlen;
+
+			skb = dev_alloc_skb(len + 1);
+			if (skb == NULL) {
+				printk(KERN_INFO
+				       "%s: Memory squeeze,

dropping packet.\n",

drivers/net/irda/Kconfig +7 -0
+				       dev->name);
+				si->stats.rx_dropped++;
+			} else {
+				skb->dev = dev;
+				skb_reserve(skb, 1);
+				memcpy(skb_put(skb, len),
+				       si->rx_vaddr[bdp -

si->rx_bd_base], len);

drivers/net/irda/Kconfig

Quoted 6 lines
drivers/net/irda/Kconfig +6 -0
+				skb_trim(skb, skb->len - 2);
+
+				si->stats.rx_packets++;
+				si->stats.rx_bytes += len;
+
+				skb->mac.raw = skb->data;

This should be

Review

Quoted 1 line
(quoted diff) +1 -0
+				skb_reset_mac_header(skb);

OK

Quoted 82 lines
Quoted 82 lines
drivers/net/irda/Kconfig +22 -0
+static irqreturn_t mpc8xx_irda_irq(int irq, void *dev_id)
+{
+	struct net_device *dev = dev_id;
+	struct mpc8xx_irda *si = dev->priv;
+	scc_t *sccp = si->sccp;
+	cbd_t *bdp;
+	ushort int_events;
+	int must_restart = 0;
+
+	/* Get the interrupt events that caused us to be here.
+	 */
+	int_events = in_be16(&sccp->scc_scce);
+	out_be16(&sccp->scc_scce, int_events);
+
+	/* Handle receive event in its own function.
+	 */
+	if (int_events & SCC_AHDLC_RXF)
+		mpc8xx_irda_rx(dev);
+
+	spin_lock(&si->lock);
+
+	/* Transmit OK, or non-fatal error.  Update the buffer

descriptors.

drivers/net/irda/Kconfig +14 -0
+	 */
+	if (int_events & (SCC_AHDLC_TXE | SCC_AHDLC_TXB)) {
+		bdp = si->dirty_tx;
+
+		while ((bdp->cbd_sc & BD_AHDLC_TX_READY) == 0) {
+			if (si->tx_free == TX_RING_SIZE)
+				break;
+
+			if (bdp->cbd_sc & BD_AHDLC_TX_CTS)
+				must_restart = 1;
+
+			si->stats.tx_packets++;
+
+			/* Free the sk buffer associated with this

last transmit.

drivers/net/irda/Kconfig +2 -0
+			 */
+

dev_kfree_skb_irq(si->tx_skbuff[si->skb_dirty]);

drivers/net/irda/Kconfig +1 -0
+			si->skb_dirty = (si->skb_dirty + 1) &

TX_RING_MOD_MASK; +

drivers/net/irda/Kconfig +1 -0
+			/* Update pointer to next buffer descriptor

to be transmitted.

drivers/net/irda/Kconfig +7 -0
+			 */
+			if (bdp->cbd_sc & BD_AHDLC_TX_WRAP)
+				bdp = si->tx_bd_base;
+			else
+				bdp++;
+
+			/* Since we have freed up a buffer, the

ring is no longer full.

drivers/net/irda/Kconfig +10 -0
+			 */
+			if (!si->tx_free++) {
+				if (netif_queue_stopped(dev))
+					netif_wake_queue(dev);
+			}
+
+			si->dirty_tx = (cbd_t *) bdp;
+
+			if (si->newspeed) {
+				mpc8xx_irda_set_speed(dev,

si->newspeed);

drivers/net/irda/Kconfig +10 -0
+				si->speed = si->newspeed;
+				si->newspeed = 0;
+			}
+		}
+
+		if (must_restart) {
+			cpm8xx_t *cp = immr_map(im_cpm);
+			printk(KERN_INFO "restart TX\n");
+
+			/* Some transmit errors cause the

transmitter to shut

drivers/net/irda/Kconfig +1 -0
+			 * down.  We now issue a restart transmit.

Since the

drivers/net/irda/Kconfig +1 -0
+			 * errors close the BD and update the

pointers, the restart

drivers/net/irda/Kconfig +1 -0
+			 * _should_ pick up without having to reset

any of our

Quoted 8 lines

drivers/net/irda/Kconfig

Quoted 7 lines
drivers/net/irda/Kconfig +5 -0
+			 * pointers either.
+			 */
+			out_be16(&cp->cp_cpcr,
+			    mk_cr_cmd(CPM_CR_CH_SCC2,
+				      CPM_CR_RESTART_TX) |

CPM_CR_FLG);

drivers/net/irda/Kconfig +1 -0
+			while (in_be16(&cp->cp_cpcr) & CPM_CR_FLG) ;

You're busy looping in an interrupt handler, that's not really nice.

That's correct. In fact, I included protection stuff for SCC Ethernet in fs_enet driver to get rid of indefinite loop in case something really bad happens in CPM microcode.

I'll move it here.

Quoted 3 lines

In general, I think this interrupt handler would deserve a bottom half split since it looks quite busy.

I don't think it worths bh stuff - scc/FCC/etc ethernet (drivers/net/fs_enet/) use more busy int handler and is for the similar (SCC) SoC device on the same target board (with higher throughout speed) without performance affected.

It is doable but I guess we'll lose more than win. Also we have to keep in mind, that 8xx PQ SoC is not speed-blasting and having IRQ path between schedule() ticks would not be great either.

So to recap, similar handling path for similar SoC device existing in current kernel for a while now, and working good. You are right that we have to provide some protection in case of CPM lockup though.

Quoted 9 lines

drivers/net/irda/Kconfig

Quoted 7 lines
drivers/net/irda/Kconfig +6 -0
+static struct device_driver m8xxir_driver = {
+	.name = "fsl-cpm-scc:irda",
+	.bus = &platform_bus_type,
+	.probe = mpc8xx_irda_probe,
+	.remove = mpc8xx_irda_remove,
+};

Why not a platform driver ?

Now I have full of_platform_driver implementation so I better drop platform_devices here.

Thanks for review, will follow-up with fixes shortly.

Signature · 1 line
Sincerely, Vitaly
#3 lore raw

Hi Vitaly,

Quoted 5 lines · Vitaly Bordug
Quoted 4 lines

I'd really prefer this patch to be splitted in 2 parts: The PPC specific bits, and the IrDA driver that would apply on top of it. Meanwhile, I can comment on the IrDA driver code:

I used to do such before with network drivers but it may result in badly bre=

akage since stuff is heading through different routes. The most productive wa= y seems to acquire ACK from both driver-wise and arch-wise areas,

Quoted 1 line

and have Andrew to merge it. IOW, separating stuff that cannot live one with=

out other is error-prone.

Quoted 2 lines

Of course, there's np do do that for your convenience - I'm just against pus=

hing it through different trees.

Quoted 1 line
Quoted 1 line

Fine, but please CC netdev and [email protected] for your next patch iteration.

Quoted 89 lines
Quoted 81 lines
Quoted 81 lines
(quoted diff) +22 -0
+static irqreturn_t mpc8xx_irda_irq(int irq, void *dev_id)
+{
+=09struct net_device *dev =3D dev_id;
+=09struct mpc8xx_irda *si =3D dev->priv;
+=09scc_t *sccp =3D si->sccp;
+=09cbd_t *bdp;
+=09ushort int_events;
+=09int must_restart =3D 0;
+
+=09/* Get the interrupt events that caused us to be here.
+=09 */
+=09int_events =3D in_be16(&sccp->scc_scce);
+=09out_be16(&sccp->scc_scce, int_events);
+
+=09/* Handle receive event in its own function.
+=09 */
+=09if (int_events & SCC_AHDLC_RXF)
+=09=09mpc8xx_irda_rx(dev);
+
+=09spin_lock(&si->lock);
+
+=09/* Transmit OK, or non-fatal error.  Update the buffer

descriptors.

+=09 */
+=09if (int_events & (SCC_AHDLC_TXE | SCC_AHDLC_TXB)) {
+=09=09bdp =3D si->dirty_tx;
(quoted diff) +11 -0
+
+=09=09while ((bdp->cbd_sc & BD_AHDLC_TX_READY) =3D=3D 0) {
+=09=09=09if (si->tx_free =3D=3D TX_RING_SIZE)
+=09=09=09=09break;
+
+=09=09=09if (bdp->cbd_sc & BD_AHDLC_TX_CTS)
+=09=09=09=09must_restart =3D 1;
+
+=09=09=09si->stats.tx_packets++;
+
+=09=09=09/* Free the sk buffer associated with this

last transmit.
+=09=09=09 */
+ dev_kfree_skb_irq(si->tx_skbuff[si->skb_dirty]); +=09=09=09si->skb_dirty =3D (si->skb_dirty + 1) & TX_RING_MOD_MASK; +
+=09=09=09/* Update pointer to next buffer descriptor to be transmitted.

+=09=09=09 */
+=09=09=09if (bdp->cbd_sc & BD_AHDLC_TX_WRAP)
+=09=09=09=09bdp =3D si->tx_bd_base;
+=09=09=09else
+=09=09=09=09bdp++;
+
+=09=09=09/* Since we have freed up a buffer, the
ring is no longer full.
+=09=09=09 */
+=09=09=09if (!si->tx_free++) {
+=09=09=09=09if (netif_queue_stopped(dev))
+=09=09=09=09=09netif_wake_queue(dev);
+=09=09=09}
(quoted diff) +5 -0
+
+=09=09=09si->dirty_tx =3D (cbd_t *) bdp;
+
+=09=09=09if (si->newspeed) {
+=09=09=09=09mpc8xx_irda_set_speed(dev,

si->newspeed);

+=09=09=09=09si->speed =3D si->newspeed;
+=09=09=09=09si->newspeed =3D 0;
+=09=09=09}
+=09=09}
(quoted diff) +6 -0
+
+=09=09if (must_restart) {
+=09=09=09cpm8xx_t *cp =3D immr_map(im_cpm);
+=09=09=09printk(KERN_INFO "restart TX\n");
+
+=09=09=09/* Some transmit errors cause the

transmitter to shut
+=09=09=09 * down. We now issue a restart transmit. Since the
+=09=09=09 * errors close the BD and update the pointers, the restart
+=09=09=09 * _should_ pick up without having to reset any of our

Quoted 8 lines
Quoted 7 lines
+=09=09=09 * pointers either.
+=09=09=09 */
+=09=09=09out_be16(&cp->cp_cpcr,
+=09=09=09    mk_cr_cmd(CPM_CR_CH_SCC2,
+=09=09=09=09      CPM_CR_RESTART_TX) |

CPM_CR_FLG);
+=09=09=09while (in_be16(&cp->cp_cpcr) & CPM_CR_FLG) ;

You're busy looping in an interrupt handler, that's not really nice.

Quoted 1 line

That's correct. In fact, I included protection stuff for SCC Ethernet in fs_=

enet driver to

Quoted 1 line

get rid of indefinite loop in case something really bad happens in CPM micro=

code.

Quoted 2 lines

I'll move it here.

Good.

Quoted 4 lines
Quoted 3 lines

In general, I think this interrupt handler would deserve a bottom half split since it looks quite busy.

I don't think it worths bh stuff - scc/FCC/etc ethernet (drivers/net/fs_enet=

/) use more busy int handler and is for

Quoted 1 line

the similar (SCC) SoC device on the same target board (with higher throughou=

t speed) without performance affected.

Quoted 2 lines

It is doable but I guess we'll lose more than win. Also we have to keep in m=

ind, that 8xx PQ SoC is not speed-blasting and having IRQ path between schedu= le() ticks would not be great either.

Quoted 2 lines

So to recap, similar handling path for similar SoC device existing in curren=

t kernel for a while now, and working good.

I'm sure it works good, but doing the whole RX path from an interrupt handler doesn't sound like the best thing to do, at least to me. And with a SIR IrDA device, you can afford to offload your interrupt processing to a BH, nobody will notice the difference in terms of performance.
I'm not against your proposed implementation, but I just think there's a nicer way to achieve the same result.

Quoted 1 line

Thanks for review, will follow-up with fixes shortly.

Thanks for the patch.

Cheers,
Samuel.

#4 lore raw
Quoted 10 lines · On 9 May 2007 13:46:11 -0000 Samuel Ortiz wrote:
Quoted 2 lines

So to recap, similar handling path for similar SoC device existing in current kernel for a while now, and working good.

I'm sure it works good, but doing the whole RX path from an interrupt handler doesn't sound like the best thing to do, at least to me. And with a SIR IrDA device, you can afford to offload your interrupt processing to a BH, nobody will notice the difference in terms of performance.
I'm not against your proposed implementation, but I just think there's a nicer way to achieve the same result.

May I ask to point to the code you're keeping in mind here?

I'm not going to touch this path or else the code will miss this merge window as well, but I'm going to keep improving it, and this rework might be useful not only for this particular driver, but for similar kernel pieces too.

Signature · 1 line
Sincerely, Vitaly
#5 lore raw
In reply to Vitaly Bordug

arch/powerpc/sysdev/fsl_soc.c err: · line 1130

Quoted 5 lines · On Wed, 09 May 2007 02:42:07 +0400 Vitaly Bordug <[email protected]>…
arch/powerpc/sysdev/fsl_soc.c +5 -0
+		model = (char *)get_property(np, "model", NULL);
+		if (model == NULL)
+			return -ENODEV;
+
+		id = (u32 *) get_property(np, "device-id", NULL);

get_property() got renamed to of_get_property().

You have two coding-styles in the typecasting here. The former (no space) is more common and makes more sense, IMO.

However of_get_property() returns const void* so really you shouldn't be doing any casting at all. model' should have type const char *' and then you can do

	model = get_property(np, "model", NULL);

which has nice type-safety and const-correctness.