Re: [patch 2.6.20-rc1 6/6] input: ads7846 directly senses PENUP state
David Brownell a écrit : On Thursday 28 December 2006 10:22 pm, Dmitry Torokhov wrote: I appied all patches except for hwmon as it had some issues with CONFIG_HWMON handling. Could you please take a look at the patch below and tell me if it works for you? Looked OK, except: +#if defined(CONFIG_HWMON) || (defined(MODULE) defined(CONFIG_HWMON_MODULE)) That idiom is more usually written #if defined(CONFIG_HWMON) || defined(CONFIG_HWMON_MODULE) Thanks! I'll be glad to see fewer versions of this driver floating around. And to see the next version of the ads7843 patches ... :) Hi, I am back on this task... I hope I will have a working patchset soon. I face an issue using the hrtimer instead of the old timer framework (your patch #4/6). It seems that I do not sample at a sufficient rate using hrtimer : I see squares when drawing circles ;-) Do you know if the hrtimer framework has an issue on at91 or do I have to code something to have a low res timer support in the hrtimer framework ? Cheers, -- Nicolas Ferre - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] input/spi: add ads7843 support to ads7846 touchscreen driver
Add support for the ads7843 touchscreen controller to the ads7846 driver code. The pen down information is managed quite differently as we do not have a touch-pressure measurement on the ads7843. Signed-off-by: Nicolas Ferre [EMAIL PROTECTED] --- I add a ads7843_rx function to manage the end of a measurement cycle. As for ads7846_rx, it does the real work and communicates with the input subsystem. The timer function is responsible of taking the pen up/pen down state through the board specific get_pendown_state() callback. As the SPI underlying code behaves quite differently from a controller driver to another while not having a tx_buf filled, I have add a zeroed buffer to give to the SPI layer while receiving data. === --- a/input/touchscreen/ads7846.c (.../linux-2.6.19-at91/drivers) (revision 634) +++ b/input/touchscreen/ads7846.c (.../linux-2.6.19-atmel-devel/drivers) (revision 634) @@ -4,6 +4,7 @@ * Copyright (c) 2005 David Brownell * Copyright (c) 2006 Nokia Corporation * Various changes: Imre Deak [EMAIL PROTECTED] + * Ads7843 support: Atmel, Nicolas Ferre [EMAIL PROTECTED] * * Using code from: * - corgi_ts.c @@ -38,7 +39,8 @@ /* * This code has been heavily tested on a Nokia 770, and lightly * tested on other ads7846 devices (OSK/Mistral, Lubbock). - * Support for ads7843 and ads7845 has only been stubbed in. + * Support for ads7843 tested on Atmel at91sam926x-EK. + * Support for ads7845 has only been stubbed in. * * IRQ handling needs a workaround because of a shortcoming in handling * edge triggered IRQs on some platforms like the OMAP1/2. These @@ -82,6 +84,7 @@ struct ads7846 { u16 pressure_max; u8 read_x, read_y, read_z1, read_z2, pwrdown; + u16 zerro; /* to send zerros while receiving */ u16 dummy; /* for the pwrdown read */ struct ts_event tc; @@ -151,6 +154,10 @@ struct ads7846 { #define READ_X (READ_12BIT_DFR(x) | ADS_PD10_ADC_ON) #define PWRDOWN (READ_12BIT_DFR(y) | ADS_PD10_PDOWN) /* LAST */ +/* alternate ads7843 commands */ +#defineALT_READ_Y (READ_12BIT_DFR(y) | ADS_PD10_ALL_ON) +#defineALT_READ_X (READ_12BIT_DFR(x) | ADS_PD10_ALL_ON) + /* single-ended samples need to first power up reference voltage; * we leave both ADC and VREF powered */ @@ -171,6 +178,7 @@ struct ser_req { u8 command; u8 ref_off; u16 scratch; + u16 zerro; __be16 sample; struct spi_message msg; struct spi_transfer xfer[6]; @@ -203,6 +211,7 @@ static int ads7846_read12_ser(struct dev req-ref_on = REF_ON; req-xfer[0].tx_buf = req-ref_on; req-xfer[0].len = 1; + req-xfer[1].tx_buf = req-zerro; req-xfer[1].rx_buf = req-scratch; req-xfer[1].len = 2; @@ -217,6 +226,7 @@ static int ads7846_read12_ser(struct dev req-command = (u8) command; req-xfer[2].tx_buf = req-command; req-xfer[2].len = 1; + req-xfer[3].tx_buf = req-zerro; req-xfer[3].rx_buf = req-sample; req-xfer[3].len = 2; @@ -226,6 +236,7 @@ static int ads7846_read12_ser(struct dev req-ref_off = REF_OFF; req-xfer[4].tx_buf = req-ref_off; req-xfer[4].len = 1; + req-xfer[3].tx_buf = req-zerro; req-xfer[5].rx_buf = req-scratch; req-xfer[5].len = 2; @@ -410,6 +421,50 @@ static void ads7846_rx(void *ads) spin_unlock_irqrestore(ts-lock, flags); } +static void ads7843_rx(void *ads) +{ + struct ads7846 *ts = ads; + struct input_dev*input_dev = ts-input; + u16 x, y; + unsigned long flags; + + + /* adjust: on-wire is a must-ignore bit, a BE12 value, then padding; +* built from two 8 bit values written msb-first. +*/ + x = (be16_to_cpu(ts-tc.x) 3) 0x0fff; + y = (be16_to_cpu(ts-tc.y) 3) 0x0fff; + + /* range filtering */ + if (x == MAX_12BIT) + x = 0; + + if (ts-pendown) { + input_report_key(input_dev, BTN_TOUCH, 1); + input_report_abs(input_dev, ABS_PRESSURE, ts-pressure_max / 2); + input_report_abs(input_dev, ABS_X, x); + input_report_abs(input_dev, ABS_Y, y); + } else { + input_report_key(input_dev, BTN_TOUCH, 0); + input_report_abs(input_dev, ABS_PRESSURE, 0); + } + + input_sync(input_dev); + +#ifdef VERBOSE + pr_debug(%s: %d/%d%s\n, ts-spi-dev.bus_id, + x, y, ts-pendown ? : UP); +#endif + + if (ts-pendown) { + spin_lock_irqsave(ts-lock, flags); + + mod_timer(ts-timer, jiffies + TS_POLL_PERIOD
Re: [PATCH] input/spi: add ads7843 support to ads7846 touchscreen driver
Andrew Morton a écrit : On Fri, 15 Dec 2006 15:45:08 +0100 Nicolas FERRE [EMAIL PROTECTED] wrote: Add support for the ads7843 touchscreen controller to the ads7846 driver code. Generates a lot of errors when applied to the current mainline kernel. Please prepare and test patches against Linus's current git tree. Hi, David Brownell told me to take into account code written by the omap/N770 guys. I will then refresh my patch against those bits and produce an up-to-date patch. Follow-up for this thread @ http://lkml.org/lkml/2006/12/20/293 Regards, -- Nicolas Ferre - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] input/spi: add ads7843 support to ads7846 touchscreen driver
David Brownell a écrit : On Friday 15 December 2006 7:20 am, Nicolas FERRE wrote: Add support for the ads7843 touchscreen controller to the ads7846 driver code. Glad to see this! Is this for AT91sam9261-EK board support, maybe? Indeed ! An also for the AT91sam9263-EK which has the same touchscreen chip. Let me try to sort out the mess with those updates, and ask you to refresh this ads7843 support against that more-current ads7846 code. Ok, let me know when you have a newer code. I will try to adapt my ads7843 support then. As the SPI underlying code behaves quite differently from a controller driver to another whan not having a tx_buf filled, I have add a zerroed buffer to give to the spi layer while receiving data. You must be working with a buggy controller driver then. That part of this patch should never be needed. It's expected that rx-only transfers will omit a tx buf; all controller drivers must handle that case. I said that because it is true that most of spi controller drivers manage rx only transactions filling the tx buffer with zerros but the spi_s3c24xx.c driver seems to fill with ones (line 177 hw_txbyte()) Anyway, I will check in our controller driver to sort this out. Regards, -- Nicolas Ferre - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] input/spi: add ads7843 support to ads7846 touchscreen driver
Nicolas Ferre a écrit : As the SPI underlying code behaves quite differently from a controller driver to another whan not having a tx_buf filled, I have add a zerroed buffer to give to the spi layer while receiving data. You must be working with a buggy controller driver then. That part of this patch should never be needed. It's expected that rx-only transfers will omit a tx buf; all controller drivers must handle that case. I said that because it is true that most of spi controller drivers manage rx only transactions filling the tx buffer with zerros but the spi_s3c24xx.c driver seems to fill with ones (line 177 hw_txbyte()) Anyway, I will check in our controller driver to sort this out. I dug a bit into this. Well, in the atmel_spi driver code, we use previous rx buffer if we do not provide a tx_buf (as it is said that in struct spi_transfer comments, If the transmit buffer is null, undefined data will be shifted out while filling rx_buf). So, the touchscreen controller sees sometimes a start condition (bit 7 of a control byte). It then takes the control byte and sets trash bits as a configuration. I ran into those troubles and add a zerroed buffer as tx. Do you think that shifting zerros out when a tx_buf is not specified is the desired behavior ? Regards, -- Nicolas Ferre - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 08/10] net/macb: macb_get_drvinfo: add GEM/MACB suffix to differentiate revision
On 09/06/2012 01:27 AM, Ben Hutchings : On Wed, 2012-09-05 at 11:00 +0200, Nicolas Ferre wrote: Add an indication about which revision of the hardware we are running in info-driver string. Signed-off-by: Nicolas Ferre nicolas.fe...@atmel.com --- drivers/net/ethernet/cadence/macb.c |4 1 file changed, 4 insertions(+) diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c index bd331fd..c7c39f1 100644 --- a/drivers/net/ethernet/cadence/macb.c +++ b/drivers/net/ethernet/cadence/macb.c @@ -1313,6 +1313,10 @@ static void macb_get_drvinfo(struct net_device *dev, struct macb *bp = netdev_priv(dev); strcpy(info-driver, bp-pdev-dev.driver-name); +if (macb_is_gem(bp)) +strcat(info-driver, GEM); +else +strcat(info-driver, MACB); strcpy(info-version, $Revision: 1.14 $); Related to hardware revisions (which don't belong here, as David said), I rather doubt this CVS ID is very useful as a driver version. If the driver doesn't have a meaningful version (aside from the kernel version) then you can remove this function and let the ethtool core fill in the other two fields automatically. Absolutely, I will do this. Thanks for the tip. Best regards, -- Nicolas Ferre -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 09/10] net/macb: ethtool interface: add register dump feature
Add macb_get_regs() ethtool function and its helper function: macb_get_regs_len(). The version field is deduced from the IP revision which gives the MACB or GEM information. An additional version field is reserved. Signed-off-by: Nicolas Ferre nicolas.fe...@atmel.com --- v2: - modify MACB_GREGS_NBR name and adapt to number of registers actually displayed. - change version format to reflect register layout and add a version number to be future proof. drivers/net/ethernet/cadence/macb.c | 40 +++ drivers/net/ethernet/cadence/macb.h |3 +++ 2 files changed, 43 insertions(+) diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c index dc34ff1..cab42e7 100644 --- a/drivers/net/ethernet/cadence/macb.c +++ b/drivers/net/ethernet/cadence/macb.c @@ -1223,9 +1223,49 @@ static int macb_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) return phy_ethtool_sset(phydev, cmd); } +static int macb_get_regs_len(struct net_device *netdev) +{ + return MACB_GREGS_NBR * sizeof(u32); +} + +static void macb_get_regs(struct net_device *dev, struct ethtool_regs *regs, + void *p) +{ + struct macb *bp = netdev_priv(dev); + unsigned int tail, head; + u32 *regs_buff = p; + + regs-version = (macb_readl(bp, MID) ((1 MACB_REV_SIZE) - 1)) + | MACB_GREGS_VERSION; + + tail = macb_tx_ring_wrap(bp-tx_tail); + head = macb_tx_ring_wrap(bp-tx_head); + + regs_buff[0] = macb_readl(bp, NCR); + regs_buff[1] = macb_or_gem_readl(bp, NCFGR); + regs_buff[2] = macb_readl(bp, NSR); + regs_buff[3] = macb_readl(bp, TSR); + regs_buff[4] = macb_readl(bp, RBQP); + regs_buff[5] = macb_readl(bp, TBQP); + regs_buff[6] = macb_readl(bp, RSR); + regs_buff[7] = macb_readl(bp, IMR); + + regs_buff[8] = tail; + regs_buff[9] = head; + regs_buff[10] = macb_tx_dma(bp, tail); + regs_buff[11] = macb_tx_dma(bp, head); + + if (macb_is_gem(bp)) { + regs_buff[12] = gem_readl(bp, USRIO); + regs_buff[13] = gem_readl(bp, DMACFG); + } +} + static const struct ethtool_ops macb_ethtool_ops = { .get_settings = macb_get_settings, .set_settings = macb_set_settings, + .get_regs_len = macb_get_regs_len, + .get_regs = macb_get_regs, .get_link = ethtool_op_get_link, }; diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h index f69ceef..bcadc3c 100644 --- a/drivers/net/ethernet/cadence/macb.h +++ b/drivers/net/ethernet/cadence/macb.h @@ -10,6 +10,9 @@ #ifndef _MACB_H #define _MACB_H +#define MACB_GREGS_NBR 16 +#define MACB_GREGS_VERSION 1 + /* MACB register offsets */ #define MACB_NCR 0x #define MACB_NCFGR 0x0004 -- 1.7.10 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 04/10] net/macb: Fix a race in macb_start_xmit()
On 09/05/2012 11:30 PM, David Miller : From: Nicolas Ferre nicolas.fe...@atmel.com Date: Wed, 5 Sep 2012 10:19:11 +0200 From: Havard Skinnemoen hav...@skinnemoen.net Fix a race in macb_start_xmit() where we unconditionally set the TSTART bit. If an underrun just happened (we do this with interrupts disabled, so it might not have been handled yet), the controller starts transmitting from the first entry in the ring, which is usually wrong. Restart the controller after error handling. Signed-off-by: Havard Skinnemoen hav...@skinnemoen.net [nicolas.fe...@atmel.com: split patch in topics] Signed-off-by: Nicolas Ferre nicolas.fe...@atmel.com Accumulating special case code and checks into the hot path of TX packet processing is extremely unwise. Instead, when you handle the TX error conditions and reset the chip you should first ensure that there are no flows of control in the transmit function of your driver by using the appropriate locking et al. facilities. For example, you can quiesce the transmit path by handling the chip error interrupt as follows: 1) Disable chip interrupt generation. 2) Schedule a workqueue so you can process the reset outside of hard interrupt context. 3) In the workqueue function, disable NAPI and perform a netif_tx_disable() to guarentee there are no threads of execution trying to queue up packets for TX into the driver. 4) Perform your chip reset and whatever else is necessary. 5) Re-enable NAPI and TX. Then you don't need any special checks in your xmit method at all. I see... I will rework the series and try to implement this as part of the [PATCH 06/10] net/macb: better manage tx errors So this patch will disappear in future v2 series and patch 06 will be seriously modified. In fact I will also try to stack cosmetic patches at the beginning of the series. Thanks, best regards, -- Nicolas Ferre -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 04/10] net/macb: Fix a race in macb_start_xmit()
On 09/06/2012 05:49 PM, Havard Skinnemoen : On Wed, Sep 5, 2012 at 11:30 PM, David Miller da...@davemloft.net wrote: From: Nicolas Ferre nicolas.fe...@atmel.com Date: Wed, 5 Sep 2012 10:19:11 +0200 From: Havard Skinnemoen hav...@skinnemoen.net Fix a race in macb_start_xmit() where we unconditionally set the TSTART bit. If an underrun just happened (we do this with interrupts disabled, so it might not have been handled yet), the controller starts transmitting from the first entry in the ring, which is usually wrong. Restart the controller after error handling. Signed-off-by: Havard Skinnemoen hav...@skinnemoen.net [nicolas.fe...@atmel.com: split patch in topics] Signed-off-by: Nicolas Ferre nicolas.fe...@atmel.com Accumulating special case code and checks into the hot path of TX packet processing is extremely unwise. Instead, when you handle the TX error conditions and reset the chip you should first ensure that there are no flows of control in the transmit function of your driver by using the appropriate locking et al. facilities. IIRC, the hardware resets the ring pointers when an error happens, and if we set TSTART right after that happens, the hardware will happily transmit whatever is sitting in the beginning of the ring. This is what I was trying to avoid. The details are a bit hazy as it's been a while since I looked at this, so it could be that simply letting it happen and using a bigger hammer during reset processing might work just as well. Just want to make sure y'all understand that we're talking about a race against hardware, not against interrupt handlers, threads or anything that can be solved by locking :) Yes, you are right Havard. I will see if we can let the transmitter go just before being interrupted by the pending error. It is true that there are several cases here: - tx immediately stopped again by the USED bit of a non initialized descriptor. We thus have to cleanup the error frame but also take care about the newly queued packet... - beginning of transmission of a not-related fragment that has just been queued by the start_xmit; just before catching the pending error IRQ. We may have to consider the consequences of this! So, stay tuned ;-) Best regards, -- Nicolas Ferre -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 01/16] ARM: at91: move platform_data definitions
On 09/11/2012 03:20 PM, Jean-Christophe PLAGNIOL-VILLARD : On 14:59 Tue 11 Sep , Arnd Bergmann wrote: Platform data for device drivers should be defined in include/linux/platform_data/*.h, not in the architecture and platform specific directories. This moves such data out of the at91 include directories Signed-off-by: Arnd Bergmann a...@arndb.de Cc: Nicolas Ferre nicolas.fe...@atmel.com Cc: Jean-Christophe Plagniol-Villard plagn...@jcrosoft.com Cc: Vinod Koul vinod.k...@intel.com Cc: Dan Williams d...@fb.com --- arch/arm/mach-at91/at91sam9g45_devices.c |2 +- arch/arm/mach-at91/at91sam9rl_devices.c |2 +- arch/arm/mach-at91/include/mach/atmel-mci.h |2 +- drivers/dma/at_hdmac_regs.h |2 +- include/linux/platform_data/atmel-aes.h |2 +- .../mach/at_hdmac.h = include/linux/platform_data/dma-atmel.h |0 6 files changed, 5 insertions(+), 5 deletions(-) rename arch/arm/mach-at91/include/mach/at_hdmac.h = include/linux/platform_data/dma-atmel.h (100%) diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c index 0607399..0aa9bdb 100644 --- a/arch/arm/mach-at91/at91sam9g45_devices.c +++ b/arch/arm/mach-at91/at91sam9g45_devices.c @@ -31,7 +31,7 @@ #include mach/at91sam9g45_matrix.h #include mach/at91_matrix.h #include mach/at91sam9_smc.h -#include mach/at_hdmac.h +#include linux/platform_data/dma-atmel.h #include mach/atmel-mci.h #include media/atmel-isi.h diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c index f09fff9..e4da717 100644 --- a/arch/arm/mach-at91/at91sam9rl_devices.c +++ b/arch/arm/mach-at91/at91sam9rl_devices.c @@ -22,7 +22,7 @@ #include mach/at91sam9rl_matrix.h #include mach/at91_matrix.h #include mach/at91sam9_smc.h -#include mach/at_hdmac.h +#include linux/platform_data/dma-atmel.h I prefer to have all of them in atmel.h as I started Sorry J. but I do not agree: - ok for what is currently in include/mach/board.h == platform_data/atmel.h - no for individual drivers that have already a dedicated header file So for this move of at_hdmac.h == dma-atmel.h Acked-by: Nicolas Ferre nicolas.fe...@atmel.com Best regards, #include generic.h diff --git a/arch/arm/mach-at91/include/mach/atmel-mci.h b/arch/arm/mach-at91/include/mach/atmel-mci.h index 998cb0c..cd580a1 100644 --- a/arch/arm/mach-at91/include/mach/atmel-mci.h +++ b/arch/arm/mach-at91/include/mach/atmel-mci.h @@ -1,7 +1,7 @@ #ifndef __MACH_ATMEL_MCI_H #define __MACH_ATMEL_MCI_H -#include mach/at_hdmac.h +#include linux/platform_data/dma-atmel.h /** * struct mci_dma_data - DMA data for MCI interface diff --git a/drivers/dma/at_hdmac_regs.h b/drivers/dma/at_hdmac_regs.h index 8a6c8e8..116e4ad 100644 --- a/drivers/dma/at_hdmac_regs.h +++ b/drivers/dma/at_hdmac_regs.h @@ -11,7 +11,7 @@ #ifndef AT_HDMAC_REGS_H #define AT_HDMAC_REGS_H -#include mach/at_hdmac.h +#include linux/platform_data/dma-atmel.h #define AT_DMA_MAX_NR_CHANNELS 8 diff --git a/include/linux/platform_data/atmel-aes.h b/include/linux/platform_data/atmel-aes.h index e7a1949..ab68082 100644 --- a/include/linux/platform_data/atmel-aes.h +++ b/include/linux/platform_data/atmel-aes.h @@ -1,7 +1,7 @@ #ifndef __LINUX_ATMEL_AES_H #define __LINUX_ATMEL_AES_H -#include mach/at_hdmac.h +#include linux/platform_data/dma-atmel.h /** * struct aes_dma_data - DMA data for AES diff --git a/arch/arm/mach-at91/include/mach/at_hdmac.h b/include/linux/platform_data/dma-atmel.h similarity index 100% rename from arch/arm/mach-at91/include/mach/at_hdmac.h rename to include/linux/platform_data/dma-atmel.h -- 1.7.10 -- Nicolas Ferre -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/2] dmaengine: at_hdmac: fix comment in atc_prep_slave_sg()
s/dma_memcpy/slave_sg/ and it is sg length that we are talking about. Signed-off-by: Nicolas Ferre nicolas.fe...@atmel.com Cc: Stable sta...@vger.kernel.org [2.6.31+] --- drivers/dma/at_hdmac.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c index 3934fcc..6c09e18 100644 --- a/drivers/dma/at_hdmac.c +++ b/drivers/dma/at_hdmac.c @@ -661,7 +661,7 @@ atc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl, flags); if (unlikely(!atslave || !sg_len)) { - dev_dbg(chan2dev(chan), prep_dma_memcpy: length is zero!\n); + dev_dbg(chan2dev(chan), prep_slave_sg: sg length is zero!\n); return NULL; } -- 1.7.10 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/2] dmaengine: at_hdmac: check that each sg data length is non-null
Avoid the construction of a malformed DMA request sent to the DMA controller. Log message is for debug only because this condition is unlikely to append and may only trigger at driver development time. Signed-off-by: Nicolas Ferre nicolas.fe...@atmel.com Cc: Stable sta...@vger.kernel.org [2.6.31+] --- drivers/dma/at_hdmac.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c index 6c09e18..7ab6e26 100644 --- a/drivers/dma/at_hdmac.c +++ b/drivers/dma/at_hdmac.c @@ -689,6 +689,11 @@ atc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl, mem = sg_dma_address(sg); len = sg_dma_len(sg); + if (unlikely(!len)) { + dev_dbg(chan2dev(chan), + prep_slave_sg: sg(%d) data length is zero\n, i); + goto err; + } mem_width = 2; if (unlikely(mem 3 || len 3)) mem_width = 0; @@ -724,6 +729,11 @@ atc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl, mem = sg_dma_address(sg); len = sg_dma_len(sg); + if (unlikely(!len)) { + dev_dbg(chan2dev(chan), + prep_slave_sg: sg(%d) data length is zero\n, i); + goto err; + } mem_width = 2; if (unlikely(mem 3 || len 3)) mem_width = 0; @@ -757,6 +767,7 @@ atc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl, err_desc_get: dev_err(chan2dev(chan), not enough descriptors available\n); +err: atc_desc_put(atchan, first); return NULL; } -- 1.7.10 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 02/24] ARM: at91: use __iomem pointers for MMIO
On 09/14/2012 11:34 PM, Arnd Bergmann : ARM is moving to stricter checks on readl/write functions, so we need to use the correct types everywhere. Cc: Nicolas Ferre nicolas.fe...@atmel.com Cc: Jean-Christophe Plagniol-Villard plagn...@jcrosoft.com Signed-off-by: Arnd Bergmann a...@arndb.de --- arch/arm/mach-at91/at91x40.c |2 +- arch/arm/mach-at91/at91x40_time.c|4 ++-- arch/arm/mach-at91/include/mach/hardware.h |4 ++-- arch/arm/mach-at91/include/mach/uncompress.h |6 +++--- arch/arm/mach-at91/setup.c |4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/arch/arm/mach-at91/at91x40.c b/arch/arm/mach-at91/at91x40.c index 46090e6..6bd7300 100644 --- a/arch/arm/mach-at91/at91x40.c +++ b/arch/arm/mach-at91/at91x40.c @@ -47,7 +47,7 @@ static void at91x40_idle(void) * Disable the processor clock. The processor will be automatically * re-enabled by an interrupt or by a reset. */ - __raw_writel(AT91_PS_CR_CPU, AT91_PS_CR); + __raw_writel(AT91_PS_CR_CPU, AT91_IO_P2V(AT91_PS_CR)); cpu_do_idle(); } diff --git a/arch/arm/mach-at91/at91x40_time.c b/arch/arm/mach-at91/at91x40_time.c index 6ca680a..ee06d7b 100644 --- a/arch/arm/mach-at91/at91x40_time.c +++ b/arch/arm/mach-at91/at91x40_time.c @@ -29,10 +29,10 @@ #include mach/at91_tc.h #define at91_tc_read(field) \ - __raw_readl(AT91_TC + field) + __raw_readl(AT91_IO_P2V(AT91_TC) + field) #define at91_tc_write(field, value) \ - __raw_writel(value, AT91_TC + field); + __raw_writel(value, AT91_IO_P2V(AT91_TC) + field); /* * 3 counter/timer units present. diff --git a/arch/arm/mach-at91/include/mach/hardware.h b/arch/arm/mach-at91/include/mach/hardware.h index 09242b6..711a789 100644 --- a/arch/arm/mach-at91/include/mach/hardware.h +++ b/arch/arm/mach-at91/include/mach/hardware.h @@ -67,13 +67,13 @@ * to 0xFEF78000 .. 0xFF00. (544Kb) */ #define AT91_IO_PHYS_BASE0xFFF78000 -#define AT91_IO_VIRT_BASE(0xFF00 - AT91_IO_SIZE) +#define AT91_IO_VIRT_BASEIOMEM(0xFF00 - AT91_IO_SIZE) #else /* * Identity mapping for the non MMU case. */ #define AT91_IO_PHYS_BASEAT91_BASE_SYS -#define AT91_IO_VIRT_BASEAT91_IO_PHYS_BASE +#define AT91_IO_VIRT_BASEIOMEM(AT91_IO_PHYS_BASE) #endif #define AT91_IO_SIZE (0x - AT91_IO_PHYS_BASE + 1) diff --git a/arch/arm/mach-at91/include/mach/uncompress.h b/arch/arm/mach-at91/include/mach/uncompress.h index 6f6118d..58c9d5b 100644 --- a/arch/arm/mach-at91/include/mach/uncompress.h +++ b/arch/arm/mach-at91/include/mach/uncompress.h @@ -94,7 +94,7 @@ static const u32 uarts_sam9x5[] = { 0, }; -static inline const u32* decomp_soc_detect(u32 dbgu_base) +static inline const u32* decomp_soc_detect(void __iomem*dbgu_base) A whitespace is missing before the *, no? { u32 cidr, socid; @@ -142,10 +142,10 @@ static inline void arch_decomp_setup(void) int i = 0; const u32* usarts; - usarts = decomp_soc_detect(AT91_BASE_DBGU0); + usarts = decomp_soc_detect((void __iomem *)AT91_BASE_DBGU0); if (!usarts) - usarts = decomp_soc_detect(AT91_BASE_DBGU1); + usarts = decomp_soc_detect((void __iomem *)AT91_BASE_DBGU1); if (!usarts) { at91_uart = NULL; return; diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c index 944bffb..e6f52de 100644 --- a/arch/arm/mach-at91/setup.c +++ b/arch/arm/mach-at91/setup.c @@ -73,7 +73,7 @@ void __init at91_init_sram(int bank, unsigned long base, unsigned int length) { struct map_desc *desc = sram_desc[bank]; - desc-virtual = AT91_IO_VIRT_BASE - length; + desc-virtual = (unsigned long)AT91_IO_VIRT_BASE - length; if (bank 0) desc-virtual -= sram_desc[bank - 1].length; @@ -88,7 +88,7 @@ void __init at91_init_sram(int bank, unsigned long base, unsigned int length) } static struct map_desc at91_io_desc __initdata = { - .virtual= AT91_VA_BASE_SYS, + .virtual= (unsigned long)AT91_VA_BASE_SYS, .pfn= __phys_to_pfn(AT91_BASE_SYS), .length = SZ_16K, .type = MT_DEVICE, Otherwise, look good. Acked-by: Nicolas Ferre nicolas.fe...@atmel.com You can carry it directly in the arm-soc tree. Bye, -- Nicolas Ferre -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v3 04/15] dmaengine: Pass flags via device_prep_dma_cyclic() callback
On 09/14/2012 02:05 PM, Peter Ujfalusi : Change the parameter list of device_prep_dma_cyclic() so the DMA drivers can receive the flags coming from clients. This feature can be used during audio operation to disable all audio related interrupts when the DMA_PREP_INTERRUPT is cleared from the flags. Signed-off-by: Peter Ujfalusi peter.ujfal...@ti.com CC: Nicolas Ferre nicolas.fe...@atmel.com CC: Barry Song baohua.s...@csr.com CC: Srinidhi Kasagar srinidhi.kasa...@stericsson.com CC: Russell King - ARM Linux li...@arm.linux.org.uk CC: Vista Silicon javier.mar...@vista-silicon.com CC: Zhangfei Gao zhangfei@marvell.com CC: Shawn Guo shawn@linaro.org CC: Laxman Dewangan ldewan...@nvidia.com --- drivers/dma/at_hdmac.c| 3 ++- For Atmel's driver: Acked-by: Nicolas Ferre nicolas.fe...@atmel.com drivers/dma/ep93xx_dma.c | 4 +++- drivers/dma/imx-dma.c | 2 +- drivers/dma/imx-sdma.c| 2 +- drivers/dma/mmp_tdma.c| 2 +- drivers/dma/mxs-dma.c | 2 +- drivers/dma/omap-dma.c| 3 ++- drivers/dma/pl330.c | 2 +- drivers/dma/sa11x0-dma.c | 2 +- drivers/dma/sirf-dma.c| 2 +- drivers/dma/ste_dma40.c | 3 ++- drivers/dma/tegra20-apb-dma.c | 2 +- include/linux/dmaengine.h | 4 ++-- 13 files changed, 19 insertions(+), 14 deletions(-) diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c index 3934fcc..7e5f6b6 100644 --- a/drivers/dma/at_hdmac.c +++ b/drivers/dma/at_hdmac.c @@ -841,12 +841,13 @@ atc_dma_cyclic_fill_desc(struct dma_chan *chan, struct at_desc *desc, * @buf_len: total number of bytes for the entire buffer * @period_len: number of bytes for each period * @direction: transfer direction, to or from device + * @flags: tx descriptor status flags * @context: transfer context (ignored) */ static struct dma_async_tx_descriptor * atc_prep_dma_cyclic(struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len, size_t period_len, enum dma_transfer_direction direction, - void *context) + unsigned long flags, void *context) { struct at_dma_chan *atchan = to_at_dma_chan(chan); struct at_dma_slave *atslave = chan-private; diff --git a/drivers/dma/ep93xx_dma.c b/drivers/dma/ep93xx_dma.c index c64917e..493735b 100644 --- a/drivers/dma/ep93xx_dma.c +++ b/drivers/dma/ep93xx_dma.c @@ -1120,6 +1120,7 @@ fail: * @buf_len: length of the buffer (in bytes) * @period_len: lenght of a single period * @dir: direction of the operation + * @flags: tx descriptor status flags * @context: operation context (ignored) * * Prepares a descriptor for cyclic DMA operation. This means that once the @@ -1133,7 +1134,8 @@ fail: static struct dma_async_tx_descriptor * ep93xx_dma_prep_dma_cyclic(struct dma_chan *chan, dma_addr_t dma_addr, size_t buf_len, size_t period_len, -enum dma_transfer_direction dir, void *context) +enum dma_transfer_direction dir, unsigned long flags, +void *context) { struct ep93xx_dma_chan *edmac = to_ep93xx_dma_chan(chan); struct ep93xx_dma_desc *desc, *first; diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c index 5084975..41b4376 100644 --- a/drivers/dma/imx-dma.c +++ b/drivers/dma/imx-dma.c @@ -801,7 +801,7 @@ static struct dma_async_tx_descriptor *imxdma_prep_slave_sg( static struct dma_async_tx_descriptor *imxdma_prep_dma_cyclic( struct dma_chan *chan, dma_addr_t dma_addr, size_t buf_len, size_t period_len, enum dma_transfer_direction direction, - void *context) + unsigned long flags, void *context) { struct imxdma_channel *imxdmac = to_imxdma_chan(chan); struct imxdma_engine *imxdma = imxdmac-imxdma; diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c index 1dc2a4a..2c5fd3e 100644 --- a/drivers/dma/imx-sdma.c +++ b/drivers/dma/imx-sdma.c @@ -1012,7 +1012,7 @@ err_out: static struct dma_async_tx_descriptor *sdma_prep_dma_cyclic( struct dma_chan *chan, dma_addr_t dma_addr, size_t buf_len, size_t period_len, enum dma_transfer_direction direction, - void *context) + unsigned long flags, void *context) { struct sdma_channel *sdmac = to_sdma_chan(chan); struct sdma_engine *sdma = sdmac-sdma; diff --git a/drivers/dma/mmp_tdma.c b/drivers/dma/mmp_tdma.c index 8a15cf2..6d52bd4 100644 --- a/drivers/dma/mmp_tdma.c +++ b/drivers/dma/mmp_tdma.c @@ -358,7 +358,7 @@ struct mmp_tdma_desc *mmp_tdma_alloc_descriptor(struct mmp_tdma_chan *tdmac) static struct dma_async_tx_descriptor *mmp_tdma_prep_dma_cyclic( struct dma_chan *chan, dma_addr_t dma_addr, size_t buf_len, size_t period_len, enum dma_transfer_direction direction, - void *context
[GIT PULL] at91: one fix for 3.6
Arnd, Olof, We have one last minute fix. It can help us to use the device tree for GPIO interrupt attached devices. I have based my tag on top of the fixes pull request that I've already sent to you. I hope that it could make it for 3.6-final. The following changes since commit 51a6149b89b822cacf572b2ca2a15cb6f2232b11: ARM: at91/feature-removal-schedule: delay at91_mci removal (2012-08-27 09:59:36 +0200) are available in the git repository at: git://github.com/at91linux/linux-at91.git tags/at91-fixes for you to fetch changes up to 51ac51a6a5ab5f0aff46c4757ba4c32f3f8f7a2e: ARM: at91: fix missing #interrupt-cells on gpio-controller (2012-09-17 10:25:01 +0200) Modify AT91 device tree files for making the GPIO interrupts work. Jean-Christophe PLAGNIOL-VILLARD (1): ARM: at91: fix missing #interrupt-cells on gpio-controller arch/arm/boot/dts/at91sam9260.dtsi | 3 +++ arch/arm/boot/dts/at91sam9263.dtsi | 5 + arch/arm/boot/dts/at91sam9g45.dtsi | 5 + arch/arm/boot/dts/at91sam9n12.dtsi | 4 arch/arm/boot/dts/at91sam9x5.dtsi | 4 5 files changed, 21 insertions(+) Thanks, best regards, -- Nicolas Ferre -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 0/9] net/macb: driver enhancement concerning GEM support, ring logic and cleanup
This is an enhancement work that began several years ago. I try to catchup with some performance improvement that has been implemented then by Havard. The ring index logic and the TX error path modification are the biggest changes but some cleanup/debugging have been added along the way. The GEM revision will benefit from the Gigabit support. The series has been tested on several Atmel AT91 SoC with the two MACB/GEM flavors. v2: - modify the tx error handling: now uses a workqueue - information provided by ethtool -i were not accurate: removed Havard Skinnemoen (4): net/macb: memory barriers cleanup net/macb: change debugging messages net/macb: clean up ring buffer logic net/macb: Offset first RX buffer by two bytes Nicolas Ferre (4): net/macb: remove macb_get_drvinfo() net/macb: tx status is more than 8 bits now net/macb: ethtool interface: add register dump feature net/macb: better manage tx errors Patrice Vilchez (1): net/macb: Add support for Gigabit Ethernet mode drivers/net/ethernet/cadence/macb.c | 433 +--- drivers/net/ethernet/cadence/macb.h | 30 ++- 2 files changed, 321 insertions(+), 142 deletions(-) -- 1.7.11.3 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 1/9] net/macb: Add support for Gigabit Ethernet mode
From: Patrice Vilchez patrice.vilc...@atmel.com Add Gigabit Ethernet mode to GEM cadence IP and enable RGMII connection. Signed-off-by: Patrice Vilchez patrice.vilc...@atmel.com Signed-off-by: Nicolas Ferre nicolas.fe...@atmel.com --- drivers/net/ethernet/cadence/macb.c | 15 --- drivers/net/ethernet/cadence/macb.h | 4 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c index c4834c2..56375e2 100644 --- a/drivers/net/ethernet/cadence/macb.c +++ b/drivers/net/ethernet/cadence/macb.c @@ -152,13 +152,17 @@ static void macb_handle_link_change(struct net_device *dev) reg = macb_readl(bp, NCFGR); reg = ~(MACB_BIT(SPD) | MACB_BIT(FD)); + if (macb_is_gem(bp)) + reg = ~GEM_BIT(GBE); if (phydev-duplex) reg |= MACB_BIT(FD); if (phydev-speed == SPEED_100) reg |= MACB_BIT(SPD); + if (phydev-speed == SPEED_1000) + reg |= GEM_BIT(GBE); - macb_writel(bp, NCFGR, reg); + macb_or_gem_writel(bp, NCFGR, reg); bp-speed = phydev-speed; bp-duplex = phydev-duplex; @@ -213,7 +217,10 @@ static int macb_mii_probe(struct net_device *dev) } /* mask with MAC supported features */ - phydev-supported = PHY_BASIC_FEATURES; + if (macb_is_gem(bp)) + phydev-supported = PHY_GBIT_FEATURES; + else + phydev-supported = PHY_BASIC_FEATURES; phydev-advertising = phydev-supported; @@ -1377,7 +1384,9 @@ static int __init macb_probe(struct platform_device *pdev) bp-phy_interface = err; } - if (bp-phy_interface == PHY_INTERFACE_MODE_RMII) + if (bp-phy_interface == PHY_INTERFACE_MODE_RGMII) + macb_or_gem_writel(bp, USRIO, GEM_BIT(RGMII)); + else if (bp-phy_interface == PHY_INTERFACE_MODE_RMII) #if defined(CONFIG_ARCH_AT91) macb_or_gem_writel(bp, USRIO, (MACB_BIT(RMII) | MACB_BIT(CLKEN))); diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h index 335e288..f69ceef 100644 --- a/drivers/net/ethernet/cadence/macb.h +++ b/drivers/net/ethernet/cadence/macb.h @@ -145,6 +145,8 @@ #define MACB_IRXFCS_SIZE 1 /* GEM specific NCFGR bitfields. */ +#define GEM_GBE_OFFSET 10 +#define GEM_GBE_SIZE 1 #define GEM_CLK_OFFSET 18 #define GEM_CLK_SIZE 3 #define GEM_DBW_OFFSET 21 @@ -246,6 +248,8 @@ /* Bitfields in USRIO (AT91) */ #define MACB_RMII_OFFSET 0 #define MACB_RMII_SIZE 1 +#define GEM_RGMII_OFFSET 0 /* GEM gigabit mode */ +#define GEM_RGMII_SIZE 1 #define MACB_CLKEN_OFFSET 1 #define MACB_CLKEN_SIZE1 -- 1.7.11.3 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 2/9] net/macb: memory barriers cleanup
From: Havard Skinnemoen hav...@skinnemoen.net Remove a couple of unneeded barriers and document the remaining ones. Signed-off-by: Havard Skinnemoen hav...@skinnemoen.net [nicolas.fe...@atmel.com: split patch in topics] Signed-off-by: Nicolas Ferre nicolas.fe...@atmel.com --- drivers/net/ethernet/cadence/macb.c | 18 ++ 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c index 56375e2..313cba2 100644 --- a/drivers/net/ethernet/cadence/macb.c +++ b/drivers/net/ethernet/cadence/macb.c @@ -369,7 +369,9 @@ static void macb_tx(struct macb *bp) BUG_ON(skb == NULL); + /* Make hw descriptor updates visible to CPU */ rmb(); + bufstat = bp-tx_ring[tail].ctrl; if (!(bufstat MACB_BIT(TX_USED))) @@ -412,7 +414,10 @@ static int macb_rx_frame(struct macb *bp, unsigned int first_frag, if (frag == last_frag) break; } + + /* Make descriptor updates visible to hardware */ wmb(); + return 1; } @@ -433,12 +438,14 @@ static int macb_rx_frame(struct macb *bp, unsigned int first_frag, frag_len); offset += RX_BUFFER_SIZE; bp-rx_ring[frag].addr = ~MACB_BIT(RX_USED); - wmb(); if (frag == last_frag) break; } + /* Make descriptor updates visible to hardware */ + wmb(); + skb-protocol = eth_type_trans(skb, bp-dev); bp-stats.rx_packets++; @@ -458,6 +465,8 @@ static void discard_partial_frame(struct macb *bp, unsigned int begin, for (frag = begin; frag != end; frag = NEXT_RX(frag)) bp-rx_ring[frag].addr = ~MACB_BIT(RX_USED); + + /* Make descriptor updates visible to hardware */ wmb(); /* @@ -476,7 +485,9 @@ static int macb_rx(struct macb *bp, int budget) for (; budget 0; tail = NEXT_RX(tail)) { u32 addr, ctrl; + /* Make hw descriptor updates visible to CPU */ rmb(); + addr = bp-rx_ring[tail].addr; ctrl = bp-rx_ring[tail].ctrl; @@ -671,6 +682,8 @@ static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev) bp-tx_ring[entry].addr = mapping; bp-tx_ring[entry].ctrl = ctrl; + + /* Make newly initialized descriptor visible to hardware */ wmb(); entry = NEXT_TX(entry); @@ -779,9 +792,6 @@ static void macb_init_rings(struct macb *bp) static void macb_reset_hw(struct macb *bp) { - /* Make sure we have the write buffer for ourselves */ - wmb(); - /* * Disable RX and TX (XXX: Should we halt the transmission * more gracefully?) -- 1.7.11.3 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 5/9] net/macb: tx status is more than 8 bits now
On some revision of GEM, TSR status register has more information. Signed-off-by: Nicolas Ferre nicolas.fe...@atmel.com --- drivers/net/ethernet/cadence/macb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c index 31f945c..e98f6fc 100644 --- a/drivers/net/ethernet/cadence/macb.c +++ b/drivers/net/ethernet/cadence/macb.c @@ -310,7 +310,7 @@ static void macb_tx(struct macb *bp) status = macb_readl(bp, TSR); macb_writel(bp, TSR, status); - netdev_vdbg(bp-dev, macb_tx status = %02lx\n, (unsigned long)status); + netdev_vdbg(bp-dev, macb_tx status = 0x%03lx\n, (unsigned long)status); if (status (MACB_BIT(UND) | MACB_BIT(TSR_RLE))) { int i; -- 1.7.11.3 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 4/9] net/macb: remove macb_get_drvinfo()
This function has little meaning so remove it altogether and let ethtool core fill in the fields automatically. Signed-off-by: Nicolas Ferre nicolas.fe...@atmel.com --- drivers/net/ethernet/cadence/macb.c | 11 --- 1 file changed, 11 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c index 2948553..31f945c 100644 --- a/drivers/net/ethernet/cadence/macb.c +++ b/drivers/net/ethernet/cadence/macb.c @@ -1217,20 +1217,9 @@ static int macb_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) return phy_ethtool_sset(phydev, cmd); } -static void macb_get_drvinfo(struct net_device *dev, -struct ethtool_drvinfo *info) -{ - struct macb *bp = netdev_priv(dev); - - strcpy(info-driver, bp-pdev-dev.driver-name); - strcpy(info-version, $Revision: 1.14 $); - strcpy(info-bus_info, dev_name(bp-pdev-dev)); -} - static const struct ethtool_ops macb_ethtool_ops = { .get_settings = macb_get_settings, .set_settings = macb_set_settings, - .get_drvinfo= macb_get_drvinfo, .get_link = ethtool_op_get_link, }; -- 1.7.11.3 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 9/9] net/macb: Offset first RX buffer by two bytes
From: Havard Skinnemoen hav...@skinnemoen.net Make the ethernet frame payload word-aligned, possibly making the memcpy into the skb a bit faster. This will be even more important after we eliminate the copy altogether. Also eliminate the redundant RX_OFFSET constant -- it has the same definition and purpose as NET_IP_ALIGN. Signed-off-by: Havard Skinnemoen hav...@skinnemoen.net [nicolas.fe...@atmel.com: adapt to newer kernel] Signed-off-by: Nicolas Ferre nicolas.fe...@atmel.com --- drivers/net/ethernet/cadence/macb.c | 23 --- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c index cfd6d5d..09ea7c7 100644 --- a/drivers/net/ethernet/cadence/macb.c +++ b/drivers/net/ethernet/cadence/macb.c @@ -33,9 +33,6 @@ #define RX_RING_SIZE 512 #define RX_RING_BYTES (sizeof(struct macb_dma_desc) * RX_RING_SIZE) -/* Make the IP header word-aligned (the ethernet header is 14 bytes) */ -#define RX_OFFSET 2 - #define TX_RING_SIZE 128 #define TX_RING_BYTES (sizeof(struct macb_dma_desc) * TX_RING_SIZE) @@ -494,7 +491,7 @@ static int macb_rx_frame(struct macb *bp, unsigned int first_frag, { unsigned int len; unsigned int frag; - unsigned int offset = 0; + unsigned int offset; struct sk_buff *skb; struct macb_dma_desc *desc; @@ -505,7 +502,16 @@ static int macb_rx_frame(struct macb *bp, unsigned int first_frag, macb_rx_ring_wrap(first_frag), macb_rx_ring_wrap(last_frag), len); - skb = netdev_alloc_skb(bp-dev, len + RX_OFFSET); + /* +* The ethernet header starts NET_IP_ALIGN bytes into the +* first buffer. Since the header is 14 bytes, this makes the +* payload word-aligned. +* +* Instead of calling skb_reserve(NET_IP_ALIGN), we just copy +* the two padding bytes into the skb so that we avoid hitting +* the slowpath in memcpy(), and pull them off afterwards. +*/ + skb = netdev_alloc_skb(bp-dev, len + NET_IP_ALIGN); if (!skb) { bp-stats.rx_dropped++; for (frag = first_frag; ; frag++) { @@ -521,7 +527,8 @@ static int macb_rx_frame(struct macb *bp, unsigned int first_frag, return 1; } - skb_reserve(skb, RX_OFFSET); + offset = 0; + len += NET_IP_ALIGN; skb_checksum_none_assert(skb); skb_put(skb, len); @@ -545,10 +552,11 @@ static int macb_rx_frame(struct macb *bp, unsigned int first_frag, /* Make descriptor updates visible to hardware */ wmb(); + __skb_pull(skb, NET_IP_ALIGN); skb-protocol = eth_type_trans(skb, bp-dev); bp-stats.rx_packets++; - bp-stats.rx_bytes += len; + bp-stats.rx_bytes += skb-len; netdev_vdbg(bp-dev, received skb of length %u, csum: %08x\n, skb-len, skb-csum); netif_receive_skb(skb); @@ -1008,6 +1016,7 @@ static void macb_init_hw(struct macb *bp) __macb_set_hwaddr(bp); config = macb_mdc_clk_div(bp); + config |= MACB_BF(RBOF, NET_IP_ALIGN); /* Make eth data aligned */ config |= MACB_BIT(PAE);/* PAuse Enable */ config |= MACB_BIT(DRFCS); /* Discard Rx FCS */ config |= MACB_BIT(BIG);/* Receive oversized frames */ -- 1.7.11.3 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[RFC PATCH v2 8/9] net/macb: better manage tx errors
Handle all TX errors, not only underruns. TX error management is deferred to a dedicated workqueue. Reinitialize the TX ring after treating all remaining frames, and restart the controller when everything has been cleaned up properly. Napi is not stopped during this task as the driver only handles napi for RX for now. With this sequence, we do not need a special check during the xmit method as the packets will be caught by TX disable during workqueue execution. Signed-off-by: Nicolas Ferre nicolas.fe...@atmel.com --- v2: - modify the tx error handling: now uses a workqueue Hi, I have marked this patch as RFC because I would like feedback from David and Havard as both of you made comments on the previous series: did I address your views on this tx error handling? Thanks for your help. drivers/net/ethernet/cadence/macb.c | 166 drivers/net/ethernet/cadence/macb.h | 1 + 2 files changed, 113 insertions(+), 54 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c index 2c4358e..cfd6d5d 100644 --- a/drivers/net/ethernet/cadence/macb.c +++ b/drivers/net/ethernet/cadence/macb.c @@ -44,6 +44,16 @@ #define MACB_RX_INT_FLAGS (MACB_BIT(RCOMP) | MACB_BIT(RXUBR) \ | MACB_BIT(ISR_ROVR)) +#define MACB_TX_ERR_FLAGS (MACB_BIT(ISR_TUND) \ + | MACB_BIT(ISR_RLE) \ + | MACB_BIT(TXERR)) +#define MACB_TX_INT_FLAGS (MACB_TX_ERR_FLAGS | MACB_BIT(TCOMP)) + +/* + * Graceful stop timeouts in us. We should allow up to + * 1 frame time (10 Mbits/s, full-duplex, ignoring collisions) + */ +#define MACB_HALT_TIMEOUT 1230 /* Ring buffer accessors */ static unsigned int macb_tx_ring_wrap(unsigned int index) @@ -335,66 +345,113 @@ static void macb_update_stats(struct macb *bp) *p += __raw_readl(reg); } -static void macb_tx(struct macb *bp) +static int macb_halt_tx(struct macb *bp) { - unsigned int tail; - unsigned int head; - u32 status; + unsigned long halt_time, timeout; + u32 status; - status = macb_readl(bp, TSR); - macb_writel(bp, TSR, status); + macb_writel(bp, NCR, macb_readl(bp, NCR) | MACB_BIT(THALT)); - netdev_vdbg(bp-dev, macb_tx status = 0x%03lx\n, (unsigned long)status); + timeout = jiffies + usecs_to_jiffies(MACB_HALT_TIMEOUT); + do { + halt_time = jiffies; + status = macb_readl(bp, TSR); + if (!(status MACB_BIT(TGO))) + return 0; - if (status (MACB_BIT(UND) | MACB_BIT(TSR_RLE))) { - int i; - netdev_err(bp-dev, TX %s, resetting buffers\n, - status MACB_BIT(UND) ? - underrun : retry limit exceeded); + usleep_range(10, 250); + } while (time_before(halt_time, timeout)); - /* Transfer ongoing, disable transmitter, to avoid confusion */ - if (status MACB_BIT(TGO)) - macb_writel(bp, NCR, macb_readl(bp, NCR) ~MACB_BIT(TE)); + return -ETIMEDOUT; +} - head = bp-tx_head; +static void macb_tx_error_task(struct work_struct *work) +{ + struct macb *bp = container_of(work, struct macb, tx_error_task); + struct macb_tx_skb *tx_skb; + struct sk_buff *skb; + unsigned inttail; - /*Mark all the buffer as used to avoid sending a lost buffer*/ - for (i = 0; i TX_RING_SIZE; i++) - bp-tx_ring[i].ctrl = MACB_BIT(TX_USED); + netdev_vdbg(bp-dev, macb_tx_error_task: t = %u, h = %u\n, + bp-tx_tail, bp-tx_head); - /* Add wrap bit */ - bp-tx_ring[TX_RING_SIZE - 1].ctrl |= MACB_BIT(TX_WRAP); + /* Make sure nobody is trying to queue up new packets */ + netif_stop_queue(bp-dev); - /* free transmit buffer in upper layer*/ - for (tail = bp-tx_tail; tail != head; tail++) { - struct macb_tx_skb *tx_skb; - struct sk_buff *skb; + /* +* Stop transmission now +* (in case we have just queued new packets) +*/ + if (macb_halt_tx(bp)) + /* Just complain for now, reinitializing TX path can be good */ + netdev_err(bp-dev, BUG: halt tx timed out\n); - rmb(); + /* No need for the lock here as nobody will interrupt us anymore */ - tx_skb = macb_tx_skb(bp, tail); - skb = tx_skb-skb; + /* +* Treat frames in TX queue including the ones that caused the error. +* Free transmit buffers in upper layer. +*/ + for (tail = bp-tx_tail; tail != bp
[PATCH v2 7/9] net/macb: ethtool interface: add register dump feature
Add macb_get_regs() ethtool function and its helper function: macb_get_regs_len(). The version field is deduced from the IP revision which gives the MACB or GEM information. An additional version field is reserved. Signed-off-by: Nicolas Ferre nicolas.fe...@atmel.com Reviewed-by: Ben Hutchings bhutchi...@solarflare.com --- drivers/net/ethernet/cadence/macb.c | 40 + drivers/net/ethernet/cadence/macb.h | 3 +++ 2 files changed, 43 insertions(+) diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c index 5758a1c..2c4358e 100644 --- a/drivers/net/ethernet/cadence/macb.c +++ b/drivers/net/ethernet/cadence/macb.c @@ -1265,9 +1265,49 @@ static int macb_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) return phy_ethtool_sset(phydev, cmd); } +static int macb_get_regs_len(struct net_device *netdev) +{ + return MACB_GREGS_NBR * sizeof(u32); +} + +static void macb_get_regs(struct net_device *dev, struct ethtool_regs *regs, + void *p) +{ + struct macb *bp = netdev_priv(dev); + unsigned int tail, head; + u32 *regs_buff = p; + + regs-version = (macb_readl(bp, MID) ((1 MACB_REV_SIZE) - 1)) + | MACB_GREGS_VERSION; + + tail = macb_tx_ring_wrap(bp-tx_tail); + head = macb_tx_ring_wrap(bp-tx_head); + + regs_buff[0] = macb_readl(bp, NCR); + regs_buff[1] = macb_or_gem_readl(bp, NCFGR); + regs_buff[2] = macb_readl(bp, NSR); + regs_buff[3] = macb_readl(bp, TSR); + regs_buff[4] = macb_readl(bp, RBQP); + regs_buff[5] = macb_readl(bp, TBQP); + regs_buff[6] = macb_readl(bp, RSR); + regs_buff[7] = macb_readl(bp, IMR); + + regs_buff[8] = tail; + regs_buff[9] = head; + regs_buff[10] = macb_tx_dma(bp, tail); + regs_buff[11] = macb_tx_dma(bp, head); + + if (macb_is_gem(bp)) { + regs_buff[12] = gem_readl(bp, USRIO); + regs_buff[13] = gem_readl(bp, DMACFG); + } +} + static const struct ethtool_ops macb_ethtool_ops = { .get_settings = macb_get_settings, .set_settings = macb_set_settings, + .get_regs_len = macb_get_regs_len, + .get_regs = macb_get_regs, .get_link = ethtool_op_get_link, }; diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h index 8a4ee2f..5be5900 100644 --- a/drivers/net/ethernet/cadence/macb.h +++ b/drivers/net/ethernet/cadence/macb.h @@ -10,6 +10,9 @@ #ifndef _MACB_H #define _MACB_H +#define MACB_GREGS_NBR 16 +#define MACB_GREGS_VERSION 1 + /* MACB register offsets */ #define MACB_NCR 0x #define MACB_NCFGR 0x0004 -- 1.7.11.3 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 6/9] net/macb: clean up ring buffer logic
From: Havard Skinnemoen hav...@skinnemoen.net Instead of masking head and tail every time we increment them, just let them wrap through UINT_MAX and mask them when subscripting. Add simple accessor functions to do the subscripting properly to minimize the chances of messing this up. This makes the code slightly smaller, and hopefully faster as well. Also, doing the ring buffer management this way will simplify things a lot when making the ring sizes configurable in the future. Signed-off-by: Havard Skinnemoen hav...@skinnemoen.net [nicolas.fe...@atmel.com: split patch in topics, adapt to newer kernel] Signed-off-by: Nicolas Ferre nicolas.fe...@atmel.com --- drivers/net/ethernet/cadence/macb.c | 168 +++- drivers/net/ethernet/cadence/macb.h | 22 +++-- 2 files changed, 122 insertions(+), 68 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c index e98f6fc..5758a1c 100644 --- a/drivers/net/ethernet/cadence/macb.c +++ b/drivers/net/ethernet/cadence/macb.c @@ -31,24 +31,13 @@ #define RX_BUFFER_SIZE 128 #define RX_RING_SIZE 512 -#define RX_RING_BYTES (sizeof(struct dma_desc) * RX_RING_SIZE) +#define RX_RING_BYTES (sizeof(struct macb_dma_desc) * RX_RING_SIZE) /* Make the IP header word-aligned (the ethernet header is 14 bytes) */ #define RX_OFFSET 2 #define TX_RING_SIZE 128 -#define DEF_TX_RING_PENDING(TX_RING_SIZE - 1) -#define TX_RING_BYTES (sizeof(struct dma_desc) * TX_RING_SIZE) - -#define TX_RING_GAP(bp)\ - (TX_RING_SIZE - (bp)-tx_pending) -#define TX_BUFFS_AVAIL(bp) \ - (((bp)-tx_tail = (bp)-tx_head) ? \ -(bp)-tx_tail + (bp)-tx_pending - (bp)-tx_head : \ -(bp)-tx_tail - (bp)-tx_head - TX_RING_GAP(bp)) -#define NEXT_TX(n) (((n) + 1) (TX_RING_SIZE - 1)) - -#define NEXT_RX(n) (((n) + 1) (RX_RING_SIZE - 1)) +#define TX_RING_BYTES (sizeof(struct macb_dma_desc) * TX_RING_SIZE) /* minimum number of free TX descriptors before waking up TX process */ #define MACB_TX_WAKEUP_THRESH (TX_RING_SIZE / 4) @@ -56,6 +45,51 @@ #define MACB_RX_INT_FLAGS (MACB_BIT(RCOMP) | MACB_BIT(RXUBR) \ | MACB_BIT(ISR_ROVR)) +/* Ring buffer accessors */ +static unsigned int macb_tx_ring_wrap(unsigned int index) +{ + return index (TX_RING_SIZE - 1); +} + +static unsigned int macb_tx_ring_avail(struct macb *bp) +{ + return TX_RING_SIZE - (bp-tx_head - bp-tx_tail); +} + +static struct macb_dma_desc *macb_tx_desc(struct macb *bp, unsigned int index) +{ + return bp-tx_ring[macb_tx_ring_wrap(index)]; +} + +static struct macb_tx_skb *macb_tx_skb(struct macb *bp, unsigned int index) +{ + return bp-tx_skb[macb_tx_ring_wrap(index)]; +} + +static dma_addr_t macb_tx_dma(struct macb *bp, unsigned int index) +{ + dma_addr_t offset; + + offset = macb_tx_ring_wrap(index) * sizeof(struct macb_dma_desc); + + return bp-tx_ring_dma + offset; +} + +static unsigned int macb_rx_ring_wrap(unsigned int index) +{ + return index (RX_RING_SIZE - 1); +} + +static struct macb_dma_desc *macb_rx_desc(struct macb *bp, unsigned int index) +{ + return bp-rx_ring[macb_rx_ring_wrap(index)]; +} + +static void *macb_rx_buffer(struct macb *bp, unsigned int index) +{ + return bp-rx_buffers + RX_BUFFER_SIZE * macb_rx_ring_wrap(index); +} + static void __macb_set_hwaddr(struct macb *bp) { u32 bottom; @@ -332,17 +366,18 @@ static void macb_tx(struct macb *bp) bp-tx_ring[TX_RING_SIZE - 1].ctrl |= MACB_BIT(TX_WRAP); /* free transmit buffer in upper layer*/ - for (tail = bp-tx_tail; tail != head; tail = NEXT_TX(tail)) { - struct ring_info *rp = bp-tx_skb[tail]; - struct sk_buff *skb = rp-skb; - - BUG_ON(skb == NULL); + for (tail = bp-tx_tail; tail != head; tail++) { + struct macb_tx_skb *tx_skb; + struct sk_buff *skb; rmb(); - dma_unmap_single(bp-pdev-dev, rp-mapping, skb-len, -DMA_TO_DEVICE); - rp-skb = NULL; + tx_skb = macb_tx_skb(bp, tail); + skb = tx_skb-skb; + + dma_unmap_single(bp-pdev-dev, tx_skb-mapping, + skb-len, DMA_TO_DEVICE); + tx_skb-skb = NULL; dev_kfree_skb_irq(skb); } @@ -362,34 +397,38 @@ static void macb_tx(struct macb *bp) return; head = bp-tx_head; - for (tail = bp-tx_tail; tail != head; tail
[PATCH v2 3/9] net/macb: change debugging messages
From: Havard Skinnemoen hav...@skinnemoen.net Convert some noisy netdev_dbg() statements to netdev_vdbg(). Defining DEBUG will no longer fill up the logs; VERBOSE_DEBUG still does. Add one more verbose debug for ISR status. Signed-off-by: Havard Skinnemoen hav...@skinnemoen.net [nicolas.fe...@atmel.com: split patch in topics, add ISR status] Signed-off-by: Nicolas Ferre nicolas.fe...@atmel.com --- drivers/net/ethernet/cadence/macb.c | 22 -- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c index 313cba2..2948553 100644 --- a/drivers/net/ethernet/cadence/macb.c +++ b/drivers/net/ethernet/cadence/macb.c @@ -310,7 +310,7 @@ static void macb_tx(struct macb *bp) status = macb_readl(bp, TSR); macb_writel(bp, TSR, status); - netdev_dbg(bp-dev, macb_tx status = %02lx\n, (unsigned long)status); + netdev_vdbg(bp-dev, macb_tx status = %02lx\n, (unsigned long)status); if (status (MACB_BIT(UND) | MACB_BIT(TSR_RLE))) { int i; @@ -377,7 +377,7 @@ static void macb_tx(struct macb *bp) if (!(bufstat MACB_BIT(TX_USED))) break; - netdev_dbg(bp-dev, skb %u (data %p) TX complete\n, + netdev_vdbg(bp-dev, skb %u (data %p) TX complete\n, tail, skb-data); dma_unmap_single(bp-pdev-dev, rp-mapping, skb-len, DMA_TO_DEVICE); @@ -403,7 +403,7 @@ static int macb_rx_frame(struct macb *bp, unsigned int first_frag, len = MACB_BFEXT(RX_FRMLEN, bp-rx_ring[last_frag].ctrl); - netdev_dbg(bp-dev, macb_rx_frame frags %u - %u (len %u)\n, + netdev_vdbg(bp-dev, macb_rx_frame frags %u - %u (len %u)\n, first_frag, last_frag, len); skb = netdev_alloc_skb(bp-dev, len + RX_OFFSET); @@ -450,7 +450,7 @@ static int macb_rx_frame(struct macb *bp, unsigned int first_frag, bp-stats.rx_packets++; bp-stats.rx_bytes += len; - netdev_dbg(bp-dev, received skb of length %u, csum: %08x\n, + netdev_vdbg(bp-dev, received skb of length %u, csum: %08x\n, skb-len, skb-csum); netif_receive_skb(skb); @@ -532,7 +532,7 @@ static int macb_poll(struct napi_struct *napi, int budget) work_done = 0; - netdev_dbg(bp-dev, poll: status = %08lx, budget = %d\n, + netdev_vdbg(bp-dev, poll: status = %08lx, budget = %d\n, (unsigned long)status, budget); work_done = macb_rx(bp, budget); @@ -571,6 +571,8 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id) break; } + netdev_vdbg(bp-dev, isr = 0x%08lx\n, (unsigned long)status); + if (status MACB_RX_INT_FLAGS) { /* * There's no point taking any more interrupts @@ -582,7 +584,7 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id) macb_writel(bp, IDR, MACB_RX_INT_FLAGS); if (napi_schedule_prep(bp-napi)) { - netdev_dbg(bp-dev, scheduling RX softirq\n); + netdev_vdbg(bp-dev, scheduling RX softirq\n); __napi_schedule(bp-napi); } } @@ -644,8 +646,8 @@ static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev) u32 ctrl; unsigned long flags; -#ifdef DEBUG - netdev_dbg(bp-dev, +#if defined(DEBUG) defined(VERBOSE_DEBUG) + netdev_vdbg(bp-dev, start_xmit: len %u head %p data %p tail %p end %p\n, skb-len, skb-head, skb-data, skb_tail_pointer(skb), skb_end_pointer(skb)); @@ -667,12 +669,12 @@ static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev) } entry = bp-tx_head; - netdev_dbg(bp-dev, Allocated ring entry %u\n, entry); + netdev_vdbg(bp-dev, Allocated ring entry %u\n, entry); mapping = dma_map_single(bp-pdev-dev, skb-data, len, DMA_TO_DEVICE); bp-tx_skb[entry].skb = skb; bp-tx_skb[entry].mapping = mapping; - netdev_dbg(bp-dev, Mapped skb data %p to DMA addr %08lx\n, + netdev_vdbg(bp-dev, Mapped skb data %p to DMA addr %08lx\n, skb-data, (unsigned long)mapping); ctrl = MACB_BF(TX_FRMLEN, len); -- 1.7.11.3 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 0/9] net/macb: driver enhancement concerning GEM support, ring logic and cleanup
On 09/19/2012 07:50 PM, David Miller : From: Nicolas Ferre nicolas.fe...@atmel.com Date: Wed, 19 Sep 2012 13:55:13 +0200 This is an enhancement work that began several years ago. I try to catchup with some performance improvement that has been implemented then by Havard. The ring index logic and the TX error path modification are the biggest changes but some cleanup/debugging have been added along the way. The GEM revision will benefit from the Gigabit support. The series has been tested on several Atmel AT91 SoC with the two MACB/GEM flavors. v2: - modify the tx error handling: now uses a workqueue - information provided by ethtool -i were not accurate: removed Don't submit patches like this. When you put an RFC right in the middle of the series, it screws everything up. It means that I can't only apply the parts that are not RFC. I will submit a v3 patch series when I am more confident about the patch that I have tagged as RFC... And as you noted last time that I have included a modified patch in a series: Please, when you receive feedback on your patches, you need to resubmit the whole patch series for review not just the patches where changes were asked for. == I thought that it was a better idea to post the whole patch series so that people could figure out the context. As the TX error path is greatly modified, it could make senses. Now, is it possible to review this series as it is or should I repost patches? attached to the previous thread? RFC patch alone? puzzled, -- Nicolas Ferre -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v11 0/4] AT91: replace old i2c-at91.c TWI driver
On 08/29/2012 09:28 AM, Nikolaus Voss : The old driver has two main deficencies: i) No repeated start (Sr) condiction is possible, this makes it unusable e.g. for most SMBus transfers. ii) I/O was done with polling/busy waiting what caused over-/underruns even at light system loads and clock speeds. The new driver overcomes these deficencies and in addition allows for more than one TWI interface. A remaining limitation is the fact, that only one repeated start is possible (two concatenated messages). This limitation is imposed by the hardware. However, this should not be a problem as all common i2c-client communication does not rely on more than one repeated start. Changes since v11: - corrected wrong id_entry on sam9261 twi gpio pdev Hi Wolfram, Despite the patch revision written in the subject, it is actually the real v12 patch series from Nikolaus. BTW, I suspect that you were not in copy... In addition to the Tested-By tag by Ludovic, you can add my: Reviewed-by: Nicolas Ferre nicolas.fe...@atmel.com Nikolaus Voss (4): drivers/i2c/busses/i2c-at91.c: remove old polling driver Replace clk_lookup.con_id with clk_lookup.dev_id entries for twi clk drivers/i2c/busses/i2c-at91.c: add new driver G45 TWI: remove open drain setting for twi function gpios arch/arm/mach-at91/at91rm9200.c|1 + arch/arm/mach-at91/at91rm9200_devices.c|9 + arch/arm/mach-at91/at91sam9260.c |1 + arch/arm/mach-at91/at91sam9261.c |1 + arch/arm/mach-at91/at91sam9261_devices.c |9 + arch/arm/mach-at91/at91sam9263.c |1 + arch/arm/mach-at91/at91sam9g45.c |2 + arch/arm/mach-at91/at91sam9g45_devices.c |6 - arch/arm/mach-at91/at91sam9rl.c|2 + arch/arm/mach-at91/at91sam9x5.c|3 + arch/arm/mach-at91/include/mach/at91_twi.h | 68 drivers/i2c/busses/Kconfig | 11 +- drivers/i2c/busses/i2c-at91.c | 591 ++-- 13 files changed, 418 insertions(+), 287 deletions(-) delete mode 100644 arch/arm/mach-at91/include/mach/at91_twi.h -- Nicolas Ferre -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] USB: ohci-at91: fix PIO handling in relation with number of ports
If the number of ports present on the SoC/board is not the maximum and that the platform data is not filled with all data, there is an easy way to mess the PIO setup for this interface. This quick fix addresses mis-configuration in USB host platform data that is common in at91 boards since commit 0ee6d1e (USB: ohci-at91: change maximum number of ports) that did not modified the associatd board files. Reported-by: Klaus Falkner klaus.falk...@solectrix.de Signed-off-by: Nicolas Ferre nicolas.fe...@atmel.com Cc: Alan Stern st...@rowland.harvard.edu Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Cc: linux-...@vger.kernel.org Cc: Stable sta...@vger.kernel.org [3.4+] --- drivers/usb/host/ohci-at91.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index a665b3e..aaa8d2b 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c @@ -570,6 +570,16 @@ static int __devinit ohci_hcd_at91_drv_probe(struct platform_device *pdev) if (pdata) { at91_for_each_port(i) { + /* +* do not configure PIO if not in relation with +* real USB port on board +*/ + if (i = pdata-ports) { + pdata-vbus_pin[i] = -EINVAL; + pdata-overcurrent_pin[i] = -EINVAL; + break; + } + if (!gpio_is_valid(pdata-vbus_pin[i])) continue; gpio = pdata-vbus_pin[i]; -- 1.7.10 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] USB: ohci-at91: fix PIO handling in relation with number of ports
On 08/29/2012 11:49 AM, Nicolas Ferre : If the number of ports present on the SoC/board is not the maximum and that the platform data is not filled with all data, there is an easy way to mess the PIO setup for this interface. This quick fix addresses mis-configuration in USB host platform data that is common in at91 boards since commit 0ee6d1e (USB: ohci-at91: change maximum number of ports) that did not modified the associatd board files. Reported-by: Klaus Falkner klaus.falk...@solectrix.de Signed-off-by: Nicolas Ferre nicolas.fe...@atmel.com Cc: Alan Stern st...@rowland.harvard.edu Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Cc: linux-...@vger.kernel.org Cc: Stable sta...@vger.kernel.org [3.4+] Alan, Greg, gentle ping... I really would like to seen it landing in stable soon... Thanks, best regards, --- drivers/usb/host/ohci-at91.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index a665b3e..aaa8d2b 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c @@ -570,6 +570,16 @@ static int __devinit ohci_hcd_at91_drv_probe(struct platform_device *pdev) if (pdata) { at91_for_each_port(i) { + /* + * do not configure PIO if not in relation with + * real USB port on board + */ + if (i = pdata-ports) { + pdata-vbus_pin[i] = -EINVAL; + pdata-overcurrent_pin[i] = -EINVAL; + break; + } + if (!gpio_is_valid(pdata-vbus_pin[i])) continue; gpio = pdata-vbus_pin[i]; -- Nicolas Ferre -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 01/10] net/macb: Add support for Gigabit Ethernet mode
From: Patrice Vilchez patrice.vilc...@atmel.com Add Gigabit Ethernet mode to GEM cadence IP and enable RGMII connection. Signed-off-by: Patrice Vilchez patrice.vilc...@atmel.com Signed-off-by: Nicolas Ferre nicolas.fe...@atmel.com --- drivers/net/ethernet/cadence/macb.c | 15 --- drivers/net/ethernet/cadence/macb.h |4 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c index 033064b..9a10f69 100644 --- a/drivers/net/ethernet/cadence/macb.c +++ b/drivers/net/ethernet/cadence/macb.c @@ -152,13 +152,17 @@ static void macb_handle_link_change(struct net_device *dev) reg = macb_readl(bp, NCFGR); reg = ~(MACB_BIT(SPD) | MACB_BIT(FD)); + if (macb_is_gem(bp)) + reg = ~GEM_BIT(GBE); if (phydev-duplex) reg |= MACB_BIT(FD); if (phydev-speed == SPEED_100) reg |= MACB_BIT(SPD); + if (phydev-speed == SPEED_1000) + reg |= GEM_BIT(GBE); - macb_writel(bp, NCFGR, reg); + macb_or_gem_writel(bp, NCFGR, reg); bp-speed = phydev-speed; bp-duplex = phydev-duplex; @@ -216,7 +220,10 @@ static int macb_mii_probe(struct net_device *dev) } /* mask with MAC supported features */ - phydev-supported = PHY_BASIC_FEATURES; + if (macb_is_gem(bp)) + phydev-supported = PHY_GBIT_FEATURES; + else + phydev-supported = PHY_BASIC_FEATURES; phydev-advertising = phydev-supported; @@ -1384,7 +1391,9 @@ static int __init macb_probe(struct platform_device *pdev) bp-phy_interface = err; } - if (bp-phy_interface == PHY_INTERFACE_MODE_RMII) + if (bp-phy_interface == PHY_INTERFACE_MODE_RGMII) + macb_or_gem_writel(bp, USRIO, GEM_BIT(RGMII)); + else if (bp-phy_interface == PHY_INTERFACE_MODE_RMII) #if defined(CONFIG_ARCH_AT91) macb_or_gem_writel(bp, USRIO, (MACB_BIT(RMII) | MACB_BIT(CLKEN))); diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h index 335e288..f69ceef 100644 --- a/drivers/net/ethernet/cadence/macb.h +++ b/drivers/net/ethernet/cadence/macb.h @@ -145,6 +145,8 @@ #define MACB_IRXFCS_SIZE 1 /* GEM specific NCFGR bitfields. */ +#define GEM_GBE_OFFSET 10 +#define GEM_GBE_SIZE 1 #define GEM_CLK_OFFSET 18 #define GEM_CLK_SIZE 3 #define GEM_DBW_OFFSET 21 @@ -246,6 +248,8 @@ /* Bitfields in USRIO (AT91) */ #define MACB_RMII_OFFSET 0 #define MACB_RMII_SIZE 1 +#define GEM_RGMII_OFFSET 0 /* GEM gigabit mode */ +#define GEM_RGMII_SIZE 1 #define MACB_CLKEN_OFFSET 1 #define MACB_CLKEN_SIZE1 -- 1.7.10 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 03/10] net/macb: change debugging messages
From: Havard Skinnemoen hav...@skinnemoen.net Convert some noisy netdev_dbg() statements to netdev_vdbg(). Defining DEBUG will no longer fill up the logs; VERBOSE_DEBUG still does. Add one more verbose debug for ISR status. Signed-off-by: Havard Skinnemoen hav...@skinnemoen.net [nicolas.fe...@atmel.com: split patch in topics, add ISR status] Signed-off-by: Nicolas Ferre nicolas.fe...@atmel.com --- drivers/net/ethernet/cadence/macb.c | 22 -- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c index 26ca01e..2228dfc 100644 --- a/drivers/net/ethernet/cadence/macb.c +++ b/drivers/net/ethernet/cadence/macb.c @@ -313,7 +313,7 @@ static void macb_tx(struct macb *bp) status = macb_readl(bp, TSR); macb_writel(bp, TSR, status); - netdev_dbg(bp-dev, macb_tx status = %02lx\n, (unsigned long)status); + netdev_vdbg(bp-dev, macb_tx status = %02lx\n, (unsigned long)status); if (status (MACB_BIT(UND) | MACB_BIT(TSR_RLE))) { int i; @@ -380,7 +380,7 @@ static void macb_tx(struct macb *bp) if (!(bufstat MACB_BIT(TX_USED))) break; - netdev_dbg(bp-dev, skb %u (data %p) TX complete\n, + netdev_vdbg(bp-dev, skb %u (data %p) TX complete\n, tail, skb-data); dma_unmap_single(bp-pdev-dev, rp-mapping, skb-len, DMA_TO_DEVICE); @@ -406,7 +406,7 @@ static int macb_rx_frame(struct macb *bp, unsigned int first_frag, len = MACB_BFEXT(RX_FRMLEN, bp-rx_ring[last_frag].ctrl); - netdev_dbg(bp-dev, macb_rx_frame frags %u - %u (len %u)\n, + netdev_vdbg(bp-dev, macb_rx_frame frags %u - %u (len %u)\n, first_frag, last_frag, len); skb = netdev_alloc_skb(bp-dev, len + RX_OFFSET); @@ -453,7 +453,7 @@ static int macb_rx_frame(struct macb *bp, unsigned int first_frag, bp-stats.rx_packets++; bp-stats.rx_bytes += len; - netdev_dbg(bp-dev, received skb of length %u, csum: %08x\n, + netdev_vdbg(bp-dev, received skb of length %u, csum: %08x\n, skb-len, skb-csum); netif_receive_skb(skb); @@ -535,7 +535,7 @@ static int macb_poll(struct napi_struct *napi, int budget) work_done = 0; - netdev_dbg(bp-dev, poll: status = %08lx, budget = %d\n, + netdev_vdbg(bp-dev, poll: status = %08lx, budget = %d\n, (unsigned long)status, budget); work_done = macb_rx(bp, budget); @@ -574,6 +574,8 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id) break; } + netdev_vdbg(bp-dev, isr = 0x%08lx\n, (unsigned long)status); + if (status MACB_RX_INT_FLAGS) { /* * There's no point taking any more interrupts @@ -585,7 +587,7 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id) macb_writel(bp, IDR, MACB_RX_INT_FLAGS); if (napi_schedule_prep(bp-napi)) { - netdev_dbg(bp-dev, scheduling RX softirq\n); + netdev_vdbg(bp-dev, scheduling RX softirq\n); __napi_schedule(bp-napi); } } @@ -647,8 +649,8 @@ static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev) u32 ctrl; unsigned long flags; -#ifdef DEBUG - netdev_dbg(bp-dev, +#if defined(DEBUG) defined(VERBOSE_DEBUG) + netdev_vdbg(bp-dev, start_xmit: len %u head %p data %p tail %p end %p\n, skb-len, skb-head, skb-data, skb_tail_pointer(skb), skb_end_pointer(skb)); @@ -670,12 +672,12 @@ static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev) } entry = bp-tx_head; - netdev_dbg(bp-dev, Allocated ring entry %u\n, entry); + netdev_vdbg(bp-dev, Allocated ring entry %u\n, entry); mapping = dma_map_single(bp-pdev-dev, skb-data, len, DMA_TO_DEVICE); bp-tx_skb[entry].skb = skb; bp-tx_skb[entry].mapping = mapping; - netdev_dbg(bp-dev, Mapped skb data %p to DMA addr %08lx\n, + netdev_vdbg(bp-dev, Mapped skb data %p to DMA addr %08lx\n, skb-data, (unsigned long)mapping); ctrl = MACB_BF(TX_FRMLEN, len); -- 1.7.10 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 04/10] net/macb: Fix a race in macb_start_xmit()
From: Havard Skinnemoen hav...@skinnemoen.net Fix a race in macb_start_xmit() where we unconditionally set the TSTART bit. If an underrun just happened (we do this with interrupts disabled, so it might not have been handled yet), the controller starts transmitting from the first entry in the ring, which is usually wrong. Restart the controller after error handling. Signed-off-by: Havard Skinnemoen hav...@skinnemoen.net [nicolas.fe...@atmel.com: split patch in topics] Signed-off-by: Nicolas Ferre nicolas.fe...@atmel.com --- drivers/net/ethernet/cadence/macb.c | 20 +++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c index 2228dfc..f4b8adf 100644 --- a/drivers/net/ethernet/cadence/macb.c +++ b/drivers/net/ethernet/cadence/macb.c @@ -390,6 +390,13 @@ static void macb_tx(struct macb *bp) dev_kfree_skb_irq(skb); } + /* +* Someone may have submitted a new frame while this interrupt +* was pending, or we may just have handled an error. +*/ + if (head != tail !(status MACB_BIT(TGO))) + macb_writel(bp, NCR, macb_readl(bp, NCR) | MACB_BIT(TSTART)); + bp-tx_tail = tail; if (netif_queue_stopped(bp-dev) TX_BUFFS_AVAIL(bp) MACB_TX_WAKEUP_THRESH) @@ -696,7 +703,18 @@ static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev) skb_tx_timestamp(skb); - macb_writel(bp, NCR, macb_readl(bp, NCR) | MACB_BIT(TSTART)); + /* +* Only start the controller if the queue was empty; otherwise +* we may race against the hardware resetting the ring pointer +* due to a transmit error. +* +* If the controller is idle but the queue isn't empty, there +* must be a pending interrupt that will trigger as soon as we +* re-enable interrupts, and the interrupt handler will make +* sure the controler is started. +*/ + if (NEXT_TX(bp-tx_tail) == bp-tx_head) + macb_writel(bp, NCR, macb_readl(bp, NCR) | MACB_BIT(TSTART)); if (TX_BUFFS_AVAIL(bp) 1) netif_stop_queue(dev); -- 1.7.10 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 00/10] net/macb: driver enhancement concerning GEM support, ring logic and cleanup
This is an enhancement work that began several years ago. I try to catchup with some performance improvement that has been implemented then by Havard. The ring index logic and the TX error path modification are the biggest changes but some cleanup/debugging have been added along the way. The GEM revision will benefit from the Gigabit support. The series has been tested on several Atmel AT91 SoC with the two MACB/GEM flavors. Havard Skinnemoen (5): net/macb: memory barriers cleanup net/macb: change debugging messages net/macb: Fix a race in macb_start_xmit() net/macb: clean up ring buffer logic net/macb: Offset first RX buffer by two bytes Nicolas Ferre (4): net/macb: better manage tx errors net/macb: tx status is more than 8 bits now net/macb: macb_get_drvinfo: add GEM/MACB suffix to differentiate revision net/macb: ethtool interface: add register dump feature Patrice Vilchez (1): net/macb: Add support for Gigabit Ethernet mode drivers/net/ethernet/cadence/macb.c | 408 --- drivers/net/ethernet/cadence/macb.h | 29 ++- 2 files changed, 304 insertions(+), 133 deletions(-) -- 1.7.10 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 02/10] net/macb: memory barriers cleanup
From: Havard Skinnemoen hav...@skinnemoen.net Remove a couple of unneeded barriers and document the remaining ones. Signed-off-by: Havard Skinnemoen hav...@skinnemoen.net [nicolas.fe...@atmel.com: split patch in topics] Signed-off-by: Nicolas Ferre nicolas.fe...@atmel.com --- drivers/net/ethernet/cadence/macb.c | 18 ++ 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c index 9a10f69..26ca01e 100644 --- a/drivers/net/ethernet/cadence/macb.c +++ b/drivers/net/ethernet/cadence/macb.c @@ -372,7 +372,9 @@ static void macb_tx(struct macb *bp) BUG_ON(skb == NULL); + /* Make hw descriptor updates visible to CPU */ rmb(); + bufstat = bp-tx_ring[tail].ctrl; if (!(bufstat MACB_BIT(TX_USED))) @@ -415,7 +417,10 @@ static int macb_rx_frame(struct macb *bp, unsigned int first_frag, if (frag == last_frag) break; } + + /* Make descriptor updates visible to hardware */ wmb(); + return 1; } @@ -436,12 +441,14 @@ static int macb_rx_frame(struct macb *bp, unsigned int first_frag, frag_len); offset += RX_BUFFER_SIZE; bp-rx_ring[frag].addr = ~MACB_BIT(RX_USED); - wmb(); if (frag == last_frag) break; } + /* Make descriptor updates visible to hardware */ + wmb(); + skb-protocol = eth_type_trans(skb, bp-dev); bp-stats.rx_packets++; @@ -461,6 +468,8 @@ static void discard_partial_frame(struct macb *bp, unsigned int begin, for (frag = begin; frag != end; frag = NEXT_RX(frag)) bp-rx_ring[frag].addr = ~MACB_BIT(RX_USED); + + /* Make descriptor updates visible to hardware */ wmb(); /* @@ -479,7 +488,9 @@ static int macb_rx(struct macb *bp, int budget) for (; budget 0; tail = NEXT_RX(tail)) { u32 addr, ctrl; + /* Make hw descriptor updates visible to CPU */ rmb(); + addr = bp-rx_ring[tail].addr; ctrl = bp-rx_ring[tail].ctrl; @@ -674,6 +685,8 @@ static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev) bp-tx_ring[entry].addr = mapping; bp-tx_ring[entry].ctrl = ctrl; + + /* Make newly initialized descriptor visible to hardware */ wmb(); entry = NEXT_TX(entry); @@ -782,9 +795,6 @@ static void macb_init_rings(struct macb *bp) static void macb_reset_hw(struct macb *bp) { - /* Make sure we have the write buffer for ourselves */ - wmb(); - /* * Disable RX and TX (XXX: Should we halt the transmission * more gracefully?) -- 1.7.10 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 05/10] net/macb: clean up ring buffer logic
From: Havard Skinnemoen hav...@skinnemoen.net Instead of masking head and tail every time we increment them, just let them wrap through UINT_MAX and mask them when subscripting. Add simple accessor functions to do the subscripting properly to minimize the chances of messing this up. This makes the code slightly smaller, and hopefully faster as well. Also, doing the ring buffer management this way will simplify things a lot when making the ring sizes configurable in the future. Signed-off-by: Havard Skinnemoen hav...@skinnemoen.net [nicolas.fe...@atmel.com: split patch in topics, adapt to newer kernel] Signed-off-by: Nicolas Ferre nicolas.fe...@atmel.com --- drivers/net/ethernet/cadence/macb.c | 170 ++- drivers/net/ethernet/cadence/macb.h | 22 +++-- 2 files changed, 123 insertions(+), 69 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c index f4b8adf..3d3a077 100644 --- a/drivers/net/ethernet/cadence/macb.c +++ b/drivers/net/ethernet/cadence/macb.c @@ -31,24 +31,13 @@ #define RX_BUFFER_SIZE 128 #define RX_RING_SIZE 512 -#define RX_RING_BYTES (sizeof(struct dma_desc) * RX_RING_SIZE) +#define RX_RING_BYTES (sizeof(struct macb_dma_desc) * RX_RING_SIZE) /* Make the IP header word-aligned (the ethernet header is 14 bytes) */ #define RX_OFFSET 2 #define TX_RING_SIZE 128 -#define DEF_TX_RING_PENDING(TX_RING_SIZE - 1) -#define TX_RING_BYTES (sizeof(struct dma_desc) * TX_RING_SIZE) - -#define TX_RING_GAP(bp)\ - (TX_RING_SIZE - (bp)-tx_pending) -#define TX_BUFFS_AVAIL(bp) \ - (((bp)-tx_tail = (bp)-tx_head) ? \ -(bp)-tx_tail + (bp)-tx_pending - (bp)-tx_head : \ -(bp)-tx_tail - (bp)-tx_head - TX_RING_GAP(bp)) -#define NEXT_TX(n) (((n) + 1) (TX_RING_SIZE - 1)) - -#define NEXT_RX(n) (((n) + 1) (RX_RING_SIZE - 1)) +#define TX_RING_BYTES (sizeof(struct macb_dma_desc) * TX_RING_SIZE) /* minimum number of free TX descriptors before waking up TX process */ #define MACB_TX_WAKEUP_THRESH (TX_RING_SIZE / 4) @@ -56,6 +45,51 @@ #define MACB_RX_INT_FLAGS (MACB_BIT(RCOMP) | MACB_BIT(RXUBR) \ | MACB_BIT(ISR_ROVR)) +/* Ring buffer accessors */ +static unsigned int macb_tx_ring_wrap(unsigned int index) +{ + return index (TX_RING_SIZE - 1); +} + +static unsigned int macb_tx_ring_avail(struct macb *bp) +{ + return TX_RING_SIZE - (bp-tx_head - bp-tx_tail); +} + +static struct macb_dma_desc *macb_tx_desc(struct macb *bp, unsigned int index) +{ + return bp-tx_ring[macb_tx_ring_wrap(index)]; +} + +static struct macb_tx_skb *macb_tx_skb(struct macb *bp, unsigned int index) +{ + return bp-tx_skb[macb_tx_ring_wrap(index)]; +} + +static dma_addr_t macb_tx_dma(struct macb *bp, unsigned int index) +{ + dma_addr_t offset; + + offset = macb_tx_ring_wrap(index) * sizeof(struct macb_dma_desc); + + return bp-tx_ring_dma + offset; +} + +static unsigned int macb_rx_ring_wrap(unsigned int index) +{ + return index (RX_RING_SIZE - 1); +} + +static struct macb_dma_desc *macb_rx_desc(struct macb *bp, unsigned int index) +{ + return bp-rx_ring[macb_rx_ring_wrap(index)]; +} + +static void *macb_rx_buffer(struct macb *bp, unsigned int index) +{ + return bp-rx_buffers + RX_BUFFER_SIZE * macb_rx_ring_wrap(index); +} + static void __macb_set_hwaddr(struct macb *bp) { u32 bottom; @@ -335,17 +369,18 @@ static void macb_tx(struct macb *bp) bp-tx_ring[TX_RING_SIZE - 1].ctrl |= MACB_BIT(TX_WRAP); /* free transmit buffer in upper layer*/ - for (tail = bp-tx_tail; tail != head; tail = NEXT_TX(tail)) { - struct ring_info *rp = bp-tx_skb[tail]; - struct sk_buff *skb = rp-skb; - - BUG_ON(skb == NULL); + for (tail = bp-tx_tail; tail != head; tail++) { + struct macb_tx_skb *tx_skb; + struct sk_buff *skb; rmb(); - dma_unmap_single(bp-pdev-dev, rp-mapping, skb-len, -DMA_TO_DEVICE); - rp-skb = NULL; + tx_skb = macb_tx_skb(bp, tail); + skb = tx_skb-skb; + + dma_unmap_single(bp-pdev-dev, tx_skb-mapping, + skb-len, DMA_TO_DEVICE); + tx_skb-skb = NULL; dev_kfree_skb_irq(skb); } @@ -365,28 +400,32 @@ static void macb_tx(struct macb *bp) return; head = bp-tx_head; - for (tail = bp-tx_tail; tail != head; tail
[PATCH 07/10] net/macb: tx status is more than 8 bits now
On some revision of GEM, TSR status register is has more information. Signed-off-by: Nicolas Ferre nicolas.fe...@atmel.com --- drivers/net/ethernet/cadence/macb.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c index af71151..bd331fd 100644 --- a/drivers/net/ethernet/cadence/macb.c +++ b/drivers/net/ethernet/cadence/macb.c @@ -390,7 +390,7 @@ static void macb_tx_interrupt(struct macb *bp) status = macb_readl(bp, TSR); macb_writel(bp, TSR, status); - netdev_vdbg(bp-dev, macb_tx_interrupt status = %02lx\n, + netdev_vdbg(bp-dev, macb_tx_interrupt status = 0x%03lx\n, (unsigned long)status); head = bp-tx_head; -- 1.7.10 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 06/10] net/macb: better manage tx errors
Handle all TX errors, not only underruns. Reinitialize the TX ring after skipping all remaining frames, and restart the controller when everything has been cleaned up properly. Original idea from a patch by Havard Skinnemoen. Signed-off-by: Nicolas Ferre nicolas.fe...@atmel.com --- drivers/net/ethernet/cadence/macb.c | 124 --- 1 file changed, 71 insertions(+), 53 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c index 3d3a077..af71151 100644 --- a/drivers/net/ethernet/cadence/macb.c +++ b/drivers/net/ethernet/cadence/macb.c @@ -44,6 +44,10 @@ #define MACB_RX_INT_FLAGS (MACB_BIT(RCOMP) | MACB_BIT(RXUBR) \ | MACB_BIT(ISR_ROVR)) +#define MACB_TX_INT_FLAGS (MACB_BIT(ISR_TUND) \ + | MACB_BIT(ISR_RLE) \ + | MACB_BIT(TXERR) \ + | MACB_BIT(TCOMP)) /* Ring buffer accessors */ static unsigned int macb_tx_ring_wrap(unsigned int index) @@ -338,66 +342,56 @@ static void macb_update_stats(struct macb *bp) *p += __raw_readl(reg); } -static void macb_tx(struct macb *bp) +static void macb_handle_tx_error(struct macb *bp, unsigned int err_tail, u32 ctrl) { - unsigned int tail; - unsigned int head; - u32 status; - - status = macb_readl(bp, TSR); - macb_writel(bp, TSR, status); + struct macb_tx_skb *tx_skb; + struct sk_buff *skb; + unsigned inthead = bp-tx_head; - netdev_vdbg(bp-dev, macb_tx status = %02lx\n, (unsigned long)status); + netdev_dbg(bp-dev, TX error: ctrl 0x%08x, head %u, error tail %u\n, + ctrl, head, err_tail); - if (status (MACB_BIT(UND) | MACB_BIT(TSR_RLE))) { - int i; - netdev_err(bp-dev, TX %s, resetting buffers\n, - status MACB_BIT(UND) ? - underrun : retry limit exceeded); - - /* Transfer ongoing, disable transmitter, to avoid confusion */ - if (status MACB_BIT(TGO)) - macb_writel(bp, NCR, macb_readl(bp, NCR) ~MACB_BIT(TE)); - - head = bp-tx_head; - - /*Mark all the buffer as used to avoid sending a lost buffer*/ - for (i = 0; i TX_RING_SIZE; i++) - bp-tx_ring[i].ctrl = MACB_BIT(TX_USED); - - /* Add wrap bit */ - bp-tx_ring[TX_RING_SIZE - 1].ctrl |= MACB_BIT(TX_WRAP); + /* +* Buffers exhausted mid-frame errors may only happen if the +* driver is buggy, so complain loudly about those. Statistics +* are updated by hardware. +*/ + if (ctrl MACB_BIT(TX_BUF_EXHAUSTED)) + netdev_err(bp-dev, BUG: TX buffers exhausted mid-frame\n); - /* free transmit buffer in upper layer*/ - for (tail = bp-tx_tail; tail != head; tail++) { - struct macb_tx_skb *tx_skb; - struct sk_buff *skb; + /* +* Drop the frames that caused the error plus all remaining in queue. +* Free transmit buffers in upper layer. +*/ + for (; err_tail != head; err_tail++) { + struct macb_dma_desc*desc; - rmb(); + tx_skb = macb_tx_skb(bp, err_tail); + skb = tx_skb-skb; + dma_unmap_single(bp-pdev-dev, tx_skb-mapping, skb-len, +DMA_TO_DEVICE); + dev_kfree_skb_irq(skb); + tx_skb-skb = NULL; - tx_skb = macb_tx_skb(bp, tail); - skb = tx_skb-skb; + desc = macb_tx_desc(bp, err_tail); + desc-ctrl |= MACB_BIT(TX_USED); + } - dma_unmap_single(bp-pdev-dev, tx_skb-mapping, - skb-len, DMA_TO_DEVICE); - tx_skb-skb = NULL; - dev_kfree_skb_irq(skb); - } + /* Make descriptor updates visible to hardware */ + wmb(); +} - bp-tx_head = bp-tx_tail = 0; +static void macb_tx_interrupt(struct macb *bp) +{ + unsigned int tail; + unsigned int head; + u32 status; - /* Enable the transmitter again */ - if (status MACB_BIT(TGO)) - macb_writel(bp, NCR, macb_readl(bp, NCR) | MACB_BIT(TE)); - } + status = macb_readl(bp, TSR); + macb_writel(bp, TSR, status); - if (!(status MACB_BIT(COMP))) - /* -* This may happen when a buffer becomes complete -* between reading the ISR and scanning the -* descriptors. Nothing to worry about
[PATCH 09/10] net/macb: ethtool interface: add register dump feature
Add macb_get_regs() ethtool function and its helper function: macb_get_regs_len(). Signed-off-by: Nicolas Ferre nicolas.fe...@atmel.com --- drivers/net/ethernet/cadence/macb.c | 40 +++ drivers/net/ethernet/cadence/macb.h |3 +++ 2 files changed, 43 insertions(+) diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c index c7c39f1..f31c0a7 100644 --- a/drivers/net/ethernet/cadence/macb.c +++ b/drivers/net/ethernet/cadence/macb.c @@ -1321,10 +1321,50 @@ static void macb_get_drvinfo(struct net_device *dev, strcpy(info-bus_info, dev_name(bp-pdev-dev)); } +static int macb_get_regs_len(struct net_device *netdev) +{ + return MACB_GREGS_LEN * sizeof(u32); +} + +static void macb_get_regs(struct net_device *dev, struct ethtool_regs *regs, + void *p) +{ + struct macb *bp = netdev_priv(dev); + unsigned int tail, head; + u32 *regs_buff = p; + +memset(p, 0, MACB_GREGS_LEN * sizeof(u32)); + regs-version = MACB_BFEXT(IDNUM, macb_readl(bp, MID)); + + tail = macb_tx_ring_wrap(bp-tx_tail); + head = macb_tx_ring_wrap(bp-tx_head); + + regs_buff[0] = macb_readl(bp, NCR); + regs_buff[1] = macb_or_gem_readl(bp, NCFGR); + regs_buff[2] = macb_readl(bp, NSR); + regs_buff[3] = macb_readl(bp, TSR); + regs_buff[4] = macb_readl(bp, RBQP); + regs_buff[5] = macb_readl(bp, TBQP); + regs_buff[6] = macb_readl(bp, RSR); + regs_buff[7] = macb_readl(bp, IMR); + + regs_buff[8] = tail; + regs_buff[9] = head; + regs_buff[10] = macb_tx_dma(bp, tail); + regs_buff[11] = macb_tx_dma(bp, head); + + if (macb_is_gem(bp)) { + regs_buff[12] = gem_readl(bp, USRIO); + regs_buff[13] = gem_readl(bp, DMACFG); + } +} + static const struct ethtool_ops macb_ethtool_ops = { .get_settings = macb_get_settings, .set_settings = macb_set_settings, .get_drvinfo= macb_get_drvinfo, + .get_regs_len = macb_get_regs_len, + .get_regs = macb_get_regs, .get_link = ethtool_op_get_link, .get_ts_info= ethtool_op_get_ts_info, }; diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h index 8a4ee2f..d509e88 100644 --- a/drivers/net/ethernet/cadence/macb.h +++ b/drivers/net/ethernet/cadence/macb.h @@ -10,6 +10,9 @@ #ifndef _MACB_H #define _MACB_H + +#define MACB_GREGS_LEN 32 + /* MACB register offsets */ #define MACB_NCR 0x #define MACB_NCFGR 0x0004 -- 1.7.10 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 08/10] net/macb: macb_get_drvinfo: add GEM/MACB suffix to differentiate revision
Add an indication about which revision of the hardware we are running in info-driver string. Signed-off-by: Nicolas Ferre nicolas.fe...@atmel.com --- drivers/net/ethernet/cadence/macb.c |4 1 file changed, 4 insertions(+) diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c index bd331fd..c7c39f1 100644 --- a/drivers/net/ethernet/cadence/macb.c +++ b/drivers/net/ethernet/cadence/macb.c @@ -1313,6 +1313,10 @@ static void macb_get_drvinfo(struct net_device *dev, struct macb *bp = netdev_priv(dev); strcpy(info-driver, bp-pdev-dev.driver-name); + if (macb_is_gem(bp)) + strcat(info-driver, GEM); + else + strcat(info-driver, MACB); strcpy(info-version, $Revision: 1.14 $); strcpy(info-bus_info, dev_name(bp-pdev-dev)); } -- 1.7.10 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 10/10] net/macb: Offset first RX buffer by two bytes
From: Havard Skinnemoen hav...@skinnemoen.net Make the ethernet frame payload word-aligned, possibly making the memcpy into the skb a bit faster. This will be even more important after we eliminate the copy altogether. Also eliminate the redundant RX_OFFSET constant -- it has the same definition and purpose as NET_IP_ALIGN. Signed-off-by: Havard Skinnemoen hav...@skinnemoen.net [nicolas.fe...@atmel.com: adapt to newer kernel] Signed-off-by: Nicolas Ferre nicolas.fe...@atmel.com --- drivers/net/ethernet/cadence/macb.c | 23 --- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c index f31c0a7..f7716b6 100644 --- a/drivers/net/ethernet/cadence/macb.c +++ b/drivers/net/ethernet/cadence/macb.c @@ -33,9 +33,6 @@ #define RX_RING_SIZE 512 #define RX_RING_BYTES (sizeof(struct macb_dma_desc) * RX_RING_SIZE) -/* Make the IP header word-aligned (the ethernet header is 14 bytes) */ -#define RX_OFFSET 2 - #define TX_RING_SIZE 128 #define TX_RING_BYTES (sizeof(struct macb_dma_desc) * TX_RING_SIZE) @@ -466,7 +463,7 @@ static int macb_rx_frame(struct macb *bp, unsigned int first_frag, { unsigned int len; unsigned int frag; - unsigned int offset = 0; + unsigned int offset; struct sk_buff *skb; struct macb_dma_desc *desc; @@ -477,7 +474,16 @@ static int macb_rx_frame(struct macb *bp, unsigned int first_frag, macb_rx_ring_wrap(first_frag), macb_rx_ring_wrap(last_frag), len); - skb = netdev_alloc_skb(bp-dev, len + RX_OFFSET); + /* +* The ethernet header starts NET_IP_ALIGN bytes into the +* first buffer. Since the header is 14 bytes, this makes the +* payload word-aligned. +* +* Instead of calling skb_reserve(NET_IP_ALIGN), we just copy +* the two padding bytes into the skb so that we avoid hitting +* the slowpath in memcpy(), and pull them off afterwards. +*/ + skb = netdev_alloc_skb(bp-dev, len + NET_IP_ALIGN); if (!skb) { bp-stats.rx_dropped++; for (frag = first_frag; ; frag++) { @@ -493,7 +499,8 @@ static int macb_rx_frame(struct macb *bp, unsigned int first_frag, return 1; } - skb_reserve(skb, RX_OFFSET); + offset = 0; + len += NET_IP_ALIGN; skb_checksum_none_assert(skb); skb_put(skb, len); @@ -517,10 +524,11 @@ static int macb_rx_frame(struct macb *bp, unsigned int first_frag, /* Make descriptor updates visible to hardware */ wmb(); + __skb_pull(skb, NET_IP_ALIGN); skb-protocol = eth_type_trans(skb, bp-dev); bp-stats.rx_packets++; - bp-stats.rx_bytes += len; + bp-stats.rx_bytes += skb-len; netdev_vdbg(bp-dev, received skb of length %u, csum: %08x\n, skb-len, skb-csum); netif_receive_skb(skb); @@ -985,6 +993,7 @@ static void macb_init_hw(struct macb *bp) __macb_set_hwaddr(bp); config = macb_mdc_clk_div(bp); + config |= MACB_BF(RBOF, NET_IP_ALIGN); /* Make eth data aligned */ config |= MACB_BIT(PAE);/* PAuse Enable */ config |= MACB_BIT(DRFCS); /* Discard Rx FCS */ config |= MACB_BIT(BIG);/* Receive oversized frames */ -- 1.7.10 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[GIT PULL] at91: soc update (for 3.6)
Hi Arnd, hi Olof, Here is an additional AT91 pull request that is still related with the replacement of sd/mmc platform data. (it doesn't merge seamlessly with current Linus' tree: I can provide a resolution hint or rebase this work if necessary). The following changes since commit 6887a4131da3adaab011613776d865f4bcfb5678: Linux 3.5-rc5 (2012-06-30 16:08:57 -0700) are available in the git repository at: git://github.com/at91linux/linux-at91.git tags/at91-for-next-soc for you to fetch changes up to 4cf3326ab5f34a333a46c59d0d3783db9cef13bf: ARM: at91: add atmel-mci support for chips and boards which can use it (2012-07-02 18:03:01 +0200) AT91 SoC related code modifications: a cleanup in defconfigs and a one liner in a board file. The most important is the move to atmel-mci driver in AT91 SoC boards. The old at91_mci (marked as deprecated) will be removed in 3.7. So all platform data for this old driver are erased and replace by information needed by atmel-mci driver. Ludovic Desroches (1): ARM: at91: add atmel-mci support for chips and boards which can use it Nicolas Ferre (1): ARM: at91/defconfig: change the MCI driver to use in defconfigs Paul Bolle (1): ARM: at91: set i2c_board_info.type to ds1339 directly Richard Genoud (1): ARM: at91/defconfig: Remove unaffected config option arch/arm/configs/afeb9260_defconfig |1 - arch/arm/configs/at91rm9200_defconfig|2 +- arch/arm/configs/at91sam9261_defconfig |2 +- arch/arm/configs/at91sam9263_defconfig |3 +- arch/arm/configs/at91sam9g20_defconfig |2 +- arch/arm/configs/at91sam9rl_defconfig|2 +- arch/arm/configs/cpu9260_defconfig |2 +- arch/arm/configs/cpu9g20_defconfig |2 +- arch/arm/configs/qil-a9260_defconfig |3 +- arch/arm/configs/stamp9g20_defconfig |1 - arch/arm/configs/usb-a9260_defconfig |1 - arch/arm/mach-at91/at91rm9200_devices.c | 92 - arch/arm/mach-at91/at91sam9260_devices.c | 84 +- arch/arm/mach-at91/at91sam9261_devices.c | 60 +-- arch/arm/mach-at91/at91sam9263.c |4 +- arch/arm/mach-at91/at91sam9263_devices.c | 161 ++-- arch/arm/mach-at91/at91sam9rl_devices.c | 60 +-- arch/arm/mach-at91/board-afeb-9260v1.c | 14 +++ arch/arm/mach-at91/board-carmeva.c | 14 +++ arch/arm/mach-at91/board-cpu9krea.c | 17 arch/arm/mach-at91/board-cpuat91.c | 13 +++--- arch/arm/mach-at91/board-csb337.c| 14 +++ arch/arm/mach-at91/board-eb9200.c| 14 +++ arch/arm/mach-at91/board-ecbat91.c | 14 +++ arch/arm/mach-at91/board-eco920.c| 14 +++ arch/arm/mach-at91/board-flexibity.c | 14 +++ arch/arm/mach-at91/board-foxg20.c| 16 arch/arm/mach-at91/board-kb9202.c| 14 +++ arch/arm/mach-at91/board-neocore926.c| 13 +++--- arch/arm/mach-at91/board-picotux200.c| 14 +++ arch/arm/mach-at91/board-qil-a9260.c | 14 +++ arch/arm/mach-at91/board-rm9200dk.c | 14 +++ arch/arm/mach-at91/board-rm9200ek.c | 14 +++ arch/arm/mach-at91/board-rsi-ews.c | 13 +++--- arch/arm/mach-at91/board-sam9-l9260.c| 16 arch/arm/mach-at91/board-sam9260ek.c | 16 arch/arm/mach-at91/board-sam9261ek.c | 13 +++--- arch/arm/mach-at91/board-sam9263ek.c | 13 +++--- arch/arm/mach-at91/board-sam9g20ek.c | 16 +--- arch/arm/mach-at91/board-sam9rlek.c | 13 +++--- arch/arm/mach-at91/board-stamp9g20.c | 14 --- arch/arm/mach-at91/board-usb-a926x.c |2 - arch/arm/mach-at91/board-yl-9200.c | 13 +++--- drivers/mtd/nand/Kconfig | 40 -- 44 files changed, 384 insertions(+), 494 deletions(-) Thanks, best regards, -- Nicolas Ferre -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [GIT PULL] at91: platform data for atmel-mci (for 3.5)
On 07/25/2012 10:06 PM, Arnd Bergmann : On Thursday 31 May 2012, Nicolas Ferre wrote: On 05/24/2012 05:12 PM, Nicolas Ferre : Hi Arnd, hi Olof, Ping? (or maybe you will have a look at this after the merge window...) I've just gone through all old pull requests that I had somewhere in my inbox and this turned out to be one that we never pulled. It looks like it still applies and we should send it to Linus as as late branch this time, given that we screwed up and it was there all the time. Nicolas, can you please confirm? Arnd, I have sent to you a pull-request covering this work several days ago ([GIT PULL] at91: soc update (for 3.6)): what is your feeling about it: do you think that it will still go upstream for 3.6? Thanks, bye, -- Nicolas Ferre -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 4/4] [RFC] ARM: treewide: manually change more mach-*/*.h includes
On 08/23/2012 01:35 PM, Arnd Bergmann : On Wednesday 22 August 2012, Russell King - ARM Linux wrote: On Wed, Aug 22, 2012 at 01:01:19PM +, Arnd Bergmann wrote: These are lots of device drivers that include machine specific header files from ARM platforms and that are not easily scriptable. The changes have been found through manual inspection and should cause no visible changes because of the build script that maps the old names to the new ones. [..] How about I move all the pure platform data definition files now and rebase the other patches on top of that. Here is a list of suggested file names in include/linux/platform_data/: mach-at91/at_hdmac.h - dma-atmel.h Fine with me. Maybe atmel-dma.h can better match what we already have in this directory, but I do not know what is the policy in this directory... [..] ** list of mach/* inclusions that I could not match with ** exactly one ARM platform: In fact, for *atmel* type of files, they usually match *both* AVR32 and ARM/AT91 devices: so, we have to be careful about them... Best regards, -- Nicolas Ferre -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] ARM: at91/feature-removal-schedule: delay at91_mci removal
From: Ludovic Desroches ludovic.desroc...@atmel.com Delay sd/mmc driver at91_mci.c removal because of tight schedule to move platform data to new driver atmel-mci. Signed-off-by: Ludovic Desroches ludovic.desroc...@atmel.com Signed-off-by: Nicolas Ferre nicolas.fe...@atmel.com --- Hi, I plan to queue this one with the at91-fixes pull-request for 3.6. If you do not feel it is a good idea, please say so. Documentation/feature-removal-schedule.txt |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt index afaff31..f4d8c71 100644 --- a/Documentation/feature-removal-schedule.txt +++ b/Documentation/feature-removal-schedule.txt @@ -579,7 +579,7 @@ Why:KVM tracepoints provide mostly equivalent information in a much more What: at91-mci driver (CONFIG_MMC_AT91) -When: 3.7 +When: 3.8 Why: There are two mci drivers: at91-mci and atmel-mci. The PDC support was added to atmel-mci as a first step to support more chips. Then at91-mci was kept only for old IP versions (on at91rm9200 and -- 1.7.10 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[GIT PULL] at91: fixes for 3.6 (take 1)
The following changes since commit d9875690d9b89a866022ff49e3fcea892345ad92: Linux 3.6-rc2 (2012-08-16 14:51:24 -0700) are available in the git repository at: git://github.com/at91linux/linux-at91.git tags/at91-fixes for you to fetch changes up to 0d4d1e37ca732615717d4434b58682f81a6bb61c: ARM: at91/feature-removal-schedule: delay at91_mci removal (2012-08-24 10:45:07 +0200) Fixes for AT91 related to: - move to sparse IRQ: some drivers were forgotten - a build error in sound driver a DTS typo - the delay for removal of old at91_mci driver Bo Shen (1): ARM: at91/dts: remove partial parameter in at91sam9g25ek.dts Joachim Eastwood (1): ASoC: atmel-ssc: include linux/io.h for raw io Ludovic Desroches (3): ARM: at91: fix system timer irq issue due to sparse irq support ARM: at91: fix rtc-at91sam9 irq issue due to sparse irq support ARM: at91/feature-removal-schedule: delay at91_mci removal Nicolas Ferre (1): ARM: at91/clock: fix PLLA overclock warning Documentation/feature-removal-schedule.txt |2 +- arch/arm/boot/dts/at91sam9g25ek.dts|2 +- arch/arm/mach-at91/at91rm9200_time.c |2 +- arch/arm/mach-at91/at91sam9260_devices.c |6 +- arch/arm/mach-at91/at91sam9261_devices.c |6 +- arch/arm/mach-at91/at91sam9263_devices.c | 10 -- arch/arm/mach-at91/at91sam9g45_devices.c |6 +- arch/arm/mach-at91/at91sam9rl_devices.c|6 +- arch/arm/mach-at91/clock.c | 12 drivers/rtc/rtc-at91sam9.c | 22 +++--- include/linux/atmel-ssc.h |1 + 11 files changed, 59 insertions(+), 16 deletions(-) Thanks, best regards, -- Nicolas Ferre -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [GIT PULL] at91: fixes for 3.6 (take 1)
On 08/24/2012 05:59 PM, Nicolas Ferre : The following changes since commit d9875690d9b89a866022ff49e3fcea892345ad92: Linux 3.6-rc2 (2012-08-16 14:51:24 -0700) are available in the git repository at: git://github.com/at91linux/linux-at91.git tags/at91-fixes for you to fetch changes up to 0d4d1e37ca732615717d4434b58682f81a6bb61c: ARM: at91/feature-removal-schedule: delay at91_mci removal (2012-08-24 10:45:07 +0200) Fixes for AT91 related to: - move to sparse IRQ: some drivers were forgotten - a build error in sound driver a DTS typo - the delay for removal of old at91_mci driver Bo Shen (1): ARM: at91/dts: remove partial parameter in at91sam9g25ek.dts Joachim Eastwood (1): ASoC: atmel-ssc: include linux/io.h for raw io Hi, As per Mark's suggestion, this one will go through ASoC tree. So I have removed it from the tag. I resend a pull request now. Best regards, Ludovic Desroches (3): ARM: at91: fix system timer irq issue due to sparse irq support ARM: at91: fix rtc-at91sam9 irq issue due to sparse irq support ARM: at91/feature-removal-schedule: delay at91_mci removal Nicolas Ferre (1): ARM: at91/clock: fix PLLA overclock warning Documentation/feature-removal-schedule.txt |2 +- arch/arm/boot/dts/at91sam9g25ek.dts|2 +- arch/arm/mach-at91/at91rm9200_time.c |2 +- arch/arm/mach-at91/at91sam9260_devices.c |6 +- arch/arm/mach-at91/at91sam9261_devices.c |6 +- arch/arm/mach-at91/at91sam9263_devices.c | 10 -- arch/arm/mach-at91/at91sam9g45_devices.c |6 +- arch/arm/mach-at91/at91sam9rl_devices.c|6 +- arch/arm/mach-at91/clock.c | 12 drivers/rtc/rtc-at91sam9.c | 22 +++--- include/linux/atmel-ssc.h |1 + 11 files changed, 59 insertions(+), 16 deletions(-) Thanks, best regards, -- Nicolas Ferre -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[GIT PULL] at91: fixes for 3.6 (take 1 bis)
Hi, This pull request supersedes the previous one from August 24th. It removes the ASoC SSC part which is now handled by Mark Brown. The following changes since commit d9875690d9b89a866022ff49e3fcea892345ad92: Linux 3.6-rc2 (2012-08-16 14:51:24 -0700) are available in the git repository at: git://github.com/at91linux/linux-at91.git tags/at91-fixes for you to fetch changes up to 51a6149b89b822cacf572b2ca2a15cb6f2232b11: ARM: at91/feature-removal-schedule: delay at91_mci removal (2012-08-27 09:59:36 +0200) Fixes for AT91 related to: - move to sparse IRQ: some drivers were forgotten - a DTS typo - the delay for removal of old at91_mci driver Bo Shen (1): ARM: at91/dts: remove partial parameter in at91sam9g25ek.dts Ludovic Desroches (3): ARM: at91: fix system timer irq issue due to sparse irq support ARM: at91: fix rtc-at91sam9 irq issue due to sparse irq support ARM: at91/feature-removal-schedule: delay at91_mci removal Nicolas Ferre (1): ARM: at91/clock: fix PLLA overclock warning Documentation/feature-removal-schedule.txt |2 +- arch/arm/boot/dts/at91sam9g25ek.dts|2 +- arch/arm/mach-at91/at91rm9200_time.c |2 +- arch/arm/mach-at91/at91sam9260_devices.c |6 +- arch/arm/mach-at91/at91sam9261_devices.c |6 +- arch/arm/mach-at91/at91sam9263_devices.c | 10 -- arch/arm/mach-at91/at91sam9g45_devices.c |6 +- arch/arm/mach-at91/at91sam9rl_devices.c|6 +- arch/arm/mach-at91/clock.c | 12 drivers/rtc/rtc-at91sam9.c | 22 +++--- 10 files changed, 58 insertions(+), 16 deletions(-) Thanks, best regards, -- Nicolas Ferre -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] at91_mci: use generic GPIO calls
From: David Brownell [EMAIL PROTECTED] Update the AT91 MMC driver to use the generic GPIO calls instead of the AT91-specific calls; and to request (and release) those GPIO signals. That required updating the probe() fault cleanup codepaths. Now there is a single sequence for freeing resources, in reverse order of their allocation. Also that code uses use dev_*() for messaging, and has less abuse of KERN_ERR. Likewise with updating remove() cleanup. This had to free the GPIOs, and while adding that code I noticed and fixed two other problems: it was poking at a workqueue owned by the mmc core; and in one (rare) case would try freeing an IRQ that it didn't allocate. Signed-off-by: David Brownell [EMAIL PROTECTED] Signed-off-by: Nicolas Ferre [EMAIL PROTECTED] --- Little update from previous patch to match the modification introduced by : http://lkml.org/lkml/2008/1/30/308 So it applies on to of it. drivers/mmc/host/at91_mci.c | 114 ++-- 1 file changed, 80 insertions(+), 34 deletions(-) --- linux-2.6-snapshot.orig/drivers/mmc/host/at91_mci.c +++ linux-2.6-snapshot/drivers/mmc/host/at91_mci.c @@ -70,10 +70,11 @@ #include asm/io.h #include asm/irq.h +#include asm/gpio.h + #include asm/mach/mmc.h #include asm/arch/board.h #include asm/arch/cpu.h -#include asm/arch/gpio.h #include asm/arch/at91_mci.h #define DRIVER_NAME at91_mci @@ -659,10 +660,10 @@ static void at91_mci_set_ios(struct mmc_ if (host-board-vcc_pin) { switch (ios-power_mode) { case MMC_POWER_OFF: - at91_set_gpio_value(host-board-vcc_pin, 0); + gpio_set_value(host-board-vcc_pin, 0); break; case MMC_POWER_UP: - at91_set_gpio_value(host-board-vcc_pin, 1); + gpio_set_value(host-board-vcc_pin, 1); break; default: break; @@ -769,7 +770,7 @@ static irqreturn_t at91_mci_irq(int irq, static irqreturn_t at91_mmc_det_irq(int irq, void *_host) { struct at91mci_host *host = _host; - int present = !at91_get_gpio_value(irq); + int present = !gpio_get_value(irq_to_gpio(irq)); /* * we expect this irq on both insert and remove, @@ -794,7 +795,7 @@ static int at91_mci_get_ro(struct mmc_ho struct at91mci_host *host = mmc_priv(mmc); if (host-board-wp_pin) { - read_only = at91_get_gpio_value(host-board-wp_pin); + read_only = gpio_get_value(host-board-wp_pin); printk(KERN_WARNING %s: card is %s\n, mmc_hostname(mmc), (read_only ? read-only : read-write) ); } @@ -821,8 +822,6 @@ static int __init at91_mci_probe(struct struct resource *res; int ret; - pr_debug(Probe MCI devices\n); - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) return -ENXIO; @@ -832,9 +831,9 @@ static int __init at91_mci_probe(struct mmc = mmc_alloc_host(sizeof(struct at91mci_host), pdev-dev); if (!mmc) { - pr_debug(Failed to allocate mmc host\n); - release_mem_region(res-start, res-end - res-start + 1); - return -ENOMEM; + ret = -ENOMEM; + dev_dbg(pdev-dev, couldn't allocate mmc host\n); + goto fail6; } mmc-ops = at91_mci_ops; @@ -854,19 +853,44 @@ static int __init at91_mci_probe(struct if (cpu_is_at91sam9260() || cpu_is_at91sam9263()) mmc-caps |= MMC_CAP_4_BIT_DATA; else - printk(AT91 MMC: 4 wire bus mode not supported + dev_warn(pdev-dev, 4 wire bus mode not supported - using 1 wire\n); } /* +* Reserve GPIOs ... board init code makes sure these pins are set +* up as GPIOs with the right direction (input, except for vcc) +*/ + if (host-board-det_pin) { + ret = gpio_request(host-board-det_pin, mmc_detect); + if (ret 0) { + dev_dbg(pdev-dev, couldn't claim card detect pin\n); + goto fail5; + } + } + if (host-board-wp_pin) { + ret = gpio_request(host-board-wp_pin, mmc_wp); + if (ret 0) { + dev_dbg(pdev-dev, couldn't claim wp sense pin\n); + goto fail4; + } + } + if (host-board-vcc_pin) { + ret = gpio_request(host-board-vcc_pin, mmc_vcc); + if (ret 0) { + dev_dbg(pdev-dev, couldn't claim vcc switch pin\n); + goto fail3; + } + } + + /* * Get Clock */ host-mci_clk = clk_get(pdev-dev, mci_clk); if (IS_ERR(host-mci_clk
[PATCH] at91_mci: minor cleanup
From: Marc Pignat [EMAIL PROTECTED] MMC_POWER_ON is a noop, no need to set the power pin again. Signed-off-by: Marc Pignat [EMAIL PROTECTED] Signed-off-by: Nicolas Ferre [EMAIL PROTECTED] --- MMC_POWER_OFF/MMC_POWER_UP turn the power OFF/ON, there is nothing to change when ios-power_mode==MMC_POWER_ON. Also changed indentation for the switch (CodingStyle), because there is no other switch statement in this driver. --- a/drivers/mmc/host/at91_mci.c +++ b/drivers/mmc/host/at91_mci.c @@ -658,13 +658,14 @@ static void at91_mci_set_ios(struct mmc_ /* maybe switch power to the card */ if (host-board-vcc_pin) { switch (ios-power_mode) { - case MMC_POWER_OFF: - at91_set_gpio_value(host-board-vcc_pin, 0); - break; - case MMC_POWER_UP: - case MMC_POWER_ON: - at91_set_gpio_value(host-board-vcc_pin, 1); - break; + case MMC_POWER_OFF: + at91_set_gpio_value(host-board-vcc_pin, 0); + break; + case MMC_POWER_UP: + at91_set_gpio_value(host-board-vcc_pin, 1); + break; + default: + break; } } } -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] AT91: correct at91sam9263ek LCD power gpio pin
Corrects GPIO pin assignment for the LCD power control (PCI) Signed-off-by: Nicolas Ferre [EMAIL PROTECTED] --- Simpler one. arch/arm/mach-at91/board-sam9263ek.c |5 + 1 file changed, 1 insertion(+), 4 deletions(-) --- linux-2.6-snapshot.orig/arch/arm/mach-at91/board-sam9263ek.c +++ linux-2.6-snapshot/arch/arm/mach-at91/board-sam9263ek.c @@ -242,10 +242,7 @@ static struct fb_monspecs at91fb_default static void at91_lcdc_power_control(int on) { - if (on) - at91_set_gpio_value(AT91_PIN_PD12, 0); /* power up */ - else - at91_set_gpio_value(AT91_PIN_PD12, 1); /* power down */ + at91_set_gpio_value(AT91_PIN_PA30, on); } /* Driver datas */ -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] atmel_lcdfb: backlight control
From: David Brownell [EMAIL PROTECTED] On the sam9 EK boards, the LCD backlight is hooked up to a PWM output from the LCD controller. It's controlled by contrast registers though. This patch lets boards declare that they have that kind of backlight control. The driver can then export this control, letting screenblank and other operations actually take effect ... reducing the typically substantial power drain from the backlight. Signed-off-by: David Brownell [EMAIL PROTECTED] Signed-off-by: Nicolas Ferre [EMAIL PROTECTED] --- Note that it's not fully cooked - doesn't force backlight off during system suspend - the power and blank events may not be done right This should be easily added in the future. arch/arm/mach-at91/board-sam9261ek.c |1 arch/arm/mach-at91/board-sam9263ek.c |1 drivers/video/atmel_lcdfb.c | 114 +-- drivers/video/backlight/Kconfig | 13 +++ include/video/atmel_lcdc.h | 11 ++- 5 files changed, 134 insertions(+), 6 deletions(-) --- linux-2.6-snapshot.orig/arch/arm/mach-at91/board-sam9261ek.c +++ linux-2.6-snapshot/arch/arm/mach-at91/board-sam9261ek.c @@ -322,6 +322,7 @@ static void at91_lcdc_power_control(int /* Driver datas */ static struct atmel_lcdfb_info __initdata ek_lcdc_data = { + .lcdcon_is_backlight= true, .default_bpp= 16, .default_dmacon = ATMEL_LCDC_DMAEN, .default_lcdcon2= AT91SAM9261_DEFAULT_LCDCON2, --- linux-2.6-snapshot.orig/arch/arm/mach-at91/board-sam9263ek.c +++ linux-2.6-snapshot/arch/arm/mach-at91/board-sam9263ek.c @@ -250,6 +250,7 @@ static void at91_lcdc_power_control(int /* Driver datas */ static struct atmel_lcdfb_info __initdata ek_lcdc_data = { + .lcdcon_is_backlight= true, .default_bpp= 16, .default_dmacon = ATMEL_LCDC_DMAEN, .default_lcdcon2= AT91SAM9263_DEFAULT_LCDCON2, --- linux-2.6-snapshot.orig/drivers/video/atmel_lcdfb.c +++ linux-2.6-snapshot/drivers/video/atmel_lcdfb.c @@ -16,6 +16,7 @@ #include linux/fb.h #include linux/init.h #include linux/delay.h +#include linux/backlight.h #include asm/arch/board.h #include asm/arch/cpu.h @@ -69,6 +70,107 @@ static void atmel_lcdfb_update_dma2d(str } #endif +static const u32 contrast_ctr = ATMEL_LCDC_PS_DIV8 + | ATMEL_LCDC_POL_POSITIVE + | ATMEL_LCDC_ENA_PWMENABLE; + +#ifdef CONFIG_BACKLIGHT_ATMEL_LCDC + +/* some bl-props field just changed */ +static int atmel_bl_update_status(struct backlight_device *bl) +{ + struct atmel_lcdfb_info *sinfo = bl_get_data(bl); + int power = sinfo-bl_power; + int brightness = bl-props.brightness; + + /* REVISIT there may be a meaningful difference between +* fb_blank and power ... there seem to be some cases +* this doesn't handle correctly. +*/ + if (bl-props.fb_blank != sinfo-bl_power) + power = bl-props.fb_blank; + else if (bl-props.power != sinfo-bl_power) + power = bl-props.power; + + if (brightness 0 power == FB_BLANK_UNBLANK) + brightness = lcdc_readl(sinfo, ATMEL_LCDC_CONTRAST_VAL); + else if (power != FB_BLANK_UNBLANK) + brightness = 0; + + lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_VAL, brightness); + lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, + brightness ? contrast_ctr : 0); + + bl-props.fb_blank = bl-props.power = sinfo-bl_power = power; + + return 0; +} + +static int atmel_bl_get_brightness(struct backlight_device *bl) +{ + struct atmel_lcdfb_info *sinfo = bl_get_data(bl); + + return lcdc_readl(sinfo, ATMEL_LCDC_CONTRAST_VAL); +} + +static struct backlight_ops atmel_lcdc_bl_ops = { + .update_status = atmel_bl_update_status, + .get_brightness = atmel_bl_get_brightness, +}; + +static inline void init_backlight(struct atmel_lcdfb_info *sinfo) +{ + struct backlight_device *bl; + + sinfo-bl_power = FB_BLANK_UNBLANK; + + if (sinfo-backlight) + return; + + bl = backlight_device_register(backlight, sinfo-pdev-dev, + sinfo, atmel_lcdc_bl_ops); + if (IS_ERR(sinfo-backlight)) { + dev_err(sinfo-pdev-dev, error %ld on backlight register\n, + PTR_ERR(bl)); + return; + } + sinfo-backlight = bl; + + bl-props.power = FB_BLANK_UNBLANK; + bl-props.fb_blank = FB_BLANK_UNBLANK; + bl-props.max_brightness = 0xff; + bl-props.brightness = atmel_bl_get_brightness(bl); +} + +static inline void exit_contrast(struct atmel_lcdfb_info *sinfo) +{ + if (sinfo-backlight) + backlight_device_unregister(sinfo-backlight); +} + +#else + +static inline void init_backlight(struct atmel_lcdfb_info
Re: [Linux-fbdev-devel] [PATCH] atmel_lcdfb: backlight control - tiny rework
Tiny patch that removes not needed inline and renames function : exit_contrast() - exit_backlight(). It adds the missing exit_backlight() in probe() error path. Signed-off-by: Nicolas Ferre [EMAIL PROTECTED] --- Follows comments from Andrew Morton and Haavard Skinnemoen. Thanks to both of you. drivers/video/atmel_lcdfb.c | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) --- a/drivers/video/atmel_lcdfb.c +++ b/drivers/video/atmel_lcdfb.c @@ -118,7 +118,7 @@ static struct backlight_ops atmel_lcdc_b .get_brightness = atmel_bl_get_brightness, }; -static inline void init_backlight(struct atmel_lcdfb_info *sinfo) +static void init_backlight(struct atmel_lcdfb_info *sinfo) { struct backlight_device *bl; @@ -142,7 +142,7 @@ static inline void init_backlight(struct bl-props.brightness = atmel_bl_get_brightness(bl); } -static inline void exit_contrast(struct atmel_lcdfb_info *sinfo) +static void exit_backlight(struct atmel_lcdfb_info *sinfo) { if (sinfo-backlight) backlight_device_unregister(sinfo-backlight); @@ -150,18 +150,18 @@ static inline void exit_contrast(struct #else -static inline void init_backlight(struct atmel_lcdfb_info *sinfo) +static void init_backlight(struct atmel_lcdfb_info *sinfo) { dev_warn(sinfo-pdev-dev, backlight control is not available\n); } -static inline void exit_contrast(struct atmel_lcdfb_info *sinfo) +static void exit_backlight(struct atmel_lcdfb_info *sinfo) { } #endif -static inline void init_contrast(struct atmel_lcdfb_info *sinfo) +static void init_contrast(struct atmel_lcdfb_info *sinfo) { /* have some default contrast/backlight settings */ lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, contrast_ctr); @@ -823,6 +823,7 @@ free_cmap: unregister_irqs: free_irq(sinfo-irq_base, info); unmap_mmio: + exit_backlight(sinfo); iounmap(sinfo-mmio); release_mem: release_mem_region(info-fix.mmio_start, info-fix.mmio_len); @@ -857,7 +858,7 @@ static int __exit atmel_lcdfb_remove(str if (!sinfo) return 0; - exit_contrast(sinfo); + exit_backlight(sinfo); if (sinfo-atmel_lcdfb_power_control) sinfo-atmel_lcdfb_power_control(0); unregister_framebuffer(info); -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[GIT PULL] at91: a little dt pull request for 3.6
Hi Arnd, hi Olof, The following changes since commit bd0a521e88aa7a06ae7aabaed7ae196ed4ad867a: Linux 3.5-rc6 (2012-07-07 17:23:56 -0700) are available in the git repository at: git://github.com/at91linux/linux-at91.git tags/at91-for-next-dt for you to fetch changes up to 3c68bb48214f87562b6956195178d991403d66d4: ARM: at91: Add support for board aks-cdu (2012-07-09 20:45:31 +0200) Two new boards described with device tree Fabio Porcedda (1): ARM: at91: add support for Telit EVK-PRO3 with Telit GE863-PRO3 Jiri Prchal (1): ARM: at91: Add support for board aks-cdu arch/arm/boot/dts/aks-cdu.dts | 113 + arch/arm/boot/dts/evk-pro3.dts| 41 +++ arch/arm/boot/dts/ge863-pro3.dtsi | 52 +++ arch/arm/mach-at91/Makefile.boot |2 ++ 4 files changed, 208 insertions(+) create mode 100644 arch/arm/boot/dts/aks-cdu.dts create mode 100644 arch/arm/boot/dts/evk-pro3.dts create mode 100644 arch/arm/boot/dts/ge863-pro3.dtsi Thanks, best regards, -- Nicolas Ferre -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: at91sam9260 MACB problem with IP fragmentation
Erwin, On 12/06/2012 12:32 PM, Erwin Rol : Hello Nicolas, Havard, all, I have a very obscure problem with a at91sam9260 board (almost 1 to 1 copy of the Atmel EK). The MACB seems to stall when I use large (2 * MTU) UDP datagrams. The test case is that a udp echo client (PC) sends datagrams with increasing length to the AT91 until the max length of the UDP datagram is reached. When there is no IP fragmentation everything is fine, but when the datagrams are starting to get fragmented the AT91 will not reply anymore. But as soon as some network traffic happens it goes on again, and non of the data is lost. With wireshark the effect can be easily seen (192.168.1.4 is the PC echo client, and 192.168.1.133 is the at91 echo server) After the first request there comes no reply. After a 5 second timeout the second request is send. And then both replies are returned. When I enabled debugging output it all started to work. So I tried some udelays in the driver instead of printk and with a 1ms delay in the irq handler it started working. Of course that is an unacceptable fix, but it looks like that is some weird race condition that causes the sending to stall. The only difference with normal MTU sized datagrams I can think of is that the fragmented packets can be passed very quickly to the macb tx function, because the kernel has all 5 skb's ready. I would be very interested to hear if someone else could reproduce this problem. Or even better, has seen this problem and has a fix for it. I tried several kernels including the test version from Nicolas that he posted on LKML in October. They all show the same effect. [..] It seems that Matteo has the same behavior: check here: http://www.spinics.net/lists/netdev/msg218951.html I am working on the macb driver right now, so I will try to reproduce and track this issue on my side. Best regards, -- Nicolas Ferre -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[GIT PULL v2] at91: fixes for 3.7-rc7
Arnd, Olof, Just for the record, I do not want to put pressure at a such late time in the 3.7-rc process. So, I just reworked that pull-request because the previous one was wrong: - wrong patch content (DT nodes with wrong size) - not all tags in patches (Jean-Christophe and Arnd tags were missing...) Just to start from a sane base if I have to rebase this work for 3.8, I let you know that I have updated this tag... The following changes since commit 641f3ce64b050961d454a0716bb6dbf528315aac: ARM: at91/usbh: fix overcurrent gpio setup (2012-11-16 10:46:29 +0100) are available in the git repository at: git://github.com/at91linux/linux-at91.git tags/at91-fixes for you to fetch changes up to 6a342d1ee6ff7d5b3e5a0665457f1772e7fe640a: ARM: at91/dts: add nodes for atmel hsmci controllers for atmel boards (2012-11-20 09:51:07 +0100) Add entries for enabling the use of sd/mmc driver on AT91. Those entries where missing for device tree use on these platforms. Ludovic Desroches (3): ARM: at91: add clocks for DT entries ARM: at91/dts: add nodes for atmel hsmci controllers for atmel SOCs ARM: at91/dts: add nodes for atmel hsmci controllers for atmel boards arch/arm/boot/dts/at91sam9260.dtsi | 9 + arch/arm/boot/dts/at91sam9263.dtsi | 18 ++ arch/arm/boot/dts/at91sam9263ek.dts | 10 ++ arch/arm/boot/dts/at91sam9g20ek_2mmc.dts| 12 arch/arm/boot/dts/at91sam9g20ek_common.dtsi | 9 + arch/arm/boot/dts/at91sam9g25ek.dts | 18 ++ arch/arm/boot/dts/at91sam9g45.dtsi | 18 ++ arch/arm/boot/dts/at91sam9m10g45ek.dts | 19 +++ arch/arm/boot/dts/at91sam9n12.dtsi | 9 + arch/arm/boot/dts/at91sam9n12ek.dts | 9 + arch/arm/boot/dts/at91sam9x5.dtsi | 18 ++ arch/arm/mach-at91/at91sam9260.c| 1 + arch/arm/mach-at91/at91sam9263.c| 2 ++ arch/arm/mach-at91/at91sam9g45.c| 2 ++ arch/arm/mach-at91/at91sam9n12.c| 1 + arch/arm/mach-at91/at91sam9x5.c | 2 ++ 16 files changed, 157 insertions(+) Bye, -- Nicolas Ferre -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [GIT PULL v2] at91: fixes for 3.7-rc7
On 11/21/2012 08:03 AM, Olof Johansson : Hi, On Tue, Nov 20, 2012 at 09:59:27AM +0100, Nicolas Ferre wrote: Arnd, Olof, Just for the record, I do not want to put pressure at a such late time in the 3.7-rc process. So, I just reworked that pull-request because the previous one was wrong: - wrong patch content (DT nodes with wrong size) - not all tags in patches (Jean-Christophe and Arnd tags were missing...) Just to start from a sane base if I have to rebase this work for 3.8, I let you know that I have updated this tag... The following changes since commit 641f3ce64b050961d454a0716bb6dbf528315aac: ARM: at91/usbh: fix overcurrent gpio setup (2012-11-16 10:46:29 +0100) are available in the git repository at: git://github.com/at91linux/linux-at91.git tags/at91-fixes The new patches seem to belong in an at91/dt branch, not in a fixes one. I can pull in the previous fixes branch as an at91/fixes-non-critical for 3.8 if you want. There's no need to rebase them for this, is there? What is the pinctrl dependency that you are talking about, are some of these patches needed as prerequisites for pinctrl changes or the other way around? Sorry if I've missed more elaborate emails on this and are asking repeat questions. ;) No worries Olof, I might have been more precise in the subject of my email: I have made up my mind and consider this material for 3.8. As for the relation with pinctrl, we have made big modification to the layout of some dtsi/dts there and it would make everyones' life easier if we queue these dt/mmc changes on top of the current pinctrl tree... Moreover, Jean-Christophe plans to add the pinctrl part of these additions on top of the modification present in this pull-request: one more reason to queue them in pinctrl git tree. So, in brief: forget this pull-request (and the one that it replaces obviously). Thanks, bye, -- Nicolas Ferre -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] net/macb: GEM DMA configuration register update
Add information to the DMA Configuration Register to maximize system performance: - rx/tx packet buffer full memory size - allow possibility to use INCR16 if supported Signed-off-by: Nicolas Ferre nicolas.fe...@atmel.com --- drivers/net/ethernet/cadence/macb.c | 10 -- drivers/net/ethernet/cadence/macb.h | 11 +++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c index cc6e593..6a59bce 100644 --- a/drivers/net/ethernet/cadence/macb.c +++ b/drivers/net/ethernet/cadence/macb.c @@ -1033,8 +1033,12 @@ static u32 macb_dbw(struct macb *bp) } /* - * Configure the receive DMA engine to use the correct receive buffer size. - * This is a configurable parameter for GEM. + * Configure the receive DMA engine + * - use the correct receive buffer size + * - set the possibility to use INCR16 bursts + * (if not supported by FIFO, it will fallback to default) + * - set both rx/tx packet buffers to full memory size + * These are configurable parameters for GEM. */ static void macb_configure_dma(struct macb *bp) { @@ -1043,6 +1047,8 @@ static void macb_configure_dma(struct macb *bp) if (macb_is_gem(bp)) { dmacfg = gem_readl(bp, DMACFG) ~GEM_BF(RXBS, -1L); dmacfg |= GEM_BF(RXBS, RX_BUFFER_SIZE / 64); + dmacfg |= GEM_BF(FBLDO, 16); + dmacfg |= GEM_BIT(TXPBMS) | GEM_BF(RXBMS, -1L); gem_writel(bp, DMACFG, dmacfg); } } diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h index 4414421..570908b 100644 --- a/drivers/net/ethernet/cadence/macb.h +++ b/drivers/net/ethernet/cadence/macb.h @@ -171,8 +171,19 @@ #define GEM_DBW128 2 /* Bitfields in DMACFG. */ +#define GEM_FBLDO_OFFSET 0 +#define GEM_FBLDO_SIZE 5 +#define GEM_RXBMS_OFFSET 8 +#define GEM_RXBMS_SIZE 2 +#define GEM_TXPBMS_OFFSET 10 +#define GEM_TXPBMS_SIZE1 +#define GEM_TXCOEN_OFFSET 11 +#define GEM_TXCOEN_SIZE1 #define GEM_RXBS_OFFSET16 #define GEM_RXBS_SIZE 8 +#define GEM_DDRP_OFFSET24 +#define GEM_DDRP_SIZE 1 + /* Bitfields in NSR */ #define MACB_NSR_LINK_OFFSET 0 -- 1.8.0 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] net/macb: Use non-coherent memory for rx buffers
From: Havard Skinnemoen hav...@skinnemoen.net Allocate regular pages to use as backing for the RX ring and use the DMA API to sync the caches. This should give a bit better performance since it allows the CPU to do burst transfers from memory. It is also a necessary step on the way to reduce the amount of copying done by the driver. Signed-off-by: Havard Skinnemoen hav...@skinnemoen.net [nicolas.fe...@atmel.com: adapt to newer kernel] Signed-off-by: Nicolas Ferre nicolas.fe...@atmel.com --- drivers/net/ethernet/cadence/macb.c | 206 +++- drivers/net/ethernet/cadence/macb.h | 20 +++- 2 files changed, 148 insertions(+), 78 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c index 6a59bce..c2955da 100644 --- a/drivers/net/ethernet/cadence/macb.c +++ b/drivers/net/ethernet/cadence/macb.c @@ -10,6 +10,7 @@ #define pr_fmt(fmt) KBUILD_MODNAME : fmt #include linux/clk.h +#include linux/highmem.h #include linux/module.h #include linux/moduleparam.h #include linux/kernel.h @@ -35,6 +36,8 @@ #define RX_BUFFER_SIZE 128 #define RX_RING_SIZE 512 /* must be power of 2 */ #define RX_RING_BYTES (sizeof(struct macb_dma_desc) * RX_RING_SIZE) +#define RX_BUFFERS_PER_PAGE(PAGE_SIZE / RX_BUFFER_SIZE) +#define RX_RING_PAGES (RX_RING_SIZE / RX_BUFFERS_PER_PAGE) #define TX_RING_SIZE 128 /* must be power of 2 */ #define TX_RING_BYTES (sizeof(struct macb_dma_desc) * TX_RING_SIZE) @@ -90,9 +93,16 @@ static struct macb_dma_desc *macb_rx_desc(struct macb *bp, unsigned int index) return bp-rx_ring[macb_rx_ring_wrap(index)]; } -static void *macb_rx_buffer(struct macb *bp, unsigned int index) +static struct macb_rx_page *macb_rx_page(struct macb *bp, unsigned int index) { - return bp-rx_buffers + RX_BUFFER_SIZE * macb_rx_ring_wrap(index); + unsigned int entry = macb_rx_ring_wrap(index); + + return bp-rx_page[entry / RX_BUFFERS_PER_PAGE]; +} + +static unsigned int macb_rx_page_offset(struct macb *bp, unsigned int index) +{ + return (index % RX_BUFFERS_PER_PAGE) * RX_BUFFER_SIZE; } void macb_set_hwaddr(struct macb *bp) @@ -528,11 +538,15 @@ static void macb_tx_interrupt(struct macb *bp) static int macb_rx_frame(struct macb *bp, unsigned int first_frag, unsigned int last_frag) { - unsigned int len; - unsigned int frag; - unsigned int offset; - struct sk_buff *skb; - struct macb_dma_desc *desc; + unsigned intlen; + unsigned intfrag; + unsigned intskb_offset; + unsigned intpg_offset; + struct macb_rx_page *rx_page; + dma_addr_t phys; + void*buf; + struct sk_buff *skb; + struct macb_dma_desc*desc; desc = macb_rx_desc(bp, last_frag); len = MACB_BFEXT(RX_FRMLEN, desc-ctrl); @@ -566,7 +580,7 @@ static int macb_rx_frame(struct macb *bp, unsigned int first_frag, return 1; } - offset = 0; + skb_offset = 0; len += NET_IP_ALIGN; skb_checksum_none_assert(skb); skb_put(skb, len); @@ -574,13 +588,28 @@ static int macb_rx_frame(struct macb *bp, unsigned int first_frag, for (frag = first_frag; ; frag++) { unsigned int frag_len = RX_BUFFER_SIZE; - if (offset + frag_len len) { + if (skb_offset + frag_len len) { BUG_ON(frag != last_frag); - frag_len = len - offset; + frag_len = len - skb_offset; } - skb_copy_to_linear_data_offset(skb, offset, - macb_rx_buffer(bp, frag), frag_len); - offset += RX_BUFFER_SIZE; + + rx_page = macb_rx_page(bp, frag); + pg_offset = macb_rx_page_offset(bp, frag); + phys = rx_page-phys; + + dma_sync_single_range_for_cpu(bp-pdev-dev, phys, + pg_offset, frag_len, DMA_FROM_DEVICE); + + buf = kmap_atomic(rx_page-page); + skb_copy_to_linear_data_offset(skb, skb_offset, + buf + pg_offset, frag_len); + kunmap_atomic(buf); + + skb_offset += frag_len; + + dma_sync_single_range_for_device(bp-pdev-dev, phys, + pg_offset, frag_len, DMA_FROM_DEVICE); + desc = macb_rx_desc(bp, frag); desc-addr = ~MACB_BIT(RX_USED); @@ -860,86 +889,90 @@ static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev) return NETDEV_TX_OK; } -static void macb_free_consistent(struct macb *bp) +static void macb_free_rings(struct macb *bp) { - if (bp-tx_skb) { - kfree(bp-tx_skb); - bp-tx_skb
Re: linux-next: manual merge of the arm-soc tree with the pinctrl tree
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 11/26/2012 10:34 AM, Stephen Rothwell : Hi all, Today's linux-next merge of the arm-soc tree got a conflict in arch/arm/boot/dts/Makefile between commit ec6754a7b9e9 (arm: at91: dt: at91sam9 add serial pinctrl support) from the pinctrl tree and commit e8d623986990 (Merge branch 'next/soc' into for-next) from the arm-soc tree. I fixed it up (see below) and can carry the fix as necessary (no action is required). It seems to be the good way to fix it. Thanks Stephen, bye, - -- Nicolas Ferre -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with undefined - http://www.enigmail.net/ iQEcBAEBAgAGBQJQs0BPAAoJEAf03oE53VmQTXwH/jMoCTS48phBHKB9kYSfPfkY t9wgFhjTLOrtb/FCuoWxKPs1TN3F4t4zRcr4wRq+HvthuZ74kD+t6icoRxtjYkEB Az8oSPN95///evy9ber+IbmJFJsxk6m9mcKTaJ6BYz3YhvA2CT0Qz4Z8c+1DbctC kKsZ9Ngsb/suu/5xloPFdwO1KN5//PqPeOaXjlyY7eZabyIWf2u+OSG9rU0X3jH4 G+HXXW4AagUrxHrMY6CBKroXFj1VpVNyWq4EpQjmjjHuc01ofA5nLNmz99PW2wYX 2Xe/j8gUvE+3kmd+x7AV51NcZoGVDPDOYt0lTwjL6vXUwNxAgisOf5Be+nEA5f4= =Y2lP -END PGP SIGNATURE- -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: linux-next: manual merge of the arm-soc tree with the sound-asoc and pincrtl trees
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 11/26/2012 10:53 AM, Stephen Rothwell : Hi all, Today's linux-next merge of the arm-soc tree got a conflict in arch/arm/boot/dts/at91sam9263.dtsi between various commits from the arm-soc and pinctrl trees and commit 7492e7ca0f95 (ARM: at91/dts: add at91sam9_wdt driver to at91sam926x, at91sam9g45) from the arm-soc tree. I fixed it up (see below) and can carry the fix as necessary (no action is required). Good fix. Thanks. Best regards, - -- Nicolas Ferre -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with undefined - http://www.enigmail.net/ iQEcBAEBAgAGBQJQs0DFAAoJEAf03oE53VmQ6QwIAJFOQ58HXL8RTJMii7T8Qvmj hP0BVyICTYIJNymKiYk9R2RHXUhz3iwjSGCNYKtnaqcY3G3DQGy2uwwqyGjqTMzB n0W8s1z3rMr1facVzwlbsVHg/Y+K4a8dJPiwvskUVbRPctKkWYvjdQ+Ruv6v+F9u a2qqMM8zRNTgZhJvDT3mT4hjLnwRIH3CRckvHKQlDwoxE+Kbhvn3wM2uc9P/bCCX oVtx05SrCU129RRpztPkvyFzDnuoduznaB9CauSzmKpgzT0PF1yZkDNXgJUCoUXr jpSRLQg167/yk/2Sufz7pbSB9v10FEO54SavkdbIg00ktKTqc4CIdpKE5Wy1Jws= =S3HZ -END PGP SIGNATURE- -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: linux-next: manual merge of the arm-soc tree with the arm-soc and pincrtl trees
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 11/26/2012 10:56 AM, Stephen Rothwell : Hi all, Today's linux-next merge of the arm-soc tree got a conflict in arch/arm/boot/dts/at91sam9g45.dtsi between various commits from the arm-soc and pincrtl trees and commit 7492e7ca0f95 (ARM: at91/dts: add at91sam9_wdt driver to at91sam926x, at91sam9g45) from the arm-soc tree. I fixed it up (see below) and can carry the fix as necessary (no action is required). Good fix. Thanks for your help Stephen. Best regards, - -- Nicolas Ferre -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with undefined - http://www.enigmail.net/ iQEcBAEBAgAGBQJQs0EBAAoJEAf03oE53VmQW6kIAK4g8nWh1FloA74ZcfRTIgWQ /T4jQkub7phq9Q61jZ6yf4SsISpU7UE2q6G71J8Y/JWnYQf+7N8ricr/+B7arVMD U9xnPnkwEghOIZ6uI7r5rYGypuIdUwAJSb9pg8h7O+ISi7vgEUxiiZRioyb8qBH9 NBFTQr9mLiu89fi9iN5N2QMJdn7L3qE+K6JRbRjXbxv9O2kFCWqEBGxyWNtBzAe3 rLSnRTtI2Oh5UZ0bTi5khL+hcJLsw/rcNv/6odhc1A/bDlZKVoMKlR0sZI9DQx4w pOtlhxsWX8c4XiTXVKn5fk9wjAOhXSJTfZbNo8Ii2ndGuWorNYoYF2Cm9NuiUSI= =nzDW -END PGP SIGNATURE- -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: linux-next: manual merge of the arm-soc tree with the arm tree
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 11/26/2012 11:31 AM, Stephen Rothwell : Hi all, Today's linux-next merge of the arm-soc tree got a conflict in drivers/tty/serial/atmel_serial.c between commit 95e629b761ce (ARM/AVR32: get rid of serial_at91.h) from the arm tree and commit bcd2360c1ff9 (arm: at91: move platfarm_data to include/linux/platform_data/atmel.h) from the arm-soc tree. I fixed it up (see below) and can carry the fix as necessary (no action is required). Yes, good fix that has to be carried... Thanks, bye, - -- Nicolas Ferre -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with undefined - http://www.enigmail.net/ iQEcBAEBAgAGBQJQs0buAAoJEAf03oE53VmQMPgH/0Gynlb5BBImnjSU75mh/dPC ob/lTJv3w/2gUKPqbOgyxTSmMc9ckFcDELAhFYt+df9hKfOMBzZAUPHLEclZolZ+ AqpnIjGq88TYWMgaREUZ2bigTrzuWKqHiIWV/AoNcz2slhWC//CHK6z9SHE7hZOI zZFwf326v0dRkm4g785cqalg7pNxQDpE6iMZXuifb8zPWePgKBxqHyPRCbhP1dwu T4XQ3IgnrvzWcqz/V4mr8kppJXzHNfDEsVZ2XfndhUKVFY4qMGZhFBoTlI6LhNWO Nu2mD7TaENoKRijLYrdMfidJ65uwAGtEWA6UxEfV1VWVddSsi/D8OuniBta+Ewg= =zF93 -END PGP SIGNATURE- -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] net/macb: Use non-coherent memory for rx buffers
On 11/23/2012 05:12 PM, Joachim Eastwood : Hi Nicolas, On 23 November 2012 14:50, Nicolas Ferre nicolas.fe...@atmel.com wrote: From: Havard Skinnemoen hav...@skinnemoen.net Allocate regular pages to use as backing for the RX ring and use the DMA API to sync the caches. This should give a bit better performance since it allows the CPU to do burst transfers from memory. It is also a necessary step on the way to reduce the amount of copying done by the driver. Signed-off-by: Havard Skinnemoen hav...@skinnemoen.net [nicolas.fe...@atmel.com: adapt to newer kernel] Signed-off-by: Nicolas Ferre nicolas.fe...@atmel.com --- drivers/net/ethernet/cadence/macb.c | 206 +++- drivers/net/ethernet/cadence/macb.h | 20 +++- 2 files changed, 148 insertions(+), 78 deletions(-) snip diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h index 570908b..74e68a3 100644 --- a/drivers/net/ethernet/cadence/macb.h +++ b/drivers/net/ethernet/cadence/macb.h @@ -453,6 +453,23 @@ struct macb_dma_desc { #define MACB_TX_USED_SIZE 1 /** + * struct macb_rx_page - data associated with a page used as RX buffers + * @page: Physical page used as storage for the buffers + * @phys: DMA address of the page + * + * Each page is used to provide %MACB_RX_BUFFERS_PER_PAGE RX buffers. + * The page gets an initial reference when it is inserted into the + * ring, and an additional reference each time it is passed up the + * stack as a fragment. When all the buffers have been used, we drop + * the initial reference and allocate a new page. Any additional + * references are dropped when the higher layers free the skb. + */ +struct macb_rx_page { + struct page *page; + dma_addr_t phys; +}; + +/** * struct macb_tx_skb - data about an skb which is being transmitted * @skb: skb currently being transmitted * @mapping: DMA address of the skb's data buffer @@ -543,7 +560,7 @@ struct macb { unsigned intrx_tail; struct macb_dma_desc*rx_ring; - void*rx_buffers; + struct macb_rx_page *rx_page; unsigned inttx_head, tx_tail; struct macb_dma_desc*tx_ring; @@ -564,7 +581,6 @@ struct macb { dma_addr_t rx_ring_dma; dma_addr_t tx_ring_dma; - dma_addr_t rx_buffers_dma; struct mii_bus *mii_bus; struct phy_device *phy_dev; -- struct macb is shared between at91_ether and macb. Removing rx_buffers_dma and rx_buffers will break compilation on at91_ether. OMG, you are absolutely right. So please either leave the two struct members alone, for now, or fix up at91_ether at the same time. Well, I do not plan to touch at91_ether driver for the moment, so I certainly will keep the two struct members for now. I will wait a little more feedback before sending a v2 patch with these changes. Best regards, -- Nicolas Ferre -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: at91sam9260 MACB problem with IP fragmentation
On 12/20/2012 10:17 AM, Erwin Rol : Hallo Nicolas, On 6-12-2012 14:27, Nicolas Ferre wrote: Erwin, On 12/06/2012 12:32 PM, Erwin Rol : Hello Nicolas, Havard, all, I have a very obscure problem with a at91sam9260 board (almost 1 to 1 copy of the Atmel EK). The MACB seems to stall when I use large (2 * MTU) UDP datagrams. The test case is that a udp echo client (PC) sends datagrams with increasing length to the AT91 until the max length of the UDP datagram is reached. When there is no IP fragmentation everything is fine, but when the datagrams are starting to get fragmented the AT91 will not reply anymore. But as soon as some network traffic happens it goes on again, and non of the data is lost. snip I tried several kernels including the test version from Nicolas that he posted on LKML in October. They all show the same effect. [..] It seems that Matteo has the same behavior: check here: http://www.spinics.net/lists/netdev/msg218951.html I tried Matteo's patch and it seems to work. But I don't know if the patch is really the right solution. I checked again with wireshark and it really seems the sending that stalls not the receiving. But as soon as a ethernet frame is received the sending un-stalls. So maybe the patch just causes an MACB IRQ at certain moments that causes the sending to continue? Any digging is interesting for me. I am working on the macb driver right now, so I will try to reproduce and track this issue on my side. Any luck reproducing it ? Yes, I see unexpected things happening but as I am connected to a whole company network so maybe some broadcast packets are unlocking the interface... Anyway, I am continuing to investigate. Best regards,-- Nicolas Ferre -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 0/3] at91/ssc: fixes on ASoC tree for 3.8
Hi Mark, This series goes on top of current Linus' git tree and fixes an error that we have while compiling DTBs for AT91: ERROR (phandle_references): Reference to non-existent node or label pinctrl_ssc0_tx ERROR: Input tree has errors, aborting (use -f to force output) make[3]: *** [arch/arm/boot/dts/at91sam9g20ek.dtb] Error 2 I have included pending material that is dealing with SSC and pinctrl. The pinctrl part can be merged more easily now that the big pinctrl update for AT91 has been merged upstream. I have also included a typo patch that you have already taken as 315656b (ASoC: atmel-ssc: change disable to disable in dts node) in your topic/atmel branch but that was not described properly. If you find it easier, I can provide you a git tree for this material: just tell me... Thanks for your help, best regards, Bo Shen (3): ARM: at91/dts: fix typo in SSC status property ARM: at91/dts: add pinctrl support for SSC peripheral ASoC: atmel-ssc: add pinctrl selection to driver arch/arm/boot/dts/at91sam9260.dtsi | 18 + arch/arm/boot/dts/at91sam9263.dtsi | 40 -- arch/arm/boot/dts/at91sam9g45.dtsi | 40 -- arch/arm/boot/dts/at91sam9n12.dtsi | 26 + arch/arm/boot/dts/at91sam9x5.dtsi | 32 +++--- drivers/misc/atmel-ssc.c | 8 6 files changed, 153 insertions(+), 11 deletions(-) -- 1.8.0 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/3] ARM: at91/dts: fix typo in SSC status property
From: Bo Shen voice.s...@atmel.com Change the value of status to disabled to conform with property requirement. Signed-off-by: Bo Shen voice.s...@atmel.com [nicolas.fe...@atmel.com: commit subject line and typos] Signed-off-by: Nicolas Ferre nicolas.fe...@atmel.com --- arch/arm/boot/dts/at91sam9263.dtsi | 4 ++-- arch/arm/boot/dts/at91sam9g45.dtsi | 4 ++-- arch/arm/boot/dts/at91sam9x5.dtsi | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/arm/boot/dts/at91sam9263.dtsi b/arch/arm/boot/dts/at91sam9263.dtsi index 8e6251f..32ec62c 100644 --- a/arch/arm/boot/dts/at91sam9263.dtsi +++ b/arch/arm/boot/dts/at91sam9263.dtsi @@ -368,14 +368,14 @@ compatible = atmel,at91rm9200-ssc; reg = 0xfff98000 0x4000; interrupts = 16 4 5; - status = disable; + status = disabled; }; ssc1: ssc@fff9c000 { compatible = atmel,at91rm9200-ssc; reg = 0xfff9c000 0x4000; interrupts = 17 4 5; - status = disable; + status = disabled; }; macb0: ethernet@fffbc000 { diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi b/arch/arm/boot/dts/at91sam9g45.dtsi index fa1ae0c..231858f 100644 --- a/arch/arm/boot/dts/at91sam9g45.dtsi +++ b/arch/arm/boot/dts/at91sam9g45.dtsi @@ -425,14 +425,14 @@ compatible = atmel,at91sam9g45-ssc; reg = 0xfff9c000 0x4000; interrupts = 16 4 5; - status = disable; + status = disabled; }; ssc1: ssc@fffa { compatible = atmel,at91sam9g45-ssc; reg = 0xfffa 0x4000; interrupts = 17 4 5; - status = disable; + status = disabled; }; adc0: adc@fffb { diff --git a/arch/arm/boot/dts/at91sam9x5.dtsi b/arch/arm/boot/dts/at91sam9x5.dtsi index 617ede5..40ac3a4 100644 --- a/arch/arm/boot/dts/at91sam9x5.dtsi +++ b/arch/arm/boot/dts/at91sam9x5.dtsi @@ -92,7 +92,7 @@ compatible = atmel,at91sam9g45-ssc; reg = 0xf001 0x4000; interrupts = 28 4 5; - status = disable; + status = disabled; }; tcb0: timer@f8008000 { -- 1.8.0 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/3] ARM: at91/dts: add pinctrl support for SSC peripheral
From: Bo Shen voice.s...@atmel.com Add pinctrl support for SSC on AT91 dtsi files. Signed-off-by: Bo Shen voice.s...@atmel.com [nicolas.fe...@atmel.com: split dtsi and driver changes] Signed-off-by: Nicolas Ferre nicolas.fe...@atmel.com --- arch/arm/boot/dts/at91sam9260.dtsi | 18 ++ arch/arm/boot/dts/at91sam9263.dtsi | 36 arch/arm/boot/dts/at91sam9g45.dtsi | 36 arch/arm/boot/dts/at91sam9n12.dtsi | 26 ++ arch/arm/boot/dts/at91sam9x5.dtsi | 32 +--- 5 files changed, 141 insertions(+), 7 deletions(-) diff --git a/arch/arm/boot/dts/at91sam9260.dtsi b/arch/arm/boot/dts/at91sam9260.dtsi index 68bccf4..cb7bcc5 100644 --- a/arch/arm/boot/dts/at91sam9260.dtsi +++ b/arch/arm/boot/dts/at91sam9260.dtsi @@ -306,6 +306,22 @@ }; }; + ssc0 { + pinctrl_ssc0_tx: ssc0_tx-0 { + atmel,pins = + 1 16 0x1 0x0 /* PB16 periph A */ +1 17 0x1 0x0 /* PB17 periph A */ +1 18 0x1 0x0; /* PB18 periph A */ + }; + + pinctrl_ssc0_rx: ssc0_rx-0 { + atmel,pins = + 1 19 0x1 0x0 /* PB19 periph A */ +1 20 0x1 0x0 /* PB20 periph A */ +1 21 0x1 0x0; /* PB21 periph A */ + }; + }; + pioA: gpio@f400 { compatible = atmel,at91rm9200-gpio; reg = 0xf400 0x200; @@ -450,6 +466,8 @@ compatible = atmel,at91rm9200-ssc; reg = 0xfffbc000 0x4000; interrupts = 14 4 5; + pinctrl-names = default; + pinctrl-0 = pinctrl_ssc0_tx pinctrl_ssc0_rx; status = disabled; }; diff --git a/arch/arm/boot/dts/at91sam9263.dtsi b/arch/arm/boot/dts/at91sam9263.dtsi index 32ec62c..271d4de 100644 --- a/arch/arm/boot/dts/at91sam9263.dtsi +++ b/arch/arm/boot/dts/at91sam9263.dtsi @@ -271,6 +271,38 @@ }; }; + ssc0 { + pinctrl_ssc0_tx: ssc0_tx-0 { + atmel,pins = + 1 0 0x2 0x0/* PB0 periph B */ +1 1 0x2 0x0/* PB1 periph B */ +1 2 0x2 0x0; /* PB2 periph B */ + }; + + pinctrl_ssc0_rx: ssc0_rx-0 { + atmel,pins = + 1 3 0x2 0x0/* PB3 periph B */ +1 4 0x2 0x0/* PB4 periph B */ +1 5 0x2 0x0; /* PB5 periph B */ + }; + }; + + ssc1 { + pinctrl_ssc1_tx: ssc1_tx-0 { + atmel,pins = + 1 6 0x1 0x0/* PB6 periph A */ +1 7 0x1 0x0/* PB7 periph A */ +1 8 0x1 0x0; /* PB8 periph A */ + }; + + pinctrl_ssc1_rx: ssc1_rx-0 { + atmel,pins = + 1 9 0x1 0x0/* PB9 periph A */ +1 10 0x1 0x0 /* PB10 periph A */ +1 11 0x1 0x0; /* PB11 periph A */ + }; + }; + pioA: gpio@f200 { compatible = atmel,at91rm9200-gpio; reg = 0xf200 0x200; @@ -368,6 +400,8
[PATCH 3/3] ASoC: atmel-ssc: add pinctrl selection to driver
From: Bo Shen voice.s...@atmel.com Add default pinctrl selection to atmel-ssc driver. The pinctrl is mandatory. Signed-off-by: Bo Shen voice.s...@atmel.com [nicolas.fe...@atmel.com: split dtsi and driver changes] Signed-off-by: Nicolas Ferre nicolas.fe...@atmel.com --- drivers/misc/atmel-ssc.c | 8 1 file changed, 8 insertions(+) diff --git a/drivers/misc/atmel-ssc.c b/drivers/misc/atmel-ssc.c index 158da5a..3c09cbb 100644 --- a/drivers/misc/atmel-ssc.c +++ b/drivers/misc/atmel-ssc.c @@ -19,6 +19,7 @@ #include linux/module.h #include linux/of.h +#include linux/pinctrl/consumer.h /* Serialize access to ssc_list and user count */ static DEFINE_SPINLOCK(user_lock); @@ -131,6 +132,13 @@ static int ssc_probe(struct platform_device *pdev) struct resource *regs; struct ssc_device *ssc; const struct atmel_ssc_platform_data *plat_dat; + struct pinctrl *pinctrl; + + pinctrl = devm_pinctrl_get_select_default(pdev-dev); + if (IS_ERR(pinctrl)) { + dev_err(pdev-dev, Failed to request pinctrl\n); + return PTR_ERR(pinctrl); + } ssc = devm_kzalloc(pdev-dev, sizeof(struct ssc_device), GFP_KERNEL); if (!ssc) { -- 1.8.0 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 0/3 v2] net/macb: RX path enhancement
Hi, Here is the patch series for modifying the RX path in macb driver. This change applies on GEM variant of the Cadence IP and introduces function pointers to match the path to the proper adapter. The move to RX buffers adapted to MTU and that can be DMAed directly in SKB is done in two steps but can be merged in a single patch. v2: - gave up the idea of using non-coherent memory for rx buffers - addition of the struct macb layout optimization Havard Skinnemoen (1): net/macb: Try to optimize struct macb layout Nicolas Ferre (2): net/macb: increase RX buffer size for GEM net/macb: change RX path for GEM drivers/net/ethernet/cadence/macb.c | 323 +++- drivers/net/ethernet/cadence/macb.h | 35 ++-- 2 files changed, 306 insertions(+), 52 deletions(-) -- 1.8.0 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/3 v2] net/macb: increase RX buffer size for GEM
Macb Ethernet controller requires a RX buffer of 128 bytes. It is highly sub-optimal for Gigabit-capable GEM that is able to use a bigger DMA buffer. Change this constant and associated macros with data stored in the private structure. RX DMA buffer size has to be multiple of 64 bytes as indicated in DMA Configuration Register specification. Signed-off-by: Nicolas Ferre nicolas.fe...@atmel.com --- drivers/net/ethernet/cadence/macb.c | 45 ++--- drivers/net/ethernet/cadence/macb.h | 1 + 2 files changed, 38 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c index a9b0830..50f8669 100644 --- a/drivers/net/ethernet/cadence/macb.c +++ b/drivers/net/ethernet/cadence/macb.c @@ -32,7 +32,9 @@ #include macb.h -#define RX_BUFFER_SIZE 128 +#define MACB_RX_BUFFER_SIZE128 +#define GEM_RX_BUFFER_SIZE 2048 +#define RX_BUFFER_MULTIPLE 64 /* bytes */ #define RX_RING_SIZE 512 /* must be power of 2 */ #define RX_RING_BYTES (sizeof(struct macb_dma_desc) * RX_RING_SIZE) @@ -92,7 +94,7 @@ static struct macb_dma_desc *macb_rx_desc(struct macb *bp, unsigned int index) static void *macb_rx_buffer(struct macb *bp, unsigned int index) { - return bp-rx_buffers + RX_BUFFER_SIZE * macb_rx_ring_wrap(index); + return bp-rx_buffers + bp-rx_buffer_size * macb_rx_ring_wrap(index); } void macb_set_hwaddr(struct macb *bp) @@ -572,7 +574,7 @@ static int macb_rx_frame(struct macb *bp, unsigned int first_frag, skb_put(skb, len); for (frag = first_frag; ; frag++) { - unsigned int frag_len = RX_BUFFER_SIZE; + unsigned int frag_len = bp-rx_buffer_size; if (offset + frag_len len) { BUG_ON(frag != last_frag); @@ -580,7 +582,7 @@ static int macb_rx_frame(struct macb *bp, unsigned int first_frag, } skb_copy_to_linear_data_offset(skb, offset, macb_rx_buffer(bp, frag), frag_len); - offset += RX_BUFFER_SIZE; + offset += bp-rx_buffer_size; desc = macb_rx_desc(bp, frag); desc-addr = ~MACB_BIT(RX_USED); @@ -860,6 +862,30 @@ static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev) return NETDEV_TX_OK; } +static void macb_init_rx_buffer_size(struct macb *bp) +{ + if (!macb_is_gem(bp)) { + bp-rx_buffer_size = MACB_RX_BUFFER_SIZE; + } else { + bp-rx_buffer_size = GEM_RX_BUFFER_SIZE; + + if (bp-rx_buffer_size PAGE_SIZE) { + netdev_warn(bp-dev, + RX buffer cannot be bigger than PAGE_SIZE, shrinking\n); + bp-rx_buffer_size = PAGE_SIZE; + } + if (bp-rx_buffer_size % RX_BUFFER_MULTIPLE) { + netdev_warn(bp-dev, + RX buffer must be multiple of %d bytes, shrinking\n, + RX_BUFFER_MULTIPLE); + bp-rx_buffer_size = + rounddown(bp-rx_buffer_size, RX_BUFFER_MULTIPLE); + } + bp-rx_buffer_size = max(RX_BUFFER_MULTIPLE, GEM_RX_BUFFER_SIZE); + } +} + + static void macb_free_consistent(struct macb *bp) { if (bp-tx_skb) { @@ -878,7 +904,7 @@ static void macb_free_consistent(struct macb *bp) } if (bp-rx_buffers) { dma_free_coherent(bp-pdev-dev, - RX_RING_SIZE * RX_BUFFER_SIZE, + RX_RING_SIZE * bp-rx_buffer_size, bp-rx_buffers, bp-rx_buffers_dma); bp-rx_buffers = NULL; } @@ -911,7 +937,7 @@ static int macb_alloc_consistent(struct macb *bp) Allocated TX ring of %d bytes at %08lx (mapped %p)\n, size, (unsigned long)bp-tx_ring_dma, bp-tx_ring); - size = RX_RING_SIZE * RX_BUFFER_SIZE; + size = RX_RING_SIZE * bp-rx_buffer_size; bp-rx_buffers = dma_alloc_coherent(bp-pdev-dev, size, bp-rx_buffers_dma, GFP_KERNEL); if (!bp-rx_buffers) @@ -936,7 +962,7 @@ static void macb_init_rings(struct macb *bp) for (i = 0; i RX_RING_SIZE; i++) { bp-rx_ring[i].addr = addr; bp-rx_ring[i].ctrl = 0; - addr += RX_BUFFER_SIZE; + addr += bp-rx_buffer_size; } bp-rx_ring[RX_RING_SIZE - 1].addr |= MACB_BIT(RX_WRAP); @@ -1046,7 +1072,7 @@ static void macb_configure_dma(struct macb *bp) if (macb_is_gem(bp)) { dmacfg = gem_readl(bp, DMACFG) ~GEM_BF(RXBS, -1L); - dmacfg |= GEM_BF(RXBS, RX_BUFFER_SIZE / 64); + dmacfg |= GEM_BF(RXBS, bp-rx_buffer_size
[PATCH 2/3 v2] net/macb: change RX path for GEM
GEM is able to adapt its DMA buffer size, so change the RX path to take advantage of this possibility and remove all kind of memcpy in this path. This modification introduces function pointers for managing differences between MACB and GEM adapter type. Signed-off-by: Nicolas Ferre nicolas.fe...@atmel.com --- drivers/net/ethernet/cadence/macb.c | 308 ++-- drivers/net/ethernet/cadence/macb.h | 13 ++ 2 files changed, 272 insertions(+), 49 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c index 50f8669..16ec751 100644 --- a/drivers/net/ethernet/cadence/macb.c +++ b/drivers/net/ethernet/cadence/macb.c @@ -33,7 +33,6 @@ #include macb.h #define MACB_RX_BUFFER_SIZE128 -#define GEM_RX_BUFFER_SIZE 2048 #define RX_BUFFER_MULTIPLE 64 /* bytes */ #define RX_RING_SIZE 512 /* must be power of 2 */ #define RX_RING_BYTES (sizeof(struct macb_dma_desc) * RX_RING_SIZE) @@ -527,6 +526,155 @@ static void macb_tx_interrupt(struct macb *bp) netif_wake_queue(bp-dev); } +static void gem_rx_refill(struct macb *bp) +{ + unsigned intentry; + struct sk_buff *skb; + struct macb_dma_desc*desc; + dma_addr_t paddr; + + while (CIRC_SPACE(bp-rx_prepared_head, bp-rx_tail, RX_RING_SIZE) 0) { + u32 addr, ctrl; + + entry = macb_rx_ring_wrap(bp-rx_prepared_head); + desc = bp-rx_ring[entry]; + + /* Make hw descriptor updates visible to CPU */ + rmb(); + + addr = desc-addr; + ctrl = desc-ctrl; + bp-rx_prepared_head++; + + if ((addr MACB_BIT(RX_USED))) + continue; + + if (bp-rx_skbuff[entry] == NULL) { + /* allocate sk_buff for this free entry in ring */ + skb = netdev_alloc_skb(bp-dev, bp-rx_buffer_size); + if (unlikely(skb == NULL)) { + netdev_err(bp-dev, + Unable to allocate sk_buff\n); + break; + } + bp-rx_skbuff[entry] = skb; + + /* now fill corresponding descriptor entry */ + paddr = dma_map_single(bp-pdev-dev, skb-data, + bp-rx_buffer_size, DMA_FROM_DEVICE); + + if (entry == RX_RING_SIZE - 1) + paddr |= MACB_BIT(RX_WRAP); + bp-rx_ring[entry].addr = paddr; + bp-rx_ring[entry].ctrl = 0; + + /* properly align Ethernet header */ + skb_reserve(skb, NET_IP_ALIGN); + } + } + + /* Make descriptor updates visible to hardware */ + wmb(); + + netdev_vdbg(bp-dev, rx ring: prepared head %d, tail %d\n, + bp-rx_prepared_head, bp-rx_tail); +} + +/* Mark DMA descriptors from begin up to and not including end as unused */ +static void discard_partial_frame(struct macb *bp, unsigned int begin, + unsigned int end) +{ + unsigned int frag; + + for (frag = begin; frag != end; frag++) { + struct macb_dma_desc *desc = macb_rx_desc(bp, frag); + desc-addr = ~MACB_BIT(RX_USED); + } + + /* Make descriptor updates visible to hardware */ + wmb(); + + /* +* When this happens, the hardware stats registers for +* whatever caused this is updated, so we don't have to record +* anything. +*/ +} + +static int gem_rx(struct macb *bp, int budget) +{ + unsigned intlen; + unsigned intentry; + struct sk_buff *skb; + struct macb_dma_desc*desc; + int count = 0; + + while (count budget) { + u32 addr, ctrl; + + entry = macb_rx_ring_wrap(bp-rx_tail); + desc = bp-rx_ring[entry]; + + /* Make hw descriptor updates visible to CPU */ + rmb(); + + addr = desc-addr; + ctrl = desc-ctrl; + + if (!(addr MACB_BIT(RX_USED))) + break; + + desc-addr = ~MACB_BIT(RX_USED); + bp-rx_tail++; + count++; + + if (!(ctrl MACB_BIT(RX_SOF) ctrl MACB_BIT(RX_EOF))) { + netdev_err(bp-dev, + not whole frame pointed by descriptor\n); + bp-stats.rx_dropped++; + break; + } + skb = bp-rx_skbuff[entry]; + if (unlikely(!skb)) { + netdev_err(bp-dev, + inconsistent
[PATCH 3/3 v2] net/macb: Try to optimize struct macb layout
From: Havard Skinnemoen hav...@skinnemoen.net Move TX-related fields to the top of the struct so that they end up on the same cache line. Move the NAPI struct below that since it is used from the interrupt handler. RX-related fields go below those. Move the spinlock before regs since they are usually used together. Signed-off-by: Havard Skinnemoen hav...@skinnemoen.net [nicolas.fe...@atmel.com: adapt to newer kernel] Signed-off-by: Nicolas Ferre nicolas.fe...@atmel.com --- drivers/net/ethernet/cadence/macb.h | 25 + 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h index cef146f..aeeb729 100644 --- a/drivers/net/ethernet/cadence/macb.h +++ b/drivers/net/ethernet/cadence/macb.h @@ -548,38 +548,39 @@ struct macb_or_gem_ops { }; struct macb { + spinlock_t lock; void __iomem*regs; + unsigned inttx_head; + unsigned inttx_tail; + struct macb_dma_desc*tx_ring; + struct macb_tx_skb *tx_skb; + dma_addr_t tx_ring_dma; + struct work_struct tx_error_task; + + struct napi_struct napi; + unsigned intrx_tail; unsigned intrx_prepared_head; struct macb_dma_desc*rx_ring; struct sk_buff **rx_skbuff; void*rx_buffers; size_t rx_buffer_size; + dma_addr_t rx_ring_dma; + dma_addr_t rx_buffers_dma; - unsigned inttx_head, tx_tail; - struct macb_dma_desc*tx_ring; - struct macb_tx_skb *tx_skb; + struct macb_or_gem_ops macbgem_ops; - spinlock_t lock; struct platform_device *pdev; struct clk *pclk; struct clk *hclk; struct net_device *dev; - struct napi_struct napi; - struct work_struct tx_error_task; struct net_device_stats stats; union { struct macb_stats macb; struct gem_statsgem; } hw_stats; - dma_addr_t rx_ring_dma; - dma_addr_t tx_ring_dma; - dma_addr_t rx_buffers_dma; - - struct macb_or_gem_ops macbgem_ops; - struct mii_bus *mii_bus; struct phy_device *phy_dev; unsigned intlink; -- 1.8.0 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH RESEND 3/4] pinctrl: at91: Prevent NULL dereference if of_match_device returns NULL
On 11/15/2012 05:58 AM, Axel Lin : of_match_device() may return NULL. Signed-off-by: Axel Lin axel@ingics.com Seems sensible, Acked-by: Nicolas Ferre nicolas.fe...@atmel.com --- This resend CC Jean-Christophe. drivers/pinctrl/pinctrl-at91.c | 17 + 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c index 8490a55..32006c8 100644 --- a/drivers/pinctrl/pinctrl-at91.c +++ b/drivers/pinctrl/pinctrl-at91.c @@ -829,13 +829,18 @@ static int __devinit at91_pinctrl_probe_dt(struct platform_device *pdev, uint32_t *tmp; struct device_node *np = pdev-dev.of_node; struct device_node *child; + const struct of_device_id *match; if (!np) return -ENODEV; + match = of_match_device(at91_pinctrl_of_match, pdev-dev)-data; + if (!match) + return -ENODEV; + info-dev = pdev-dev; - info-ops = (struct at91_pinctrl_mux_ops*) - of_match_device(at91_pinctrl_of_match, pdev-dev)-data; + info-ops = (struct at91_pinctrl_mux_ops *) match-data; + at91_pinctrl_child_count(info, np); if (info-nbanks 1) { @@ -1359,6 +1364,7 @@ static struct of_device_id at91_gpio_of_match[] __devinitdata = { static int __devinit at91_gpio_probe(struct platform_device *pdev) { struct device_node *np = pdev-dev.of_node; + const struct of_device_id *match; struct resource *res; struct at91_gpio_chip *at91_chip = NULL; struct gpio_chip *chip; @@ -1399,8 +1405,11 @@ static int __devinit at91_gpio_probe(struct platform_device *pdev) goto err; } - at91_chip-ops = (struct at91_pinctrl_mux_ops*) - of_match_device(at91_gpio_of_match, pdev-dev)-data; + match = of_match_device(at91_gpio_of_match, pdev-dev); + if (!match) + return -ENODEV; + + at91_chip-ops = (struct at91_pinctrl_mux_ops *) match-data; at91_chip-pioc_virq = irq; at91_chip-pioc_idx = alias_idx; -- Nicolas Ferre -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH RESEND 3/4] pinctrl: at91: Prevent NULL dereference if of_match_device returns NULL
On 11/15/2012 11:00 AM, Jean-Christophe PLAGNIOL-VILLARD : On 12:58 Thu 15 Nov , Axel Lin wrote: of_match_device() may return NULL. this is not possible on at91 and I do a oups here as if we have a NULL pointer which means the driver is wrong Well, okay, but it does not prevent from adding a supplementary check to mimic every other pinctrl driver and use a common return path to the of_match_device() function. So I am not completely against this patch (that I why I added my Acked-by). Signed-off-by: Axel Lin axel@ingics.com --- This resend CC Jean-Christophe. drivers/pinctrl/pinctrl-at91.c | 17 + 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c index 8490a55..32006c8 100644 --- a/drivers/pinctrl/pinctrl-at91.c +++ b/drivers/pinctrl/pinctrl-at91.c @@ -829,13 +829,18 @@ static int __devinit at91_pinctrl_probe_dt(struct platform_device *pdev, uint32_t *tmp; struct device_node *np = pdev-dev.of_node; struct device_node *child; +const struct of_device_id *match; if (!np) return -ENODEV; +match = of_match_device(at91_pinctrl_of_match, pdev-dev)-data; +if (!match) +return -ENODEV; + info-dev = pdev-dev; -info-ops = (struct at91_pinctrl_mux_ops*) -of_match_device(at91_pinctrl_of_match, pdev-dev)-data; +info-ops = (struct at91_pinctrl_mux_ops *) match-data; + at91_pinctrl_child_count(info, np); if (info-nbanks 1) { @@ -1359,6 +1364,7 @@ static struct of_device_id at91_gpio_of_match[] __devinitdata = { static int __devinit at91_gpio_probe(struct platform_device *pdev) { struct device_node *np = pdev-dev.of_node; +const struct of_device_id *match; struct resource *res; struct at91_gpio_chip *at91_chip = NULL; struct gpio_chip *chip; @@ -1399,8 +1405,11 @@ static int __devinit at91_gpio_probe(struct platform_device *pdev) goto err; } -at91_chip-ops = (struct at91_pinctrl_mux_ops*) -of_match_device(at91_gpio_of_match, pdev-dev)-data; +match = of_match_device(at91_gpio_of_match, pdev-dev); +if (!match) +return -ENODEV; + +at91_chip-ops = (struct at91_pinctrl_mux_ops *) match-data; at91_chip-pioc_virq = irq; at91_chip-pioc_idx = alias_idx; -- 1.7.9.5 ___ linux-arm-kernel mailing list linux-arm-ker...@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel -- Nicolas Ferre -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/5] ARM: AT91SAM9G45: fix crypto peripherals irq issue due to sparse irq support.
On 11/07/2012 04:27 PM, Jean-Christophe PLAGNIOL-VILLARD : On 17:31 Tue 06 Nov , Nicolas Royer wrote: Spare irq support introduced by commit 8fe82a5 ARM: at91: sparse irq support involves to add the NR_IRQS_LEGACY offset to irq number. Signed-off-by: Nicolas Royer nico...@eukrea.com Acked-by: Nicolas Ferre nicolas.fe...@atmel.com Acked-by: Eric Bénard e...@eukrea.com Tested-by: Eric Bénard e...@eukrea.com Cc: sta...@vger.kernel.org # 3.6 ok will see if we can have it for 3.7 Queued in our at91-fixes pull request for 3.7-final. Thanks a lot, best regards, -- Nicolas Ferre -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 09/11] watchdog/at91sam9_wdt: add support to device tree
On 11/14/2012 08:16 AM, Wenyou Yang : Signed-off-by: Wenyou Yang wenyou.y...@atmel.com No. The work has already been done by Fabio Porcedda and he managed to sustain the discussion and reach a consensus at his v9 patch series: so please take into account his work and build yours on top of his patch series. Best regards, Cc: grant.lik...@secretlab.ca Cc: rob.herr...@calxeda.com Cc: devicetree-disc...@lists.ozlabs.org --- drivers/watchdog/at91sam9_wdt.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/drivers/watchdog/at91sam9_wdt.c b/drivers/watchdog/at91sam9_wdt.c index e7ce9ea..cba5c5d 100644 --- a/drivers/watchdog/at91sam9_wdt.c +++ b/drivers/watchdog/at91sam9_wdt.c @@ -32,6 +32,7 @@ #include linux/jiffies.h #include linux/timer.h #include linux/bitops.h +#include linux/of.h #include at91sam9_wdt.h @@ -251,12 +252,21 @@ static int __exit at91wdt_remove(struct platform_device *pdev) return 0; } +#ifdef CONFIG_OF +static const struct of_device_id at91wdt_match[] = { + { .compatible = atmel,at91sam-wdt }, + {}, +}; +MODULE_DEVICE_TABLE(of, at91wdt_match); +#endif + static struct platform_driver at91wdt_driver = { .probe = at91wdt_probe, .remove = __exit_p(at91wdt_remove), .driver = { .name = at91_wdt, .owner = THIS_MODULE, + .of_match_table = of_match_ptr(at91wdt_match), }, }; -- Nicolas Ferre -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/6] dma: at_hdmac: check direction properly for cyclic transfers
On 11/16/2012 02:59 PM, Andy Shevchenko : dma_transfer_direction is a normal enum. It means we can't usually use the values as bit fields. Let's adjust this check and move it above the usage of the direction parameter. Signed-off-by: Andy Shevchenko andriy.shevche...@linux.intel.com Cc: Nicolas Ferre nicolas.fe...@atmel.com Whatever name of function is: Acked-by: Nicolas Ferre nicolas.fe...@atmel.com --- drivers/dma/at_hdmac.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c index 13a02f4..997ae54 100644 --- a/drivers/dma/at_hdmac.c +++ b/drivers/dma/at_hdmac.c @@ -778,7 +778,7 @@ err: */ static int atc_dma_cyclic_check_values(unsigned int reg_width, dma_addr_t buf_addr, - size_t period_len, enum dma_transfer_direction direction) + size_t period_len) { if (period_len (ATC_BTSIZE_MAX reg_width)) goto err_out; @@ -786,8 +786,6 @@ atc_dma_cyclic_check_values(unsigned int reg_width, dma_addr_t buf_addr, goto err_out; if (unlikely(buf_addr ((1 reg_width) - 1))) goto err_out; - if (unlikely(!(direction (DMA_DEV_TO_MEM | DMA_MEM_TO_DEV - goto err_out; return 0; @@ -886,14 +884,16 @@ atc_prep_dma_cyclic(struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len, return NULL; } + if (unlikely(!is_slave_xfer(direction))) + goto err_out; + if (sconfig-direction == DMA_MEM_TO_DEV) reg_width = convert_buswidth(sconfig-dst_addr_width); else reg_width = convert_buswidth(sconfig-src_addr_width); /* Check for too big/unaligned periods and unaligned DMA buffer */ - if (atc_dma_cyclic_check_values(reg_width, buf_addr, - period_len, direction)) + if (atc_dma_cyclic_check_values(reg_width, buf_addr, period_len)) goto err_out; /* build cyclic linked list */ -- Nicolas Ferre -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[GIT PULL] at91: fixes for 3.7-rc6
(Resent with mailing-lists) Arnd, Olof, Here is the second at91-fixes pull request for 3.7. I have built it on top of my previous fixes pull request for this kernel revision. The following changes since commit 08d04a135a1c2e24c4d4bc7bbafee5e0e58f80c6: ARM: at91: drop duplicated config SOC_AT91SAM9 entry (2012-10-24 18:08:48 +0200) are available in the git repository at: git://github.com/at91linux/linux-at91.git tags/at91-fixes for you to fetch changes up to 641f3ce64b050961d454a0716bb6dbf528315aac: ARM: at91/usbh: fix overcurrent gpio setup (2012-11-16 10:46:29 +0100) Two little fixes, one related to the move to sparse irq and another one fixing the check of a GPIO for USB host overcurrent. Johan Hovold (1): ARM: at91/usbh: fix overcurrent gpio setup Nicolas Royer (1): ARM: at91/AT91SAM9G45: fix crypto peripherals irq issue due to sparse irq support arch/arm/mach-at91/at91rm9200_devices.c | 2 +- arch/arm/mach-at91/at91sam9260_devices.c | 2 +- arch/arm/mach-at91/at91sam9261_devices.c | 2 +- arch/arm/mach-at91/at91sam9263_devices.c | 2 +- arch/arm/mach-at91/at91sam9g45_devices.c | 12 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) Thanks, best regards, -- Nicolas Ferre -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] net/macb: move to circ_buf macros and fix initial condition
Move to circular buffers management macro and correct an error with circular buffer initial condition. Without this patch, the macb_tx_ring_avail() function was not reporting the proper ring availability at startup: macb macb: eth0: BUG! Tx Ring full when queue awake! macb macb: eth0: tx_head = 0, tx_tail = 0 And hanginig forever... I remove the macb_tx_ring_avail() function and use the proven macros from circ_buf.h. CIRC_CNT() is used in the consumer part of the driver: macb_tx_interrupt() to match advice from Documentation/circular-buffers.txt. Signed-off-by: Nicolas Ferre nicolas.fe...@atmel.com --- drivers/net/ethernet/cadence/macb.c | 17 +++-- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c index edb2aba..27991dd 100644 --- a/drivers/net/ethernet/cadence/macb.c +++ b/drivers/net/ethernet/cadence/macb.c @@ -14,6 +14,7 @@ #include linux/moduleparam.h #include linux/kernel.h #include linux/types.h +#include linux/circ_buf.h #include linux/slab.h #include linux/init.h #include linux/gpio.h @@ -38,8 +39,8 @@ #define TX_RING_SIZE 128 /* must be power of 2 */ #define TX_RING_BYTES (sizeof(struct macb_dma_desc) * TX_RING_SIZE) -/* minimum number of free TX descriptors before waking up TX process */ -#define MACB_TX_WAKEUP_THRESH (TX_RING_SIZE / 4) +/* level of occupied TX descriptors under which we wake up TX process */ +#define MACB_TX_WAKEUP_THRESH (3 * TX_RING_SIZE / 4) #define MACB_RX_INT_FLAGS (MACB_BIT(RCOMP) | MACB_BIT(RXUBR) \ | MACB_BIT(ISR_ROVR)) @@ -60,11 +61,6 @@ static unsigned int macb_tx_ring_wrap(unsigned int index) return index (TX_RING_SIZE - 1); } -static unsigned int macb_tx_ring_avail(struct macb *bp) -{ - return (bp-tx_tail - bp-tx_head) (TX_RING_SIZE - 1); -} - static struct macb_dma_desc *macb_tx_desc(struct macb *bp, unsigned int index) { return bp-tx_ring[macb_tx_ring_wrap(index)]; @@ -524,7 +520,8 @@ static void macb_tx_interrupt(struct macb *bp) bp-tx_tail = tail; if (netif_queue_stopped(bp-dev) -macb_tx_ring_avail(bp) MACB_TX_WAKEUP_THRESH) +CIRC_CNT(bp-tx_head, bp-tx_tail, + TX_RING_SIZE) = MACB_TX_WAKEUP_THRESH) netif_wake_queue(bp-dev); } @@ -818,7 +815,7 @@ static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev) spin_lock_irqsave(bp-lock, flags); /* This is a hard error, log it. */ - if (macb_tx_ring_avail(bp) 1) { + if (CIRC_SPACE(bp-tx_head, bp-tx_tail, TX_RING_SIZE) 1) { netif_stop_queue(dev); spin_unlock_irqrestore(bp-lock, flags); netdev_err(bp-dev, BUG! Tx Ring full when queue awake!\n); @@ -855,7 +852,7 @@ static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev) macb_writel(bp, NCR, macb_readl(bp, NCR) | MACB_BIT(TSTART)); - if (macb_tx_ring_avail(bp) 1) + if (CIRC_SPACE(bp-tx_head, bp-tx_tail, TX_RING_SIZE) 1) netif_stop_queue(dev); spin_unlock_irqrestore(bp-lock, flags); -- 1.8.0 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2] net/macb: move to circ_buf macros and fix initial condition
Move to circular buffers management macro and correct an error with circular buffer initial condition. Without this patch, the macb_tx_ring_avail() function was not reporting the proper ring availability at startup: macb macb: eth0: BUG! Tx Ring full when queue awake! macb macb: eth0: tx_head = 0, tx_tail = 0 And hanginig forever... I remove the macb_tx_ring_avail() function and use the proven macros from circ_buf.h. CIRC_CNT() is used in the consumer part of the driver: macb_tx_interrupt() to match advice from Documentation/circular-buffers.txt. Reported-by: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com Signed-off-by: Nicolas Ferre nicolas.fe...@atmel.com Tested-by: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com --- v2: - added tags from Jean-Christophe PLAGNIOL-VILLARD drivers/net/ethernet/cadence/macb.c | 17 +++-- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c index edb2aba..27991dd 100644 --- a/drivers/net/ethernet/cadence/macb.c +++ b/drivers/net/ethernet/cadence/macb.c @@ -14,6 +14,7 @@ #include linux/moduleparam.h #include linux/kernel.h #include linux/types.h +#include linux/circ_buf.h #include linux/slab.h #include linux/init.h #include linux/gpio.h @@ -38,8 +39,8 @@ #define TX_RING_SIZE 128 /* must be power of 2 */ #define TX_RING_BYTES (sizeof(struct macb_dma_desc) * TX_RING_SIZE) -/* minimum number of free TX descriptors before waking up TX process */ -#define MACB_TX_WAKEUP_THRESH (TX_RING_SIZE / 4) +/* level of occupied TX descriptors under which we wake up TX process */ +#define MACB_TX_WAKEUP_THRESH (3 * TX_RING_SIZE / 4) #define MACB_RX_INT_FLAGS (MACB_BIT(RCOMP) | MACB_BIT(RXUBR) \ | MACB_BIT(ISR_ROVR)) @@ -60,11 +61,6 @@ static unsigned int macb_tx_ring_wrap(unsigned int index) return index (TX_RING_SIZE - 1); } -static unsigned int macb_tx_ring_avail(struct macb *bp) -{ - return (bp-tx_tail - bp-tx_head) (TX_RING_SIZE - 1); -} - static struct macb_dma_desc *macb_tx_desc(struct macb *bp, unsigned int index) { return bp-tx_ring[macb_tx_ring_wrap(index)]; @@ -524,7 +520,8 @@ static void macb_tx_interrupt(struct macb *bp) bp-tx_tail = tail; if (netif_queue_stopped(bp-dev) -macb_tx_ring_avail(bp) MACB_TX_WAKEUP_THRESH) +CIRC_CNT(bp-tx_head, bp-tx_tail, + TX_RING_SIZE) = MACB_TX_WAKEUP_THRESH) netif_wake_queue(bp-dev); } @@ -818,7 +815,7 @@ static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev) spin_lock_irqsave(bp-lock, flags); /* This is a hard error, log it. */ - if (macb_tx_ring_avail(bp) 1) { + if (CIRC_SPACE(bp-tx_head, bp-tx_tail, TX_RING_SIZE) 1) { netif_stop_queue(dev); spin_unlock_irqrestore(bp-lock, flags); netdev_err(bp-dev, BUG! Tx Ring full when queue awake!\n); @@ -855,7 +852,7 @@ static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev) macb_writel(bp, NCR, macb_readl(bp, NCR) | MACB_BIT(TSTART)); - if (macb_tx_ring_avail(bp) 1) + if (CIRC_SPACE(bp-tx_head, bp-tx_tail, TX_RING_SIZE) 1) netif_stop_queue(dev); spin_unlock_irqrestore(bp-lock, flags); -- 1.8.0 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[GIT PULL] at91: fixes for 3.7-rc7
Arnd, Olof, Here is another fixes pull request for AT91. It enables the sd/mmc driver for Device Tree enabled platforms. Those patches where part of a series that was split in two for reaching upstream: the MMC part is already in Linus' tree and this is the arm-soc part. I have placed these patches on top of the fixes that you already have for AT91. The following changes since commit 641f3ce64b050961d454a0716bb6dbf528315aac: ARM: at91/usbh: fix overcurrent gpio setup (2012-11-16 10:46:29 +0100) are available in the git repository at: git://github.com/at91linux/linux-at91.git tags/at91-fixes for you to fetch changes up to 83ce1c55cfb639438c2516cb05f3b8ee472023e5: ARM: at91/dts: add nodes for atmel hsmci controllers for atmel boards (2012-11-19 17:02:40 +0100) Add entries for enabling the use of sd/mmc driver on AT91. Those entries where missing for device tree use on these platforms. Ludovic Desroches (3): ARM: at91: add clocks for DT entries ARM: at91/dts: add nodes for atmel hsmci controllers for atmel SOCs ARM: at91/dts: add nodes for atmel hsmci controllers for atmel boards arch/arm/boot/dts/at91sam9260.dtsi | 9 + arch/arm/boot/dts/at91sam9263.dtsi | 18 ++ arch/arm/boot/dts/at91sam9263ek.dts | 10 ++ arch/arm/boot/dts/at91sam9g20ek_2mmc.dts| 12 arch/arm/boot/dts/at91sam9g20ek_common.dtsi | 9 + arch/arm/boot/dts/at91sam9g25ek.dts | 18 ++ arch/arm/boot/dts/at91sam9g45.dtsi | 18 ++ arch/arm/boot/dts/at91sam9m10g45ek.dts | 19 +++ arch/arm/boot/dts/at91sam9n12.dtsi | 9 + arch/arm/boot/dts/at91sam9n12ek.dts | 9 + arch/arm/boot/dts/at91sam9x5.dtsi | 18 ++ arch/arm/mach-at91/at91sam9260.c| 1 + arch/arm/mach-at91/at91sam9263.c| 2 ++ arch/arm/mach-at91/at91sam9g45.c| 2 ++ arch/arm/mach-at91/at91sam9n12.c| 1 + arch/arm/mach-at91/at91sam9x5.c | 2 ++ 16 files changed, 157 insertions(+) -- Nicolas Ferre -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[GIT PULL] at91: header fix for 3.8
Arnd, Olof, A little fix that goes on top of the modification of headers made by Jean-Christophe. Obviously, I have placed this one on top of your current at91/header branch. The following changes since commit 75984df05d86956541795f01e62d7dc67bc522fd: arm: at91: move at91rm9200 rtc header in drivers/rtc (2012-11-06 20:30:52 +0800) are available in the git repository at: git://github.com/at91linux/linux-at91.git tags/at91-header for you to fetch changes up to 2abb74eaf6e73cb42e87bdc9e9c2535ce485e614: atmel: move ATMEL_MAX_UART to platform_data/atmel.h (2012-11-19 17:44:54 +0100) One fix related to UART for the headers move branch Jean-Christophe PLAGNIOL-VILLARD (1): atmel: move ATMEL_MAX_UART to platform_data/atmel.h arch/arm/mach-at91/include/mach/hardware.h | 3 --- arch/avr32/mach-at32ap/include/mach/board.h | 1 - include/linux/platform_data/atmel.h | 6 ++ 3 files changed, 6 insertions(+), 4 deletions(-) Thanks, best regards, -- Nicolas Ferre -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [GIT PULL] at91: fixes for 3.7-rc7
On 11/19/2012 05:52 PM, Olof Johansson : Hi Nicolas, On Mon, Nov 19, 2012 at 8:31 AM, Nicolas Ferre nicolas.fe...@atmel.com wrote: Arnd, Olof, Here is another fixes pull request for AT91. It enables the sd/mmc driver for Device Tree enabled platforms. Those patches where part of a series that was split in two for reaching upstream: the MMC part is already in Linus' tree and this is the arm-soc part. I have placed these patches on top of the fixes that you already have for AT91. What regressions do these fixes resolve? It looks more like they are DT-enablement patches to me, and thus 3.8 material, not 3.7. I'll be happy to queue them up in next/dt though. Hi Olof, You are right, it does not strictly fixes a regression and we were late for including these patches which are around since end of July... I still sent this pull-request to enable more people to use device tree on AT91 for the upcoming release. If you do not take it for 3.7, maybe we will have to queue these patches on top of our AT91 pinctrl work (on Linus Walleij side), so, you do need to queue this one for the moment... Best regards, -- Nicolas Ferre -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[GIT PULL] at91: tiny cleanup for 3.8
Arnd, Olof, A very little cleanup single patch for AT91. The following changes since commit 77b67063bb6bce6d475e910d3b886a606d0d91f7: Linux 3.7-rc5 (2012-11-11 13:44:33 +0100) are available in the git repository at: git://github.com/at91linux/linux-at91.git tags/at91-for-next-cleanup for you to fetch changes up to f7c9f47239e9bc2fdf30f51cf46249aeb79980d3: ARM: at91/atmel-mci: remove unused setup_dma_addr() macro (2012-11-16 11:52:36 +0100) Removing unneeded macro. Nicolas Ferre (1): ARM: at91/atmel-mci: remove unused setup_dma_addr() macro arch/arm/mach-at91/include/mach/atmel-mci.h | 7 --- 1 file changed, 7 deletions(-) Thanks, bye, -- Nicolas Ferre -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[GIT PULL] at91: DT material for 3.8
Arnd, Olof, Here is a little update on the DT front for AT91. The biggest part will come from the pinctrl which is located in Linus Walleij's git tree. The following changes since commit 77b67063bb6bce6d475e910d3b886a606d0d91f7: Linux 3.7-rc5 (2012-11-11 13:44:33 +0100) are available in the git repository at: git://github.com/at91linux/linux-at91.git tags/at91-for-next-dt for you to fetch changes up to 824b43968fed4b5a200cfef06129c0470eef306a: ARM: at91/dts: evk-pro3: enable watchdog (2012-11-16 15:48:48 +0100) More DT material for AT91: - conversion of watchdog to DT - usart definition for evk-pro3 board Fabio Porcedda (4): ARM: at91: dt: evk-pro3: enable uart0 and uart2 watchdog: at91sam9_wdt: add device tree support ARM: at91/dts: add at91sam9_wdt driver to at91sam926x, at91sam9g45 ARM: at91/dts: evk-pro3: enable watchdog Documentation/devicetree/bindings/watchdog/atmel-wdt.txt | 15 +++ arch/arm/boot/dts/at91sam9260.dtsi | 6 ++ arch/arm/boot/dts/at91sam9263.dtsi | 6 ++ arch/arm/boot/dts/at91sam9g45.dtsi | 6 ++ arch/arm/boot/dts/evk-pro3.dts | 12 drivers/watchdog/at91sam9_wdt.c | 11 +++ 6 files changed, 56 insertions(+) create mode 100644 Documentation/devicetree/bindings/watchdog/atmel-wdt.txt Thanks, bye, -- Nicolas Ferre -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 0/2 v2] at91/ssc: fixes on ASoC tree for 3.8
Hi Mark, Olof, Arnd, This series goes on top of Linus' v3.8-rc3 and fixes an error that we have while compiling DTBs for AT91: ERROR (phandle_references): Reference to non-existent node or label pinctrl_ssc0_tx ERROR: Input tree has errors, aborting (use -f to force output) make[3]: *** [arch/arm/boot/dts/at91sam9g20ek.dtb] Error 2 I have included pending material that is dealing with SSC and pinctrl. The pinctrl part can be merged more easily now that the big pinctrl update for AT91 has been merged upstream. This material was designed to enter Mark's fixes queue, but as discussed with Olof, we can imagine merging everything through arm-soc or split the series (of 2 patches) and let them progress upstream separated (option that I do not like even if I know that the consequences are not so dramatic). So please, Olof, if you feel confortable with this series, tell us what you prefer and we will make our best to make this material go forward... Thanks for your help, best regards, v2: - remove the fix for typo in SSC status property: already merged upstream Bo Shen (2): ARM: at91/dts: add pinctrl support for SSC peripheral ASoC: atmel-ssc: add pinctrl selection to driver arch/arm/boot/dts/at91sam9260.dtsi | 18 ++ arch/arm/boot/dts/at91sam9263.dtsi | 36 arch/arm/boot/dts/at91sam9g45.dtsi | 36 arch/arm/boot/dts/at91sam9n12.dtsi | 26 ++ arch/arm/boot/dts/at91sam9x5.dtsi | 32 +--- drivers/misc/atmel-ssc.c | 8 6 files changed, 149 insertions(+), 7 deletions(-) -- 1.8.0 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/2 v2] ARM: at91/dts: add pinctrl support for SSC peripheral
From: Bo Shen voice.s...@atmel.com Add pinctrl support for SSC on AT91 dtsi files. Signed-off-by: Bo Shen voice.s...@atmel.com [nicolas.fe...@atmel.com: split dtsi and driver changes] Signed-off-by: Nicolas Ferre nicolas.fe...@atmel.com --- arch/arm/boot/dts/at91sam9260.dtsi | 18 ++ arch/arm/boot/dts/at91sam9263.dtsi | 36 arch/arm/boot/dts/at91sam9g45.dtsi | 36 arch/arm/boot/dts/at91sam9n12.dtsi | 26 ++ arch/arm/boot/dts/at91sam9x5.dtsi | 32 +--- 5 files changed, 141 insertions(+), 7 deletions(-) diff --git a/arch/arm/boot/dts/at91sam9260.dtsi b/arch/arm/boot/dts/at91sam9260.dtsi index 68bccf4..cb7bcc5 100644 --- a/arch/arm/boot/dts/at91sam9260.dtsi +++ b/arch/arm/boot/dts/at91sam9260.dtsi @@ -306,6 +306,22 @@ }; }; + ssc0 { + pinctrl_ssc0_tx: ssc0_tx-0 { + atmel,pins = + 1 16 0x1 0x0 /* PB16 periph A */ +1 17 0x1 0x0 /* PB17 periph A */ +1 18 0x1 0x0; /* PB18 periph A */ + }; + + pinctrl_ssc0_rx: ssc0_rx-0 { + atmel,pins = + 1 19 0x1 0x0 /* PB19 periph A */ +1 20 0x1 0x0 /* PB20 periph A */ +1 21 0x1 0x0; /* PB21 periph A */ + }; + }; + pioA: gpio@f400 { compatible = atmel,at91rm9200-gpio; reg = 0xf400 0x200; @@ -450,6 +466,8 @@ compatible = atmel,at91rm9200-ssc; reg = 0xfffbc000 0x4000; interrupts = 14 4 5; + pinctrl-names = default; + pinctrl-0 = pinctrl_ssc0_tx pinctrl_ssc0_rx; status = disabled; }; diff --git a/arch/arm/boot/dts/at91sam9263.dtsi b/arch/arm/boot/dts/at91sam9263.dtsi index 32ec62c..271d4de 100644 --- a/arch/arm/boot/dts/at91sam9263.dtsi +++ b/arch/arm/boot/dts/at91sam9263.dtsi @@ -271,6 +271,38 @@ }; }; + ssc0 { + pinctrl_ssc0_tx: ssc0_tx-0 { + atmel,pins = + 1 0 0x2 0x0/* PB0 periph B */ +1 1 0x2 0x0/* PB1 periph B */ +1 2 0x2 0x0; /* PB2 periph B */ + }; + + pinctrl_ssc0_rx: ssc0_rx-0 { + atmel,pins = + 1 3 0x2 0x0/* PB3 periph B */ +1 4 0x2 0x0/* PB4 periph B */ +1 5 0x2 0x0; /* PB5 periph B */ + }; + }; + + ssc1 { + pinctrl_ssc1_tx: ssc1_tx-0 { + atmel,pins = + 1 6 0x1 0x0/* PB6 periph A */ +1 7 0x1 0x0/* PB7 periph A */ +1 8 0x1 0x0; /* PB8 periph A */ + }; + + pinctrl_ssc1_rx: ssc1_rx-0 { + atmel,pins = + 1 9 0x1 0x0/* PB9 periph A */ +1 10 0x1 0x0 /* PB10 periph A */ +1 11 0x1 0x0; /* PB11 periph A */ + }; + }; + pioA: gpio@f200 { compatible = atmel,at91rm9200-gpio; reg = 0xf200 0x200; @@ -368,6 +400,8
[PATCH 2/2 v2] ASoC: atmel-ssc: add pinctrl selection to driver
From: Bo Shen voice.s...@atmel.com Add default pinctrl selection to atmel-ssc driver. The pinctrl is mandatory. Signed-off-by: Bo Shen voice.s...@atmel.com [nicolas.fe...@atmel.com: split dtsi and driver changes] Signed-off-by: Nicolas Ferre nicolas.fe...@atmel.com --- drivers/misc/atmel-ssc.c | 8 1 file changed, 8 insertions(+) diff --git a/drivers/misc/atmel-ssc.c b/drivers/misc/atmel-ssc.c index 158da5a..3c09cbb 100644 --- a/drivers/misc/atmel-ssc.c +++ b/drivers/misc/atmel-ssc.c @@ -19,6 +19,7 @@ #include linux/module.h #include linux/of.h +#include linux/pinctrl/consumer.h /* Serialize access to ssc_list and user count */ static DEFINE_SPINLOCK(user_lock); @@ -131,6 +132,13 @@ static int ssc_probe(struct platform_device *pdev) struct resource *regs; struct ssc_device *ssc; const struct atmel_ssc_platform_data *plat_dat; + struct pinctrl *pinctrl; + + pinctrl = devm_pinctrl_get_select_default(pdev-dev); + if (IS_ERR(pinctrl)) { + dev_err(pdev-dev, Failed to request pinctrl\n); + return PTR_ERR(pinctrl); + } ssc = devm_kzalloc(pdev-dev, sizeof(struct ssc_device), GFP_KERNEL); if (!ssc) { -- 1.8.0 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH RESEND 6/6 v13] gpio: Add block gpio to several gpio drivers
Hi, Le 15/01/2013 12:51, Roland Stigge a écrit : This patch adds block GPIO support to several gpio drivers. This implements block GPIO only for some selected drivers since block GPIO is an optional feature which may not be suitable for every GPIO hardware. (With automatic fallback to the single GPIO functions if not available in a driver.) Signed-off-by: Roland Stigge sti...@antcom.de --- drivers/gpio/Kconfig |2 drivers/gpio/gpio-em.c| 23 ++ drivers/gpio/gpio-ge.c| 29 + drivers/gpio/gpio-generic.c | 56 + drivers/gpio/gpio-ks8695.c| 34 +++ drivers/gpio/gpio-lpc32xx.c | 82 ++ drivers/gpio/gpio-max730x.c | 61 drivers/gpio/gpio-max732x.c | 59 +++ drivers/gpio/gpio-mc33880.c | 16 +++ drivers/gpio/gpio-ml-ioh.c| 27 drivers/gpio/gpio-mm-lantiq.c | 22 ++ drivers/gpio/gpio-mpc5200.c | 64 + drivers/gpio/gpio-mpc8xxx.c | 41 +++ drivers/gpio/gpio-pca953x.c | 64 + drivers/gpio/gpio-pcf857x.c | 24 +++ drivers/gpio/gpio-pch.c | 27 drivers/gpio/gpio-pl061.c | 17 +++ drivers/gpio/gpio-sa1100.c| 20 + drivers/gpio/gpio-samsung.c | 31 ++ drivers/gpio/gpio-twl6040.c | 32 ++ drivers/gpio/gpio-ucb1400.c | 23 ++ drivers/gpio/gpio-vt8500.c| 24 +++ drivers/gpio/gpio-xilinx.c| 44 drivers/pinctrl/pinctrl-at91.c| 29 + I do not want to delay the process of inclusion for this patch series. But I have a little question on AT91 driver modification... drivers/pinctrl/pinctrl-nomadik.c | 36 25 files changed, 887 insertions(+) [..] --- linux-2.6.orig/drivers/pinctrl/pinctrl-at91.c +++ linux-2.6/drivers/pinctrl/pinctrl-at91.c @@ -49,6 +49,7 @@ struct at91_gpio_chip { struct clk *clock; /* associated clock */ struct irq_domain *domain;/* associated irq domain */ struct at91_pinctrl_mux_ops *ops; /* ops */ + unsigned long mask_cache; /* cached mask for block gpio */ }; #define to_at91_gpio_chip(c) container_of(c, struct at91_gpio_chip, chip) @@ -1125,6 +1126,32 @@ static void at91_gpio_set(struct gpio_ch writel_relaxed(mask, pio + (val ? PIO_SODR : PIO_CODR)); } +static unsigned long at91_gpio_get_block(struct gpio_chip *chip, +unsigned long mask) +{ + struct at91_gpio_chip *at91_gpio = to_at91_gpio_chip(chip); + void __iomem *pio = at91_gpio-regbase; + u32 pdsr; + + pdsr = __raw_readl(pio + PIO_PDSR); Maybe you should use readl_relaxed() here as it is used in the at91_gpio_[get|set]() functions. + return pdsr mask; +} + +static void at91_gpio_set_block(struct gpio_chip *chip, unsigned long mask, + unsigned long val) +{ + struct at91_gpio_chip *at91_gpio = to_at91_gpio_chip(chip); + void __iomem *pio = at91_gpio-regbase; + + /* Do synchronous data output with a single write access */ + if (mask != at91_gpio-mask_cache) { + at91_gpio-mask_cache = mask; + __raw_writel(~mask, pio + PIO_OWDR); + __raw_writel(mask, pio + PIO_OWER); + } + __raw_writel(val, pio + PIO_ODSR); Ditto. +} + static int at91_gpio_direction_output(struct gpio_chip *chip, unsigned offset, int val) { @@ -1435,8 +1462,10 @@ static struct gpio_chip at91_gpio_templa .free = at91_gpio_free, .direction_input= at91_gpio_direction_input, .get= at91_gpio_get, + .get_block = at91_gpio_get_block, .direction_output = at91_gpio_direction_output, .set= at91_gpio_set, + .set_block = at91_gpio_set_block, .to_irq = at91_gpio_to_irq, .dbg_show = at91_gpio_dbg_show, .can_sleep = 0, --- linux-2.6.orig/drivers/pinctrl/pinctrl-nomadik.c +++ linux-2.6/drivers/pinctrl/pinctrl-nomadik.c [..] Otherwise, seems ok to me ; for AT91 part: Acked-by: Nicolas Ferre nicolas.fe...@atmel.com Best regards, -- Nicolas Ferre -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 22/25] usb/at91_udc: don't use [delayed_]work_pending()
On 12/22/2012 02:57 AM, Tejun Heo : There's no need to test whether a (delayed) work item in pending before queueing, flushing or cancelling it. Most uses are unnecessary and quite a few of them are buggy. Remove unnecessary pending tests from at91_udc. Only compile tested. Signed-off-by: Tejun Heo t...@kernel.org Cc: Andrew Victor li...@maxim.org.za Cc: Nicolas Ferre nicolas.fe...@atmel.com Acked-by: Nicolas Ferre nicolas.fe...@atmel.com Cc: Jean-Christophe Plagniol-Villard plagn...@jcrosoft.com Cc: Felipe Balbi ba...@ti.com Cc: linux-...@vger.kernel.org --- Please let me know how this patch should be routed. I can take it through the workqueue tree if necessary. Thanks. drivers/usb/gadget/at91_udc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c index f4a21f6..e81d8a2 100644 --- a/drivers/usb/gadget/at91_udc.c +++ b/drivers/usb/gadget/at91_udc.c @@ -1621,8 +1621,7 @@ static void at91_vbus_timer(unsigned long data) * bus such as i2c or spi which may sleep, so schedule some work * to read the vbus gpio */ - if (!work_pending(udc-vbus_timer_work)) - schedule_work(udc-vbus_timer_work); + schedule_work(udc-vbus_timer_work); } static int at91_start(struct usb_gadget *gadget, -- Nicolas Ferre -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] mmc: at91_mci: fix hanging and rework to match flowcharts
Pierre Ossman : Nicolas Ferre wrote: Fixes hanging using multi block operations (seen during CMD25). Follows closely the datasheet flowcharts. This piece of code handles better big file writing. I had to take care of the notbusy signal during write (at91_mci_handle_cmdrdy function) and to rearrange the AT91_MCI_ENDRX and AT91_MCI_RXBUFF flag usage. Signed-off-by: Nicolas Ferre [EMAIL PROTECTED] --- Most of the patch looks ok. Do you want to wait for some more tests or should I chuck this into the imminent merge window? *pong* I think it is ok to put it into the merge window. @@ -817,7 +834,11 @@ static int __init at91_mci_probe(struct mmc-ops = at91_mci_ops; mmc-f_min = 375000; -mmc-f_max = 2500; +if (cpu_is_at91sam9263()) +mmc-f_max = 5000; +else +mmc-f_max = 2500; + mmc-ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34; mmc-caps = MMC_CAP_BYTEBLOCK | MMC_CAP_MULTIWRITE; This seems unrelated to the rest of the patch. Also, high-speed won't be enabled unless you set the appropriate caps (which should be checked against timing specifications, not just assigned and hope for the best). True. I remove this chunk off the patch. @@ -830,11 +851,11 @@ static int __init at91_mci_probe(struct host-bus_mode = 0; host-board = pdev-dev.platform_data; if (host-board-wire4) { -#ifdef SUPPORT_4WIRE -mmc-caps |= MMC_CAP_4_BIT_DATA; -#else -printk(AT91 MMC: 4 wire bus mode not supported by this driver - using 1 wire\n); -#endif +if (cpu_is_at91sam9260() || cpu_is_at91sam9263()) +mmc-caps |= MMC_CAP_4_BIT_DATA; +else +printk(AT91 MMC: 4 wire bus mode not supported + - using 1 wire\n); } /* This also looks unrelated. Well, It is related to capacities of newer IPs that allow readproof and writeproof features that I enable here : + if (cpu_is_at91sam9260() || cpu_is_at91sam9263()) + mr |= AT91_MCI_RDPROOF | AT91_MCI_WRPROOF; This allows to have a smooth data transmission internally (prevent underruns) and so have full 4 wires capacity. So I think this is good for having a full featured driver on all chips. I resend a corrected patch now. Regards, -- Nicolas Ferre - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] mmc: at91_mci: fix hanging and rework to match flowcharts
Fixes hanging using multi block operations (seen during CMD25). Follows closely the datasheet flowcharts. This piece of code handles better big file writing. I had to take care of the notbusy signal during write (at91_mci_handle_cmdrdy function) and to rearrange the AT91_MCI_ENDRX and AT91_MCI_RXBUFF flag usage. Signed-off-by: Nicolas Ferre [EMAIL PROTECTED] --- This second patch is rebuild following Mariusz and Pierre comments. This patch is applied on top of the typo one : http://kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.22-rc6/2.6.22-rc6-mm1/broken-out/mmc-at91_mci-typo.patch It is cooked with the help of Wu Xuan and Marc Pignat. Big thanks to them. It has been tested on several systems and reported to work ok : at91rm9200 ok w/ 1 wire at91sam9261 ok w/ 1 wire at91sam926[03] ok w/ 4 wires The code takes care of those specificities. drivers/mmc/host/at91_mci.c | 199 ++ 1 file changed, 108 insertions(+), 91 deletions(-) Index: b/drivers/mmc/host/at91_mci.c === --- a/drivers/mmc/host/at91_mci.c +++ b/drivers/mmc/host/at91_mci.c @@ -80,8 +78,6 @@ #define DRIVER_NAME at91_mci -#undef SUPPORT_4WIRE - #define FL_SENT_COMMAND (1 0) #define FL_SENT_STOP(1 1) @@ -270,8 +266,6 @@ static void at91_mci_post_dma_read(struc } while (host-in_use_index host-transfer_index) { - unsigned int *buffer; - struct scatterlist *sg; pr_debug(finishing index %d\n, host-in_use_index); @@ -282,20 +276,22 @@ static void at91_mci_post_dma_read(struc dma_unmap_page(NULL, sg-dma_address, sg-length, DMA_FROM_DEVICE); - /* Swap the contents of the buffer */ - buffer = kmap_atomic(sg-page, KM_BIO_SRC_IRQ) + sg-offset; - pr_debug(buffer = %p, length = %d\n, buffer, sg-length); - data-bytes_xfered += sg-length; if (cpu_is_at91rm9200()) { /* AT91RM9200 errata */ + unsigned int *buffer; int index; + /* Swap the contents of the buffer */ + buffer = kmap_atomic(sg-page, KM_BIO_SRC_IRQ) + sg-offset; + pr_debug(buffer = %p, length = %d\n, buffer, sg-length); + for (index = 0; index (sg-length / 4); index++) buffer[index] = swab32(buffer[index]); + + kunmap_atomic(buffer, KM_BIO_SRC_IRQ); } - kunmap_atomic(buffer, KM_BIO_SRC_IRQ); flush_dcache_page(sg-page); } @@ -303,8 +299,8 @@ static void at91_mci_post_dma_read(struc if (host-transfer_index data-sg_len) at91_mci_pre_dma_read(host); else { + at91_mci_write(host, AT91_MCI_IDR, AT91_MCI_ENDRX); at91_mci_write(host, AT91_MCI_IER, AT91_MCI_RXBUFF); - at91_mci_write(host, ATMEL_PDC_PTCR, ATMEL_PDC_RXTDIS | ATMEL_PDC_TXTDIS); } pr_debug(post dma read done\n); @@ -325,7 +321,6 @@ static void at91_mci_handle_transmitted( /* Now wait for cmd ready */ at91_mci_write(host, AT91_MCI_IDR, AT91_MCI_TXBUFE); - at91_mci_write(host, AT91_MCI_IER, AT91_MCI_NOTBUSY); cmd = host-cmd; if (!cmd) return; @@ -333,18 +328,53 @@ static void at91_mci_handle_transmitted( data = cmd-data; if (!data) return; + if (cmd-data-flags MMC_DATA_MULTI) { + pr_debug(multiple write : wait for BLKE...\n); + at91_mci_write(host, AT91_MCI_IER, AT91_MCI_BLKE); + } else + at91_mci_write(host, AT91_MCI_IER, AT91_MCI_NOTBUSY); + data-bytes_xfered = host-total_length; } +/*Handle after command sent ready*/ +static int at91_mci_handle_cmdrdy(struct at91mci_host *host) +{ + if (!host-cmd) + return 1; + else if (!host-cmd-data) { + if (host-flags FL_SENT_STOP) { + /*After multi block write, we must wait for NOTBUSY*/ + at91_mci_write(host, AT91_MCI_IER, AT91_MCI_NOTBUSY); + } else return 1; + } else if (host-cmd-data-flags MMC_DATA_WRITE) { + /*After sendding multi-block-write command, start DMA transfer*/ + at91_mci_write(host, AT91_MCI_IER, AT91_MCI_TXBUFE); + at91_mci_write(host, AT91_MCI_IER, AT91_MCI_BLKE); + at91_mci_write(host, ATMEL_PDC_PTCR, ATMEL_PDC_TXTEN); + } + + /* command not completed, have to wait */ + return 0; +} + + /* * Enable the controller */ static void at91_mci_enable(struct at91mci_host *host) { + unsigned int mr; + at91_mci_write(host, AT91_MCI_CR, AT91_MCI_MCIEN); at91_mci_write(host, AT91_MCI_IDR, 0x); at91_mci_write(host, AT91_MCI_DTOR
[PATCH] atmel_lcdfb: Fix STN LCD support
From: Nicolas Ferre [EMAIL PROTECTED] Fixes STN LCD support for the atmel_lcdfb framebuffer driver. Signed-off-by: Nicolas Ferre [EMAIL PROTECTED] --- Take 2 with 1 minor modification (Kconfig entry depends on board switch). This patch is the result of a work from Jan Altenberg and has been tested on a Hitachi SP06Q002 on at91sam9261ek. It adds a Kconfig switch that enables the proper LCD in the board configuration file (STN or TFT). The switch is used in arch/arm/mach-at91/at91sam9261_devices.c board-sam9261ek.c as an example. This patch includes the Fix wrong line_length calculation little one from Jan and Haavard (submitted earlier). AT91 platform informations are directly submitted trough the at91 maintainer, here : http://article.gmane.org/gmane.linux.kernel/543158 drivers/video/Kconfig | 10 + drivers/video/atmel_lcdfb.c | 62 +- 2 files changed, 64 insertions(+), 8 deletions(-) Index: b/drivers/video/atmel_lcdfb.c === --- a/drivers/video/atmel_lcdfb.c 2007-06-13 10:55:42.0 +0200 +++ b/drivers/video/atmel_lcdfb.c 2007-06-15 10:25:06.0 +0200 @@ -79,6 +79,29 @@ .accel = FB_ACCEL_NONE, }; +static unsigned long compute_hozval(unsigned long xres, unsigned long lcdcon2) +{ + unsigned long value; + + if (!(cpu_is_at91sam9261() || cpu_is_at32ap7000())) + return xres; + + value = xres; + if ((lcdcon2 ATMEL_LCDC_DISTYPE) != ATMEL_LCDC_DISTYPE_TFT) { + /* STN display */ + if ((lcdcon2 ATMEL_LCDC_DISTYPE) == ATMEL_LCDC_DISTYPE_STNCOLOR) { + value *= 3; + } + if ( (lcdcon2 ATMEL_LCDC_IFWIDTH) == ATMEL_LCDC_IFWIDTH_4 + || ( (lcdcon2 ATMEL_LCDC_IFWIDTH) == ATMEL_LCDC_IFWIDTH_8 + (lcdcon2 ATMEL_LCDC_SCANMOD) == ATMEL_LCDC_SCANMOD_DUAL )) + value = DIV_ROUND_UP(value, 4); + else + value = DIV_ROUND_UP(value, 8); + } + + return value; +} static void atmel_lcdfb_update_dma(struct fb_info *info, struct fb_var_screeninfo *var) @@ -181,6 +204,7 @@ var-xoffset = var-yoffset = 0; switch (var-bits_per_pixel) { + case 1: case 2: case 4: case 8: @@ -228,8 +252,10 @@ static int atmel_lcdfb_set_par(struct fb_info *info) { struct atmel_lcdfb_info *sinfo = info-par; + unsigned long hozval_linesz; unsigned long value; unsigned long clk_value_khz; + unsigned long bits_per_line; dev_dbg(info-device, %s:\n, __func__); dev_dbg(info-device, * resolution: %ux%u (%ux%u virtual)\n, @@ -241,12 +267,15 @@ lcdc_writel(sinfo, ATMEL_LCDC_DMACON, 0); - if (info-var.bits_per_pixel = 8) + if (info-var.bits_per_pixel == 1) + info-fix.visual = FB_VISUAL_MONO01; + else if (info-var.bits_per_pixel = 8) info-fix.visual = FB_VISUAL_PSEUDOCOLOR; else info-fix.visual = FB_VISUAL_TRUECOLOR; - info-fix.line_length = info-var.xres_virtual * (info-var.bits_per_pixel / 8); + bits_per_line = info-var.xres_virtual * info-var.bits_per_pixel; + info-fix.line_length = DIV_ROUND_UP(bits_per_line, 8); /* Re-initialize the DMA engine... */ dev_dbg(info-device, * update DMA engine\n); @@ -262,18 +291,21 @@ /* Set pixel clock */ clk_value_khz = clk_get_rate(sinfo-lcdc_clk) / 1000; - value = clk_value_khz / PICOS2KHZ(info-var.pixclock); - - if (clk_value_khz % PICOS2KHZ(info-var.pixclock)) - value++; + value = DIV_ROUND_UP(clk_value_khz, PICOS2KHZ(info-var.pixclock)); value = (value / 2) - 1; + dev_dbg(info-device, * programming CLKVAL = 0x%08lx\n, value); if (value = 0) { dev_notice(info-device, Bypassing pixel clock divider\n); lcdc_writel(sinfo, ATMEL_LCDC_LCDCON1, ATMEL_LCDC_BYPASS); - } else + } else { lcdc_writel(sinfo, ATMEL_LCDC_LCDCON1, value ATMEL_LCDC_CLKVAL_OFFSET); + info-var.pixclock = KHZ2PICOS(clk_value_khz / (2 * (value + 1))); + dev_dbg(info-device, updated pixclk: %lu KHz\n, + PICOS2KHZ(info-var.pixclock)); + } + /* Initialize control register 2 */ value = sinfo-default_lcdcon2; @@ -311,9 +343,14 @@ dev_dbg(info-device, * LCDTIM2 = %08lx\n, value); lcdc_writel(sinfo, ATMEL_LCDC_TIM2, value); + /* Horizontal value (aka line size) */ + hozval_linesz = compute_hozval(info-var.xres, + lcdc_readl(sinfo, ATMEL_LCDC_LCDCON2)); + /* Display size */ - value = (info-var.xres - 1
Re: [RFC] Orphaning MMC host drivers
Pierre Ossman : +ATMEL AT91 MCI DRIVER +S: Orphan + Hi Pierre, I come back on this request... better late than never ;-) As I have patched the AT91 MCI driver these days, with the kind help of a few people, I think I can now add myself as maintainer for this driver. Here is the entry below. Kind regards, -- Nicolas Ferre --- a/MAINTAINERS +++ b/MAINTAINERS @@ -662,7 +662,12 @@ S: Maintained ATMEL AT91 MCI DRIVER -S: Orphan +P: Nicolas Ferre +M: [EMAIL PROTECTED] +L: [EMAIL PROTECTED] (subscribers-only) +W: http://www.atmel.com/products/AT91/ +W: http://www.at91.com/ +S: Maintained ATMEL MACB ETHERNET DRIVER P: Haavard Skinnemoen - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] atmel_lcdfb: Fix wrong line_length calculation
Haavard Skinnemoen : As Jan Altenberg pointed out, line_length will always be 0 if bits_per_pixel 8. Fix this and also make sure that we round up to the nearest byte. Signed-off-by: Haavard Skinnemoen [EMAIL PROTECTED] --- I haven't tested this with any real program that uses the frame buffer, but fbset seems to report sane values for line_length: Thank you Haavard. I have a bigger patch for all the support for STN display (tested with mono STN display). It is based on the work from Jan Altenberg. This bigger patch includes your modifications. I send it right now. As a separate message. Haavard, can you check if the compute_hozval() function is ok on avr32 (I have reviewed with the at32ap7000 and hope that it is ok) ? Regards, -- Nicolas Ferre - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] atmel_lcdfb: Fix STN LCD support
From: Nicolas Ferre [EMAIL PROTECTED] Fixes STN LCD support for the atmel_lcdfb framebuffer driver. Signed-off-by: Nicolas Ferre [EMAIL PROTECTED] --- This patch is the result of a work from Jan Altenberg and has been tested on a Hitachi SP06Q002 on at91sam9261ek. It adds a Kconfig switch that enables the proper LCD in the board configuration file (STN or TFT). This patch includes the Fix wrong line_length calculation little one from Jan and Haavard (submitted earlier). AT91 platform informations are directly submitted trough the at91 maintainer and follow in a [RFC] message. drivers/video/Kconfig | 10 + drivers/video/atmel_lcdfb.c | 62 +- 2 files changed, 64 insertions(+), 8 deletions(-) Index: b/drivers/video/atmel_lcdfb.c === --- a/drivers/video/atmel_lcdfb.c 2007-06-13 10:55:42.0 +0200 +++ b/drivers/video/atmel_lcdfb.c 2007-06-15 10:25:06.0 +0200 @@ -79,6 +79,29 @@ .accel = FB_ACCEL_NONE, }; +static unsigned long compute_hozval(unsigned long xres, unsigned long lcdcon2) +{ + unsigned long value; + + if (!(cpu_is_at91sam9261() || cpu_is_at32ap7000())) + return xres; + + value = xres; + if ((lcdcon2 ATMEL_LCDC_DISTYPE) != ATMEL_LCDC_DISTYPE_TFT) { + /* STN display */ + if ((lcdcon2 ATMEL_LCDC_DISTYPE) == ATMEL_LCDC_DISTYPE_STNCOLOR) { + value *= 3; + } + if ( (lcdcon2 ATMEL_LCDC_IFWIDTH) == ATMEL_LCDC_IFWIDTH_4 + || ( (lcdcon2 ATMEL_LCDC_IFWIDTH) == ATMEL_LCDC_IFWIDTH_8 + (lcdcon2 ATMEL_LCDC_SCANMOD) == ATMEL_LCDC_SCANMOD_DUAL )) + value = DIV_ROUND_UP(value, 4); + else + value = DIV_ROUND_UP(value, 8); + } + + return value; +} static void atmel_lcdfb_update_dma(struct fb_info *info, struct fb_var_screeninfo *var) @@ -181,6 +204,7 @@ var-xoffset = var-yoffset = 0; switch (var-bits_per_pixel) { + case 1: case 2: case 4: case 8: @@ -228,8 +252,10 @@ static int atmel_lcdfb_set_par(struct fb_info *info) { struct atmel_lcdfb_info *sinfo = info-par; + unsigned long hozval_linesz; unsigned long value; unsigned long clk_value_khz; + unsigned long bits_per_line; dev_dbg(info-device, %s:\n, __func__); dev_dbg(info-device, * resolution: %ux%u (%ux%u virtual)\n, @@ -241,12 +267,15 @@ lcdc_writel(sinfo, ATMEL_LCDC_DMACON, 0); - if (info-var.bits_per_pixel = 8) + if (info-var.bits_per_pixel == 1) + info-fix.visual = FB_VISUAL_MONO01; + else if (info-var.bits_per_pixel = 8) info-fix.visual = FB_VISUAL_PSEUDOCOLOR; else info-fix.visual = FB_VISUAL_TRUECOLOR; - info-fix.line_length = info-var.xres_virtual * (info-var.bits_per_pixel / 8); + bits_per_line = info-var.xres_virtual * info-var.bits_per_pixel; + info-fix.line_length = DIV_ROUND_UP(bits_per_line, 8); /* Re-initialize the DMA engine... */ dev_dbg(info-device, * update DMA engine\n); @@ -262,18 +291,21 @@ /* Set pixel clock */ clk_value_khz = clk_get_rate(sinfo-lcdc_clk) / 1000; - value = clk_value_khz / PICOS2KHZ(info-var.pixclock); - - if (clk_value_khz % PICOS2KHZ(info-var.pixclock)) - value++; + value = DIV_ROUND_UP(clk_value_khz, PICOS2KHZ(info-var.pixclock)); value = (value / 2) - 1; + dev_dbg(info-device, * programming CLKVAL = 0x%08lx\n, value); if (value = 0) { dev_notice(info-device, Bypassing pixel clock divider\n); lcdc_writel(sinfo, ATMEL_LCDC_LCDCON1, ATMEL_LCDC_BYPASS); - } else + } else { lcdc_writel(sinfo, ATMEL_LCDC_LCDCON1, value ATMEL_LCDC_CLKVAL_OFFSET); + info-var.pixclock = KHZ2PICOS(clk_value_khz / (2 * (value + 1))); + dev_dbg(info-device, updated pixclk: %lu KHz\n, + PICOS2KHZ(info-var.pixclock)); + } + /* Initialize control register 2 */ value = sinfo-default_lcdcon2; @@ -311,9 +343,14 @@ dev_dbg(info-device, * LCDTIM2 = %08lx\n, value); lcdc_writel(sinfo, ATMEL_LCDC_TIM2, value); + /* Horizontal value (aka line size) */ + hozval_linesz = compute_hozval(info-var.xres, + lcdc_readl(sinfo, ATMEL_LCDC_LCDCON2)); + /* Display size */ - value = (info-var.xres - 1) ATMEL_LCDC_HOZVAL_OFFSET; + value = (hozval_linesz - 1) ATMEL_LCDC_HOZVAL_OFFSET; value |= info-var.yres - 1; + dev_dbg(info-device, * LCDFRMCFG = %08lx\n, value); lcdc_writel(sinfo
[RFC] AT91: atmel_lcdfb: at91sam9261ek support for STN b/w display
From: Nicolas Ferre [EMAIL PROTECTED] Adds STN LCD support on at91sam9261ek. Uses a black and white screen from Hitachi : SP06Q002. Signed-off-by: Nicolas Ferre [EMAIL PROTECTED] --- Submitted in linux-fbdev for a RFC but will make its way through the AT91 maintainer. Relies on the CONFIG_FB_ATMEL_STN switch to choose the TFT or STN display (switch in drivers/video/Kconfig). arch/arm/mach-at91/at91sam9261_devices.c | 15 arch/arm/mach-at91/board-sam9261ek.c | 74 +++-- 2 files changed, 83 insertions(+), 6 deletions(-) Index: b/arch/arm/mach-at91/board-sam9261ek.c === --- a/arch/arm/mach-at91/board-sam9261ek.c +++ b/arch/arm/mach-at91/board-sam9261ek.c @@ -281,6 +281,8 @@ * LCD Controller */ #if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE) + +/* TFT */ static struct fb_videomode at91_tft_vga_modes[] = { { .name = TX09D50VM1CCA @ 60, @@ -297,7 +299,7 @@ }, }; -static struct fb_monspecs at91fb_default_monspecs = { +static struct fb_monspecs at91fb_default_tft_monspecs = { .manufacturer = HIT, .monitor= TX09D50VM1CCA, @@ -309,11 +311,11 @@ .vfmax = 150, }; -#define AT91SAM9261_DEFAULT_LCDCON2(ATMEL_LCDC_MEMOR_LITTLE \ +#define AT91SAM9261_DEFAULT_TFT_LCDCON2(ATMEL_LCDC_MEMOR_LITTLE \ | ATMEL_LCDC_DISTYPE_TFT\ | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE) -static void at91_lcdc_power_control(int on) +static void at91_lcdc_tft_power_control(int on) { if (on) at91_set_gpio_value(AT91_PIN_PA12, 0); /* power up */ @@ -321,15 +323,75 @@ at91_set_gpio_value(AT91_PIN_PA12, 1); /* power down */ } +/* STN */ +static struct fb_videomode at91_stn_modes[] = { +{ + .name = SP06Q002 @ 75, + .refresh= 75, + .xres = 320, .yres = 240, + .pixclock = KHZ2PICOS(1440), + + .left_margin= 1,.right_margin = 1, + .upper_margin = 0,.lower_margin = 0, + .hsync_len = 1,.vsync_len = 1, + + .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, + .vmode = FB_VMODE_NONINTERLACED, +}, +}; + +static struct fb_monspecs at91fb_default_stn_monspecs = { +.manufacturer = HIT, +.monitor= SP06Q002, + +.modedb = at91_stn_modes, +.modedb_len = ARRAY_SIZE(at91_stn_modes), +.hfmin = 15000, +.hfmax = 64000, +.vfmin = 50, +.vfmax = 150, +}; + +#define AT91SAM9261_DEFAULT_STN_LCDCON2(ATMEL_LCDC_MEMOR_LITTLE \ + | ATMEL_LCDC_DISTYPE_STNMONO \ + | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE \ + | ATMEL_LCDC_IFWIDTH_4 \ + | ATMEL_LCDC_SCANMOD_SINGLE) + +static void at91_lcdc_stn_power_control(int on) +{ + /* backlight */ + if (on) { + /* power up */ + at91_set_gpio_value(AT91_PIN_PC14, 0); + at91_set_gpio_value(AT91_PIN_PC15, 0); + } else { + /* power down */ + at91_set_gpio_value(AT91_PIN_PC14, 1); + at91_set_gpio_value(AT91_PIN_PC15, 1); + } +} + /* Driver datas */ +#if defined(CONFIG_FB_ATMEL_STN) +static struct atmel_lcdfb_info __initdata ek_lcdc_data = { + .default_bpp= 1, + .default_dmacon = ATMEL_LCDC_DMAEN, + .default_lcdcon2= AT91SAM9261_DEFAULT_STN_LCDCON2, + .default_monspecs = at91fb_default_stn_monspecs, + .atmel_lcdfb_power_control = at91_lcdc_stn_power_control, + .guard_time = 1, +}; +#else static struct atmel_lcdfb_info __initdata ek_lcdc_data = { .default_bpp= 16, .default_dmacon = ATMEL_LCDC_DMAEN, - .default_lcdcon2= AT91SAM9261_DEFAULT_LCDCON2, - .default_monspecs = at91fb_default_monspecs, - .atmel_lcdfb_power_control = at91_lcdc_power_control, + .default_lcdcon2= AT91SAM9261_DEFAULT_TFT_LCDCON2, + .default_monspecs = at91fb_default_tft_monspecs, + .atmel_lcdfb_power_control = at91_lcdc_tft_power_control, .guard_time = 1, }; +#endif #else static struct atmel_lcdfb_info __initdata ek_lcdc_data; Index: b/arch/arm/mach-at91/at91sam9261_devices.c === --- a/arch/arm/mach-at91/at91sam9261_devices.c +++ b/arch
[PATCH] mmc: at91_mci typo
Typo fix in at91_mci driver : standardized the typo (at91_mci everywhere) Signed-off-by: Nicolas Ferre [EMAIL PROTECTED] --- Will not make the driver works better but will satisfy the most demanding typo specialists. drivers/mmc/host/at91_mci.c | 30 +++--- 1 file changed, 15 insertions(+), 15 deletions(-) Index: b/drivers/mmc/host/at91_mci.c === --- a/drivers/mmc/host/at91_mci.c +++ b/drivers/mmc/host/at91_mci.c @@ -131,7 +131,7 @@ struct at91mci_host /* * Copy from sg to a dma block - used for transfers */ -static inline void at91mci_sg_to_dma(struct at91mci_host *host, struct mmc_data *data) +static inline void at91_mci_sg_to_dma(struct at91mci_host *host, struct mmc_data *data) { unsigned int len, i, size; unsigned *dmabuf = host-buffer; @@ -180,7 +180,7 @@ static inline void at91mci_sg_to_dma(str /* * Prepare a dma read */ -static void at91mci_pre_dma_read(struct at91mci_host *host) +static void at91_mci_pre_dma_read(struct at91mci_host *host) { int i; struct scatterlist *sg; @@ -248,7 +248,7 @@ static void at91mci_pre_dma_read(struct /* * Handle after a dma read */ -static void at91mci_post_dma_read(struct at91mci_host *host) +static void at91_mci_post_dma_read(struct at91mci_host *host) { struct mmc_command *cmd; struct mmc_data *data; @@ -299,7 +299,7 @@ static void at91mci_post_dma_read(struct /* Is there another transfer to trigger? */ if (host-transfer_index data-sg_len) - at91mci_pre_dma_read(host); + at91_mci_pre_dma_read(host); else { at91_mci_write(host, AT91_MCI_IER, AT91_MCI_RXBUFF); at91_mci_write(host, ATMEL_PDC_PTCR, ATMEL_PDC_RXTDIS | ATMEL_PDC_TXTDIS); @@ -464,7 +464,7 @@ static unsigned int at91_mci_send_comman host-buffer = NULL; host-total_length = 0; - at91mci_pre_dma_read(host); + at91_mci_pre_dma_read(host); ier = AT91_MCI_ENDRX /* | AT91_MCI_RXBUFF */; } else { @@ -476,7 +476,7 @@ static unsigned int at91_mci_send_comman host-total_length, host-physical_address, GFP_KERNEL); - at91mci_sg_to_dma(host, data); + at91_mci_sg_to_dma(host, data); pr_debug(Transmitting %d bytes\n, host-total_length); @@ -506,7 +506,7 @@ static unsigned int at91_mci_send_comman /* * Wait for a command to complete */ -static void at91mci_process_command(struct at91mci_host *host, struct mmc_command *cmd) +static void at91_mci_process_command(struct at91mci_host *host, struct mmc_command *cmd) { unsigned int ier; @@ -521,15 +521,15 @@ static void at91mci_process_command(stru /* * Process the next step in the request */ -static void at91mci_process_next(struct at91mci_host *host) +static void at91_mci_process_next(struct at91mci_host *host) { if (!(host-flags FL_SENT_COMMAND)) { host-flags |= FL_SENT_COMMAND; - at91mci_process_command(host, host-request-cmd); + at91_mci_process_command(host, host-request-cmd); } else if ((!(host-flags FL_SENT_STOP)) host-request-stop) { host-flags |= FL_SENT_STOP; - at91mci_process_command(host, host-request-stop); + at91_mci_process_command(host, host-request-stop); } else mmc_request_done(host-mmc, host-request); @@ -538,7 +538,7 @@ static void at91mci_process_next(struct /* * Handle a command that has been completed */ -static void at91mci_completed_command(struct at91mci_host *host) +static void at91_mci_completed_command(struct at91mci_host *host) { struct mmc_command *cmd = host-cmd; unsigned int status; @@ -581,7 +581,7 @@ static void at91mci_completed_command(st else cmd-error = MMC_ERR_NONE; - at91mci_process_next(host); + at91_mci_process_next(host); } /* @@ -593,7 +593,7 @@ static void at91_mci_request(struct mmc_ host-request = mrq; host-flags = 0; - at91mci_process_next(host); + at91_mci_process_next(host); } /* @@ -706,7 +706,7 @@ static irqreturn_t at91_mci_irq(int irq, if (int_status AT91_MCI_ENDRX) { pr_debug(Receive has ended\n); - at91mci_post_dma_read(host); + at91_mci_post_dma_read(host); } if (int_status AT91_MCI_NOTBUSY) { @@ -735,7 +735,7 @@ static irqreturn_t at91_mci_irq(int irq, if (completed) { pr_debug(Completed command\n); at91_mci_write(host, AT91_MCI_IDR, 0x
Re: [PATCH] atmel_lcdfb: Fix STN LCD support
Haavard Skinnemoen : On Fri, 15 Jun 2007 10:50:12 +0200 Nicolas Ferre [EMAIL PROTECTED] wrote: From: Nicolas Ferre [EMAIL PROTECTED] Fixes STN LCD support for the atmel_lcdfb framebuffer driver. Signed-off-by: Nicolas Ferre [EMAIL PROTECTED] Looks correct to me. Although... Index: b/drivers/video/Kconfig === --- a/drivers/video/Kconfig 2007-05-14 11:02:16.0 +0200 +++ b/drivers/video/Kconfig 2007-06-13 11:04:10.0 +0200 @@ -701,6 +701,16 @@ Say Y if you want to map Frame Buffer in internal SRAM. Say N if you want to let frame buffer in external SDRAM. +config FB_ATMEL_STN + bool Use a STN display with AT91/AT32 LCD Controller + depends on FB_ATMEL ARCH_AT91SAM9261 + default n + help + Say Y if you want to connect a STN LCD display to the AT91/AT32 LCD + Controller. Say N if you want to connect a TFT. + + If unsure, say N. + I don't think it's appropriate to include chip-specific options here. This option will not affect the driver at all, it will only affect the board-specific setup code, so IMO it should be under Platform-specific options or something like that. True in a code centric point of view. I do not think it is very usable to move this switch in the board setup : The user will have to check if an option is appearing in the board menu while he select the Atmel LCD driver. He is supposed to have already selected the chip'n'board he is using. Moreover, this option will not show its nose until the board that implements it is not included in depends. (It is basically the same case with the option just above, with the very same arguments). Also, the text says AT91/AT32 but it depends on one particular AT91 chip. Ok, will move it to a board switch (MACH_AT91SAM9261EK for instance). This will grow as STN configuration will be implemented for boards. Regards, -- Nicolas Ferre - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Oops in a driver while using SLUB as a SLAB allocator
: r6:c02c5f38 r5:000b r4:c029c4bc [c005bc58] (handle_level_irq+0x0/0x104) from [c0025048] (asm_do_IRQ+0x48/0x78) r5:c029c4bc r4:000b [c0025000] (asm_do_IRQ+0x0/0x78) from [c0025a84] (__irq_svc+0x24/0x60) Exception stack(0xc3d0bdc0 to 0xc3d0be08) bdc0: 001b 0001 c488 c07f0040 c3d0bed0 c3d64800 0001 bde0: 002c c3d0bea4 c3d0be78 c3d0be14 c029ae50 c3d0be08 c029ae50 c017db6c be00: 6013 r7:0001 r6:000b r5:fefff000 r4: [c017db18] (at91mci_process_next+0x0/0x68) from [c017dba0] (at91_mci_request+0x20/0x24) [c017db80] (at91_mci_request+0x0/0x24) from [c0179890] (mmc_start_request+0xf8/0x108) [c0179798] (mmc_start_request+0x0/0x108) from [c01798f0] (mmc_wait_for_req+0x38/0x50) r6: r5:c3d0be44 r4: [c01798b8] (mmc_wait_for_req+0x0/0x50) from [c017c744] (mmc_sd_switch+0x138/0x160) r5:c3c54800 r4: [c017c60c] (mmc_sd_switch+0x0/0x160) from [c017be4c] (mmc_attach_sd+0x554/0x7e4) [c017b8f8] (mmc_attach_sd+0x0/0x7e4) from [c017a080] (mmc_rescan+0x14c/0x20c) [c0179f34] (mmc_rescan+0x0/0x20c) from [c00499c0] (run_workqueue+0xb8/0x14c) r7:c3d6cde0 r6:c3c4f280 r5:c0179f34 r4:c3d6cde0 [c0049908] (run_workqueue+0x0/0x14c) from [c0049b24] (worker_thread+0xd0/0xe4) r5:c3d0bfac r4:c3d6cde8 [c0049a54] (worker_thread+0x0/0xe4) from [c004d444] (kthread+0x54/0x7c) r7: r6: r5:c0049a54 r4:fffc [c004d3f0] (kthread+0x0/0x7c) from [c003c3f4] (do_exit+0x0/0x75c) r5: r4: Code: e1d000b6 e241c024 e350 e1a3 (0591300c) Kernel panic - not syncing: Aiee, killing interrupt handler! Note that when using CONFIG_SLAB the dma mapping adresses are : dma address = 0x23D8AB68, length = 8 dma address = 0x23D453A0, length = 64 dma address = 0x23D3, length = 4096 for instance. and the driver behaves OK (like it behaves until now). Do you find a reason why I cannot use SLUB ? Did I missed something or do I use a bad dma_xx or cache flush call in the driver ? Thanks, regards, -- Nicolas Ferre - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/