unicore32 subsystem: 6 patches for 2.6.39
cover unicore32 subsystem: 6 patches for 2.6.39
Two patches for PKUnity v3 SoC drivers:
add mac driver, and move rtc driver to appropriate place
Two patches for new 2.6.39 updates:
using generic-y and modify PERCPU macro
Other two patches are small fixes.
---
Guan Xuetao (6):
unicore32: move rtc-puv3.c to drivers/rtc directory
unicore32: add pkunity-v3 mac/net driver (umal)
unicore32: change zImage physical address, though it's PIC codes
unicore32: add KBUILD_DEFCONFIG with unicore32_defconfig (old
debug_defconfig)
unicore32: change PERCPU to PERCPU_SECTION
unicore32: using generic-y format for one line asm-generic files
MAINTAINERS | 2 + arch/unicore32/Kconfig | 4 - arch/unicore32/Makefile | 38 +- arch/unicore32/boot/compressed/Makefile | 2 +- arch/unicore32/configs/debug_defconfig | 215 --- arch/unicore32/configs/unicore32_defconfig | 215 +++ arch/unicore32/include/asm/Kbuild | 59 + arch/unicore32/kernel/Makefile | 1 - arch/unicore32/kernel/rtc.c | 371 ------ arch/unicore32/kernel/vmlinux.lds.S | 2 +- drivers/net/Kconfig | 5 + drivers/net/Makefile | 1 + drivers/net/mac-puv3.c | 1942 ++++++++++++++++++++++++++++ drivers/rtc/Kconfig | 9 + drivers/rtc/Makefile | 1 + drivers/rtc/rtc-puv3.c | 359 +++++ 16 files changed, 2597 insertions(+), 629 deletions(-) delete mode 100644 arch/unicore32/configs/debug_defconfig create mode 100644 arch/unicore32/configs/unicore32_defconfig delete mode 100644 arch/unicore32/kernel/rtc.c create mode 100644 drivers/net/mac-puv3.c create mode 100644 drivers/rtc/rtc-puv3.c
Signature · 1 line
1.7.5.2
PATCH 1/6 unicore32: move rtc-puv3.c to drivers/rtc directory
From: Guan Xuetao <[email protected]>
--- MAINTAINERS | 1 + arch/unicore32/Kconfig | 4 - arch/unicore32/configs/debug_defconfig | 6 +- arch/unicore32/kernel/Makefile | 1 - arch/unicore32/kernel/rtc.c | 371 -------------------------------- drivers/rtc/Kconfig | 9 + drivers/rtc/Makefile | 1 + drivers/rtc/rtc-puv3.c | 359 ++++++++++++++++++++++++++++++ 8 files changed, 373 insertions(+), 379 deletions(-) delete mode 100644 arch/unicore32/kernel/rtc.c create mode 100644 drivers/rtc/rtc-puv3.c
MAINTAINERS +1 -0
@@ -4929,6 +4929,7 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/epip/linux-2.6-unicore32.gi F: drivers/input/serio/i8042-unicore32io.h F: drivers/i2c/busses/i2c-puv3.c F: drivers/video/fb-puv3.c +F: drivers/rtc/rtc-puv3.c PMC SIERRA MaxRAID DRIVER M: Anil Ravindranath <[email protected]>
arch/unicore32/Kconfig +0 -4
@@ -231,10 +231,6 @@ config PUV3_PWM help Enable support for NB0916 PWM controllers -config PUV3_RTC - tristate "PKUnity v3 RTC Support" - depends on !ARCH_FPGA - if PUV3_NB0916 menu "PKUnity NetBook-0916 Features"
arch/unicore32/configs/debug_defconfig +3 -3
@@ -64,7 +64,6 @@ CONFIG_I2C_BATTERY_BQ27200=n CONFIG_I2C_EEPROM_AT24=n CONFIG_LCD_BACKLIGHT=n -CONFIG_PUV3_RTC=y CONFIG_PUV3_UMAL=y CONFIG_PUV3_MUSB=n CONFIG_PUV3_AC97=n
@@ -167,8 +166,9 @@ CONFIG_LEDS_TRIGGER_IDE_DISK=y CONFIG_LEDS_TRIGGER_HEARTBEAT=y # Real Time Clock -CONFIG_RTC_LIB=m -CONFIG_RTC_CLASS=m +CONFIG_RTC_LIB=y +CONFIG_RTC_CLASS=y +CONFIG_RTC_DRV_PUV3=y ### File systems CONFIG_EXT2_FS=m
arch/unicore32/kernel/Makefile +0 -1
@@ -16,7 +16,6 @@ obj-$(CONFIG_UNICORE_FPU_F64) += fpu-ucf64.o obj-$(CONFIG_ARCH_PUV3) += clock.o irq.o time.o obj-$(CONFIG_PUV3_GPIO) += gpio.o -obj-$(CONFIG_PUV3_RTC) += rtc.o obj-$(CONFIG_PUV3_PWM) += pwm.o obj-$(CONFIG_PUV3_PM) += pm.o sleep.o obj-$(CONFIG_HIBERNATION) += hibernate.o hibernate_asm.o
arch/unicore32/kernel/rtc.c deleted +0 -371
371 lines not on this page · raw message
drivers/rtc/Kconfig +9 -0
@@ -992,4 +992,13 @@ config RTC_DRV_TEGRA This drive can also be built as a module. If so, the module will be called rtc-tegra. +config RTC_DRV_PUV3 + tristate "PKUnity v3 RTC support" + depends on ARCH_PUV3 + help + This enables support for the RTC in the PKUnity-v3 SoCs. + + This drive can also be built as a module. If so, the module + will be called rtc-puv3. + endif # RTC_CLASS
drivers/rtc/Makefile +1 -0
@@ -75,6 +75,7 @@ obj-$(CONFIG_RTC_DRV_PCF50633) += rtc-pcf50633.o obj-$(CONFIG_RTC_DRV_PL030) += rtc-pl030.o obj-$(CONFIG_RTC_DRV_PL031) += rtc-pl031.o obj-$(CONFIG_RTC_DRV_PS3) += rtc-ps3.o +obj-$(CONFIG_RTC_DRV_PUV3) += rtc-puv3.o obj-$(CONFIG_RTC_DRV_PXA) += rtc-pxa.o obj-$(CONFIG_RTC_DRV_R9701) += rtc-r9701.o obj-$(CONFIG_RTC_DRV_RP5C01) += rtc-rp5c01.o
drivers/rtc/rtc-puv3.c new file +359 -0
359 lines not on this page · raw message
Signature · 1 line
1.7.5.2
Re: [PATCH 1/6] unicore32: move rtc-puv3.c to drivers/rtc directory
Quoted 3 lines · GuanXuetao
From: Guan Xuetao <[email protected]>
Signed-off-by Guan Xuetao <[email protected]>
But next time you move files, please use the '-M' flag to git diff or git format-patch, to make it easier to review the changes.
RE: [PATCH 1/6] unicore32: move rtc-puv3.c to drivers/rtc directory
Quoted 10 lines
-----Original Message-----
From: Arnd Bergmann [mailto:[email protected]]
Sent: Thursday, May 26, 2011 8:40 PM
To: GuanXuetao
Cc: [email protected]; [email protected]; [email protected]; Alessandro Zummo; [email protected]
Subject: Re: [PATCH 1/6] unicore32: movertc-puv3.ctodrivers/rtcdirectoryOn Thursday 26 May 2011, GuanXuetao wrote:
Quoted 8 lines
Quoted 3 lines
From: Guan Xuetao <[email protected]>
Signed-off-by Guan Xuetao <[email protected]>Acked-by Arnd Bergmann <[email protected]>But next time you move files, please use the '-M' flag to git diff or git format-patch, to make it easier to review the changes.
'-M' flag is so smart.
Thanks.
Guan Xuetao
PATCH 2/6 unicore32: add pkunity-v3 mac/net driver (umal)
In reply to GuanXuetaoFrom: Guan Xuetao <[email protected]>
--- MAINTAINERS | 1 + arch/unicore32/configs/debug_defconfig | 2 +- drivers/net/Kconfig | 5 + drivers/net/Makefile | 1 + drivers/net/mac-puv3.c | 1942 ++++++++++++++++++++++++++++++++ 5 files changed, 1950 insertions(+), 1 deletions(-) create mode 100644 drivers/net/mac-puv3.c
MAINTAINERS +1 -0
@@ -4930,6 +4930,7 @@ F: drivers/input/serio/i8042-unicore32io.h F: drivers/i2c/busses/i2c-puv3.c F: drivers/video/fb-puv3.c F: drivers/rtc/rtc-puv3.c +F: drivers/net/mac-puv3.c PMC SIERRA MaxRAID DRIVER M: Anil Ravindranath <[email protected]>
arch/unicore32/configs/debug_defconfig +1 -1
@@ -64,7 +64,6 @@ CONFIG_I2C_BATTERY_BQ27200=n CONFIG_I2C_EEPROM_AT24=n CONFIG_LCD_BACKLIGHT=n -CONFIG_PUV3_UMAL=y CONFIG_PUV3_MUSB=n CONFIG_PUV3_AC97=n CONFIG_PUV3_NAND=n
@@ -101,6 +100,7 @@ CONFIG_SATA_VIA=y # Network device support CONFIG_NETDEVICES=y CONFIG_NET_ETHERNET=y +CONFIG_MAC_PUV3=y CONFIG_NETDEV_1000=y # Wireless LAN CONFIG_WLAN_80211=n
drivers/net/Kconfig +5 -0
@@ -2023,6 +2023,11 @@ config LANTIQ_ETOP help Support for the MII0 inside the Lantiq SoC +config MAC_PUV3 + tristate "PKUnity v3 UMAL Gigabit Network Adapter support" + depends on UNICORE32 && ARCH_PUV3 + select MII + select PHYLIB source "drivers/net/fs_enet/Kconfig"
drivers/net/Makefile +1 -0
@@ -148,6 +148,7 @@ obj-$(CONFIG_NE_H8300) += ne-h8300.o obj-$(CONFIG_AX88796) += ax88796.o obj-$(CONFIG_BCM63XX_ENET) += bcm63xx_enet.o obj-$(CONFIG_FTMAC100) += ftmac100.o +obj-$(CONFIG_MAC_PUV3) += mac-puv3.o obj-$(CONFIG_TSI108_ETH) += tsi108_eth.o obj-$(CONFIG_MV643XX_ETH) += mv643xx_eth.o
drivers/net/mac-puv3.c new file +1942 -0
1,942 lines not on this page · raw message
Signature · 1 line
1.7.5.2
Arnd Bergmann
maintainerRe: [PATCH 2/6] unicore32: add pkunity-v3 mac/net driver (umal)
Quoted 3 lines · GuanXuetao
From: Guan Xuetao <[email protected]>
Signed-off-by Guan Xuetao <[email protected]>
No objections to this driver, just remember that network drivers should go through the netdev tree, and if it wasn't in there before the merge window, you missed your chance for this time.
RE: [PATCH 2/6] unicore32: add pkunity-v3 mac/net driver (umal)
Quoted 9 lines
-----Original Message-----
From: Arnd Bergmann [mailto:[email protected]]
Sent: Thursday, May 26, 2011 8:43 PM
To: GuanXuetao
Cc: [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 2/6] unicore32: add pkunity-v3 mac/net driver (umal)
Quoted 8 lines
Quoted 3 lines · GuanXuetao
From: Guan Xuetao <[email protected]>
Signed-off-by Guan Xuetao <[email protected]>No objections to this driver, just remember that network drivers should go through the netdev tree, and if it wasn't in there before the merge window, you missed your chance for this time.
Yes.
I hope someone could help me review the network driver. Perhaps it's late for adding this driver during this merge window time.
Regards.
Guan Xuetao
Re: [PATCH 2/6] unicore32: add pkunity-v3 mac/net driver (umal)
In reply to GuanXuetaoOn Thu, 2011-05-26 at 11:36 +0000, GuanXuetao wrote:
[...]
Quoted 2 lines
drivers/net/mac-puv3.c new file +0
-0
[...]
drivers/net/mac-puv3.c line 52
Quoted 9 lines
drivers/net/mac-puv3.c new file +9
-0+/********************************************************************** +* Simple types +********************************************************************* */ +enum umal_speed { + umal_speed_none =0 , + umal_speed_10 =SPEED_10 , + umal_speed_100 =SPEED_100 , + umal_speed_1000 =SPEED_1000 , +};
Just use the numbers directly: 0, 10, 100, 1000.
[...]
Quoted 1 line
+#define
ETHER_ADDR_LEN6
This is already called ETH_ALEN.
[...]
drivers/net/mac-puv3.c line 101
Quoted 9 lines
drivers/net/mac-puv3.c new file +9
-0+/********************************************************************** +* DMA Descriptor structure +********************************************************************* */ +struct umaldmadscr { +dma_addr_t PacketStartAddr; +int PacketSize; +dma_addr_t NextDescriptor; +struct umaldmadscr *NextDescriptor_Virt; +};
Linux naming convention for structure fields is words_with_underscores not TitleCase.
[...]
Quoted 11 lines
+/**********************************************************************
+ *UMAL_MII_RESET(bus)
+ *
+ * Reset MII bus.
+ *
+ * Input parameters:
+ * bus - MDIO bus handle
+ *
+ * Return value:
+ * 0 if ok
+ ********************************************************************* */
Function documentation comments must follow the kernel-doc format.
[...]
Quoted 3 lines
drivers/net/mac-puv3.c new file +3
-0+static int umaldma_add_rcvbuffer (struct umal_softc *sc,struct umaldma *d, +struct sk_buff *sb) +{
[...]
Quoted 15 lines
drivers/net/mac-puv3.c new file +15
-0+/* +* Allocate a sk_buff if we don't already have one. +* If we do have an sk_buff, reset it so that it's empty. +* +* Note: sk_buffs don't seem to be guaranteed to have any sort +* of alignment when they are allocated. Therefore, allocate enough +* extra space to make sure that: +* +* 1. the data does not start in the middle of a cache line. +* 2. The data does not end in the middle of a cache line +* 3. The buffer can be aligned such that the IP addresses are +* naturally aligned. +* +* Remember, the SOCs MAC writes whole cache lines at a time, +* without reading the old contents first. So, if the sk_buff's
drivers/net/mac-puv3.c line 572
Quoted 10 lines
drivers/net/mac-puv3.c new file +10
-0+* data portion starts in the middle of a cache line, the SOC +* DMA will trash the beginning (and ending) portions. +*/ +if (sb ==NULL ) { + sb_new =netdev_alloc_skb (dev,ENET_PACKET_SIZE + +SMP_CACHE_BYTES *2 +NET_IP_ALIGN ); +if (sb_new ==NULL ) { +pr_info ("%s: sk_buff allocation failed\n" , + d->umaldma_eth->umal_dev->name); +return -ENOBUFS ;
Surely -ENOMEM.
drivers/net/mac-puv3.c
Quoted 2 lines
drivers/net/mac-puv3.c new file +2
-0+ } +skb_reserve (sb_new,2 );
This presumably needs to be:
skb_reserve(sb_new, SMP_CACHE_BYTES + NET_IP_ALIGN);
unless you assume that the skb allocator will always ensure cache line alignment (in which case, why use padding of SMP_CACHE_BYTES * 2?).
[...]
Quoted 6 lines
drivers/net/mac-puv3.c new file +6
-0+static void umaldma_tx_process (struct umal_softc *sc,struct umaldma *d, +int poll) +{ +struct net_device *dev = sc->umal_dev; +int curidx; +int hwidx;
drivers/net/mac-puv3.c line 878
Quoted 10 lines
drivers/net/mac-puv3.c new file +10
-0+struct umaldmadscr *dsc; +struct sk_buff *sb; +unsigned long flags; +int packets_handled =0 ; +unsigned int int_status; + +spin_lock_irqsave (&(sc->umal_lock), flags); + +if (!netif_device_present (dev)) +return ;
[...]
This returns with the lock held!
(This is not by any means a thorough review.)
Ben.
Signature · 3 lines
Ben Hutchings, Senior Software Engineer, Solarflare Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
Guan Xuetao
AppliedRE: [PATCH 2/6] unicore32: add pkunity-v3 mac/net driver (umal)
Quoted 14 lines
-----Original Message-----
From: Ben Hutchings [mailto:[email protected]]
Sent: Friday, May 27, 2011 1:56 AM
To: GuanXuetao
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 2/6] unicore32: add pkunity-v3 mac/net driver (umal)On Thu, 2011-05-26 at 11:36 +0000, GuanXuetao wrote:
[...]Quoted 2 lines
drivers/net/mac-puv3.c new file +0
-0[...]
Quoted 11 lines
drivers/net/mac-puv3.c line 52
Quoted 9 lines
drivers/net/mac-puv3.c new file +9
-0+/********************************************************************** +* Simple types +********************************************************************* */ +enum umal_speed { + umal_speed_none =0 , + umal_speed_10 =SPEED_10 , + umal_speed_100 =SPEED_100 , + umal_speed_1000 =SPEED_1000 , +};Just use the numbers directly: 0, 10, 100, 1000.
Applied.
Quoted 5 lines
[...]
Quoted 1 line
+#define
ETHER_ADDR_LEN6This is already called
ETH_ALEN.
Applied.
Quoted 14 lines
[...]
drivers/net/mac-puv3.c line 101
Quoted 9 lines
drivers/net/mac-puv3.c new file +9
-0+/********************************************************************** +* DMA Descriptor structure +********************************************************************* */ +struct umaldmadscr { +dma_addr_t PacketStartAddr; +int PacketSize; +dma_addr_t NextDescriptor; +struct umaldmadscr *NextDescriptor_Virt; +};Linux naming convention for structure fields is
words_with_underscoresnot TitleCase.
Ok, thanks.
Quoted 14 lines
[...]
Quoted 11 lines
+/**********************************************************************
+ *UMAL_MII_RESET(bus)
+ *
+ * Reset MII bus.
+ *
+ * Input parameters:
+ * bus - MDIO bus handle
+ *
+ * Return value:
+ * 0 if ok
+ ********************************************************************* */
Quoted 1 line
Function documentation comments must follow the kernel-doc format.
Ok, thanks.
Quoted 25 lines
[...]
Quoted 3 lines
drivers/net/mac-puv3.c new file +3
-0+static int umaldma_add_rcvbuffer (struct umal_softc *sc,struct umaldma *d, +struct sk_buff *sb) +{[...]
Quoted 19 lines
drivers/net/mac-puv3.c new file +19
-0+/* +* Allocate a sk_buff if we don't already have one. +* If we do have an sk_buff, reset it so that it's empty. +* +* Note: sk_buffs don't seem to be guaranteed to have any sort +* of alignment when they are allocated. Therefore, allocate enough +* extra space to make sure that: +* +* 1. the data does not start in the middle of a cache line. +* 2. The data does not end in the middle of a cache line +* 3. The buffer can be aligned such that the IP addresses are +* naturally aligned. +* +* Remember, the SOCs MAC writes whole cache lines at a time, +* without reading the old contents first. So, if the sk_buff's +* data portion starts in the middle of a cache line, the SOC +* DMA will trash the beginning (and ending) portions. +*/ +if (sb ==NULL ) {
Quoted 8 lines
drivers/net/mac-puv3.c line 572
Quoted 6 lines
drivers/net/mac-puv3.c new file +6
-0+ sb_new =netdev_alloc_skb (dev,ENET_PACKET_SIZE + +SMP_CACHE_BYTES *2 +NET_IP_ALIGN ); +if (sb_new ==NULL ) { +pr_info ("%s: sk_buff allocation failed\n" , + d->umaldma_eth->umal_dev->name); +return -ENOBUFS ;Surely
-ENOMEM.
Applied.
Quoted 10 lines
drivers/net/mac-puv3.c
Quoted 3 lines
drivers/net/mac-puv3.c new file +2
-0+ } +skb_reserve (sb_new,2 );This presumably needs to be:
skb_reserve(sb_new, SMP_CACHE_BYTES + NET_IP_ALIGN);unless you assume that the skb allocator will always ensure cache line alignment (in which case, why use padding of
SMP_CACHE_BYTES* 2?).
Applied, thanks.
Each packet address needs to be added by NET_IP_ALIGN.
And I think that SMP_CACHE_BYTES is also necessary to guarantee correctness when invalidate dma cache lines.
Quoted 20 lines
[...]
Quoted 16 lines
drivers/net/mac-puv3.c new file +16
-0+static void umaldma_tx_process (struct umal_softc *sc,struct umaldma *d, +int poll) +{ +struct net_device *dev = sc->umal_dev; +int curidx; +int hwidx; +struct umaldmadscr *dsc; +struct sk_buff *sb; +unsigned long flags; +int packets_handled =0 ; +unsigned int int_status; + +spin_lock_irqsave (&(sc->umal_lock), flags); + +if (!netif_device_present (dev)) +return ;[...]
Quoted 1 line
This returns with the lock held!
Applied, thanks.
Quoted 9 lines
(This is not by any means a thorough review.)
Ben.
--
Ben Hutchings, Senior Software Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
Thanks Ben.
I will submit next version after correcting the coding-style.
Guan Xuetao
Arnd Bergmann
maintainerRe: [PATCH 2/6] unicore32: add pkunity-v3 mac/net driver (umal)
In reply to GuanXuetaoQuoted 11 lines · GuanXuetao
From: Guan Xuetao <[email protected]>
Signed-off-by Guan Xuetao <[email protected]>--- MAINTAINERS | 1 + arch/unicore32/configs/debug_defconfig | 2 +- drivers/net/Kconfig | 5 + drivers/net/Makefile | 1 + drivers/net/mac-puv3.c | 1942 ++++++++++++++++++++++++++++++++ 5 files changed, 1950 insertions(+), 1 deletions(-) create mode 100644 drivers/net/mac-puv3.c
I also have a few comments after looking through the driver.
drivers/net/mac-puv3.c line 40
Quoted 4 lines
drivers/net/mac-puv3.c new file +4
-0+ +/********************************************************************** +* Globals +********************************************************************* */
Regular commenting style would be
/*
* Globals
*/
Quoted 37 lines
drivers/net/mac-puv3.c new file +37
-0+/********************************************************************** +* Prototypes +********************************************************************* */ +static int umal_mii_reset (struct mii_bus *bus); +static int umal_mii_read (struct mii_bus *bus,int phyaddr,int regidx); +static int umal_mii_write (struct mii_bus *bus,int phyaddr,int regidx, +u16 val); +static int umal_mii_probe (struct net_device *dev); + +static void umaldma_initctx (struct umaldma *d,struct umal_softc *s, +int rxtx,int maxdescr); +static void umaldma_uninitctx (struct umaldma *d); +static void umaldma_channel_start (struct umaldma *d,int rxtx); +static void umaldma_channel_stop (struct umaldma *d); +static int umaldma_add_rcvbuffer (struct umal_softc *sc,struct umaldma *d, +struct sk_buff *m); +static int umaldma_add_txbuffer (struct umaldma *d,struct sk_buff *m); +static void umaldma_emptyring (struct umaldma *d); +static void umaldma_fillring (struct umal_softc *sc,struct umaldma *d); +static int umaldma_rx_process (struct umal_softc *sc,struct umaldma *d, +int work_to_do,int poll); +static void umaldma_tx_process (struct umal_softc *sc,struct umaldma *d, +int poll); + +static int umal_initctx (struct umal_softc *s); +static void umal_uninitctx (struct umal_softc *s); +static void umal_channel_start (struct umal_softc *s); +static void umal_channel_stop (struct umal_softc *s); +static enum umal_state umal_set_channel_state (struct umal_softc *, +enum umal_state ); + +static int umal_init (struct platform_device *pldev,long long base); +static int umal_open (struct net_device *dev); +static int umal_close (struct net_device *dev); +static int umal_mii_ioctl (struct net_device *dev,struct ifreq *rq,int cmd); +static irqreturn_t umal_intr (int irq,void *dev_instance); +static void umal_clr_intr (struct net_device *dev);
drivers/net/mac-puv3.c line 210
Quoted 10 lines
drivers/net/mac-puv3.c new file +10
-0+static int umal_start_tx (struct sk_buff *skb,struct net_device *dev); +static void umal_tx_timeout (struct net_device *dev); +static void umal_set_rx_mode (struct net_device *dev); +static void umal_promiscuous_mode (struct umal_softc *sc,int onoff); +static void umal_setmulti (struct umal_softc *sc); +static int umal_set_speed (struct umal_softc *s,enum umal_speed speed); +static int umal_set_duplex (struct umal_softc *s,enum umal_duplex duplex, +enum umal_fc fc); +static int umal_change_mtu (struct net_device *_dev,int new_mtu); +static void umal_miipoll (struct net_device *dev);
Best avoid all these prototypes. Instead, reorder the functions in the driver so you don't need them. That is the order in which reviewers expect them.
Quoted 11 lines
+/**********************************************************************
+ *UMAL_MII_RESET(bus)
+ *
+ * Reset MII bus.
+ *
+ * Input parameters:
+ * bus - MDIO bus handle
+ *
+ * Return value:
+ * 0 if ok
+ ********************************************************************* */
For extended function documentation, use the kerneldoc style, e.g.
/**
* umal_mii_reset - reset MII bus
*
* @bus: MDIO bus handle
*
* Returns 0
*/
See also Documentation/kernel-doc-nano-HOWTO.txt
Quoted 7 lines
drivers/net/mac-puv3.c new file +7
-0+/********************************************************************** +* UMALDMA_RX_PROCESS(sc,d,work_to_do,poll) +* +* Process "completed" receive buffers on the specified DMA channel. +* +* Input parameters: +* sc - softc structure
drivers/net/mac-puv3.c line 710
Quoted 10 lines
drivers/net/mac-puv3.c new file +10
-0+* d - DMA channel context +* work_to_do - no. of packets to process before enabling interrupt +* again (for NAPI) +* poll - 1: using polling (for NAPI) +* +* Return value: +* nothing +********************************************************************* */ +static int umaldma_rx_process (struct umal_softc *sc,struct umaldma *d, +int work_to_do,int poll)
It seems that you tried to convert the driver to NAPI but did not succeed, as this function is only called from the interrupt handler directly.
There is usually a significant performance win from using NAPI, so you should better try again. If you had problems doing that, please ask on netdev.
drivers/net/mac-puv3.c line 1182
Quoted 12 lines
drivers/net/mac-puv3.c new file +12
-0+ +#ifdef CONFIG_CMDLINE_FORCE + eaddr[0 ] =0x00 ; + eaddr[1 ] =0x25 ; + eaddr[2 ] =0x9b ; + eaddr[3 ] =0xff ; + eaddr[4 ] =0x00 ; + eaddr[5 ] =0x00 ; +#endif + +for (i =0 ; i <6 ; i++) + dev->dev_addr[i] = eaddr[i];
You can use random_ether_addr() to generate a working unique MAC address if the hardware does not provide one.
Arnd
RE: [PATCH 2/6] unicore32: add pkunity-v3 mac/net driver (umal)
Quoted 152 lines
-----Original Message-----
From: Arnd Bergmann [mailto:[email protected]]
Sent: Friday, May 27, 2011 5:20 PM
To: GuanXuetao
Cc: [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 2/6] unicore32: add pkunity-v3 mac/net driver (umal)Quoted 11 lines · GuanXuetao
From: Guan Xuetao <[email protected]>
Signed-off-by Guan Xuetao <[email protected]>--- MAINTAINERS | 1 + arch/unicore32/configs/debug_defconfig | 2 +- drivers/net/Kconfig | 5 + drivers/net/Makefile | 1 + drivers/net/mac-puv3.c | 1942 ++++++++++++++++++++++++++++++++ 5 files changed, 1950 insertions(+), 1 deletions(-) create mode 100644 drivers/net/mac-puv3.cI also have a few comments after looking through the driver.
drivers/net/mac-puv3.c line 40
Quoted 4 lines
drivers/net/mac-puv3.c new file +4
-0+ +/********************************************************************** +* Globals +********************************************************************* */ Regular commenting style would be
/*
* Globals
*/Quoted 37 lines
drivers/net/mac-puv3.c new file +37
-0+/********************************************************************** +* Prototypes +********************************************************************* */ +static int umal_mii_reset (struct mii_bus *bus); +static int umal_mii_read (struct mii_bus *bus,int phyaddr,int regidx); +static int umal_mii_write (struct mii_bus *bus,int phyaddr,int regidx, +u16 val); +static int umal_mii_probe (struct net_device *dev); + +static void umaldma_initctx (struct umaldma *d,struct umal_softc *s, +int rxtx,int maxdescr); +static void umaldma_uninitctx (struct umaldma *d); +static void umaldma_channel_start (struct umaldma *d,int rxtx); +static void umaldma_channel_stop (struct umaldma *d); +static int umaldma_add_rcvbuffer (struct umal_softc *sc,struct umaldma *d, +struct sk_buff *m); +static int umaldma_add_txbuffer (struct umaldma *d,struct sk_buff *m); +static void umaldma_emptyring (struct umaldma *d); +static void umaldma_fillring (struct umal_softc *sc,struct umaldma *d); +static int umaldma_rx_process (struct umal_softc *sc,struct umaldma *d, +int work_to_do,int poll); +static void umaldma_tx_process (struct umal_softc *sc,struct umaldma *d, +int poll); + +static int umal_initctx (struct umal_softc *s); +static void umal_uninitctx (struct umal_softc *s); +static void umal_channel_start (struct umal_softc *s); +static void umal_channel_stop (struct umal_softc *s); +static enum umal_state umal_set_channel_state (struct umal_softc *, +enum umal_state ); + +static int umal_init (struct platform_device *pldev,long long base); +static int umal_open (struct net_device *dev); +static int umal_close (struct net_device *dev); +static int umal_mii_ioctl (struct net_device *dev,struct ifreq *rq,int cmd); +static irqreturn_t umal_intr (int irq,void *dev_instance); +static void umal_clr_intr (struct net_device *dev);drivers/net/mac-puv3.c line 210
Quoted 10 lines
drivers/net/mac-puv3.c new file +10
-0+static int umal_start_tx (struct sk_buff *skb,struct net_device *dev); +static void umal_tx_timeout (struct net_device *dev); +static void umal_set_rx_mode (struct net_device *dev); +static void umal_promiscuous_mode (struct umal_softc *sc,int onoff); +static void umal_setmulti (struct umal_softc *sc); +static int umal_set_speed (struct umal_softc *s,enum umal_speed speed); +static int umal_set_duplex (struct umal_softc *s,enum umal_duplex duplex, +enum umal_fc fc); +static int umal_change_mtu (struct net_device *_dev,int new_mtu); +static void umal_miipoll (struct net_device *dev);Best avoid all these prototypes. Instead, reorder the functions in the driver so you don't need them. That is the order in which reviewers expect them.
Quoted 11 lines
+/**********************************************************************
+ *UMAL_MII_RESET(bus)
+ *
+ * Reset MII bus.
+ *
+ * Input parameters:
+ * bus - MDIO bus handle
+ *
+ * Return value:
+ * 0 if ok
+ ********************************************************************* */For extended function documentation, use the kerneldoc style, e.g.
/**
*umal_mii_reset- reset MII bus
*
* @bus: MDIO bus handle
*
* Returns 0
*/See also
Documentation/kernel-doc-nano-HOWTO.txtQuoted 7 lines
drivers/net/mac-puv3.c new file +7
-0+/********************************************************************** +* UMALDMA_RX_PROCESS(sc,d,work_to_do,poll) +* +* Process "completed" receive buffers on the specified DMA channel. +* +* Input parameters: +* sc - softc structure drivers/net/mac-puv3.c line 710
Quoted 10 lines
drivers/net/mac-puv3.c new file +10
-0+* d - DMA channel context +* work_to_do - no. of packets to process before enabling interrupt +* again (for NAPI) +* poll - 1: using polling (for NAPI) +* +* Return value: +* nothing +********************************************************************* */ +static int umaldma_rx_process (struct umal_softc *sc,struct umaldma *d, +int work_to_do,int poll)It seems that you tried to convert the driver to NAPI but did not succeed, as this function is only called from the interrupt handler directly.
There is usually a significant performance win from using NAPI, so you should better try again. If you had problems doing that, please ask on netdev.
drivers/net/mac-puv3.c line 1182
Quoted 12 lines
drivers/net/mac-puv3.c new file +12
-0+ +#ifdef CONFIG_CMDLINE_FORCE + eaddr[0 ] =0x00 ; + eaddr[1 ] =0x25 ; + eaddr[2 ] =0x9b ; + eaddr[3 ] =0xff ; + eaddr[4 ] =0x00 ; + eaddr[5 ] =0x00 ; +#endif + +for (i =0 ; i <6 ; i++) + dev->dev_addr[i] = eaddr[i];You can use
random_ether_addr()to generate a working unique MAC address if the hardware does not provide one.
Quoted 1 line
Arnd
Thanks Arnd.
I will redo this driver.
Guan Xuetao
PATCH 3/6 unicore32: change zImage physical address, though it's PIC codes
In reply to GuanXuetaoFrom: Guan Xuetao <[email protected]>
--- arch/unicore32/boot/compressed/Makefile | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/unicore32/boot/compressed/Makefile +1 -1
@@ -59,7 +59,7 @@ $(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/head.o $(obj)/piggy.o \ # We now have a PIC decompressor implementation. Decompressors running # from RAM should not define ZTEXTADDR. Decompressors running directly # from ROM or Flash must define ZTEXTADDR (preferably via the config) -ZTEXTADDR := 0 +ZTEXTADDR := 0x03000000 ZBSSADDR := ALIGN(4) SEDFLAGS_lds = s/TEXT_START/$(ZTEXTADDR)/;s/BSS_START/$(ZBSSADDR)/
Signature · 1 line
1.7.5.2
Re: [PATCH 3/6] unicore32: change zImage physical address, though it's PIC codes
Quoted 3 lines · GuanXuetao
From: Guan Xuetao <[email protected]>
Signed-off-by Guan Xuetao <[email protected]>
Remember to explain the changes in your changelog.
PATCH 4/6 unicore32: add KBUILD_DEFCONFIG with unicore32_defconfig (old debug_defconfig)
In reply to GuanXuetaoFrom: Guan Xuetao <[email protected]>
--- arch/unicore32/Makefile | 3 +- arch/unicore32/configs/debug_defconfig | 215 ---------------------------- arch/unicore32/configs/unicore32_defconfig | 215 ++++++++++++++++++++++++++++ 3 files changed, 217 insertions(+), 216 deletions(-) delete mode 100644 arch/unicore32/configs/debug_defconfig create mode 100644 arch/unicore32/configs/unicore32_defconfig
arch/unicore32/Makefile +2 -1
@@ -75,7 +75,8 @@ endif boot := arch/unicore32/boot -# Default target when executing plain make +# Default defconfig and target when executing plain make +KBUILD_DEFCONFIG := $(ARCH)_defconfig KBUILD_IMAGE := zImage all: $(KBUILD_IMAGE)
arch/unicore32/configs/debug_defconfig deleted +0 -215
215 lines not on this page · raw message
arch/unicore32/configs/unicore32_defconfig new file +215 -0
215 lines not on this page · raw message
Signature · 1 line
1.7.5.2
Re: [PATCH 4/6] unicore32: add KBUILD_DEFCONFIG with unicore32_defconfig (old debug_defconfig)
Quoted 8 lines · GuanXuetao
From: Guan Xuetao <[email protected]>
Signed-off-by Guan Xuetao <[email protected]>--- arch/unicore32/Makefile | 3 +- arch/unicore32/configs/debug_defconfig | 215 ---------------------------- arch/unicore32/configs/unicore32_defconfig | 215 ++++++++++++++++++++++++++++ 3 files changed, 217 insertions(+), 216 deletions(-)
Remember to use '-M'
PATCH 5/6 unicore32: change PERCPU to PERCPU_SECTION
In reply to GuanXuetaoFrom: Guan Xuetao <[email protected]>
see commit from Tejun Heo <0415b00d175e0d8945e6785aad21b5f157976ce0>
percpu: Always align percpu output section to PAGE_SIZE
--- arch/unicore32/kernel/vmlinux.lds.S | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/unicore32/kernel/vmlinux.lds.S +1 -1
@@ -30,7 +30,7 @@ SECTIONS HEAD_TEXT_SECTION INIT_TEXT_SECTION(PAGE_SIZE) INIT_DATA_SECTION(16) - PERCPU(L1_CACHE_BYTES, PAGE_SIZE) + PERCPU_SECTION(L1_CACHE_BYTES) __init_end = .; _stext = .;
Signature · 1 line
1.7.5.2
Re: [PATCH 5/6] unicore32: change PERCPU to PERCPU_SECTION
Quoted 6 lines · GuanXuetao
From: Guan Xuetao <[email protected]>
see commit from Tejun Heo <
0415b00d175e0d8945e6785aad21b5f157976ce0>
percpu: Always align percpu output section toPAGE_SIZESigned-off-by Guan Xuetao <[email protected]>
Yeap, sorry about missing unicore32.
Thank you.
Signature · 1 line
tejun
PATCH 6/6 unicore32: using generic-y format for one line asm-generic files
In reply to GuanXuetaoFrom: Guan Xuetao <[email protected]>
see commit from Sam Ravnborg <d8ecc5cd8e227bc318513b5306ae88a474b8886d>
kbuild: asm-generic support
--- arch/unicore32/Makefile | 35 ---------------------- arch/unicore32/include/asm/Kbuild | 59 +++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 35 deletions(-)
arch/unicore32/Makefile +0 -35
@@ -40,39 +40,6 @@ core-y += arch/unicore32/mm/ libs-y += arch/unicore32/lib/ -ASM_GENERATED_DIR := $(srctree)/arch/unicore32/include/generated -LINUXINCLUDE += -I$(ASM_GENERATED_DIR) - -ASM_GENERIC_HEADERS := atomic.h auxvec.h -ASM_GENERIC_HEADERS += bitsperlong.h bug.h bugs.h -ASM_GENERIC_HEADERS += cputime.h current.h -ASM_GENERIC_HEADERS += device.h div64.h -ASM_GENERIC_HEADERS += emergency-restart.h errno.h -ASM_GENERIC_HEADERS += fb.h fcntl.h ftrace.h futex.h -ASM_GENERIC_HEADERS += hardirq.h hw_irq.h -ASM_GENERIC_HEADERS += ioctl.h ioctls.h ipcbuf.h irq_regs.h -ASM_GENERIC_HEADERS += kdebug.h kmap_types.h -ASM_GENERIC_HEADERS += local.h -ASM_GENERIC_HEADERS += mman.h module.h msgbuf.h -ASM_GENERIC_HEADERS += param.h parport.h percpu.h poll.h posix_types.h -ASM_GENERIC_HEADERS += resource.h -ASM_GENERIC_HEADERS += scatterlist.h sections.h segment.h sembuf.h serial.h -ASM_GENERIC_HEADERS += setup.h shmbuf.h shmparam.h -ASM_GENERIC_HEADERS += siginfo.h signal.h sizes.h -ASM_GENERIC_HEADERS += socket.h sockios.h stat.h statfs.h swab.h syscalls.h -ASM_GENERIC_HEADERS += termbits.h termios.h topology.h types.h -ASM_GENERIC_HEADERS += ucontext.h unaligned.h user.h -ASM_GENERIC_HEADERS += vga.h -ASM_GENERIC_HEADERS += xor.h - -archprepare: -ifneq ($(ASM_GENERATED_DIR), $(wildcard $(ASM_GENERATED_DIR))) - $(Q)mkdir -p $(ASM_GENERATED_DIR)/asm - $(Q)$(foreach a, $(ASM_GENERIC_HEADERS), \ - echo '#include <asm-generic/$a>' \ - > $(ASM_GENERATED_DIR)/asm/$a; ) -endif - boot := arch/unicore32/boot # Default defconfig and target when executing plain make
@@ -84,8 +51,6 @@ all: $(KBUILD_IMAGE) zImage Image uImage: vmlinux $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ -MRPROPER_DIRS += $(ASM_GENERATED_DIR) - archclean: $(Q)$(MAKE) $(clean)=$(boot)
arch/unicore32/include/asm/Kbuild +59 -0
61 lines not on this page · raw message
Signature · 1 line
1.7.5.2
Re: [PATCH 6/6] unicore32: using generic-y format for one line asm-generic files
Quoted 10 lines · GuanXuetao
From: Guan Xuetao <[email protected]>
see commit from Sam Ravnborg <
d8ecc5cd8e227bc318513b5306ae88a474b8886d>
kbuild: asm-generic supportSigned-off-by Guan Xuetao <[email protected]>--- arch/unicore32/Makefile | 35 ---------------------- arch/unicore32/include/asm/Kbuild | 59 +++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 35 deletions(-)
This reminds me that I should do the same for ARM and maybe some others.
RE: [PATCH 6/6] unicore32: using generic-y format for one line asm-generic files
Quoted 21 lines
-----Original Message-----
From: Arnd Bergmann [mailto:[email protected]]
Sent: Thursday, May 26, 2011 8:45 PM
To: GuanXuetao
Cc: [email protected]; [email protected]; [email protected]; Sam Ravnborg
Subject: Re: [PATCH 6/6] unicore32: using generic-y format for one line asm-generic filesQuoted 10 lines · GuanXuetao
From: Guan Xuetao <[email protected]>
see commit from Sam Ravnborg <
d8ecc5cd8e227bc318513b5306ae88a474b8886d>
kbuild: asm-generic supportSigned-off-by Guan Xuetao <[email protected]>--- arch/unicore32/Makefile | 35 ---------------------- arch/unicore32/include/asm/Kbuild | 59 +++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 35 deletions(-)
Quoted 3 lines
Acked-by Arnd Bergmann <[email protected]>This reminds me that I should do the same for ARM and maybe some others.
There is a potential problem.
When I add stat.h with generic-y method, a file is generated in arch/*/include/generated/asm/ dir. And then, a patch for old-abi is applied, which will restore an old stat.h in arch/*/include/asm/ dir. Without removing the line in arch/*/include/asm/Kbuild, two files exist in the meantime. It works, depending on the order in LINUXINCLUDE, and (perhaps) the handling order in gcc. So, a check and warning mechanism should be provided to clear up the confusion.
Guan Xuetao
Arnd Bergmann
maintainerQuoted 6 lines · GuanXuetao
Two patches for PKUnity v3 SoC drivers:
add mac driver, and move rtc driver to appropriate place
Two patches for new 2.6.39 updates:
using generic-y and modify PERCPU macro
Other two patches are small fixes.
Quoted 10 lines
---
Guan Xuetao (6):
unicore32: movertc-puv3.ctodrivers/rtcdirectory
unicore32: add pkunity-v3 mac/net driver (umal)
unicore32: change zImage physical address, though it's PIC codes
unicore32: addKBUILD_DEFCONFIGwithunicore32_defconfig(old
debug_defconfig)
unicore32: change PERCPU toPERCPU_SECTION
unicore32: using generic-y format for one line asm-generic files
The patches look basically ok, but two points to remember:
* The merge window is not the time to post patches for review, if you want to collect Acked-by's from other people, do that in the time between the merge windows, then put the patches in your git tree with the Acked-by for linux-next. During the merge window, just send stuff that was already in your tree to Linus.
Bug fixes should get sent to Linus at any time, but I think you already did that, all of these were either new features or cleanups.
* Add a small text explaining why you do something to each patch. The one-line summary that you always have is too short for this and only serves to list what you change, not why.
Arnd
Quoted 35 lines
-----Original Message-----
From: Arnd Bergmann [mailto:[email protected]]
Sent: Thursday, May 26, 2011 8:50 PM
To: GuanXuetao
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 0/6] unicore32 subsystem: 6 patches for 2.6.39Quoted 6 lines · GuanXuetao
Two patches for PKUnity v3 SoC drivers:
add mac driver, and move rtc driver to appropriate place
Two patches for new 2.6.39 updates:
using generic-y and modify PERCPU macro
Other two patches are small fixes.Quoted 10 lines
---
Guan Xuetao (6):
unicore32: movertc-puv3.ctodrivers/rtcdirectory
unicore32: add pkunity-v3 mac/net driver (umal)
unicore32: change zImage physical address, though it's PIC codes
unicore32: addKBUILD_DEFCONFIGwithunicore32_defconfig(old
debug_defconfig)
unicore32: change PERCPU toPERCPU_SECTION
unicore32: using generic-y format for one line asm-generic filesThe patches look basically ok, but two points to remember:
* The merge window is not the time to post patches for review, if you want to collect Acked-by's from other people, do that in the time between the merge windows, then put the patches in your git tree with the Acked-by for linux-next. During the merge window, just send stuff that was already in your tree to Linus.
Quoted 6 lines
Bug fixes should get sent to Linus at any time, but I think you already did that, all of these were either new features or cleanups.
* Add a small text explaining why you do something to each patch. The one-line summary that you always have is too short for this and only serves to list what you change, not why.
I see. Thanks for your explanation.
Quoted 2 lines
Arnd
Thanks & Regards.
Guan Xuetao