* Re: [PATCH 00/22] Refactor to accept NUL in commit messages
From: Junio C Hamano @ 2011-10-23 9:46 UTC (permalink / raw)
To: Nguyen Thai Ngoc Duy; +Cc: git, peff, Ævar Arnfjörð
In-Reply-To: <CACsJy8CA2cqJqt7cUN1CdnOb3=qE6B2XTd1oQKZ7osVz09kSGg@mail.gmail.com>
Nguyen Thai Ngoc Duy <pclouds@gmail.com> writes:
> On Sun, Oct 23, 2011 at 4:51 PM, Junio C Hamano <gitster@pobox.com> wrote:
> ...
>> The low level object format of our commit is textual header fields, each
>> of which is terminated with a LF, followed by a LF to mark the end of
>> header fields, and then opaque payload that can contain any bytes. It does
>> not forbid a non-Git application to reuse the object store infrastructure
>> to store ASN.1 binary goo there, and the low level interface we give such
>> as cat-file is a perfectly valid way to inspect such a "commit" object.
>
> cat-file is fine, commit-tree (or any commands that call
> commit_tree()) cuts at NUL though.
> I wonder how git processes commit messages in utf-16.
That is exactly what I am saying.
Perhaps you didn't either read or understand what you omitted from your
quoting; otherwise you even wouldn't have brought up utf-16.
Let me requote that part for you.
> But when it comes to "Git" Porcelains (e.g. the log family of commands),
> we do assume people do not store random binary byte sequences in commits,
> and we do take advantage of that assumption by splitting each "line" at
> LF, indenting them with 4 spaces, etc. In other words, a commit log in the
> Git context _is_ pretty much text and not arbitrary byte sequence.
Think what would cutting at a byte whose value is 012 and adding four
bytes whose values are 040 to each of "lines" that formed with such
cutting do to UTF-16 goo, even if it does not contain any NUL byte. As far
as Git Porcelains are concerned, it is no different from random binary
byte sequences.
^ permalink raw reply
* Re: [PATCH 00/12 RESEND] Mainly checkpatch fixes
From: Mark Einon @ 2011-10-23 9:42 UTC (permalink / raw)
To: Greg KH; +Cc: devel, linux-kernel
In-Reply-To: <20111023093651.GA22285@kroah.com>
On Sun, Oct 23, 2011 at 11:36:51AM +0200, Greg KH wrote:
> On Sun, Oct 23, 2011 at 10:22:42AM +0100, Mark Einon wrote:
> > Resending patches. Reduces the number of checkpatch warnings, removing
> > forward declarations and whitespace changes.
> >
> > Last patch removes some redundant code.
>
> Thanks, now applied, so we should be all synced up now, right?
Yes, fantastic. Thanks very much Greg.
Cheers,
Mark
^ permalink raw reply
* Re: [PATCH 2/3] ARM: AT91: IIO: Add AT91 ADC driver.
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-10-23 9:08 UTC (permalink / raw)
To: Maxime Ripard; +Cc: linux-arm-kernel, linux-iio, Patrice Vilchez, Nicolas Ferre
In-Reply-To: <1319041134-19712-3-git-send-email-maxime.ripard@free-electrons.com>
On 18:18 Wed 19 Oct , Maxime Ripard wrote:
> Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
> Cc: Patrice Vilchez <patrice.vilchez@atmel.com>
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
please keep me in CC
> +
> +static int at91adc_channel_init(struct at91adc_state *st)
> +{
> + int ret = 0, i;
> + st->channels = kzalloc(sizeof(struct iio_chan_spec) * st->nb_chan,
> + GFP_KERNEL);
> + if (st->channels == NULL)
> + return -ENOMEM;
> +
> + for (i = 0; i < st->nb_chan; i++) {
> + struct iio_chan_spec *chan = st->channels + i;
> + chan->type = IIO_VOLTAGE;
> + chan->indexed = 1;
> + chan->channel = i;
> + ++ret;
> + }
> +
> + return ret;
> +}
> +
> +static int at91adc_read_raw(struct iio_dev *idev,
> + struct iio_chan_spec const *chan,
> + int *val, int *val2, long mask)
> +{
> + struct at91adc_state *st = iio_priv(idev);
> +
> + switch (mask) {
> + case 0:
> + mutex_lock(&st->lock);
> +
> + at91adc_reg_write(st->reg_base, AT91_ADC_CHER,
> + AT91_ADC_CH(chan->channel));
> + at91adc_reg_write(st->reg_base, AT91_ADC_IER,
> + AT91_ADC_EOC(chan->channel));
> + at91adc_reg_write(st->reg_base, AT91_ADC_CR, AT91_ADC_START);
> +
> + wait_event_interruptible(st->wq_data_avail, st->done);
> + *val = st->lcdr;
> +
> + at91adc_reg_write(st->reg_base, AT91_ADC_CHDR,
> + AT91_ADC_CH(chan->channel));
> + at91adc_reg_write(st->reg_base, AT91_ADC_IDR,
> + AT91_ADC_EOC(chan->channel));
> +
> + st->lcdr = 0;
> + st->done = false;
> + mutex_unlock(&st->lock);
> + return IIO_VAL_INT;
> + default:
> + break;
> + }
> + return -EINVAL;
> +}
> +
> +static const struct iio_info at91adc_info = {
> + .driver_module = THIS_MODULE,
> + .read_raw = &at91adc_read_raw,
> +};
> +
> +static int __devinit at91adc_probe(struct platform_device *pdev)
> +{
> + unsigned int prsc, mstrclk, ticks;
> + int ret;
> + struct iio_dev *idev;
> + struct at91adc_state *st;
> + struct resource *res;
> + struct at91_adc_data *pdata = pdev->dev.platform_data;
do not refence it copy need for the DT
> +
> + dev_dbg(&pdev->dev, "AT91ADC probed\n");
> +
> + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> + if (!res) {
> + dev_err(&pdev->dev, "No resource defined\n");
> + ret = -ENXIO;
> + goto error_ret;
> + }
> +
> + idev = iio_allocate_device(sizeof(*st));
> + if (idev == NULL) {
> + dev_err(&pdev->dev, "Failed to allocate memory.\n");
> + ret = -ENOMEM;
> + goto error_ret;
> + }
> + platform_set_drvdata(pdev, idev);
> +
> + idev->dev.parent = &pdev->dev;
> + idev->name = platform_get_device_id(pdev)->name;
> + idev->modes = INDIO_DIRECT_MODE;
> + idev->info = &at91adc_info;
> +
> + st = iio_priv(idev);
> + st->irq = platform_get_irq(pdev, 0);
> + if (st->irq < 0) {
> + dev_err(&pdev->dev, "No IRQ ID is designated\n");
> + ret = -ENODEV;
> + goto error_free_device;
> + }
> +
> + if (!request_mem_region(res->start, resource_size(res),
> + "AT91 adc registers")) {
> + dev_err(&pdev->dev, "Resources are unavailable.\n");
> + ret = -EBUSY;
> + goto error_free_device;
> + }
> +
> + st->reg_base = ioremap(res->start, resource_size(res));
> + if (!st->reg_base) {
> + dev_err(&pdev->dev, "Failed to map registers.\n");
> + ret = -ENOMEM;
> + goto error_release_mem;
> + }
> +
> + /*
> + * Disable all IRQs before setting up the handler
> + */
> + at91adc_reg_write(st->reg_base, AT91_ADC_CR, AT91_ADC_SWRST);
> + at91adc_reg_write(st->reg_base, AT91_ADC_IDR, 0xFFFFFFFF);
> + ret = request_irq(st->irq,
> + at91adc_eoc_trigger, 0, pdev->dev.driver->name, st);
> + if (ret) {
> + dev_err(&pdev->dev, "Failed to allocate IRQ.\n");
> + goto error_unmap_reg;
> + }
> +
> + st->clk = clk_get(&pdev->dev, "adc_clk");
> + if (IS_ERR(st->clk)) {
> + dev_err(&pdev->dev, "Failed to get the clock.\n");
> + ret = PTR_ERR(st->clk);
> + goto error_free_irq;
> + }
> +
> + clk_enable(st->clk);
> + mstrclk = clk_get_rate(st->clk);
> +
> + if (!pdata) {
> + dev_err(&pdev->dev, "No platform data available.\n");
> + ret = -EINVAL;
> + goto error_free_clk;
> + }
> +
> + if (!pdata->adc_clock) {
> + dev_err(&pdev->dev, "No ADCClock available.\n");
> + ret = -EINVAL;
> + goto error_free_clk;
> + }
where is the platform data struct?
Best Regards,
J.
^ permalink raw reply
* [RFC][PATCH] uncompress.h cleanup and DT support
From: Uwe Kleine-König @ 2011-10-23 9:43 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <20111023092059.GB12814@n2100.arm.linux.org.uk>
On Sun, Oct 23, 2011 at 10:20:59AM +0100, Russell King - ARM Linux wrote:
> On Sun, Oct 23, 2011 at 11:12:50AM +0200, Zoltan Devai wrote:
> > 2011/10/23 Russell King - ARM Linux <linux@arm.linux.org.uk>:
> > > On Sun, Oct 23, 2011 at 10:18:29AM +0200, Zoltan Devai wrote:
> > >> Plase consider all this as RFC, it's mostly not even compile-tested.
> > >> If you think it's worth to follow-up, I'm happy to do it.
> > >
> > > Is the patch available?
> > git://github.com/zdevai/linux.git uncompress-h
>
> I'd rather not pull your tree just to look at the patch. Is it
> available somewhere else?
It's not hard to look at it and no need to pull, just do:
git fetch git://github.com/zdevai/linux.git uncompress-h
git log -p ..FETCH_HEAD
(Of course you get the objects of the branch into your object-db but
that shouldn't matter much.)
Obviously this doesn't give a good opportunity to comment the patch.
It's just to satisfy your curiosity.
Just from a quick glance commit 77bf042c54650ecb39a0e6d79de827d3157cf817
is not OK. For example it changes the license terms
of arch/arm/mach-at91/include/mach/uncompress.h from GPLv2+ to GPLv2 and
removes a copyright. Ditto for some other files.
In commit dbd13d823641694c633c01e8e33e21eb76a1aad2 git played tricks on
you and removed a line like
#define ARCH_HAVE_DECOMP_SETUP
because it thought it's a comment that shouldn't go into the log.
Note that this isn't very multi-SoC friendly.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-K?nig |
Industrial Linux Solutions | http://www.pengutronix.de/ |
^ permalink raw reply
* Re: [B.A.T.M.A.N.] [PATCH] batman-adv: remove references for global tt entries
From: Alexey Fisher @ 2011-10-23 9:43 UTC (permalink / raw)
To: The list for a Better Approach To Mobile Ad-hoc Networking
Cc: Simon Wunderlich
In-Reply-To: <20111023094053.GB6828@ritirata.org>
On 23.10.2011 11:40, Antonio Quartulli wrote:
> Hello,
>
> On Wed, Oct 19, 2011 at 11:02:25AM +0200, Simon Wunderlich wrote:
>> struct tt_global_entry holds a reference to an orig_node which must be
>> decremented before deallocating the structure.
>>
>> Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
>> ---
>
> I got a feedback on IRC from fishor_ who applied the patch while trying to
> eliminate the kernel panic problem on module unload. The refcount has not been
> printed, therefore we do not know if the patch really corrects it but at least
> we know that this patch doesn't crash batman-adv :-)
>
> Cheers,
>
tested-by: Alexey Fisher <bug-track@fisher-privat.net>
^ permalink raw reply
* Re: [B.A.T.M.A.N.] [PATCH] batman-adv: add sanity check when removing global tts
From: Alexey Fisher @ 2011-10-23 9:42 UTC (permalink / raw)
To: The list for a Better Approach To Mobile Ad-hoc Networking
In-Reply-To: <20111023093802.GA6828@ritirata.org>
On 23.10.2011 11:38, Antonio Quartulli wrote:
> Hello,
>
> On Wed, Oct 19, 2011 at 10:28:26AM +0200, Simon Wunderlich wrote:
>> After removing the batman-adv module, the hash may be already gone
>> when tt_global_del_orig() tries to clean the hash. This patch adds
>> a sanity check to avoid this.
>>
>> Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
>> ---
>
> I got a feedback on IRC from fishor_ who said that the patch solved the kernel
> panic problem on module unload and on soft_iface deactivating.
>
> Thank you for the patch Simon!
>
tested-by: Alexey Fisher <bug-track@fisher-privat.net>
^ permalink raw reply
* Re: [B.A.T.M.A.N.] [PATCH] batman-adv: remove references for global tt entries
From: Antonio Quartulli @ 2011-10-23 9:40 UTC (permalink / raw)
To: The list for a Better Approach To Mobile Ad-hoc Networking
Cc: Simon Wunderlich
In-Reply-To: <1319014945-32281-1-git-send-email-siwu@hrz.tu-chemnitz.de>
Hello,
On Wed, Oct 19, 2011 at 11:02:25AM +0200, Simon Wunderlich wrote:
> struct tt_global_entry holds a reference to an orig_node which must be
> decremented before deallocating the structure.
>
> Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
> ---
I got a feedback on IRC from fishor_ who applied the patch while trying to
eliminate the kernel panic problem on module unload. The refcount has not been
printed, therefore we do not know if the patch really corrects it but at least
we know that this patch doesn't crash batman-adv :-)
Cheers,
--
Antonio Quartulli
..each of us alone is worth nothing..
Ernesto "Che" Guevara
^ permalink raw reply
* Re: [B.A.T.M.A.N.] [PATCH] batman-adv: add sanity check when removing global tts
From: Antonio Quartulli @ 2011-10-23 9:38 UTC (permalink / raw)
To: The list for a Better Approach To Mobile Ad-hoc Networking
In-Reply-To: <20111019082826.GA31323@pandem0nium>
Hello,
On Wed, Oct 19, 2011 at 10:28:26AM +0200, Simon Wunderlich wrote:
> After removing the batman-adv module, the hash may be already gone
> when tt_global_del_orig() tries to clean the hash. This patch adds
> a sanity check to avoid this.
>
> Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
> ---
I got a feedback on IRC from fishor_ who said that the patch solved the kernel
panic problem on module unload and on soft_iface deactivating.
Thank you for the patch Simon!
--
Antonio Quartulli
..each of us alone is worth nothing..
Ernesto "Che" Guevara
^ permalink raw reply
* Re: [PATCH 00/12 RESEND] Mainly checkpatch fixes
From: Greg KH @ 2011-10-23 9:36 UTC (permalink / raw)
To: Mark Einon; +Cc: gregkh, devel, linux-kernel
In-Reply-To: <1319361774-3148-1-git-send-email-mark.einon@gmail.com>
On Sun, Oct 23, 2011 at 10:22:42AM +0100, Mark Einon wrote:
> Resending patches. Reduces the number of checkpatch warnings, removing
> forward declarations and whitespace changes.
>
> Last patch removes some redundant code.
Thanks, now applied, so we should be all synced up now, right?
greg k-h
^ permalink raw reply
* Re: [PATCH] regulator: Add S5M8767 regulator driver
From: Mark Brown @ 2011-10-23 9:30 UTC (permalink / raw)
To: Sangbeom Kim; +Cc: 'Liam Girdwood', linux-kernel
In-Reply-To: <009501cc915b$809ce880$81d6b980$@com>
On Sun, Oct 23, 2011 at 05:12:27PM +0900, Sangbeom Kim wrote:
This mostly looks good, a few smaller comments below but nothing major.
> +static int s5m8767_reg_enable_suspend(struct regulator_dev *rdev)
> +{
> + return 0;
> +}
> +static int s5m8767_reg_disable_suspend(struct regulator_dev *rdev)
> +{
I guess you need an implementation for enable_suspend() (otherwise you
can't do disable->enable).
> + {
> + .name = "AP 32KHz",
> + .id = S5M8767_32KHZAP_EN,
> + .ops = &s5m8767_others_ops,
> + .type = REGULATOR_VOLTAGE,
> + .owner = THIS_MODULE,
> + }, {
> + .name = "CP 32KHz",
> + .id = S5M8767_32KHZAP_EN,
> + .ops = &s5m8767_others_ops,
> + .type = REGULATOR_VOLTAGE,
> + .owner = THIS_MODULE,
> + },
Do these actually share anything with the other regulators? If not then
I guess it's better to do with the struct clk framework.
> + if (!pdata) {
> + dev_err(pdev->dev.parent, "Platform data not supplied\n");
> + return -ENODEV;
> + }
It should be possible to register without platform data now (giving
readback only support). Older versions of the regulator API required
constraints.
> + dev_warn(&pdev->dev, "Duplicated gpio
> request"
> + " for SET3\n");
Please keep the strings on one line (it makes grepping for errors
easier).
^ permalink raw reply
* Re: [PATCH] usb: fix unaligned access
From: Fabian van der Werf @ 2011-10-23 9:29 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox
In-Reply-To: <20111022202035.GK23421@pengutronix.de>
>
> Looks like a valid patch, I wonder that this never was a problem before.
> ARM should break here aswell I think. What architecture are you using?
>
I am working with a pandaboard (arm cortex a9). The pandaboard has a
usb ethernet controller, so I need usb to boot over tftp. I guess that
most arm configurations don't need usb for booting, and in that case
you won't run into this problem.
Regards,
Fabian
> Sascha
>
>>
>> diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
>> index 7039a2c..369a393 100644
>> --- a/drivers/usb/core/usb.c
>> +++ b/drivers/usb/core/usb.c
>> @@ -50,6 +50,7 @@
>> #include <driver.h>
>> #include <linux/ctype.h>
>> #include <asm/byteorder.h>
>> +#include <asm/unaligned.h>
>> #include <xfuncs.h>
>> #include <init.h>
>>
>> @@ -1071,6 +1072,7 @@ static int usb_hub_configure(struct usb_device *dev)
>> struct usb_hub_status *hubsts;
>> int i;
>> struct usb_hub_device *hub;
>> + unsigned short hub_chars;
>>
>> hub = xzalloc(sizeof (*hub));
>> dev->hub = hub;
>> @@ -1100,8 +1102,8 @@ static int usb_hub_configure(struct usb_device *dev)
>> }
>> memcpy((unsigned char *)&hub->desc, buffer, descriptor->bLength);
>> /* adjust 16bit values */
>> - hub->desc.wHubCharacteristics =
>> - le16_to_cpu(descriptor->wHubCharacteristics);
>> + hub_chars = le16_to_cpu(get_unaligned(&descriptor->wHubCharacteristics));
>> + put_unaligned(hub_chars, &hub->desc.wHubCharacteristics);
>> /* set the bitmap */
>> bitmap = (unsigned char *)&hub->desc.DeviceRemovable[0];
>> /* devices not removable by default */
>> @@ -1118,7 +1120,7 @@ static int usb_hub_configure(struct usb_device *dev)
>> dev->maxchild = descriptor->bNbrPorts;
>> USB_HUB_PRINTF("%d ports detected\n", dev->maxchild);
>>
>> - switch (hub->desc.wHubCharacteristics & HUB_CHAR_LPSM) {
>> + switch (hub_chars & HUB_CHAR_LPSM) {
>> case 0x00:
>> USB_HUB_PRINTF("ganged power switching\n");
>> break;
>> @@ -1131,12 +1133,12 @@ static int usb_hub_configure(struct usb_device *dev)
>> break;
>> }
>>
>> - if (hub->desc.wHubCharacteristics & HUB_CHAR_COMPOUND)
>> + if (hub_chars & HUB_CHAR_COMPOUND)
>> USB_HUB_PRINTF("part of a compound device\n");
>> else
>> USB_HUB_PRINTF("standalone hub\n");
>>
>> - switch (hub->desc.wHubCharacteristics & HUB_CHAR_OCPM) {
>> + switch (hub_chars & HUB_CHAR_OCPM) {
>> case 0x00:
>> USB_HUB_PRINTF("global over-current protection\n");
>> break;
>> diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
>> index 72f1c14..20c518a 100644
>> --- a/drivers/usb/host/ehci-hcd.c
>> +++ b/drivers/usb/host/ehci-hcd.c
>> @@ -33,6 +33,7 @@
>> #include <errno.h>
>> #include <usb/ehci.h>
>> #include <asm/mmu.h>
>> +#include <asm/unaligned.h>
>>
>> #include "ehci.h"
>>
>> @@ -795,6 +796,7 @@ static int ehci_init(struct usb_host *host)
>> struct ehci_priv *ehci = to_ehci(host);
>> uint32_t reg;
>> uint32_t cmd;
>> + unsigned short hub_chars;
>>
>> ehci_halt(ehci);
>>
>> @@ -819,12 +821,15 @@ static int ehci_init(struct usb_host *host)
>> reg = ehci_readl(&ehci->hccr->cr_hcsparams);
>> descriptor.hub.bNbrPorts = HCS_N_PORTS(reg);
>>
>> + hub_chars = get_unaligned(&descriptor.hub.wHubCharacteristics);
>> /* Port Indicators */
>> if (HCS_INDICATOR(reg))
>> - descriptor.hub.wHubCharacteristics |= 0x80;
>> + hub_chars |= 0x80;
>> /* Port Power Control */
>> if (HCS_PPC(reg))
>> - descriptor.hub.wHubCharacteristics |= 0x01;
>> + hub_chars |= 0x01;
>> +
>> + put_unaligned(hub_chars, &descriptor.hub.wHubCharacteristics);
>>
>> /* Start the host controller. */
>> cmd = ehci_readl(&ehci->hcor->or_usbcmd);
>> --
>> 1.7.0.4
>>
>>
>> _______________________________________________
>> barebox mailing list
>> barebox@lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/barebox
>>
>
> --
> Pengutronix e.K. | |
> Industrial Linux Solutions | http://www.pengutronix.de/ |
> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
> Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
>
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply
* [PATCH 03/12] staging: et131x: Remove call to find pci pm capability
From: Mark Einon @ 2011-10-23 9:22 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-kernel, Mark Einon
In-Reply-To: <1319361774-3148-1-git-send-email-mark.einon@gmail.com>
pci_find_capability is called, but not used and is now redundant as
power management is handled elsewhere. Removed.
Signed-off-by: Mark Einon <mark.einon@gmail.com>
---
drivers/staging/et131x/et131x.c | 14 --------------
1 files changed, 0 insertions(+), 14 deletions(-)
diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c
index f521e33..9383c5c 100644
--- a/drivers/staging/et131x/et131x.c
+++ b/drivers/staging/et131x/et131x.c
@@ -4356,7 +4356,6 @@ static int __devinit et131x_pci_setup(struct pci_dev *pdev,
const struct pci_device_id *ent)
{
int result;
- int pm_cap;
struct net_device *netdev;
struct et131x_adapter *adapter;
int ii;
@@ -4380,19 +4379,6 @@ static int __devinit et131x_pci_setup(struct pci_dev *pdev,
pci_set_master(pdev);
- /* Query PCI for Power Mgmt Capabilities
- *
- * NOTE: Now reading PowerMgmt in another location; is this still
- * needed?
- */
- pm_cap = pci_find_capability(pdev, PCI_CAP_ID_PM);
- if (!pm_cap) {
- dev_err(&pdev->dev,
- "Cannot find Power Management capabilities\n");
- result = -EIO;
- goto err_release_res;
- }
-
/* Check the DMA addressing support of this device */
if (!dma_set_mask(&pdev->dev, DMA_BIT_MASK(64))) {
result = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64));
--
1.7.6.4
^ permalink raw reply related
* [PATCH 04/12] staging: et131x: Remove unused rx_ring.recv_packet_pool
From: Mark Einon @ 2011-10-23 9:22 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-kernel, Mark Einon
In-Reply-To: <1319361774-3148-1-git-send-email-mark.einon@gmail.com>
tx_ring.recv_packet_pool is unused, even in the original driver code.
Removed.
Signed-off-by: Mark Einon <mark.einon@gmail.com>
---
drivers/staging/et131x/et131x.c | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c
index 9383c5c..cf6f7a2 100644
--- a/drivers/staging/et131x/et131x.c
+++ b/drivers/staging/et131x/et131x.c
@@ -337,8 +337,6 @@ struct rx_ring {
bool unfinished_receives;
- struct list_head recv_packet_pool;
-
/* lookaside lists */
struct kmem_cache *recv_lookaside;
};
--
1.7.6.4
^ permalink raw reply related
* Re: [RFC] subdevice PM: .s_power() deprecation?
From: Laurent Pinchart @ 2011-10-23 9:26 UTC (permalink / raw)
To: Sylwester Nawrocki
Cc: Sakari Ailus, Guennadi Liakhovetski, Linux Media Mailing List,
Tomasz Stanislawski
In-Reply-To: <4EA3D7DB.4000908@gmail.com>
Hi Sylwester,
On Sunday 23 October 2011 11:01:15 Sylwester Nawrocki wrote:
> On 10/23/2011 10:44 AM, Sakari Ailus wrote:
> > Sylwester Nawrocki wrote:
> ...
>
> >>>> 2. In some of our camera pipeline setups - "Sensor - MIPI-CSI receiver
> >>>> - host/DMA",
> >>>>
> >>>> the sensor won't boot properly if all MIPI-CSI regulators aren't
> >>>> enabled. So the MIPI-CSI receiver must always be powered on before
> >>>> the sensor. With the subdevs doing their own magic wrt to power
> >>>> control the situation is getting slightly out of control.
> >>>
> >>> How about this: CSI-2 receiver implements a few new regulators which
> >>> the sensor driver then requests to be enabled. Would that work for
> >>> you?
> >>
> >> No, I don't like that... :)
> >>
> >> We would have to standardize the regulator supply names, etc. Such
> >> approach would be more difficult to align with runtime/system
> >> suspend/resume. Also the sensor drivers should be independent on other
> >> drivers. The MIPI-CSI receiver is more specific to the host, rather
> >> than a sensor.
> >>
> >> Not all sensors need MIPI-CSI, some just use parallel video bus.
> >
> > The sensor drivers are responsible for the regulators they want to use,
> > right? If they need no CSI-2 related regulators then they just ignore
>
> Only for the regulator supplies for their device. In this case the sensor
> driver would have to touch MIPI-CSI device regulator supplies.
>
> > them as any other regulators the sensor doesn't need.
> >
> > The names of the regulators could come from the platform data, they're
> > board specific anyway. I can't see another way to do this without having
>
> No, you don't want regulator supply names in any platform data struct.
> The platform code binds regulator supplies to the devices, whether it is DT
> based or not.
You can still add a regulator name field to the sensor platform data, or a
link to the regulator in the device tree, and use that in the sensor driver if
present.
I'm not telling it's a good solution, but it's technically doable.
> > platform code to do this which is not quite compatible with the idea of
> > the device tree.
>
> Now I just use s_power callback in our drivers and it all works well.
Having the sensor driver calling the CSI-2 receiver s_power callback directly
sounds a bit hackish to me. If we really want to call subdev operations from
another subdev driver we'll need to specify that, as the current mode of
operation (at least in my understanding) is that subdev operations are only
called by host drivers.
--
Regards,
Laurent Pinchart
^ permalink raw reply
* [PATCH 07/12] staging: et131x: Remove more forward declarations
From: Mark Einon @ 2011-10-23 9:22 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-kernel, Mark Einon
In-Reply-To: <1319361774-3148-1-git-send-email-mark.einon@gmail.com>
Moved functions in et131x.c file to remove the following forward
declarations:
et131x_soft_reset
et131x_isr_handler
et131x_device_alloc
Signed-off-by: Mark Einon <mark.einon@gmail.com>
---
drivers/staging/et131x/et131x.c | 505 +++++++++++++++++++--------------------
1 files changed, 251 insertions(+), 254 deletions(-)
diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c
index 2947635..44fff21 100644
--- a/drivers/staging/et131x/et131x.c
+++ b/drivers/staging/et131x/et131x.c
@@ -576,13 +576,10 @@ struct et131x_adapter {
struct net_device_stats net_stats;
};
-void et131x_soft_reset(struct et131x_adapter *adapter);
-void et131x_isr_handler(struct work_struct *work);
void et1310_setup_device_for_multicast(struct et131x_adapter *adapter);
void et1310_setup_device_for_unicast(struct et131x_adapter *adapter);
void et131x_up(struct net_device *netdev);
void et131x_down(struct net_device *netdev);
-struct net_device *et131x_device_alloc(void);
void et131x_enable_txrx(struct net_device *netdev);
void et131x_disable_txrx(struct net_device *netdev);
int et1310_in_phy_coma(struct et131x_adapter *adapter);
@@ -1970,6 +1967,21 @@ void et131x_adapter_setup(struct et131x_adapter *adapter)
}
/**
+ * et131x_soft_reset - Issue a soft reset to the hardware, complete for ET1310
+ * @adapter: pointer to our private adapter structure
+ */
+void et131x_soft_reset(struct et131x_adapter *adapter)
+{
+ /* Disable MAC Core */
+ writel(0xc00f0000, &adapter->regs->mac.cfg1);
+
+ /* Set everything to a reset value */
+ writel(0x7F, &adapter->regs->global.sw_reset);
+ writel(0x000f0000, &adapter->regs->mac.cfg1);
+ writel(0x00000000, &adapter->regs->mac.cfg1);
+}
+
+/**
* et1310_enable_phy_coma - called when network cable is unplugged
* @adapter: pointer to our adapter structure
*
@@ -4097,21 +4109,6 @@ void et131x_error_timer_handler(unsigned long data)
}
/**
- * et131x_soft_reset - Issue a soft reset to the hardware, complete for ET1310
- * @adapter: pointer to our private adapter structure
- */
-void et131x_soft_reset(struct et131x_adapter *adapter)
-{
- /* Disable MAC Core */
- writel(0xc00f0000, &adapter->regs->mac.cfg1);
-
- /* Set everything to a reset value */
- writel(0x7F, &adapter->regs->global.sw_reset);
- writel(0x000f0000, &adapter->regs->mac.cfg1);
- writel(0x00000000, &adapter->regs->mac.cfg1);
-}
-
-/**
* et131x_adapter_memory_alloc
* @adapter: pointer to our private adapter structure
*
@@ -4365,200 +4362,6 @@ void et131x_disable_interrupts(struct et131x_adapter *adapter)
}
/**
- * et131x_pci_setup - Perform device initialization
- * @pdev: a pointer to the device's pci_dev structure
- * @ent: this device's entry in the pci_device_id table
- *
- * Returns 0 on success, errno on failure (as defined in errno.h)
- *
- * Registered in the pci_driver structure, this function is called when the
- * PCI subsystem finds a new PCI device which matches the information
- * contained in the pci_device_id table. This routine is the equivalent to
- * a device insertion routine.
- */
-static int __devinit et131x_pci_setup(struct pci_dev *pdev,
- const struct pci_device_id *ent)
-{
- int result;
- struct net_device *netdev;
- struct et131x_adapter *adapter;
- int ii;
-
- result = pci_enable_device(pdev);
- if (result) {
- dev_err(&pdev->dev, "pci_enable_device() failed\n");
- goto err_out;
- }
-
- /* Perform some basic PCI checks */
- if (!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM)) {
- dev_err(&pdev->dev, "Can't find PCI device's base address\n");
- goto err_disable;
- }
-
- if (pci_request_regions(pdev, DRIVER_NAME)) {
- dev_err(&pdev->dev, "Can't get PCI resources\n");
- goto err_disable;
- }
-
- pci_set_master(pdev);
-
- /* Check the DMA addressing support of this device */
- if (!dma_set_mask(&pdev->dev, DMA_BIT_MASK(64))) {
- result = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64));
- if (result) {
- dev_err(&pdev->dev,
- "Unable to obtain 64 bit DMA for consistent allocations\n");
- goto err_release_res;
- }
- } else if (!dma_set_mask(&pdev->dev, DMA_BIT_MASK(32))) {
- result = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
- if (result) {
- dev_err(&pdev->dev,
- "Unable to obtain 32 bit DMA for consistent allocations\n");
- goto err_release_res;
- }
- } else {
- dev_err(&pdev->dev, "No usable DMA addressing method\n");
- result = -EIO;
- goto err_release_res;
- }
-
- /* Allocate netdev and private adapter structs */
- netdev = et131x_device_alloc();
- if (!netdev) {
- dev_err(&pdev->dev, "Couldn't alloc netdev struct\n");
- result = -ENOMEM;
- goto err_release_res;
- }
-
- SET_NETDEV_DEV(netdev, &pdev->dev);
- et131x_set_ethtool_ops(netdev);
-
- adapter = et131x_adapter_init(netdev, pdev);
-
- /* Initialise the PCI setup for the device */
- et131x_pci_init(adapter, pdev);
-
- /* Map the bus-relative registers to system virtual memory */
- adapter->regs = pci_ioremap_bar(pdev, 0);
- if (!adapter->regs) {
- dev_err(&pdev->dev, "Cannot map device registers\n");
- result = -ENOMEM;
- goto err_free_dev;
- }
-
- /* If Phy COMA mode was enabled when we went down, disable it here. */
- writel(ET_PMCSR_INIT, &adapter->regs->global.pm_csr);
-
- /* Issue a global reset to the et1310 */
- et131x_soft_reset(adapter);
-
- /* Disable all interrupts (paranoid) */
- et131x_disable_interrupts(adapter);
-
- /* Allocate DMA memory */
- result = et131x_adapter_memory_alloc(adapter);
- if (result) {
- dev_err(&pdev->dev, "Could not alloc adapater memory (DMA)\n");
- goto err_iounmap;
- }
-
- /* Init send data structures */
- et131x_init_send(adapter);
-
- /* Set up the task structure for the ISR's deferred handler */
- INIT_WORK(&adapter->task, et131x_isr_handler);
-
- /* Copy address into the net_device struct */
- memcpy(netdev->dev_addr, adapter->addr, ETH_ALEN);
-
- /* Init variable for counting how long we do not have link status */
- adapter->boot_coma = 0;
- et1310_disable_phy_coma(adapter);
-
- /* Setup the mii_bus struct */
- adapter->mii_bus = mdiobus_alloc();
- if (!adapter->mii_bus) {
- dev_err(&pdev->dev, "Alloc of mii_bus struct failed\n");
- goto err_mem_free;
- }
-
- adapter->mii_bus->name = "et131x_eth_mii";
- snprintf(adapter->mii_bus->id, MII_BUS_ID_SIZE, "%x",
- (adapter->pdev->bus->number << 8) | adapter->pdev->devfn);
- adapter->mii_bus->priv = netdev;
- adapter->mii_bus->read = et131x_mdio_read;
- adapter->mii_bus->write = et131x_mdio_write;
- adapter->mii_bus->reset = et131x_mdio_reset;
- adapter->mii_bus->irq = kmalloc(sizeof(int)*PHY_MAX_ADDR, GFP_KERNEL);
- if (!adapter->mii_bus->irq) {
- dev_err(&pdev->dev, "mii_bus irq allocation failed\n");
- goto err_mdio_free;
- }
-
- for (ii = 0; ii < PHY_MAX_ADDR; ii++)
- adapter->mii_bus->irq[ii] = PHY_POLL;
-
- if (mdiobus_register(adapter->mii_bus)) {
- dev_err(&pdev->dev, "failed to register MII bus\n");
- mdiobus_free(adapter->mii_bus);
- goto err_mdio_free_irq;
- }
-
- if (et131x_mii_probe(netdev)) {
- dev_err(&pdev->dev, "failed to probe MII bus\n");
- goto err_mdio_unregister;
- }
-
- /* Setup et1310 as per the documentation */
- et131x_adapter_setup(adapter);
-
- /* We can enable interrupts now
- *
- * NOTE - Because registration of interrupt handler is done in the
- * device's open(), defer enabling device interrupts to that
- * point
- */
-
- /* Register the net_device struct with the Linux network layer */
- result = register_netdev(netdev);
- if (result != 0) {
- dev_err(&pdev->dev, "register_netdev() failed\n");
- goto err_mdio_unregister;
- }
-
- /* Register the net_device struct with the PCI subsystem. Save a copy
- * of the PCI config space for this device now that the device has
- * been initialized, just in case it needs to be quickly restored.
- */
- pci_set_drvdata(pdev, netdev);
- pci_save_state(adapter->pdev);
-
- return result;
-
-err_mdio_unregister:
- mdiobus_unregister(adapter->mii_bus);
-err_mdio_free_irq:
- kfree(adapter->mii_bus->irq);
-err_mdio_free:
- mdiobus_free(adapter->mii_bus);
-err_mem_free:
- et131x_adapter_memory_free(adapter);
-err_iounmap:
- iounmap(adapter->regs);
-err_free_dev:
- pci_dev_put(pdev);
- free_netdev(netdev);
-err_release_res:
- pci_release_regions(pdev);
-err_disable:
- pci_disable_device(pdev);
-err_out:
- return result;
-}
-
-/**
* et131x_pci_remove
* @pdev: a pointer to the device's pci_dev structure
*
@@ -4614,48 +4417,6 @@ static int et131x_resume(struct device *dev)
return 0;
}
-static SIMPLE_DEV_PM_OPS(et131x_pm_ops, et131x_suspend, et131x_resume);
-#define ET131X_PM_OPS (&et131x_pm_ops)
-#else
-#define ET131X_PM_OPS NULL
-#endif
-
-static DEFINE_PCI_DEVICE_TABLE(et131x_pci_table) = {
- { PCI_VDEVICE(ATT, ET131X_PCI_DEVICE_ID_GIG), 0UL},
- { PCI_VDEVICE(ATT, ET131X_PCI_DEVICE_ID_FAST), 0UL},
- {0,}
-};
-MODULE_DEVICE_TABLE(pci, et131x_pci_table);
-
-static struct pci_driver et131x_driver = {
- .name = DRIVER_NAME,
- .id_table = et131x_pci_table,
- .probe = et131x_pci_setup,
- .remove = __devexit_p(et131x_pci_remove),
- .driver.pm = ET131X_PM_OPS,
-};
-
-/**
- * et131x_init_module - The "main" entry point called on driver initialization
- *
- * Returns 0 on success, errno on failure (as defined in errno.h)
- */
-static int __init et131x_init_module(void)
-{
- return pci_register_driver(&et131x_driver);
-}
-
-/**
- * et131x_cleanup_module - The entry point called on driver cleanup
- */
-static void __exit et131x_cleanup_module(void)
-{
- pci_unregister_driver(&et131x_driver);
-}
-
-module_init(et131x_init_module);
-module_exit(et131x_cleanup_module);
-
/* ISR functions */
/**
@@ -5528,3 +5289,239 @@ struct net_device *et131x_device_alloc(void)
return netdev;
}
+/**
+ * et131x_pci_setup - Perform device initialization
+ * @pdev: a pointer to the device's pci_dev structure
+ * @ent: this device's entry in the pci_device_id table
+ *
+ * Returns 0 on success, errno on failure (as defined in errno.h)
+ *
+ * Registered in the pci_driver structure, this function is called when the
+ * PCI subsystem finds a new PCI device which matches the information
+ * contained in the pci_device_id table. This routine is the equivalent to
+ * a device insertion routine.
+ */
+static int __devinit et131x_pci_setup(struct pci_dev *pdev,
+ const struct pci_device_id *ent)
+{
+ int result;
+ struct net_device *netdev;
+ struct et131x_adapter *adapter;
+ int ii;
+
+ result = pci_enable_device(pdev);
+ if (result) {
+ dev_err(&pdev->dev, "pci_enable_device() failed\n");
+ goto err_out;
+ }
+
+ /* Perform some basic PCI checks */
+ if (!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM)) {
+ dev_err(&pdev->dev, "Can't find PCI device's base address\n");
+ goto err_disable;
+ }
+
+ if (pci_request_regions(pdev, DRIVER_NAME)) {
+ dev_err(&pdev->dev, "Can't get PCI resources\n");
+ goto err_disable;
+ }
+
+ pci_set_master(pdev);
+
+ /* Check the DMA addressing support of this device */
+ if (!dma_set_mask(&pdev->dev, DMA_BIT_MASK(64))) {
+ result = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64));
+ if (result) {
+ dev_err(&pdev->dev,
+ "Unable to obtain 64 bit DMA for consistent allocations\n");
+ goto err_release_res;
+ }
+ } else if (!dma_set_mask(&pdev->dev, DMA_BIT_MASK(32))) {
+ result = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
+ if (result) {
+ dev_err(&pdev->dev,
+ "Unable to obtain 32 bit DMA for consistent allocations\n");
+ goto err_release_res;
+ }
+ } else {
+ dev_err(&pdev->dev, "No usable DMA addressing method\n");
+ result = -EIO;
+ goto err_release_res;
+ }
+
+ /* Allocate netdev and private adapter structs */
+ netdev = et131x_device_alloc();
+ if (!netdev) {
+ dev_err(&pdev->dev, "Couldn't alloc netdev struct\n");
+ result = -ENOMEM;
+ goto err_release_res;
+ }
+
+ SET_NETDEV_DEV(netdev, &pdev->dev);
+ et131x_set_ethtool_ops(netdev);
+
+ adapter = et131x_adapter_init(netdev, pdev);
+
+ /* Initialise the PCI setup for the device */
+ et131x_pci_init(adapter, pdev);
+
+ /* Map the bus-relative registers to system virtual memory */
+ adapter->regs = pci_ioremap_bar(pdev, 0);
+ if (!adapter->regs) {
+ dev_err(&pdev->dev, "Cannot map device registers\n");
+ result = -ENOMEM;
+ goto err_free_dev;
+ }
+
+ /* If Phy COMA mode was enabled when we went down, disable it here. */
+ writel(ET_PMCSR_INIT, &adapter->regs->global.pm_csr);
+
+ /* Issue a global reset to the et1310 */
+ et131x_soft_reset(adapter);
+
+ /* Disable all interrupts (paranoid) */
+ et131x_disable_interrupts(adapter);
+
+ /* Allocate DMA memory */
+ result = et131x_adapter_memory_alloc(adapter);
+ if (result) {
+ dev_err(&pdev->dev, "Could not alloc adapater memory (DMA)\n");
+ goto err_iounmap;
+ }
+
+ /* Init send data structures */
+ et131x_init_send(adapter);
+
+ /* Set up the task structure for the ISR's deferred handler */
+ INIT_WORK(&adapter->task, et131x_isr_handler);
+
+ /* Copy address into the net_device struct */
+ memcpy(netdev->dev_addr, adapter->addr, ETH_ALEN);
+
+ /* Init variable for counting how long we do not have link status */
+ adapter->boot_coma = 0;
+ et1310_disable_phy_coma(adapter);
+
+ /* Setup the mii_bus struct */
+ adapter->mii_bus = mdiobus_alloc();
+ if (!adapter->mii_bus) {
+ dev_err(&pdev->dev, "Alloc of mii_bus struct failed\n");
+ goto err_mem_free;
+ }
+
+ adapter->mii_bus->name = "et131x_eth_mii";
+ snprintf(adapter->mii_bus->id, MII_BUS_ID_SIZE, "%x",
+ (adapter->pdev->bus->number << 8) | adapter->pdev->devfn);
+ adapter->mii_bus->priv = netdev;
+ adapter->mii_bus->read = et131x_mdio_read;
+ adapter->mii_bus->write = et131x_mdio_write;
+ adapter->mii_bus->reset = et131x_mdio_reset;
+ adapter->mii_bus->irq = kmalloc(sizeof(int)*PHY_MAX_ADDR, GFP_KERNEL);
+ if (!adapter->mii_bus->irq) {
+ dev_err(&pdev->dev, "mii_bus irq allocation failed\n");
+ goto err_mdio_free;
+ }
+
+ for (ii = 0; ii < PHY_MAX_ADDR; ii++)
+ adapter->mii_bus->irq[ii] = PHY_POLL;
+
+ if (mdiobus_register(adapter->mii_bus)) {
+ dev_err(&pdev->dev, "failed to register MII bus\n");
+ mdiobus_free(adapter->mii_bus);
+ goto err_mdio_free_irq;
+ }
+
+ if (et131x_mii_probe(netdev)) {
+ dev_err(&pdev->dev, "failed to probe MII bus\n");
+ goto err_mdio_unregister;
+ }
+
+ /* Setup et1310 as per the documentation */
+ et131x_adapter_setup(adapter);
+
+ /* We can enable interrupts now
+ *
+ * NOTE - Because registration of interrupt handler is done in the
+ * device's open(), defer enabling device interrupts to that
+ * point
+ */
+
+ /* Register the net_device struct with the Linux network layer */
+ result = register_netdev(netdev);
+ if (result != 0) {
+ dev_err(&pdev->dev, "register_netdev() failed\n");
+ goto err_mdio_unregister;
+ }
+
+ /* Register the net_device struct with the PCI subsystem. Save a copy
+ * of the PCI config space for this device now that the device has
+ * been initialized, just in case it needs to be quickly restored.
+ */
+ pci_set_drvdata(pdev, netdev);
+ pci_save_state(adapter->pdev);
+
+ return result;
+
+err_mdio_unregister:
+ mdiobus_unregister(adapter->mii_bus);
+err_mdio_free_irq:
+ kfree(adapter->mii_bus->irq);
+err_mdio_free:
+ mdiobus_free(adapter->mii_bus);
+err_mem_free:
+ et131x_adapter_memory_free(adapter);
+err_iounmap:
+ iounmap(adapter->regs);
+err_free_dev:
+ pci_dev_put(pdev);
+ free_netdev(netdev);
+err_release_res:
+ pci_release_regions(pdev);
+err_disable:
+ pci_disable_device(pdev);
+err_out:
+ return result;
+}
+
+static SIMPLE_DEV_PM_OPS(et131x_pm_ops, et131x_suspend, et131x_resume);
+#define ET131X_PM_OPS (&et131x_pm_ops)
+#else
+#define ET131X_PM_OPS NULL
+#endif
+
+static DEFINE_PCI_DEVICE_TABLE(et131x_pci_table) = {
+ { PCI_VDEVICE(ATT, ET131X_PCI_DEVICE_ID_GIG), 0UL},
+ { PCI_VDEVICE(ATT, ET131X_PCI_DEVICE_ID_FAST), 0UL},
+ {0,}
+};
+MODULE_DEVICE_TABLE(pci, et131x_pci_table);
+
+static struct pci_driver et131x_driver = {
+ .name = DRIVER_NAME,
+ .id_table = et131x_pci_table,
+ .probe = et131x_pci_setup,
+ .remove = __devexit_p(et131x_pci_remove),
+ .driver.pm = ET131X_PM_OPS,
+};
+
+/**
+ * et131x_init_module - The "main" entry point called on driver initialization
+ *
+ * Returns 0 on success, errno on failure (as defined in errno.h)
+ */
+static int __init et131x_init_module(void)
+{
+ return pci_register_driver(&et131x_driver);
+}
+
+/**
+ * et131x_cleanup_module - The entry point called on driver cleanup
+ */
+static void __exit et131x_cleanup_module(void)
+{
+ pci_unregister_driver(&et131x_driver);
+}
+
+module_init(et131x_init_module);
+module_exit(et131x_cleanup_module);
+
--
1.7.6.4
^ permalink raw reply related
* [PATCH 09/12] staging: et131x: Remove even more forward declarations
From: Mark Einon @ 2011-10-23 9:22 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-kernel, Mark Einon
In-Reply-To: <1319361774-3148-1-git-send-email-mark.einon@gmail.com>
Moved functions in et131x.c file to remove the forward declarations of:
et1310_in_phy_coma
et1310_phy_access_mii_bit
et131x_phy_mii_read
et131x_mii_write
et131x_rx_dma_memory_free
Signed-off-by: Mark Einon <mark.einon@gmail.com>
---
drivers/staging/et131x/et131x.c | 395 +++++++++++++++++++--------------------
1 files changed, 193 insertions(+), 202 deletions(-)
diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c
index 208c69f..2e621aa 100644
--- a/drivers/staging/et131x/et131x.c
+++ b/drivers/staging/et131x/et131x.c
@@ -576,15 +576,6 @@ struct et131x_adapter {
struct net_device_stats net_stats;
};
-int et1310_in_phy_coma(struct et131x_adapter *adapter);
-void et1310_phy_access_mii_bit(struct et131x_adapter *adapter,
- u16 action,
- u16 regnum, u16 bitnum, u8 *value);
-int et131x_phy_mii_read(struct et131x_adapter *adapter, u8 addr,
- u8 reg, u16 *value);
-int32_t et131x_mii_write(struct et131x_adapter *adapter,
- u8 reg, u16 value);
-void et131x_rx_dma_memory_free(struct et131x_adapter *adapter);
void et131x_rx_dma_disable(struct et131x_adapter *adapter);
void et131x_rx_dma_enable(struct et131x_adapter *adapter);
void et131x_init_send(struct et131x_adapter *adapter);
@@ -1019,6 +1010,21 @@ void et1310_config_mac_regs2(struct et131x_adapter *adapter)
}
}
+/**
+ * et1310_in_phy_coma - check if the device is in phy coma
+ * @adapter: pointer to our adapter structure
+ *
+ * Returns 0 if the device is not in phy coma, 1 if it is in phy coma
+ */
+int et1310_in_phy_coma(struct et131x_adapter *adapter)
+{
+ u32 pmcsr;
+
+ pmcsr = readl(&adapter->regs->global.pm_csr);
+
+ return ET_PM_PHY_SW_COMA & pmcsr ? 1 : 0;
+}
+
void et1310_setup_device_for_multicast(struct et131x_adapter *adapter)
{
struct rxmac_regs __iomem *rxmac = &adapter->regs->rxmac;
@@ -1318,6 +1324,184 @@ void et1310_config_macstat_regs(struct et131x_adapter *adapter)
writel(0xFFFE7E8B, &macstat->carry_reg2_mask);
}
+/**
+ * et131x_phy_mii_read - Read from the PHY through the MII Interface on the MAC
+ * @adapter: pointer to our private adapter structure
+ * @addr: the address of the transceiver
+ * @reg: the register to read
+ * @value: pointer to a 16-bit value in which the value will be stored
+ *
+ * Returns 0 on success, errno on failure (as defined in errno.h)
+ */
+int et131x_phy_mii_read(struct et131x_adapter *adapter, u8 addr,
+ u8 reg, u16 *value)
+{
+ struct mac_regs __iomem *mac = &adapter->regs->mac;
+ int status = 0;
+ u32 delay = 0;
+ u32 mii_addr;
+ u32 mii_cmd;
+ u32 mii_indicator;
+
+ /* Save a local copy of the registers we are dealing with so we can
+ * set them back
+ */
+ mii_addr = readl(&mac->mii_mgmt_addr);
+ mii_cmd = readl(&mac->mii_mgmt_cmd);
+
+ /* Stop the current operation */
+ writel(0, &mac->mii_mgmt_cmd);
+
+ /* Set up the register we need to read from on the correct PHY */
+ writel(MII_ADDR(addr, reg), &mac->mii_mgmt_addr);
+
+ writel(0x1, &mac->mii_mgmt_cmd);
+
+ do {
+ udelay(50);
+ delay++;
+ mii_indicator = readl(&mac->mii_mgmt_indicator);
+ } while ((mii_indicator & MGMT_WAIT) && delay < 50);
+
+ /* If we hit the max delay, we could not read the register */
+ if (delay == 50) {
+ dev_warn(&adapter->pdev->dev,
+ "reg 0x%08x could not be read\n", reg);
+ dev_warn(&adapter->pdev->dev, "status is 0x%08x\n",
+ mii_indicator);
+
+ status = -EIO;
+ }
+
+ /* If we hit here we were able to read the register and we need to
+ * return the value to the caller */
+ *value = readl(&mac->mii_mgmt_stat) & 0xFFFF;
+
+ /* Stop the read operation */
+ writel(0, &mac->mii_mgmt_cmd);
+
+ /* set the registers we touched back to the state at which we entered
+ * this function
+ */
+ writel(mii_addr, &mac->mii_mgmt_addr);
+ writel(mii_cmd, &mac->mii_mgmt_cmd);
+
+ return status;
+}
+
+int et131x_mii_read(struct et131x_adapter *adapter, u8 reg, u16 *value)
+{
+ struct phy_device *phydev = adapter->phydev;
+
+ if (!phydev)
+ return -EIO;
+
+ return et131x_phy_mii_read(adapter, phydev->addr, reg, value);
+}
+
+/**
+ * et131x_mii_write - Write to a PHY register through the MII interface of the MAC
+ * @adapter: pointer to our private adapter structure
+ * @reg: the register to read
+ * @value: 16-bit value to write
+ *
+ * FIXME: one caller in netdev still
+ *
+ * Return 0 on success, errno on failure (as defined in errno.h)
+ */
+int et131x_mii_write(struct et131x_adapter *adapter, u8 reg, u16 value)
+{
+ struct mac_regs __iomem *mac = &adapter->regs->mac;
+ struct phy_device *phydev = adapter->phydev;
+ int status = 0;
+ u8 addr;
+ u32 delay = 0;
+ u32 mii_addr;
+ u32 mii_cmd;
+ u32 mii_indicator;
+
+ if (!phydev)
+ return -EIO;
+
+ addr = phydev->addr;
+
+ /* Save a local copy of the registers we are dealing with so we can
+ * set them back
+ */
+ mii_addr = readl(&mac->mii_mgmt_addr);
+ mii_cmd = readl(&mac->mii_mgmt_cmd);
+
+ /* Stop the current operation */
+ writel(0, &mac->mii_mgmt_cmd);
+
+ /* Set up the register we need to write to on the correct PHY */
+ writel(MII_ADDR(addr, reg), &mac->mii_mgmt_addr);
+
+ /* Add the value to write to the registers to the mac */
+ writel(value, &mac->mii_mgmt_ctrl);
+
+ do {
+ udelay(50);
+ delay++;
+ mii_indicator = readl(&mac->mii_mgmt_indicator);
+ } while ((mii_indicator & MGMT_BUSY) && delay < 100);
+
+ /* If we hit the max delay, we could not write the register */
+ if (delay == 100) {
+ u16 tmp;
+
+ dev_warn(&adapter->pdev->dev,
+ "reg 0x%08x could not be written", reg);
+ dev_warn(&adapter->pdev->dev, "status is 0x%08x\n",
+ mii_indicator);
+ dev_warn(&adapter->pdev->dev, "command is 0x%08x\n",
+ readl(&mac->mii_mgmt_cmd));
+
+ et131x_mii_read(adapter, reg, &tmp);
+
+ status = -EIO;
+ }
+ /* Stop the write operation */
+ writel(0, &mac->mii_mgmt_cmd);
+
+ /*
+ * set the registers we touched back to the state at which we entered
+ * this function
+ */
+ writel(mii_addr, &mac->mii_mgmt_addr);
+ writel(mii_cmd, &mac->mii_mgmt_cmd);
+
+ return status;
+}
+
+/* Still used from _mac for BIT_READ */
+void et1310_phy_access_mii_bit(struct et131x_adapter *adapter, u16 action,
+ u16 regnum, u16 bitnum, u8 *value)
+{
+ u16 reg;
+ u16 mask = 0x0001 << bitnum;
+
+ /* Read the requested register */
+ et131x_mii_read(adapter, regnum, ®);
+
+ switch (action) {
+ case TRUEPHY_BIT_READ:
+ *value = (reg & mask) >> bitnum;
+ break;
+
+ case TRUEPHY_BIT_SET:
+ et131x_mii_write(adapter, regnum, reg | mask);
+ break;
+
+ case TRUEPHY_BIT_CLEAR:
+ et131x_mii_write(adapter, regnum, reg & ~mask);
+ break;
+
+ default:
+ break;
+ }
+}
+
void et1310_config_flow_control(struct et131x_adapter *adapter)
{
struct phy_device *phydev = adapter->phydev;
@@ -1476,156 +1660,6 @@ int et131x_mdio_reset(struct mii_bus *bus)
return 0;
}
-int et131x_mii_read(struct et131x_adapter *adapter, u8 reg, u16 *value)
-{
- struct phy_device *phydev = adapter->phydev;
-
- if (!phydev)
- return -EIO;
-
- return et131x_phy_mii_read(adapter, phydev->addr, reg, value);
-}
-
-/**
- * et131x_phy_mii_read - Read from the PHY through the MII Interface on the MAC
- * @adapter: pointer to our private adapter structure
- * @addr: the address of the transceiver
- * @reg: the register to read
- * @value: pointer to a 16-bit value in which the value will be stored
- *
- * Returns 0 on success, errno on failure (as defined in errno.h)
- */
-int et131x_phy_mii_read(struct et131x_adapter *adapter, u8 addr,
- u8 reg, u16 *value)
-{
- struct mac_regs __iomem *mac = &adapter->regs->mac;
- int status = 0;
- u32 delay = 0;
- u32 mii_addr;
- u32 mii_cmd;
- u32 mii_indicator;
-
- /* Save a local copy of the registers we are dealing with so we can
- * set them back
- */
- mii_addr = readl(&mac->mii_mgmt_addr);
- mii_cmd = readl(&mac->mii_mgmt_cmd);
-
- /* Stop the current operation */
- writel(0, &mac->mii_mgmt_cmd);
-
- /* Set up the register we need to read from on the correct PHY */
- writel(MII_ADDR(addr, reg), &mac->mii_mgmt_addr);
-
- writel(0x1, &mac->mii_mgmt_cmd);
-
- do {
- udelay(50);
- delay++;
- mii_indicator = readl(&mac->mii_mgmt_indicator);
- } while ((mii_indicator & MGMT_WAIT) && delay < 50);
-
- /* If we hit the max delay, we could not read the register */
- if (delay == 50) {
- dev_warn(&adapter->pdev->dev,
- "reg 0x%08x could not be read\n", reg);
- dev_warn(&adapter->pdev->dev, "status is 0x%08x\n",
- mii_indicator);
-
- status = -EIO;
- }
-
- /* If we hit here we were able to read the register and we need to
- * return the value to the caller */
- *value = readl(&mac->mii_mgmt_stat) & 0xFFFF;
-
- /* Stop the read operation */
- writel(0, &mac->mii_mgmt_cmd);
-
- /* set the registers we touched back to the state at which we entered
- * this function
- */
- writel(mii_addr, &mac->mii_mgmt_addr);
- writel(mii_cmd, &mac->mii_mgmt_cmd);
-
- return status;
-}
-
-/**
- * et131x_mii_write - Write to a PHY register through the MII interface of the MAC
- * @adapter: pointer to our private adapter structure
- * @reg: the register to read
- * @value: 16-bit value to write
- *
- * FIXME: one caller in netdev still
- *
- * Return 0 on success, errno on failure (as defined in errno.h)
- */
-int et131x_mii_write(struct et131x_adapter *adapter, u8 reg, u16 value)
-{
- struct mac_regs __iomem *mac = &adapter->regs->mac;
- struct phy_device *phydev = adapter->phydev;
- int status = 0;
- u8 addr;
- u32 delay = 0;
- u32 mii_addr;
- u32 mii_cmd;
- u32 mii_indicator;
-
- if (!phydev)
- return -EIO;
-
- addr = phydev->addr;
-
- /* Save a local copy of the registers we are dealing with so we can
- * set them back
- */
- mii_addr = readl(&mac->mii_mgmt_addr);
- mii_cmd = readl(&mac->mii_mgmt_cmd);
-
- /* Stop the current operation */
- writel(0, &mac->mii_mgmt_cmd);
-
- /* Set up the register we need to write to on the correct PHY */
- writel(MII_ADDR(addr, reg), &mac->mii_mgmt_addr);
-
- /* Add the value to write to the registers to the mac */
- writel(value, &mac->mii_mgmt_ctrl);
-
- do {
- udelay(50);
- delay++;
- mii_indicator = readl(&mac->mii_mgmt_indicator);
- } while ((mii_indicator & MGMT_BUSY) && delay < 100);
-
- /* If we hit the max delay, we could not write the register */
- if (delay == 100) {
- u16 tmp;
-
- dev_warn(&adapter->pdev->dev,
- "reg 0x%08x could not be written", reg);
- dev_warn(&adapter->pdev->dev, "status is 0x%08x\n",
- mii_indicator);
- dev_warn(&adapter->pdev->dev, "command is 0x%08x\n",
- readl(&mac->mii_mgmt_cmd));
-
- et131x_mii_read(adapter, reg, &tmp);
-
- status = -EIO;
- }
- /* Stop the write operation */
- writel(0, &mac->mii_mgmt_cmd);
-
- /*
- * set the registers we touched back to the state at which we entered
- * this function
- */
- writel(mii_addr, &mac->mii_mgmt_addr);
- writel(mii_cmd, &mac->mii_mgmt_cmd);
-
- return status;
-}
-
/**
* et1310_phy_power_down - PHY power control
* @adapter: device to control
@@ -1647,34 +1681,6 @@ void et1310_phy_power_down(struct et131x_adapter *adapter, bool down)
et131x_mii_write(adapter, MII_BMCR, data);
}
-/* Still used from _mac for BIT_READ */
-void et1310_phy_access_mii_bit(struct et131x_adapter *adapter, u16 action,
- u16 regnum, u16 bitnum, u8 *value)
-{
- u16 reg;
- u16 mask = 0x0001 << bitnum;
-
- /* Read the requested register */
- et131x_mii_read(adapter, regnum, ®);
-
- switch (action) {
- case TRUEPHY_BIT_READ:
- *value = (reg & mask) >> bitnum;
- break;
-
- case TRUEPHY_BIT_SET:
- et131x_mii_write(adapter, regnum, reg | mask);
- break;
-
- case TRUEPHY_BIT_CLEAR:
- et131x_mii_write(adapter, regnum, reg & ~mask);
- break;
-
- default:
- break;
- }
-}
-
/**
* et131x_xcvr_init - Init the phy if we are setting it into force mode
* @adapter: pointer to our private adapter structure
@@ -1771,21 +1777,6 @@ void et131x_configure_global_regs(struct et131x_adapter *adapter)
/* PM functions */
/**
- * et1310_in_phy_coma - check if the device is in phy coma
- * @adapter: pointer to our adapter structure
- *
- * Returns 0 if the device is not in phy coma, 1 if it is in phy coma
- */
-int et1310_in_phy_coma(struct et131x_adapter *adapter)
-{
- u32 pmcsr;
-
- pmcsr = readl(&adapter->regs->global.pm_csr);
-
- return ET_PM_PHY_SW_COMA & pmcsr ? 1 : 0;
-}
-
-/**
* et131x_config_rx_dma_regs - Start of Rx_DMA init sequence
* @adapter: pointer to our adapter structure
*/
--
1.7.6.4
^ permalink raw reply related
* [PATCH 11/12] staging: et131x: Mainly whitespace changes to appease checkpatch
From: Mark Einon @ 2011-10-23 9:22 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-kernel, Mark Einon
In-Reply-To: <1319361774-3148-1-git-send-email-mark.einon@gmail.com>
- Whitespace changes to appease checkpatch warnings
- Removed unneeded braces around single line if/else
Signed-off-by: Mark Einon <mark.einon@gmail.com>
---
drivers/staging/et131x/et131x.c | 81 ++++++++++++++++++++++-----------------
1 files changed, 46 insertions(+), 35 deletions(-)
diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c
index 8d36da0..98c6974 100644
--- a/drivers/staging/et131x/et131x.c
+++ b/drivers/staging/et131x/et131x.c
@@ -1935,8 +1935,8 @@ void et131x_config_rx_dma_regs(struct et131x_adapter *adapter)
*/
rx_local->fbr[0]->local_full = ET_DMA10_WRAP;
writel(
- ((rx_local->fbr[0]->num_entries * LO_MARK_PERCENT_FOR_RX) / 100) - 1,
- &rx_dma->fbr1_min_des);
+ ((rx_local->fbr[0]->num_entries * LO_MARK_PERCENT_FOR_RX) / 100) - 1,
+ &rx_dma->fbr1_min_des);
#ifdef USE_FBR0
/* Now's the best time to initialize FBR0 contents */
@@ -1959,8 +1959,8 @@ void et131x_config_rx_dma_regs(struct et131x_adapter *adapter)
*/
rx_local->fbr[1]->local_full = ET_DMA10_WRAP;
writel(
- ((rx_local->fbr[1]->num_entries * LO_MARK_PERCENT_FOR_RX) / 100) - 1,
- &rx_dma->fbr0_min_des);
+ ((rx_local->fbr[1]->num_entries * LO_MARK_PERCENT_FOR_RX) / 100) - 1,
+ &rx_dma->fbr0_min_des);
#endif
/* Program the number of packets we will receive before generating an
@@ -2383,14 +2383,16 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter)
}
#ifdef USE_FBR0
- adapter->rx_ring.psr_num_entries = adapter->rx_ring.fbr[1]->num_entries +
- adapter->rx_ring.fbr[0]->num_entries;
+ adapter->rx_ring.psr_num_entries =
+ adapter->rx_ring.fbr[1]->num_entries +
+ adapter->rx_ring.fbr[0]->num_entries;
#else
adapter->rx_ring.psr_num_entries = adapter->rx_ring.fbr[0]->num_entries;
#endif
/* Allocate an area of memory for Free Buffer Ring 1 */
- bufsize = (sizeof(struct fbr_desc) * rx_ring->fbr[0]->num_entries) + 0xfff;
+ bufsize = (sizeof(struct fbr_desc) * rx_ring->fbr[0]->num_entries) +
+ 0xfff;
rx_ring->fbr[0]->ring_virtaddr = dma_alloc_coherent(&adapter->pdev->dev,
bufsize,
&rx_ring->fbr[0]->ring_physaddr,
@@ -2421,7 +2423,8 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter)
#ifdef USE_FBR0
/* Allocate an area of memory for Free Buffer Ring 0 */
- bufsize = (sizeof(struct fbr_desc) * rx_ring->fbr[1]->num_entries) + 0xfff;
+ bufsize = (sizeof(struct fbr_desc) * rx_ring->fbr[1]->num_entries) +
+ 0xfff;
rx_ring->fbr[1]->ring_virtaddr = dma_alloc_coherent(&adapter->pdev->dev,
bufsize,
&rx_ring->fbr[1]->ring_physaddr,
@@ -2471,7 +2474,8 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter)
(FBR_CHUNKS * rx_ring->fbr[0]->buffsize) + fbr1_align - 1;
rx_ring->fbr[0]->mem_virtaddrs[i] =
dma_alloc_coherent(&adapter->pdev->dev, fbr_chunksize,
- &rx_ring->fbr[0]->mem_physaddrs[i], GFP_KERNEL);
+ &rx_ring->fbr[0]->mem_physaddrs[i],
+ GFP_KERNEL);
if (!rx_ring->fbr[0]->mem_virtaddrs[i]) {
dev_err(&adapter->pdev->dev,
@@ -2523,7 +2527,8 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter)
((FBR_CHUNKS + 1) * rx_ring->fbr[1]->buffsize) - 1;
rx_ring->fbr[1]->mem_virtaddrs[i] =
dma_alloc_coherent(&adapter->pdev->dev, fbr_chunksize,
- &rx_ring->fbr[1]->mem_physaddrs[i], GFP_KERNEL);
+ &rx_ring->fbr[1]->mem_physaddrs[i],
+ GFP_KERNEL);
if (!rx_ring->fbr[1]->mem_virtaddrs[i]) {
dev_err(&adapter->pdev->dev,
@@ -2675,10 +2680,11 @@ void et131x_rx_dma_memory_free(struct et131x_adapter *adapter)
/* Now the FIFO itself */
rx_ring->fbr[0]->ring_virtaddr = (void *)((u8 *)
- rx_ring->fbr[0]->ring_virtaddr - rx_ring->fbr[0]->offset);
+ rx_ring->fbr[0]->ring_virtaddr - rx_ring->fbr[0]->offset);
- bufsize = (sizeof(struct fbr_desc) * rx_ring->fbr[0]->num_entries)
- + 0xfff;
+ bufsize =
+ (sizeof(struct fbr_desc) * rx_ring->fbr[0]->num_entries) +
+ 0xfff;
dma_free_coherent(&adapter->pdev->dev, bufsize,
rx_ring->fbr[0]->ring_virtaddr,
@@ -2709,15 +2715,16 @@ void et131x_rx_dma_memory_free(struct et131x_adapter *adapter)
/* Now the FIFO itself */
rx_ring->fbr[1]->ring_virtaddr = (void *)((u8 *)
- rx_ring->fbr[1]->ring_virtaddr - rx_ring->fbr[1]->offset);
+ rx_ring->fbr[1]->ring_virtaddr - rx_ring->fbr[1]->offset);
- bufsize = (sizeof(struct fbr_desc) * rx_ring->fbr[1]->num_entries)
- + 0xfff;
+ bufsize =
+ (sizeof(struct fbr_desc) * rx_ring->fbr[1]->num_entries) +
+ 0xfff;
dma_free_coherent(&adapter->pdev->dev,
- bufsize,
- rx_ring->fbr[1]->ring_virtaddr,
- rx_ring->fbr[1]->ring_physaddr);
+ bufsize,
+ rx_ring->fbr[1]->ring_virtaddr,
+ rx_ring->fbr[1]->ring_physaddr);
rx_ring->fbr[1]->ring_virtaddr = NULL;
}
@@ -2857,9 +2864,9 @@ static void nic_return_rfd(struct et131x_adapter *adapter, struct rfd *rfd)
spin_lock_irqsave(&adapter->fbr_lock, flags);
if (ring_index == 1) {
- struct fbr_desc *next =
- (struct fbr_desc *) (rx_local->fbr[0]->ring_virtaddr) +
- INDEX10(rx_local->fbr[0]->local_full);
+ struct fbr_desc *next = (struct fbr_desc *)
+ (rx_local->fbr[0]->ring_virtaddr) +
+ INDEX10(rx_local->fbr[0]->local_full);
/* Handle the Free Buffer Ring advancement here. Write
* the PA / Buffer Index for the returned buffer into
@@ -2869,9 +2876,10 @@ static void nic_return_rfd(struct et131x_adapter *adapter, struct rfd *rfd)
next->addr_lo = rx_local->fbr[0]->bus_low[buff_index];
next->word2 = buff_index;
- writel(bump_free_buff_ring(&rx_local->fbr[0]->local_full,
- rx_local->fbr[0]->num_entries - 1),
- &rx_dma->fbr1_full_offset);
+ writel(bump_free_buff_ring(
+ &rx_local->fbr[0]->local_full,
+ rx_local->fbr[0]->num_entries - 1),
+ &rx_dma->fbr1_full_offset);
}
#ifdef USE_FBR0
else {
@@ -3109,8 +3117,8 @@ static struct rfd *nic_rx_pkts(struct et131x_adapter *adapter)
* 1 for FBR0 etc
*/
memcpy(skb_put(skb, rfd->len),
- rx_local->fbr[(ring_index == 0 ? 1 : 0)]->virt[buff_index],
- rfd->len);
+ rx_local->fbr[(ring_index == 0 ? 1 : 0)]->virt[buff_index],
+ rfd->len);
skb->dev = adapter->netdev;
skb->protocol = eth_type_trans(skb, adapter->netdev);
@@ -3212,11 +3220,13 @@ int et131x_tx_dma_memory_alloc(struct et131x_adapter *adapter)
*/
desc_size = (sizeof(struct tx_desc) * NUM_DESC_PER_RING_TX) + 4096 - 1;
tx_ring->tx_desc_ring =
- (struct tx_desc *) dma_alloc_coherent(&adapter->pdev->dev, desc_size,
- &tx_ring->tx_desc_ring_pa, GFP_KERNEL);
+ (struct tx_desc *) dma_alloc_coherent(&adapter->pdev->dev,
+ desc_size,
+ &tx_ring->tx_desc_ring_pa,
+ GFP_KERNEL);
if (!adapter->tx_ring.tx_desc_ring) {
dev_err(&adapter->pdev->dev,
- "Cannot alloc memory for Tx Ring\n");
+ "Cannot alloc memory for Tx Ring\n");
return -ENOMEM;
}
@@ -4871,7 +4881,8 @@ int et131x_close(struct net_device *netdev)
*
* Returns 0 on success, errno on failure (as defined in errno.h)
*/
-static int et131x_ioctl(struct net_device *netdev, struct ifreq *reqbuf, int cmd)
+static int et131x_ioctl(struct net_device *netdev, struct ifreq *reqbuf,
+ int cmd)
{
struct et131x_adapter *adapter = netdev_priv(netdev);
@@ -5030,7 +5041,8 @@ static int et131x_tx(struct sk_buff *skb, struct net_device *netdev)
struct et131x_adapter *adapter = netdev_priv(netdev);
/* stop the queue if it's getting full */
- if(adapter->tx_ring.used >= NUM_TCB - 1 && !netif_queue_stopped(netdev))
+ if (adapter->tx_ring.used >= NUM_TCB - 1 &&
+ !netif_queue_stopped(netdev))
netif_stop_queue(netdev);
/* Save the timestamp for the TX timeout watchdog */
@@ -5041,11 +5053,10 @@ static int et131x_tx(struct sk_buff *skb, struct net_device *netdev)
/* Check status and manage the netif queue if necessary */
if (status != 0) {
- if (status == -ENOMEM) {
+ if (status == -ENOMEM)
status = NETDEV_TX_BUSY;
- } else {
+ else
status = NETDEV_TX_OK;
- }
}
return status;
}
--
1.7.6.4
^ permalink raw reply related
* [PATCH 12/12] staging: et131x: Remove redundant check and return statement
From: Mark Einon @ 2011-10-23 9:22 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-kernel, Mark Einon
In-Reply-To: <1319361774-3148-1-git-send-email-mark.einon@gmail.com>
In nic_send_packet(), by the time 'frag' is checked to be zero, it never
is - the for loop has been entered (as nr_frags is always > 0) and frag
has been incremented at least once. Remove the check and associated
error return.
Signed-off-by: Mark Einon <mark.einon@gmail.com>
---
drivers/staging/et131x/et131x.c | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c
index 98c6974..45b88d4 100644
--- a/drivers/staging/et131x/et131x.c
+++ b/drivers/staging/et131x/et131x.c
@@ -3412,9 +3412,6 @@ static int nic_send_packet(struct et131x_adapter *adapter, struct tcb *tcb)
}
}
- if (frag == 0)
- return -EIO;
-
if (phydev && phydev->speed == SPEED_1000) {
if (++adapter->tx_ring.since_irq == PARM_TX_NUM_BUFS_DEF) {
/* Last element & Interrupt flag */
--
1.7.6.4
^ permalink raw reply related
* [PATCH 10/12] staging: et131x: Remove last of the forward declarations
From: Mark Einon @ 2011-10-23 9:22 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-kernel, Mark Einon
In-Reply-To: <1319361774-3148-1-git-send-email-mark.einon@gmail.com>
Moved functions in et131x.c file to remove the forward declarations of:
et131x_rx_dma_disable
et131x_rx_dma_enable
et131x_init_send
et131x_tx_dma_enable
Signed-off-by: Mark Einon <mark.einon@gmail.com>
---
drivers/staging/et131x/et131x.c | 262 +++++++++++++++++++--------------------
1 files changed, 128 insertions(+), 134 deletions(-)
diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c
index 2e621aa..8d36da0 100644
--- a/drivers/staging/et131x/et131x.c
+++ b/drivers/staging/et131x/et131x.c
@@ -576,11 +576,6 @@ struct et131x_adapter {
struct net_device_stats net_stats;
};
-void et131x_rx_dma_disable(struct et131x_adapter *adapter);
-void et131x_rx_dma_enable(struct et131x_adapter *adapter);
-void et131x_init_send(struct et131x_adapter *adapter);
-void et131x_tx_dma_enable(struct et131x_adapter *adapter);
-
/* EEPROM functions */
static int eeprom_wait_ready(struct pci_dev *pdev, u32 *status)
@@ -869,6 +864,100 @@ int et131x_init_eeprom(struct et131x_adapter *adapter)
return 0;
}
+/**
+ * et131x_rx_dma_enable - re-start of Rx_DMA on the ET1310.
+ * @adapter: pointer to our adapter structure
+ */
+void et131x_rx_dma_enable(struct et131x_adapter *adapter)
+{
+ /* Setup the receive dma configuration register for normal operation */
+ u32 csr = 0x2000; /* FBR1 enable */
+
+ if (adapter->rx_ring.fbr[0]->buffsize == 4096)
+ csr |= 0x0800;
+ else if (adapter->rx_ring.fbr[0]->buffsize == 8192)
+ csr |= 0x1000;
+ else if (adapter->rx_ring.fbr[0]->buffsize == 16384)
+ csr |= 0x1800;
+#ifdef USE_FBR0
+ csr |= 0x0400; /* FBR0 enable */
+ if (adapter->rx_ring.fbr[1]->buffsize == 256)
+ csr |= 0x0100;
+ else if (adapter->rx_ring.fbr[1]->buffsize == 512)
+ csr |= 0x0200;
+ else if (adapter->rx_ring.fbr[1]->buffsize == 1024)
+ csr |= 0x0300;
+#endif
+ writel(csr, &adapter->regs->rxdma.csr);
+
+ csr = readl(&adapter->regs->rxdma.csr);
+ if ((csr & 0x00020000) != 0) {
+ udelay(5);
+ csr = readl(&adapter->regs->rxdma.csr);
+ if ((csr & 0x00020000) != 0) {
+ dev_err(&adapter->pdev->dev,
+ "RX Dma failed to exit halt state. CSR 0x%08x\n",
+ csr);
+ }
+ }
+}
+
+/**
+ * et131x_rx_dma_disable - Stop of Rx_DMA on the ET1310
+ * @adapter: pointer to our adapter structure
+ */
+void et131x_rx_dma_disable(struct et131x_adapter *adapter)
+{
+ u32 csr;
+ /* Setup the receive dma configuration register */
+ writel(0x00002001, &adapter->regs->rxdma.csr);
+ csr = readl(&adapter->regs->rxdma.csr);
+ if ((csr & 0x00020000) == 0) { /* Check halt status (bit 17) */
+ udelay(5);
+ csr = readl(&adapter->regs->rxdma.csr);
+ if ((csr & 0x00020000) == 0)
+ dev_err(&adapter->pdev->dev,
+ "RX Dma failed to enter halt state. CSR 0x%08x\n",
+ csr);
+ }
+}
+
+/**
+ * et131x_tx_dma_enable - re-start of Tx_DMA on the ET1310.
+ * @adapter: pointer to our adapter structure
+ *
+ * Mainly used after a return to the D0 (full-power) state from a lower state.
+ */
+void et131x_tx_dma_enable(struct et131x_adapter *adapter)
+{
+ /* Setup the transmit dma configuration register for normal
+ * operation
+ */
+ writel(ET_TXDMA_SNGL_EPKT|(PARM_DMA_CACHE_DEF << ET_TXDMA_CACHE_SHIFT),
+ &adapter->regs->txdma.csr);
+}
+
+static inline void add_10bit(u32 *v, int n)
+{
+ *v = INDEX10(*v + n) | (*v & ET_DMA10_WRAP);
+}
+
+static inline void add_12bit(u32 *v, int n)
+{
+ *v = INDEX12(*v + n) | (*v & ET_DMA12_WRAP);
+}
+
+/**
+ * nic_rx_pkts - Checks the hardware for available packets
+ * @adapter: pointer to our adapter
+ *
+ * Returns rfd, a pointer to our MPRFD.
+ *
+ * Checks the hardware for available packets, using completion ring
+ * If packets are available, it gets an RFD from the recv_list, attaches
+ * the packet to it, puts the RFD in the RecvPendList, and also returns
+ * the pointer to the RFD.
+ */
/* MAC functions */
/**
@@ -2011,21 +2100,6 @@ void et131x_tx_dma_disable(struct et131x_adapter *adapter)
}
/**
- * et131x_tx_dma_enable - re-start of Tx_DMA on the ET1310.
- * @adapter: pointer to our adapter structure
- *
- * Mainly used after a return to the D0 (full-power) state from a lower state.
- */
-void et131x_tx_dma_enable(struct et131x_adapter *adapter)
-{
- /* Setup the transmit dma configuration register for normal
- * operation
- */
- writel(ET_TXDMA_SNGL_EPKT|(PARM_DMA_CACHE_DEF << ET_TXDMA_CACHE_SHIFT),
- &adapter->regs->txdma.csr);
-}
-
-/**
* et131x_enable_txrx - Enable tx/rx queues
* @netdev: device to be enabled
*/
@@ -2065,6 +2139,40 @@ void et131x_disable_txrx(struct net_device *netdev)
}
/**
+ * et131x_init_send - Initialize send data structures
+ * @adapter: pointer to our private adapter structure
+ */
+void et131x_init_send(struct et131x_adapter *adapter)
+{
+ struct tcb *tcb;
+ u32 ct;
+ struct tx_ring *tx_ring;
+
+ /* Setup some convenience pointers */
+ tx_ring = &adapter->tx_ring;
+ tcb = adapter->tx_ring.tcb_ring;
+
+ tx_ring->tcb_qhead = tcb;
+
+ memset(tcb, 0, sizeof(struct tcb) * NUM_TCB);
+
+ /* Go through and set up each TCB */
+ for (ct = 0; ct++ < NUM_TCB; tcb++)
+ /* Set the link pointer in HW TCB to the next TCB in the
+ * chain
+ */
+ tcb->next = tcb + 1;
+
+ /* Set the tail pointer */
+ tcb--;
+ tx_ring->tcb_qtail = tcb;
+ tcb->next = NULL;
+ /* Curr send queue should now be empty */
+ tx_ring->send_head = NULL;
+ tx_ring->send_tail = NULL;
+}
+
+/**
* et1310_enable_phy_coma - called when network cable is unplugged
* @adapter: pointer to our adapter structure
*
@@ -2802,86 +2910,6 @@ static void nic_return_rfd(struct et131x_adapter *adapter, struct rfd *rfd)
WARN_ON(rx_local->num_ready_recv > rx_local->num_rfd);
}
-/**
- * et131x_rx_dma_disable - Stop of Rx_DMA on the ET1310
- * @adapter: pointer to our adapter structure
- */
-void et131x_rx_dma_disable(struct et131x_adapter *adapter)
-{
- u32 csr;
- /* Setup the receive dma configuration register */
- writel(0x00002001, &adapter->regs->rxdma.csr);
- csr = readl(&adapter->regs->rxdma.csr);
- if ((csr & 0x00020000) == 0) { /* Check halt status (bit 17) */
- udelay(5);
- csr = readl(&adapter->regs->rxdma.csr);
- if ((csr & 0x00020000) == 0)
- dev_err(&adapter->pdev->dev,
- "RX Dma failed to enter halt state. CSR 0x%08x\n",
- csr);
- }
-}
-
-/**
- * et131x_rx_dma_enable - re-start of Rx_DMA on the ET1310.
- * @adapter: pointer to our adapter structure
- */
-void et131x_rx_dma_enable(struct et131x_adapter *adapter)
-{
- /* Setup the receive dma configuration register for normal operation */
- u32 csr = 0x2000; /* FBR1 enable */
-
- if (adapter->rx_ring.fbr[0]->buffsize == 4096)
- csr |= 0x0800;
- else if (adapter->rx_ring.fbr[0]->buffsize == 8192)
- csr |= 0x1000;
- else if (adapter->rx_ring.fbr[0]->buffsize == 16384)
- csr |= 0x1800;
-#ifdef USE_FBR0
- csr |= 0x0400; /* FBR0 enable */
- if (adapter->rx_ring.fbr[1]->buffsize == 256)
- csr |= 0x0100;
- else if (adapter->rx_ring.fbr[1]->buffsize == 512)
- csr |= 0x0200;
- else if (adapter->rx_ring.fbr[1]->buffsize == 1024)
- csr |= 0x0300;
-#endif
- writel(csr, &adapter->regs->rxdma.csr);
-
- csr = readl(&adapter->regs->rxdma.csr);
- if ((csr & 0x00020000) != 0) {
- udelay(5);
- csr = readl(&adapter->regs->rxdma.csr);
- if ((csr & 0x00020000) != 0) {
- dev_err(&adapter->pdev->dev,
- "RX Dma failed to exit halt state. CSR 0x%08x\n",
- csr);
- }
- }
-}
-
-
-static inline void add_10bit(u32 *v, int n)
-{
- *v = INDEX10(*v + n) | (*v & ET_DMA10_WRAP);
-}
-
-static inline void add_12bit(u32 *v, int n)
-{
- *v = INDEX12(*v + n) | (*v & ET_DMA12_WRAP);
-}
-
-/**
- * nic_rx_pkts - Checks the hardware for available packets
- * @adapter: pointer to our adapter
- *
- * Returns rfd, a pointer to our MPRFD.
- *
- * Checks the hardware for available packets, using completion ring
- * If packets are available, it gets an RFD from the recv_list, attaches
- * the packet to it, puts the RFD in the RecvPendList, and also returns
- * the pointer to the RFD.
- */
static struct rfd *nic_rx_pkts(struct et131x_adapter *adapter)
{
struct rx_ring *rx_local = &adapter->rx_ring;
@@ -3247,40 +3275,6 @@ void et131x_tx_dma_memory_free(struct et131x_adapter *adapter)
}
/**
- * et131x_init_send - Initialize send data structures
- * @adapter: pointer to our private adapter structure
- */
-void et131x_init_send(struct et131x_adapter *adapter)
-{
- struct tcb *tcb;
- u32 ct;
- struct tx_ring *tx_ring;
-
- /* Setup some convenience pointers */
- tx_ring = &adapter->tx_ring;
- tcb = adapter->tx_ring.tcb_ring;
-
- tx_ring->tcb_qhead = tcb;
-
- memset(tcb, 0, sizeof(struct tcb) * NUM_TCB);
-
- /* Go through and set up each TCB */
- for (ct = 0; ct++ < NUM_TCB; tcb++)
- /* Set the link pointer in HW TCB to the next TCB in the
- * chain
- */
- tcb->next = tcb + 1;
-
- /* Set the tail pointer */
- tcb--;
- tx_ring->tcb_qtail = tcb;
- tcb->next = NULL;
- /* Curr send queue should now be empty */
- tx_ring->send_head = NULL;
- tx_ring->send_tail = NULL;
-}
-
-/**
* nic_send_packet - NIC specific send handler for version B silicon.
* @adapter: pointer to our adapter
* @tcb: pointer to struct tcb
--
1.7.6.4
^ permalink raw reply related
* [PATCH 08/12] staging: et131x: Remove yet more forward declarations
From: Mark Einon @ 2011-10-23 9:22 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-kernel, Mark Einon
In-Reply-To: <1319361774-3148-1-git-send-email-mark.einon@gmail.com>
Moved functions in et131x.c file to remove the forward declarations of:
et1310_setup_device_for_multicast
et1310_setup_device_for_unicast
et131x_up
et131x_down
et131x_enable_txrx
et131x_disable_txrx
Signed-off-by: Mark Einon <mark.einon@gmail.com>
---
drivers/staging/et131x/et131x.c | 434 +++++++++++++++++++--------------------
1 files changed, 214 insertions(+), 220 deletions(-)
diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c
index 44fff21..208c69f 100644
--- a/drivers/staging/et131x/et131x.c
+++ b/drivers/staging/et131x/et131x.c
@@ -576,12 +576,6 @@ struct et131x_adapter {
struct net_device_stats net_stats;
};
-void et1310_setup_device_for_multicast(struct et131x_adapter *adapter);
-void et1310_setup_device_for_unicast(struct et131x_adapter *adapter);
-void et131x_up(struct net_device *netdev);
-void et131x_down(struct net_device *netdev);
-void et131x_enable_txrx(struct net_device *netdev);
-void et131x_disable_txrx(struct net_device *netdev);
int et1310_in_phy_coma(struct et131x_adapter *adapter);
void et1310_phy_access_mii_bit(struct et131x_adapter *adapter,
u16 action,
@@ -1025,6 +1019,95 @@ void et1310_config_mac_regs2(struct et131x_adapter *adapter)
}
}
+void et1310_setup_device_for_multicast(struct et131x_adapter *adapter)
+{
+ struct rxmac_regs __iomem *rxmac = &adapter->regs->rxmac;
+ uint32_t nIndex;
+ uint32_t result;
+ uint32_t hash1 = 0;
+ uint32_t hash2 = 0;
+ uint32_t hash3 = 0;
+ uint32_t hash4 = 0;
+ u32 pm_csr;
+
+ /* If ET131X_PACKET_TYPE_MULTICAST is specified, then we provision
+ * the multi-cast LIST. If it is NOT specified, (and "ALL" is not
+ * specified) then we should pass NO multi-cast addresses to the
+ * driver.
+ */
+ if (adapter->packet_filter & ET131X_PACKET_TYPE_MULTICAST) {
+ /* Loop through our multicast array and set up the device */
+ for (nIndex = 0; nIndex < adapter->multicast_addr_count;
+ nIndex++) {
+ result = ether_crc(6, adapter->multicast_list[nIndex]);
+
+ result = (result & 0x3F800000) >> 23;
+
+ if (result < 32) {
+ hash1 |= (1 << result);
+ } else if ((31 < result) && (result < 64)) {
+ result -= 32;
+ hash2 |= (1 << result);
+ } else if ((63 < result) && (result < 96)) {
+ result -= 64;
+ hash3 |= (1 << result);
+ } else {
+ result -= 96;
+ hash4 |= (1 << result);
+ }
+ }
+ }
+
+ /* Write out the new hash to the device */
+ pm_csr = readl(&adapter->regs->global.pm_csr);
+ if (!et1310_in_phy_coma(adapter)) {
+ writel(hash1, &rxmac->multi_hash1);
+ writel(hash2, &rxmac->multi_hash2);
+ writel(hash3, &rxmac->multi_hash3);
+ writel(hash4, &rxmac->multi_hash4);
+ }
+}
+
+void et1310_setup_device_for_unicast(struct et131x_adapter *adapter)
+{
+ struct rxmac_regs __iomem *rxmac = &adapter->regs->rxmac;
+ u32 uni_pf1;
+ u32 uni_pf2;
+ u32 uni_pf3;
+ u32 pm_csr;
+
+ /* Set up unicast packet filter reg 3 to be the first two octets of
+ * the MAC address for both address
+ *
+ * Set up unicast packet filter reg 2 to be the octets 2 - 5 of the
+ * MAC address for second address
+ *
+ * Set up unicast packet filter reg 3 to be the octets 2 - 5 of the
+ * MAC address for first address
+ */
+ uni_pf3 = (adapter->addr[0] << ET_UNI_PF_ADDR2_1_SHIFT) |
+ (adapter->addr[1] << ET_UNI_PF_ADDR2_2_SHIFT) |
+ (adapter->addr[0] << ET_UNI_PF_ADDR1_1_SHIFT) |
+ adapter->addr[1];
+
+ uni_pf2 = (adapter->addr[2] << ET_UNI_PF_ADDR2_3_SHIFT) |
+ (adapter->addr[3] << ET_UNI_PF_ADDR2_4_SHIFT) |
+ (adapter->addr[4] << ET_UNI_PF_ADDR2_5_SHIFT) |
+ adapter->addr[5];
+
+ uni_pf1 = (adapter->addr[2] << ET_UNI_PF_ADDR1_3_SHIFT) |
+ (adapter->addr[3] << ET_UNI_PF_ADDR1_4_SHIFT) |
+ (adapter->addr[4] << ET_UNI_PF_ADDR1_5_SHIFT) |
+ adapter->addr[5];
+
+ pm_csr = readl(&adapter->regs->global.pm_csr);
+ if (!et1310_in_phy_coma(adapter)) {
+ writel(uni_pf1, &rxmac->uni_pf_addr1);
+ writel(uni_pf2, &rxmac->uni_pf_addr2);
+ writel(uni_pf3, &rxmac->uni_pf_addr3);
+ }
+}
+
void et1310_config_rxmac_regs(struct et131x_adapter *adapter)
{
struct rxmac_regs __iomem *rxmac = &adapter->regs->rxmac;
@@ -1358,95 +1441,6 @@ void et1310_handle_macstat_interrupt(struct et131x_adapter *adapter)
adapter->stats.tx_collisions += COUNTER_WRAP_12_BIT;
}
-void et1310_setup_device_for_multicast(struct et131x_adapter *adapter)
-{
- struct rxmac_regs __iomem *rxmac = &adapter->regs->rxmac;
- uint32_t nIndex;
- uint32_t result;
- uint32_t hash1 = 0;
- uint32_t hash2 = 0;
- uint32_t hash3 = 0;
- uint32_t hash4 = 0;
- u32 pm_csr;
-
- /* If ET131X_PACKET_TYPE_MULTICAST is specified, then we provision
- * the multi-cast LIST. If it is NOT specified, (and "ALL" is not
- * specified) then we should pass NO multi-cast addresses to the
- * driver.
- */
- if (adapter->packet_filter & ET131X_PACKET_TYPE_MULTICAST) {
- /* Loop through our multicast array and set up the device */
- for (nIndex = 0; nIndex < adapter->multicast_addr_count;
- nIndex++) {
- result = ether_crc(6, adapter->multicast_list[nIndex]);
-
- result = (result & 0x3F800000) >> 23;
-
- if (result < 32) {
- hash1 |= (1 << result);
- } else if ((31 < result) && (result < 64)) {
- result -= 32;
- hash2 |= (1 << result);
- } else if ((63 < result) && (result < 96)) {
- result -= 64;
- hash3 |= (1 << result);
- } else {
- result -= 96;
- hash4 |= (1 << result);
- }
- }
- }
-
- /* Write out the new hash to the device */
- pm_csr = readl(&adapter->regs->global.pm_csr);
- if (!et1310_in_phy_coma(adapter)) {
- writel(hash1, &rxmac->multi_hash1);
- writel(hash2, &rxmac->multi_hash2);
- writel(hash3, &rxmac->multi_hash3);
- writel(hash4, &rxmac->multi_hash4);
- }
-}
-
-void et1310_setup_device_for_unicast(struct et131x_adapter *adapter)
-{
- struct rxmac_regs __iomem *rxmac = &adapter->regs->rxmac;
- u32 uni_pf1;
- u32 uni_pf2;
- u32 uni_pf3;
- u32 pm_csr;
-
- /* Set up unicast packet filter reg 3 to be the first two octets of
- * the MAC address for both address
- *
- * Set up unicast packet filter reg 2 to be the octets 2 - 5 of the
- * MAC address for second address
- *
- * Set up unicast packet filter reg 3 to be the octets 2 - 5 of the
- * MAC address for first address
- */
- uni_pf3 = (adapter->addr[0] << ET_UNI_PF_ADDR2_1_SHIFT) |
- (adapter->addr[1] << ET_UNI_PF_ADDR2_2_SHIFT) |
- (adapter->addr[0] << ET_UNI_PF_ADDR1_1_SHIFT) |
- adapter->addr[1];
-
- uni_pf2 = (adapter->addr[2] << ET_UNI_PF_ADDR2_3_SHIFT) |
- (adapter->addr[3] << ET_UNI_PF_ADDR2_4_SHIFT) |
- (adapter->addr[4] << ET_UNI_PF_ADDR2_5_SHIFT) |
- adapter->addr[5];
-
- uni_pf1 = (adapter->addr[2] << ET_UNI_PF_ADDR1_3_SHIFT) |
- (adapter->addr[3] << ET_UNI_PF_ADDR1_4_SHIFT) |
- (adapter->addr[4] << ET_UNI_PF_ADDR1_5_SHIFT) |
- adapter->addr[5];
-
- pm_csr = readl(&adapter->regs->global.pm_csr);
- if (!et1310_in_phy_coma(adapter)) {
- writel(uni_pf1, &rxmac->uni_pf_addr1);
- writel(uni_pf2, &rxmac->uni_pf_addr2);
- writel(uni_pf3, &rxmac->uni_pf_addr3);
- }
-}
-
/* PHY functions */
int et131x_mdio_read(struct mii_bus *bus, int phy_addr, int reg)
@@ -1982,6 +1976,104 @@ void et131x_soft_reset(struct et131x_adapter *adapter)
}
/**
+ * et131x_enable_interrupts - enable interrupt
+ * @adapter: et131x device
+ *
+ * Enable the appropriate interrupts on the ET131x according to our
+ * configuration
+ */
+void et131x_enable_interrupts(struct et131x_adapter *adapter)
+{
+ u32 mask;
+
+ /* Enable all global interrupts */
+ if (adapter->flowcontrol == FLOW_TXONLY ||
+ adapter->flowcontrol == FLOW_BOTH)
+ mask = INT_MASK_ENABLE;
+ else
+ mask = INT_MASK_ENABLE_NO_FLOW;
+
+ writel(mask, &adapter->regs->global.int_mask);
+}
+
+/**
+ * et131x_disable_interrupts - interrupt disable
+ * @adapter: et131x device
+ *
+ * Block all interrupts from the et131x device at the device itself
+ */
+void et131x_disable_interrupts(struct et131x_adapter *adapter)
+{
+ /* Disable all global interrupts */
+ writel(INT_MASK_DISABLE, &adapter->regs->global.int_mask);
+}
+
+/**
+ * et131x_tx_dma_disable - Stop of Tx_DMA on the ET1310
+ * @adapter: pointer to our adapter structure
+ */
+void et131x_tx_dma_disable(struct et131x_adapter *adapter)
+{
+ /* Setup the tramsmit dma configuration register */
+ writel(ET_TXDMA_CSR_HALT|ET_TXDMA_SNGL_EPKT,
+ &adapter->regs->txdma.csr);
+}
+
+/**
+ * et131x_tx_dma_enable - re-start of Tx_DMA on the ET1310.
+ * @adapter: pointer to our adapter structure
+ *
+ * Mainly used after a return to the D0 (full-power) state from a lower state.
+ */
+void et131x_tx_dma_enable(struct et131x_adapter *adapter)
+{
+ /* Setup the transmit dma configuration register for normal
+ * operation
+ */
+ writel(ET_TXDMA_SNGL_EPKT|(PARM_DMA_CACHE_DEF << ET_TXDMA_CACHE_SHIFT),
+ &adapter->regs->txdma.csr);
+}
+
+/**
+ * et131x_enable_txrx - Enable tx/rx queues
+ * @netdev: device to be enabled
+ */
+void et131x_enable_txrx(struct net_device *netdev)
+{
+ struct et131x_adapter *adapter = netdev_priv(netdev);
+
+ /* Enable the Tx and Rx DMA engines (if not already enabled) */
+ et131x_rx_dma_enable(adapter);
+ et131x_tx_dma_enable(adapter);
+
+ /* Enable device interrupts */
+ if (adapter->flags & fMP_ADAPTER_INTERRUPT_IN_USE)
+ et131x_enable_interrupts(adapter);
+
+ /* We're ready to move some data, so start the queue */
+ netif_start_queue(netdev);
+}
+
+/**
+ * et131x_disable_txrx - Disable tx/rx queues
+ * @netdev: device to be disabled
+ */
+void et131x_disable_txrx(struct net_device *netdev)
+{
+ struct et131x_adapter *adapter = netdev_priv(netdev);
+
+ /* First thing is to stop the queue */
+ netif_stop_queue(netdev);
+
+ /* Stop the Tx and Rx DMA engines */
+ et131x_rx_dma_disable(adapter);
+ et131x_tx_dma_disable(adapter);
+
+ /* Disable device interrupts */
+ et131x_disable_interrupts(adapter);
+}
+
+/**
* et1310_enable_phy_coma - called when network cable is unplugged
* @adapter: pointer to our adapter structure
*
@@ -3164,32 +3256,6 @@ void et131x_tx_dma_memory_free(struct et131x_adapter *adapter)
}
/**
- * et131x_tx_dma_disable - Stop of Tx_DMA on the ET1310
- * @adapter: pointer to our adapter structure
- */
-void et131x_tx_dma_disable(struct et131x_adapter *adapter)
-{
- /* Setup the tramsmit dma configuration register */
- writel(ET_TXDMA_CSR_HALT|ET_TXDMA_SNGL_EPKT,
- &adapter->regs->txdma.csr);
-}
-
-/**
- * et131x_tx_dma_enable - re-start of Tx_DMA on the ET1310.
- * @adapter: pointer to our adapter structure
- *
- * Mainly used after a return to the D0 (full-power) state from a lower state.
- */
-void et131x_tx_dma_enable(struct et131x_adapter *adapter)
-{
- /* Setup the transmit dma configuration register for normal
- * operation
- */
- writel(ET_TXDMA_SNGL_EPKT|(PARM_DMA_CACHE_DEF << ET_TXDMA_CACHE_SHIFT),
- &adapter->regs->txdma.csr);
-}
-
-/**
* et131x_init_send - Initialize send data structures
* @adapter: pointer to our private adapter structure
*/
@@ -4046,27 +4112,6 @@ static int et131x_pci_init(struct et131x_adapter *adapter,
}
/**
- * et131x_enable_interrupts - enable interrupt
- * @adapter: et131x device
- *
- * Enable the appropriate interrupts on the ET131x according to our
- * configuration
- */
-void et131x_enable_interrupts(struct et131x_adapter *adapter)
-{
- u32 mask;
-
- /* Enable all global interrupts */
- if (adapter->flowcontrol == FLOW_TXONLY ||
- adapter->flowcontrol == FLOW_BOTH)
- mask = INT_MASK_ENABLE;
- else
- mask = INT_MASK_ENABLE_NO_FLOW;
-
- writel(mask, &adapter->regs->global.int_mask);
-}
-
-/**
* et131x_error_timer_handler
* @data: timer-specific variable; here a pointer to our adapter structure
*
@@ -4350,18 +4395,6 @@ static struct et131x_adapter *et131x_adapter_init(struct net_device *netdev,
}
/**
- * et131x_disable_interrupts - interrupt disable
- * @adapter: et131x device
- *
- * Block all interrupts from the et131x device at the device itself
- */
-void et131x_disable_interrupts(struct et131x_adapter *adapter)
-{
- /* Disable all global interrupts */
- writel(INT_MASK_DISABLE, &adapter->regs->global.int_mask);
-}
-
-/**
* et131x_pci_remove
* @pdev: a pointer to the device's pci_dev structure
*
@@ -4388,6 +4421,33 @@ static void __devexit et131x_pci_remove(struct pci_dev *pdev)
pci_disable_device(pdev);
}
+/**
+ * et131x_up - Bring up a device for use.
+ * @netdev: device to be opened
+ */
+void et131x_up(struct net_device *netdev)
+{
+ struct et131x_adapter *adapter = netdev_priv(netdev);
+
+ et131x_enable_txrx(netdev);
+ phy_start(adapter->phydev);
+}
+
+/**
+ * et131x_down - Bring down the device
+ * @netdev: device to be broght down
+ */
+void et131x_down(struct net_device *netdev)
+{
+ struct et131x_adapter *adapter = netdev_priv(netdev);
+
+ /* Save the timestamp for the TX watchdog, prevent a timeout */
+ netdev->trans_start = jiffies;
+
+ phy_stop(adapter->phydev);
+ et131x_disable_txrx(netdev);
+}
+
#ifdef CONFIG_PM_SLEEP
static int et131x_suspend(struct device *dev)
{
@@ -4766,57 +4826,6 @@ static struct net_device_stats *et131x_stats(struct net_device *netdev)
}
/**
- * et131x_enable_txrx - Enable tx/rx queues
- * @netdev: device to be enabled
- */
-void et131x_enable_txrx(struct net_device *netdev)
-{
- struct et131x_adapter *adapter = netdev_priv(netdev);
-
- /* Enable the Tx and Rx DMA engines (if not already enabled) */
- et131x_rx_dma_enable(adapter);
- et131x_tx_dma_enable(adapter);
-
- /* Enable device interrupts */
- if (adapter->flags & fMP_ADAPTER_INTERRUPT_IN_USE)
- et131x_enable_interrupts(adapter);
-
- /* We're ready to move some data, so start the queue */
- netif_start_queue(netdev);
-}
-
-/**
- * et131x_disable_txrx - Disable tx/rx queues
- * @netdev: device to be disabled
- */
-void et131x_disable_txrx(struct net_device *netdev)
-{
- struct et131x_adapter *adapter = netdev_priv(netdev);
-
- /* First thing is to stop the queue */
- netif_stop_queue(netdev);
-
- /* Stop the Tx and Rx DMA engines */
- et131x_rx_dma_disable(adapter);
- et131x_tx_dma_disable(adapter);
-
- /* Disable device interrupts */
- et131x_disable_interrupts(adapter);
-}
-
-/**
- * et131x_up - Bring up a device for use.
- * @netdev: device to be opened
- */
-void et131x_up(struct net_device *netdev)
-{
- struct et131x_adapter *adapter = netdev_priv(netdev);
-
- et131x_enable_txrx(netdev);
- phy_start(adapter->phydev);
-}
-
-/**
* et131x_open - Open the device for use.
* @netdev: device to be opened
*
@@ -4851,21 +4860,6 @@ int et131x_open(struct net_device *netdev)
}
/**
- * et131x_down - Bring down the device
- * @netdev: device to be broght down
- */
-void et131x_down(struct net_device *netdev)
-{
- struct et131x_adapter *adapter = netdev_priv(netdev);
-
- /* Save the timestamp for the TX watchdog, prevent a timeout */
- netdev->trans_start = jiffies;
-
- phy_stop(adapter->phydev);
- et131x_disable_txrx(netdev);
-}
-
-/**
* et131x_close - Close the device
* @netdev: device to be closed
*
--
1.7.6.4
^ permalink raw reply related
* [PATCH 06/12] staging: et131x: Remove forward declaration of et131x_adapter_setup
From: Mark Einon @ 2011-10-23 9:22 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-kernel, Mark Einon
In-Reply-To: <1319361774-3148-1-git-send-email-mark.einon@gmail.com>
Also associated function movements within et131x.c file
Signed-off-by: Mark Einon <mark.einon@gmail.com>
---
drivers/staging/et131x/et131x.c | 445 +++++++++++++++++++--------------------
1 files changed, 222 insertions(+), 223 deletions(-)
diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c
index 8048d67..2947635 100644
--- a/drivers/staging/et131x/et131x.c
+++ b/drivers/staging/et131x/et131x.c
@@ -576,7 +576,6 @@ struct et131x_adapter {
struct net_device_stats net_stats;
};
-void et131x_adapter_setup(struct et131x_adapter *adapter);
void et131x_soft_reset(struct et131x_adapter *adapter);
void et131x_isr_handler(struct work_struct *work);
void et1310_setup_device_for_multicast(struct et131x_adapter *adapter);
@@ -1731,6 +1730,53 @@ void et131x_xcvr_init(struct et131x_adapter *adapter)
}
}
+/**
+ * et131x_configure_global_regs - configure JAGCore global regs
+ * @adapter: pointer to our adapter structure
+ *
+ * Used to configure the global registers on the JAGCore
+ */
+void et131x_configure_global_regs(struct et131x_adapter *adapter)
+{
+ struct global_regs __iomem *regs = &adapter->regs->global;
+
+ writel(0, ®s->rxq_start_addr);
+ writel(INTERNAL_MEM_SIZE - 1, ®s->txq_end_addr);
+
+ if (adapter->registry_jumbo_packet < 2048) {
+ /* Tx / RxDMA and Tx/Rx MAC interfaces have a 1k word
+ * block of RAM that the driver can split between Tx
+ * and Rx as it desires. Our default is to split it
+ * 50/50:
+ */
+ writel(PARM_RX_MEM_END_DEF, ®s->rxq_end_addr);
+ writel(PARM_RX_MEM_END_DEF + 1, ®s->txq_start_addr);
+ } else if (adapter->registry_jumbo_packet < 8192) {
+ /* For jumbo packets > 2k but < 8k, split 50-50. */
+ writel(INTERNAL_MEM_RX_OFFSET, ®s->rxq_end_addr);
+ writel(INTERNAL_MEM_RX_OFFSET + 1, ®s->txq_start_addr);
+ } else {
+ /* 9216 is the only packet size greater than 8k that
+ * is available. The Tx buffer has to be big enough
+ * for one whole packet on the Tx side. We'll make
+ * the Tx 9408, and give the rest to Rx
+ */
+ writel(0x01b3, ®s->rxq_end_addr);
+ writel(0x01b4, ®s->txq_start_addr);
+ }
+
+ /* Initialize the loopback register. Disable all loopbacks. */
+ writel(0, ®s->loopback);
+
+ /* MSI Register */
+ writel(0, ®s->msi_config);
+
+ /* By default, disable the watchdog timer. It will be enabled when
+ * a packet is queued.
+ */
+ writel(0, ®s->watchdog_timer);
+}
+
/* PM functions */
/**
@@ -1749,6 +1795,181 @@ int et1310_in_phy_coma(struct et131x_adapter *adapter)
}
/**
+ * et131x_config_rx_dma_regs - Start of Rx_DMA init sequence
+ * @adapter: pointer to our adapter structure
+ */
+void et131x_config_rx_dma_regs(struct et131x_adapter *adapter)
+{
+ struct rxdma_regs __iomem *rx_dma = &adapter->regs->rxdma;
+ struct rx_ring *rx_local = &adapter->rx_ring;
+ struct fbr_desc *fbr_entry;
+ u32 entry;
+ u32 psr_num_des;
+ unsigned long flags;
+
+ /* Halt RXDMA to perform the reconfigure. */
+ et131x_rx_dma_disable(adapter);
+
+ /* Load the completion writeback physical address
+ *
+ * NOTE : dma_alloc_coherent(), used above to alloc DMA regions,
+ * ALWAYS returns SAC (32-bit) addresses. If DAC (64-bit) addresses
+ * are ever returned, make sure the high part is retrieved here
+ * before storing the adjusted address.
+ */
+ writel((u32) ((u64)rx_local->rx_status_bus >> 32),
+ &rx_dma->dma_wb_base_hi);
+ writel((u32) rx_local->rx_status_bus, &rx_dma->dma_wb_base_lo);
+
+ memset(rx_local->rx_status_block, 0, sizeof(struct rx_status_block));
+
+ /* Set the address and parameters of the packet status ring into the
+ * 1310's registers
+ */
+ writel((u32) ((u64)rx_local->ps_ring_physaddr >> 32),
+ &rx_dma->psr_base_hi);
+ writel((u32) rx_local->ps_ring_physaddr, &rx_dma->psr_base_lo);
+ writel(rx_local->psr_num_entries - 1, &rx_dma->psr_num_des);
+ writel(0, &rx_dma->psr_full_offset);
+
+ psr_num_des = readl(&rx_dma->psr_num_des) & 0xFFF;
+ writel((psr_num_des * LO_MARK_PERCENT_FOR_PSR) / 100,
+ &rx_dma->psr_min_des);
+
+ spin_lock_irqsave(&adapter->rcv_lock, flags);
+
+ /* These local variables track the PSR in the adapter structure */
+ rx_local->local_psr_full = 0;
+
+ /* Now's the best time to initialize FBR1 contents */
+ fbr_entry = (struct fbr_desc *) rx_local->fbr[0]->ring_virtaddr;
+ for (entry = 0; entry < rx_local->fbr[0]->num_entries; entry++) {
+ fbr_entry->addr_hi = rx_local->fbr[0]->bus_high[entry];
+ fbr_entry->addr_lo = rx_local->fbr[0]->bus_low[entry];
+ fbr_entry->word2 = entry;
+ fbr_entry++;
+ }
+
+ /* Set the address and parameters of Free buffer ring 1 (and 0 if
+ * required) into the 1310's registers
+ */
+ writel((u32) (rx_local->fbr[0]->real_physaddr >> 32),
+ &rx_dma->fbr1_base_hi);
+ writel((u32) rx_local->fbr[0]->real_physaddr, &rx_dma->fbr1_base_lo);
+ writel(rx_local->fbr[0]->num_entries - 1, &rx_dma->fbr1_num_des);
+ writel(ET_DMA10_WRAP, &rx_dma->fbr1_full_offset);
+
+ /* This variable tracks the free buffer ring 1 full position, so it
+ * has to match the above.
+ */
+ rx_local->fbr[0]->local_full = ET_DMA10_WRAP;
+ writel(
+ ((rx_local->fbr[0]->num_entries * LO_MARK_PERCENT_FOR_RX) / 100) - 1,
+ &rx_dma->fbr1_min_des);
+
+#ifdef USE_FBR0
+ /* Now's the best time to initialize FBR0 contents */
+ fbr_entry = (struct fbr_desc *) rx_local->fbr[1]->ring_virtaddr;
+ for (entry = 0; entry < rx_local->fbr[1]->num_entries; entry++) {
+ fbr_entry->addr_hi = rx_local->fbr[1]->bus_high[entry];
+ fbr_entry->addr_lo = rx_local->fbr[1]->bus_low[entry];
+ fbr_entry->word2 = entry;
+ fbr_entry++;
+ }
+
+ writel((u32) (rx_local->fbr[1]->real_physaddr >> 32),
+ &rx_dma->fbr0_base_hi);
+ writel((u32) rx_local->fbr[1]->real_physaddr, &rx_dma->fbr0_base_lo);
+ writel(rx_local->fbr[1]->num_entries - 1, &rx_dma->fbr0_num_des);
+ writel(ET_DMA10_WRAP, &rx_dma->fbr0_full_offset);
+
+ /* This variable tracks the free buffer ring 0 full position, so it
+ * has to match the above.
+ */
+ rx_local->fbr[1]->local_full = ET_DMA10_WRAP;
+ writel(
+ ((rx_local->fbr[1]->num_entries * LO_MARK_PERCENT_FOR_RX) / 100) - 1,
+ &rx_dma->fbr0_min_des);
+#endif
+
+ /* Program the number of packets we will receive before generating an
+ * interrupt.
+ * For version B silicon, this value gets updated once autoneg is
+ *complete.
+ */
+ writel(PARM_RX_NUM_BUFS_DEF, &rx_dma->num_pkt_done);
+
+ /* The "time_done" is not working correctly to coalesce interrupts
+ * after a given time period, but rather is giving us an interrupt
+ * regardless of whether we have received packets.
+ * This value gets updated once autoneg is complete.
+ */
+ writel(PARM_RX_TIME_INT_DEF, &rx_dma->max_pkt_time);
+
+ spin_unlock_irqrestore(&adapter->rcv_lock, flags);
+}
+
+/**
+ * et131x_config_tx_dma_regs - Set up the tx dma section of the JAGCore.
+ * @adapter: pointer to our private adapter structure
+ *
+ * Configure the transmit engine with the ring buffers we have created
+ * and prepare it for use.
+ */
+void et131x_config_tx_dma_regs(struct et131x_adapter *adapter)
+{
+ struct txdma_regs __iomem *txdma = &adapter->regs->txdma;
+
+ /* Load the hardware with the start of the transmit descriptor ring. */
+ writel((u32) ((u64)adapter->tx_ring.tx_desc_ring_pa >> 32),
+ &txdma->pr_base_hi);
+ writel((u32) adapter->tx_ring.tx_desc_ring_pa,
+ &txdma->pr_base_lo);
+
+ /* Initialise the transmit DMA engine */
+ writel(NUM_DESC_PER_RING_TX - 1, &txdma->pr_num_des);
+
+ /* Load the completion writeback physical address */
+ writel((u32)((u64)adapter->tx_ring.tx_status_pa >> 32),
+ &txdma->dma_wb_base_hi);
+ writel((u32)adapter->tx_ring.tx_status_pa, &txdma->dma_wb_base_lo);
+
+ *adapter->tx_ring.tx_status = 0;
+
+ writel(0, &txdma->service_request);
+ adapter->tx_ring.send_idx = 0;
+}
+
+/**
+ * et131x_adapter_setup - Set the adapter up as per cassini+ documentation
+ * @adapter: pointer to our private adapter structure
+ *
+ * Returns 0 on success, errno on failure (as defined in errno.h)
+ */
+void et131x_adapter_setup(struct et131x_adapter *adapter)
+{
+ /* Configure the JAGCore */
+ et131x_configure_global_regs(adapter);
+
+ et1310_config_mac_regs1(adapter);
+
+ /* Configure the MMC registers */
+ /* All we need to do is initialize the Memory Control Register */
+ writel(ET_MMC_ENABLE, &adapter->regs->mmc.mmc_ctrl);
+
+ et1310_config_rxmac_regs(adapter);
+ et1310_config_txmac_regs(adapter);
+
+ et131x_config_rx_dma_regs(adapter);
+ et131x_config_tx_dma_regs(adapter);
+
+ et1310_config_macstat_regs(adapter);
+
+ et1310_phy_power_down(adapter, 0);
+ et131x_xcvr_init(adapter);
+}
+
+/**
* et1310_enable_phy_coma - called when network cable is unplugged
* @adapter: pointer to our adapter structure
*
@@ -2390,121 +2611,6 @@ int et131x_init_recv(struct et131x_adapter *adapter)
}
/**
- * et131x_config_rx_dma_regs - Start of Rx_DMA init sequence
- * @adapter: pointer to our adapter structure
- */
-void et131x_config_rx_dma_regs(struct et131x_adapter *adapter)
-{
- struct rxdma_regs __iomem *rx_dma = &adapter->regs->rxdma;
- struct rx_ring *rx_local = &adapter->rx_ring;
- struct fbr_desc *fbr_entry;
- u32 entry;
- u32 psr_num_des;
- unsigned long flags;
-
- /* Halt RXDMA to perform the reconfigure. */
- et131x_rx_dma_disable(adapter);
-
- /* Load the completion writeback physical address
- *
- * NOTE : dma_alloc_coherent(), used above to alloc DMA regions,
- * ALWAYS returns SAC (32-bit) addresses. If DAC (64-bit) addresses
- * are ever returned, make sure the high part is retrieved here
- * before storing the adjusted address.
- */
- writel((u32) ((u64)rx_local->rx_status_bus >> 32),
- &rx_dma->dma_wb_base_hi);
- writel((u32) rx_local->rx_status_bus, &rx_dma->dma_wb_base_lo);
-
- memset(rx_local->rx_status_block, 0, sizeof(struct rx_status_block));
-
- /* Set the address and parameters of the packet status ring into the
- * 1310's registers
- */
- writel((u32) ((u64)rx_local->ps_ring_physaddr >> 32),
- &rx_dma->psr_base_hi);
- writel((u32) rx_local->ps_ring_physaddr, &rx_dma->psr_base_lo);
- writel(rx_local->psr_num_entries - 1, &rx_dma->psr_num_des);
- writel(0, &rx_dma->psr_full_offset);
-
- psr_num_des = readl(&rx_dma->psr_num_des) & 0xFFF;
- writel((psr_num_des * LO_MARK_PERCENT_FOR_PSR) / 100,
- &rx_dma->psr_min_des);
-
- spin_lock_irqsave(&adapter->rcv_lock, flags);
-
- /* These local variables track the PSR in the adapter structure */
- rx_local->local_psr_full = 0;
-
- /* Now's the best time to initialize FBR1 contents */
- fbr_entry = (struct fbr_desc *) rx_local->fbr[0]->ring_virtaddr;
- for (entry = 0; entry < rx_local->fbr[0]->num_entries; entry++) {
- fbr_entry->addr_hi = rx_local->fbr[0]->bus_high[entry];
- fbr_entry->addr_lo = rx_local->fbr[0]->bus_low[entry];
- fbr_entry->word2 = entry;
- fbr_entry++;
- }
-
- /* Set the address and parameters of Free buffer ring 1 (and 0 if
- * required) into the 1310's registers
- */
- writel((u32) (rx_local->fbr[0]->real_physaddr >> 32),
- &rx_dma->fbr1_base_hi);
- writel((u32) rx_local->fbr[0]->real_physaddr, &rx_dma->fbr1_base_lo);
- writel(rx_local->fbr[0]->num_entries - 1, &rx_dma->fbr1_num_des);
- writel(ET_DMA10_WRAP, &rx_dma->fbr1_full_offset);
-
- /* This variable tracks the free buffer ring 1 full position, so it
- * has to match the above.
- */
- rx_local->fbr[0]->local_full = ET_DMA10_WRAP;
- writel(
- ((rx_local->fbr[0]->num_entries * LO_MARK_PERCENT_FOR_RX) / 100) - 1,
- &rx_dma->fbr1_min_des);
-
-#ifdef USE_FBR0
- /* Now's the best time to initialize FBR0 contents */
- fbr_entry = (struct fbr_desc *) rx_local->fbr[1]->ring_virtaddr;
- for (entry = 0; entry < rx_local->fbr[1]->num_entries; entry++) {
- fbr_entry->addr_hi = rx_local->fbr[1]->bus_high[entry];
- fbr_entry->addr_lo = rx_local->fbr[1]->bus_low[entry];
- fbr_entry->word2 = entry;
- fbr_entry++;
- }
-
- writel((u32) (rx_local->fbr[1]->real_physaddr >> 32),
- &rx_dma->fbr0_base_hi);
- writel((u32) rx_local->fbr[1]->real_physaddr, &rx_dma->fbr0_base_lo);
- writel(rx_local->fbr[1]->num_entries - 1, &rx_dma->fbr0_num_des);
- writel(ET_DMA10_WRAP, &rx_dma->fbr0_full_offset);
-
- /* This variable tracks the free buffer ring 0 full position, so it
- * has to match the above.
- */
- rx_local->fbr[1]->local_full = ET_DMA10_WRAP;
- writel(
- ((rx_local->fbr[1]->num_entries * LO_MARK_PERCENT_FOR_RX) / 100) - 1,
- &rx_dma->fbr0_min_des);
-#endif
-
- /* Program the number of packets we will receive before generating an
- * interrupt.
- * For version B silicon, this value gets updated once autoneg is
- *complete.
- */
- writel(PARM_RX_NUM_BUFS_DEF, &rx_dma->num_pkt_done);
-
- /* The "time_done" is not working correctly to coalesce interrupts
- * after a given time period, but rather is giving us an interrupt
- * regardless of whether we have received packets.
- * This value gets updated once autoneg is complete.
- */
- writel(PARM_RX_TIME_INT_DEF, &rx_dma->max_pkt_time);
-
- spin_unlock_irqrestore(&adapter->rcv_lock, flags);
-}
-
-/**
* et131x_set_rx_dma_timer - Set the heartbeat timer according to line rate.
* @adapter: pointer to our adapter structure
*/
@@ -3046,37 +3152,6 @@ void et131x_tx_dma_memory_free(struct et131x_adapter *adapter)
}
/**
- * et131x_config_tx_dma_regs - Set up the tx dma section of the JAGCore.
- * @adapter: pointer to our private adapter structure
- *
- * Configure the transmit engine with the ring buffers we have created
- * and prepare it for use.
- */
-void et131x_config_tx_dma_regs(struct et131x_adapter *adapter)
-{
- struct txdma_regs __iomem *txdma = &adapter->regs->txdma;
-
- /* Load the hardware with the start of the transmit descriptor ring. */
- writel((u32) ((u64)adapter->tx_ring.tx_desc_ring_pa >> 32),
- &txdma->pr_base_hi);
- writel((u32) adapter->tx_ring.tx_desc_ring_pa,
- &txdma->pr_base_lo);
-
- /* Initialise the transmit DMA engine */
- writel(NUM_DESC_PER_RING_TX - 1, &txdma->pr_num_des);
-
- /* Load the completion writeback physical address */
- writel((u32)((u64)adapter->tx_ring.tx_status_pa >> 32),
- &txdma->dma_wb_base_hi);
- writel((u32)adapter->tx_ring.tx_status_pa, &txdma->dma_wb_base_lo);
-
- *adapter->tx_ring.tx_status = 0;
-
- writel(0, &txdma->service_request);
- adapter->tx_ring.send_idx = 0;
-}
-
-/**
* et131x_tx_dma_disable - Stop of Tx_DMA on the ET1310
* @adapter: pointer to our adapter structure
*/
@@ -4022,82 +4097,6 @@ void et131x_error_timer_handler(unsigned long data)
}
/**
- * et131x_configure_global_regs - configure JAGCore global regs
- * @adapter: pointer to our adapter structure
- *
- * Used to configure the global registers on the JAGCore
- */
-void et131x_configure_global_regs(struct et131x_adapter *adapter)
-{
- struct global_regs __iomem *regs = &adapter->regs->global;
-
- writel(0, ®s->rxq_start_addr);
- writel(INTERNAL_MEM_SIZE - 1, ®s->txq_end_addr);
-
- if (adapter->registry_jumbo_packet < 2048) {
- /* Tx / RxDMA and Tx/Rx MAC interfaces have a 1k word
- * block of RAM that the driver can split between Tx
- * and Rx as it desires. Our default is to split it
- * 50/50:
- */
- writel(PARM_RX_MEM_END_DEF, ®s->rxq_end_addr);
- writel(PARM_RX_MEM_END_DEF + 1, ®s->txq_start_addr);
- } else if (adapter->registry_jumbo_packet < 8192) {
- /* For jumbo packets > 2k but < 8k, split 50-50. */
- writel(INTERNAL_MEM_RX_OFFSET, ®s->rxq_end_addr);
- writel(INTERNAL_MEM_RX_OFFSET + 1, ®s->txq_start_addr);
- } else {
- /* 9216 is the only packet size greater than 8k that
- * is available. The Tx buffer has to be big enough
- * for one whole packet on the Tx side. We'll make
- * the Tx 9408, and give the rest to Rx
- */
- writel(0x01b3, ®s->rxq_end_addr);
- writel(0x01b4, ®s->txq_start_addr);
- }
-
- /* Initialize the loopback register. Disable all loopbacks. */
- writel(0, ®s->loopback);
-
- /* MSI Register */
- writel(0, ®s->msi_config);
-
- /* By default, disable the watchdog timer. It will be enabled when
- * a packet is queued.
- */
- writel(0, ®s->watchdog_timer);
-}
-
-/**
- * et131x_adapter_setup - Set the adapter up as per cassini+ documentation
- * @adapter: pointer to our private adapter structure
- *
- * Returns 0 on success, errno on failure (as defined in errno.h)
- */
-void et131x_adapter_setup(struct et131x_adapter *adapter)
-{
- /* Configure the JAGCore */
- et131x_configure_global_regs(adapter);
-
- et1310_config_mac_regs1(adapter);
-
- /* Configure the MMC registers */
- /* All we need to do is initialize the Memory Control Register */
- writel(ET_MMC_ENABLE, &adapter->regs->mmc.mmc_ctrl);
-
- et1310_config_rxmac_regs(adapter);
- et1310_config_txmac_regs(adapter);
-
- et131x_config_rx_dma_regs(adapter);
- et131x_config_tx_dma_regs(adapter);
-
- et1310_config_macstat_regs(adapter);
-
- et1310_phy_power_down(adapter, 0);
- et131x_xcvr_init(adapter);
-}
-
-/**
* et131x_soft_reset - Issue a soft reset to the hardware, complete for ET1310
* @adapter: pointer to our private adapter structure
*/
--
1.7.6.4
^ permalink raw reply related
* [PATCH 05/12] staging: et131x: Remove some forward declarations
From: Mark Einon @ 2011-10-23 9:22 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-kernel, Mark Einon
In-Reply-To: <1319361774-3148-1-git-send-email-mark.einon@gmail.com>
Moved functions in et131x.c file to remove the following forward
declarations:
et131x_align_allocated_memory
et131x_disable_interrupts
et131x_enable_interrupts
et131x_error_timer_handler
Signed-off-by: Mark Einon <mark.einon@gmail.com>
---
drivers/staging/et131x/et131x.c | 126 ++++++++++++++++++--------------------
1 files changed, 60 insertions(+), 66 deletions(-)
diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c
index cf6f7a2..8048d67 100644
--- a/drivers/staging/et131x/et131x.c
+++ b/drivers/staging/et131x/et131x.c
@@ -576,12 +576,6 @@ struct et131x_adapter {
struct net_device_stats net_stats;
};
-void et131x_error_timer_handler(unsigned long data);
-void et131x_enable_interrupts(struct et131x_adapter *adapter);
-void et131x_disable_interrupts(struct et131x_adapter *adapter);
-void et131x_align_allocated_memory(struct et131x_adapter *adapter,
- u64 *phys_addr,
- u64 *offset, u64 mask);
void et131x_adapter_setup(struct et131x_adapter *adapter);
void et131x_soft_reset(struct et131x_adapter *adapter);
void et131x_isr_handler(struct work_struct *work);
@@ -1872,6 +1866,33 @@ static inline u32 bump_free_buff_ring(u32 *free_buff_ring, u32 limit)
}
/**
+ * et131x_align_allocated_memory - Align allocated memory on a given boundary
+ * @adapter: pointer to our adapter structure
+ * @phys_addr: pointer to Physical address
+ * @offset: pointer to the offset variable
+ * @mask: correct mask
+ */
+void et131x_align_allocated_memory(struct et131x_adapter *adapter,
+ uint64_t *phys_addr,
+ uint64_t *offset, uint64_t mask)
+{
+ uint64_t new_addr;
+
+ *offset = 0;
+
+ new_addr = *phys_addr & ~mask;
+
+ if (new_addr != *phys_addr) {
+ /* Move to next aligned block */
+ new_addr += mask + 1;
+ /* Return offset for adjusting virt addr */
+ *offset = new_addr - *phys_addr;
+ /* Return new physical address */
+ *phys_addr = new_addr;
+ }
+}
+
+/**
* et131x_rx_dma_memory_alloc
* @adapter: pointer to our private adapter structure
*
@@ -3938,6 +3959,27 @@ static int et131x_pci_init(struct et131x_adapter *adapter,
}
/**
+ * et131x_enable_interrupts - enable interrupt
+ * @adapter: et131x device
+ *
+ * Enable the appropriate interrupts on the ET131x according to our
+ * configuration
+ */
+void et131x_enable_interrupts(struct et131x_adapter *adapter)
+{
+ u32 mask;
+
+ /* Enable all global interrupts */
+ if (adapter->flowcontrol == FLOW_TXONLY ||
+ adapter->flowcontrol == FLOW_BOTH)
+ mask = INT_MASK_ENABLE;
+ else
+ mask = INT_MASK_ENABLE_NO_FLOW;
+
+ writel(mask, &adapter->regs->global.int_mask);
+}
+
+/**
* et131x_error_timer_handler
* @data: timer-specific variable; here a pointer to our adapter structure
*
@@ -4071,33 +4113,6 @@ void et131x_soft_reset(struct et131x_adapter *adapter)
}
/**
- * et131x_align_allocated_memory - Align allocated memory on a given boundary
- * @adapter: pointer to our adapter structure
- * @phys_addr: pointer to Physical address
- * @offset: pointer to the offset variable
- * @mask: correct mask
- */
-void et131x_align_allocated_memory(struct et131x_adapter *adapter,
- uint64_t *phys_addr,
- uint64_t *offset, uint64_t mask)
-{
- uint64_t new_addr;
-
- *offset = 0;
-
- new_addr = *phys_addr & ~mask;
-
- if (new_addr != *phys_addr) {
- /* Move to next aligned block */
- new_addr += mask + 1;
- /* Return offset for adjusting virt addr */
- *offset = new_addr - *phys_addr;
- /* Return new physical address */
- *phys_addr = new_addr;
- }
-}
-
-/**
* et131x_adapter_memory_alloc
* @adapter: pointer to our private adapter structure
*
@@ -4339,6 +4354,18 @@ static struct et131x_adapter *et131x_adapter_init(struct net_device *netdev,
}
/**
+ * et131x_disable_interrupts - interrupt disable
+ * @adapter: et131x device
+ *
+ * Block all interrupts from the et131x device at the device itself
+ */
+void et131x_disable_interrupts(struct et131x_adapter *adapter)
+{
+ /* Disable all global interrupts */
+ writel(INT_MASK_DISABLE, &adapter->regs->global.int_mask);
+}
+
+/**
* et131x_pci_setup - Perform device initialization
* @pdev: a pointer to the device's pci_dev structure
* @ent: this device's entry in the pci_device_id table
@@ -4633,39 +4660,6 @@ module_exit(et131x_cleanup_module);
/* ISR functions */
/**
- * et131x_enable_interrupts - enable interrupt
- * @adapter: et131x device
- *
- * Enable the appropriate interrupts on the ET131x according to our
- * configuration
- */
-void et131x_enable_interrupts(struct et131x_adapter *adapter)
-{
- u32 mask;
-
- /* Enable all global interrupts */
- if (adapter->flowcontrol == FLOW_TXONLY ||
- adapter->flowcontrol == FLOW_BOTH)
- mask = INT_MASK_ENABLE;
- else
- mask = INT_MASK_ENABLE_NO_FLOW;
-
- writel(mask, &adapter->regs->global.int_mask);
-}
-
-/**
- * et131x_disable_interrupts - interrupt disable
- * @adapter: et131x device
- *
- * Block all interrupts from the et131x device at the device itself
- */
-void et131x_disable_interrupts(struct et131x_adapter *adapter)
-{
- /* Disable all global interrupts */
- writel(INT_MASK_DISABLE, &adapter->regs->global.int_mask);
-}
-
-/**
* et131x_isr - The Interrupt Service Routine for the driver.
* @irq: the IRQ on which the interrupt was received.
* @dev_id: device-specific info (here a pointer to a net_device struct)
--
1.7.6.4
^ permalink raw reply related
* [PATCH 02/12] staging: et131x: Remove redundant et131x_reset_recv() call
From: Mark Einon @ 2011-10-23 9:22 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-kernel, Mark Einon
In-Reply-To: <1319361774-3148-1-git-send-email-mark.einon@gmail.com>
This call doesn't do anything useful - only warns on the receive list
being empty, so removed it.
Signed-off-by: Mark Einon <mark.einon@gmail.com>
---
drivers/staging/et131x/et131x.c | 18 ------------------
1 files changed, 0 insertions(+), 18 deletions(-)
diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c
index 8c557cf..f521e33 100644
--- a/drivers/staging/et131x/et131x.c
+++ b/drivers/staging/et131x/et131x.c
@@ -605,7 +605,6 @@ int32_t et131x_mii_write(struct et131x_adapter *adapter,
void et131x_rx_dma_memory_free(struct et131x_adapter *adapter);
void et131x_rx_dma_disable(struct et131x_adapter *adapter);
void et131x_rx_dma_enable(struct et131x_adapter *adapter);
-void et131x_reset_recv(struct et131x_adapter *adapter);
void et131x_init_send(struct et131x_adapter *adapter);
void et131x_tx_dma_enable(struct et131x_adapter *adapter);
@@ -1839,9 +1838,6 @@ void et1310_disable_phy_coma(struct et131x_adapter *adapter)
/* Re-initialize the send structures */
et131x_init_send(adapter);
- /* Reset the RFD list and re-start RU */
- et131x_reset_recv(adapter);
-
/* Bring the device back to the state it was during init prior to
* autonegotiation being complete. This way, when we get the auto-neg
* complete interrupt, we can complete init by calling ConfigMacREGS2.
@@ -2882,17 +2878,6 @@ static struct rfd *nic_rx_pkts(struct et131x_adapter *adapter)
}
/**
- * et131x_reset_recv - Reset the receive list
- * @adapter: pointer to our adapter
- *
- * Assumption, Rcv spinlock has been acquired.
- */
-void et131x_reset_recv(struct et131x_adapter *adapter)
-{
- WARN_ON(list_empty(&adapter->rx_ring.recv_list));
-}
-
-/**
* et131x_handle_recv_interrupt - Interrupt handler for receive processing
* @adapter: pointer to our adapter
*
@@ -4251,9 +4236,6 @@ static void et131x_adjust_link(struct net_device *netdev)
/* Re-initialize the send structures */
et131x_init_send(adapter);
- /* Reset the RFD list and re-start RU */
- et131x_reset_recv(adapter);
-
/*
* Bring the device back to the state it was during
* init prior to autonegotiation being complete. This
--
1.7.6.4
^ permalink raw reply related
* [PATCH 01/12] staging: et131x: Remove unused rx_ring.recv_buffer_pool
From: Mark Einon @ 2011-10-23 9:22 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-kernel, Mark Einon
In-Reply-To: <1319361774-3148-1-git-send-email-mark.einon@gmail.com>
rx_ring.recv_buffer_pool is unused, even in the original driver code.
Remove from stuct, and also remove some comments regarding it.
Signed-off-by: Mark Einon <mark.einon@gmail.com>
---
drivers/staging/et131x/et131x.c | 6 ------
1 files changed, 0 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c
index 1efa27c..8c557cf 100644
--- a/drivers/staging/et131x/et131x.c
+++ b/drivers/staging/et131x/et131x.c
@@ -329,8 +329,6 @@ struct rx_ring {
struct rx_status_block *rx_status_block;
dma_addr_t rx_status_bus;
- struct list_head recv_buff_pool;
-
/* RECV */
struct list_head recv_list;
u32 num_ready_recv;
@@ -2307,10 +2305,6 @@ void et131x_rx_dma_memory_free(struct et131x_adapter *adapter)
rx_ring->rx_status_block = NULL;
}
- /* Free receive buffer pool */
-
- /* Free receive packet pool */
-
/* Destroy the lookaside (RFD) pool */
if (adapter->flags & fMP_ADAPTER_RECV_LOOKASIDE) {
kmem_cache_destroy(rx_ring->recv_lookaside);
--
1.7.6.4
^ permalink raw reply related
* [PATCH 00/12 RESEND] Mainly checkpatch fixes
From: Mark Einon @ 2011-10-23 9:22 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-kernel
Resending patches. Reduces the number of checkpatch warnings, removing forward declarations and whitespace changes.
Last patch removes some redundant code.
Mark Einon (12):
staging: et131x: Remove unused rx_ring.recv_buffer_pool
staging: et131x: Remove redundant et131x_reset_recv() call
staging: et131x: Remove call to find pci pm capability
staging: et131x: Remove unused rx_ring.recv_packet_pool
staging: et131x: Remove some forward declarations
staging: et131x: Remove forward declaration of et131x_adapter_setup
staging: et131x: Remove more forward declarations
staging: et131x: Remove yet more forward declarations
staging: et131x: Remove even more forward declarations
staging: et131x: Remove last of the forward declarations
staging: et131x: Mainly whitespace changes to appease checkpatch
staging: et131x: Remove redundant check and return statement
drivers/staging/et131x/et131x.c | 2465 +++++++++++++++++++--------------------
1 files changed, 1201 insertions(+), 1264 deletions(-)
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.