Re: [PATCH] w5300: add WIZnet W5300 Ethernet driver
flat view
From: Taehun Kim <hidden>
Date: 2011-10-03 09:16:02
Also in:
lkml
2011/9/28 Francois Romieu [off-list ref]:
quoted
+/* Opening channels of W5300 */ +static int +w5300_open(struct wiz_private *wp, u32 type)Name it w5300_channel_open or more adequately w5300_channel_0_open as it is hardwired to channel 0 ?
The W5300 Ethernet function is only available in channel 0. The other channels (1~7) is used hardwired TCP/IP stack. I was limited to the Ethernet function in this driver because hardwired TCP/IP stack to use the TCP/IP stack in linux kernel be modified.
quoted
+ int s; + + isr = w5300_read(wp, IR); + + /* Completing all interrupts at a time. */ + while (isr) { + w5300_write(wp, IR, isr); + + /* Finding the channel to create the interrupt */ + s = find_first_bit(&isr, sizeof(u16)); + ssr = w5300_read(wp, Sn_IR(s)); + /* socket interrupt is cleared. */ + w5300_write(wp, Sn_IR(s), ssr); + DPRINTK("%s: ISR = %X, SSR = %X, s = %X\n", + __func__, isr, ssr, s); + if (likely(!s)) { + if (ssr & Sn_IR_RECV) { + /* De-activation of interrupt */ + w5300_interrupt_disable(wp, 0); + /* Receiving by polling method */ + napi_schedule(&wp->napi); + } + } + + /* Is there any interrupt to be processed? */ + isr = w5300_read(wp, IR); + } + + return IRQ_HANDLED;The hardware implementation is supposed to enforce that the 'while' is always entered, right ?
If isr is 0, it is to ensure that the W5300 is received an interrupt responses. You mean that there is a need to the loop exit routine. right? Thank you for your detailed feedback. I will rewrite the driver code by applied your feedback. When the work is completed, I will suggest the rewritten driver code to this thread. Thank you. T.K.