[PATCH] scripts/link-vmlinux.sh: source variables from KCONFIG_CONFIG
Its possible to superseed the config file with KCONFIG_CONFIG and have completely no .config in the tree. The current script is sourcing .config in every case, so the kernel will never build succesfully. This patch fixes that issue by sourcing KCONFIG_CONFIG instead. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de --- scripts/link-vmlinux.sh |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh index b3d907e..e62f1e0 100644 --- a/scripts/link-vmlinux.sh +++ b/scripts/link-vmlinux.sh @@ -132,7 +132,7 @@ if [ $1 = clean ]; then fi # We need access to CONFIG_ symbols -. ./.config +. ${KCONFIG_CONFIG} #link vmlinux.o info LD vmlinux.o -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] mc13xxx-ts: use zero as default value if no pdata was defined
On Tue, Aug 20, 2013 at 03:34:33AM +0200, Samuel Ortiz wrote: Hi Michael, On Tue, Aug 13, 2013 at 02:14:30PM +0200, Michael Grzeschik wrote: In case of devicetree, we currently don't have a way to append pdata for the touchscreen. The current approach is to bail out in that case. This patch makes it possible to probe the touchscreen without pdata and use zero as default values for the atox and ato adc conversion. Would that still make the touchscreen somehow functional ? Yes, it still works. It just defaults to zero values in no pdata case. If that's the case, and if Dmitry is fine with the ts part of this patch, could you please separate the mfd part of this patch into a separate one ? Why? The purpose of this patch is to have both cases working, pdata and no pdata. This patch is actually fixing the patch of Michael Thalmeier. There we changed the mfd and touch in one patch as well. http://lkml.indiana.edu/hypermail/linux/kernel/1201.1/01364.html Thanks, Michael -- 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- | -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] mc13xxx-ts: use zero as default value if no pdata was defined
On Tue, Aug 20, 2013 at 11:50:48AM +0200, Samuel Ortiz wrote: Hi Michael, On Tue, Aug 20, 2013 at 11:34:32AM +0200, Michael Grzeschik wrote: On Tue, Aug 20, 2013 at 03:34:33AM +0200, Samuel Ortiz wrote: On Tue, Aug 13, 2013 at 02:14:30PM +0200, Michael Grzeschik wrote: In case of devicetree, we currently don't have a way to append pdata for the touchscreen. The current approach is to bail out in that case. This patch makes it possible to probe the touchscreen without pdata and use zero as default values for the atox and ato adc conversion. Would that still make the touchscreen somehow functional ? Yes, it still works. It just defaults to zero values in no pdata case. If that's the case, and if Dmitry is fine with the ts part of this patch, could you please separate the mfd part of this patch into a separate one ? Why? To avoid cross tree commits as much as possible. The purpose of this patch is to have both cases working, pdata and no pdata. I understood that part. But you can still split the patch in 2 as the ts driver will not be probed without pdata until the mfd patch is merged upstream. This patch is actually fixing the patch of Michael Thalmeier. There we changed the mfd and touch in one patch as well. There was a build time dependency between the ts driver and the MFD changes, so the patch had to be merged atomically. That is not the case with your patch. All right then. I will resend them and the codec mfd patch together with the oftree patches I am currently working on. Thanks, Michael -- 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- | -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] mc13xxx-ts: use zero as default value if no pdata was defined
In case of devicetree, we currently don't have a way to append pdata for the touchscreen. The current approach is to bail out in that case. This patch makes it possible to probe the touchscreen without pdata and use zero as default values for the atox and ato adc conversion. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de --- drivers/input/touchscreen/mc13783_ts.c | 14 +- drivers/mfd/mc13xxx-core.c | 11 +++ 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/drivers/input/touchscreen/mc13783_ts.c b/drivers/input/touchscreen/mc13783_ts.c index d6f099c..0e24304 100644 --- a/drivers/input/touchscreen/mc13783_ts.c +++ b/drivers/input/touchscreen/mc13783_ts.c @@ -124,10 +124,17 @@ static void mc13783_ts_work(struct work_struct *work) container_of(work, struct mc13783_ts_priv, work.work); unsigned int mode = MC13XXX_ADC_MODE_TS; unsigned int channel = 12; + u8 ato = 0; + bool atox = 0; + + if (priv-touch) { + ato = priv-touch-ato; + atox = priv-touch-atox; + } if (mc13xxx_adc_do_conversion(priv-mc13xxx, mode, channel, - priv-touch-ato, priv-touch-atox, + ato, atox, priv-sample) == 0) mc13783_ts_report_sample(priv); } @@ -183,11 +190,8 @@ static int __init mc13783_ts_probe(struct platform_device *pdev) priv-mc13xxx = dev_get_drvdata(pdev-dev.parent); priv-idev = idev; priv-touch = dev_get_platdata(pdev-dev); - if (!priv-touch) { + if (!priv-touch) dev_err(pdev-dev, missing platform data\n); - ret = -ENODEV; - goto err_free_mem; - } /* * We need separate workqueue because mc13783_adc_do_conversion diff --git a/drivers/mfd/mc13xxx-core.c b/drivers/mfd/mc13xxx-core.c index 2a9b100..278601f 100644 --- a/drivers/mfd/mc13xxx-core.c +++ b/drivers/mfd/mc13xxx-core.c @@ -694,10 +694,6 @@ err_revision: if (mc13xxx-flags MC13XXX_USE_RTC) mc13xxx_add_subdevice(mc13xxx, %s-rtc); - if (mc13xxx-flags MC13XXX_USE_TOUCHSCREEN) - mc13xxx_add_subdevice_pdata(mc13xxx, %s-ts, - pdata-touch, sizeof(pdata-touch)); - if (pdata) { mc13xxx_add_subdevice_pdata(mc13xxx, %s-regulator, pdata-regulators, sizeof(pdata-regulators)); @@ -705,10 +701,17 @@ err_revision: pdata-leds, sizeof(*pdata-leds)); mc13xxx_add_subdevice_pdata(mc13xxx, %s-pwrbutton, pdata-buttons, sizeof(*pdata-buttons)); + + if (mc13xxx-flags MC13XXX_USE_TOUCHSCREEN) + mc13xxx_add_subdevice_pdata(mc13xxx, %s-ts, + pdata-touch, sizeof(pdata-touch)); } else { mc13xxx_add_subdevice(mc13xxx, %s-regulator); mc13xxx_add_subdevice(mc13xxx, %s-led); mc13xxx_add_subdevice(mc13xxx, %s-pwrbutton); + + if (mc13xxx-flags MC13XXX_USE_TOUCHSCREEN) + mc13xxx_add_subdevice(mc13xxx, %s-ts); } return 0; -- 1.8.4.rc2 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] mfd: mc13xxx: make it possible to use the codec without pdata
In case of devicetree, we currently don't have a way to append pdata for the codec. This patch makes it possible to probe the codec without pdata for that case. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de --- drivers/mfd/mc13xxx-core.c | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/mfd/mc13xxx-core.c b/drivers/mfd/mc13xxx-core.c index 278601f..e1b89e6 100644 --- a/drivers/mfd/mc13xxx-core.c +++ b/drivers/mfd/mc13xxx-core.c @@ -687,10 +687,6 @@ err_revision: if (mc13xxx-flags MC13XXX_USE_ADC) mc13xxx_add_subdevice(mc13xxx, %s-adc); - if (mc13xxx-flags MC13XXX_USE_CODEC) - mc13xxx_add_subdevice_pdata(mc13xxx, %s-codec, - pdata-codec, sizeof(*pdata-codec)); - if (mc13xxx-flags MC13XXX_USE_RTC) mc13xxx_add_subdevice(mc13xxx, %s-rtc); @@ -705,6 +701,10 @@ err_revision: if (mc13xxx-flags MC13XXX_USE_TOUCHSCREEN) mc13xxx_add_subdevice_pdata(mc13xxx, %s-ts, pdata-touch, sizeof(pdata-touch)); + + if (mc13xxx-flags MC13XXX_USE_CODEC) + mc13xxx_add_subdevice_pdata(mc13xxx, %s-codec, + pdata-codec, sizeof(*pdata-codec)); } else { mc13xxx_add_subdevice(mc13xxx, %s-regulator); mc13xxx_add_subdevice(mc13xxx, %s-led); @@ -712,6 +712,9 @@ err_revision: if (mc13xxx-flags MC13XXX_USE_TOUCHSCREEN) mc13xxx_add_subdevice(mc13xxx, %s-ts); + + if (mc13xxx-flags MC13XXX_USE_CODEC) + mc13xxx_add_subdevice(mc13xxx, %s-codec); } return 0; -- 1.8.4.rc2 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] mc13xxx-ts: use zero as default value if no pdata was defined
Hi Dimitry, On Tue, Aug 13, 2013 at 09:46:09AM -0700, Dmitry Torokhov wrote: Hi Michael, On Tue, Aug 13, 2013 at 02:14:30PM +0200, Michael Grzeschik wrote: In case of devicetree, we currently don't have a way to append pdata for the touchscreen. The current approach is to bail out in that case. This patch makes it possible to probe the touchscreen without pdata and use zero as default values for the atox and ato adc conversion. I'd rather you added the devicetree support to the driver. I know that we will need real devictree glue that generates pdata in the long run. I am working on that. Beside that, for now this patch makes sense anyway. Regards, Michael -- 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- | -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 3/4] regulator: da9052: Use apply_[reg|bit] with regmap based voltage_sel operations
Hi Axel, Mark, we should not play to much with generous functions for this pmics. With this patch we loose the fix_io code path from da9052_reg_update. include/linux/mfd/da9052.h ... if (da9052-fix_io) { ret = da9052-fix_io(da9052, reg); if (ret 0) return ret; ... This fix_io used in drivers/mfd/da9052-i2c.c /* * There is an issue with DA9052 and DA9053_AA/BA/BB PMIC where the PMIC * gets lockup up or fails to respond following a system reset. * This fix is to follow any read or write with a dummy read to a safe * register. */ static int da9052_i2c_fix(struct da9052 *da9052, unsigned char reg) { int val; switch (da9052-chip_id) { case DA9052: case DA9053_AA: case DA9053_BA: case DA9053_BB: /* A dummy read to a safe register address. */ if (!i2c_safe_reg(reg)) return regmap_read(da9052-regmap, DA9052_PARK_REGISTER, val); break; default: /* * For other chips parking of I2C register * to a safe place is not required. */ break; } return 0; } I suggest that Mark queue the revert of this patch. Thanks, Michael On Tue, Dec 18, 2012 at 09:32:52AM +0800, Axel Lin wrote: Signed-off-by: Axel Lin axel@ingics.com --- drivers/regulator/da9052-regulator.c | 41 +- 1 file changed, 6 insertions(+), 35 deletions(-) diff --git a/drivers/regulator/da9052-regulator.c b/drivers/regulator/da9052-regulator.c index d096309..c6d8651 100644 --- a/drivers/regulator/da9052-regulator.c +++ b/drivers/regulator/da9052-regulator.c @@ -70,7 +70,6 @@ struct da9052_regulator_info { int step_uV; int min_uV; int max_uV; - unsigned char activate_bit; }; struct da9052_regulator { @@ -210,36 +209,6 @@ static int da9052_map_voltage(struct regulator_dev *rdev, return sel; } -static int da9052_regulator_set_voltage_sel(struct regulator_dev *rdev, - unsigned int selector) -{ - struct da9052_regulator *regulator = rdev_get_drvdata(rdev); - struct da9052_regulator_info *info = regulator-info; - int id = rdev_get_id(rdev); - int ret; - - ret = da9052_reg_update(regulator-da9052, rdev-desc-vsel_reg, - rdev-desc-vsel_mask, selector); - if (ret 0) - return ret; - - /* Some LDOs and DCDCs are DVC controlled which requires enabling of - * the activate bit to implment the changes on the output. - */ - switch (id) { - case DA9052_ID_BUCK1: - case DA9052_ID_BUCK2: - case DA9052_ID_BUCK3: - case DA9052_ID_LDO2: - case DA9052_ID_LDO3: - ret = da9052_reg_update(regulator-da9052, DA9052_SUPPLY_REG, - info-activate_bit, info-activate_bit); - break; - } - - return ret; -} - static struct regulator_ops da9052_dcdc_ops = { .get_current_limit = da9052_dcdc_get_current_limit, .set_current_limit = da9052_dcdc_set_current_limit, @@ -247,7 +216,7 @@ static struct regulator_ops da9052_dcdc_ops = { .list_voltage = da9052_list_voltage, .map_voltage = da9052_map_voltage, .get_voltage_sel = regulator_get_voltage_sel_regmap, - .set_voltage_sel = da9052_regulator_set_voltage_sel, + .set_voltage_sel = regulator_set_voltage_sel_regmap, .is_enabled = regulator_is_enabled_regmap, .enable = regulator_enable_regmap, .disable = regulator_disable_regmap, @@ -257,7 +226,7 @@ static struct regulator_ops da9052_ldo_ops = { .list_voltage = da9052_list_voltage, .map_voltage = da9052_map_voltage, .get_voltage_sel = regulator_get_voltage_sel_regmap, - .set_voltage_sel = da9052_regulator_set_voltage_sel, + .set_voltage_sel = regulator_set_voltage_sel_regmap, .is_enabled = regulator_is_enabled_regmap, .enable = regulator_enable_regmap, .disable = regulator_disable_regmap, @@ -274,13 +243,14 @@ static struct regulator_ops da9052_ldo_ops = { .owner = THIS_MODULE,\ .vsel_reg = DA9052_BUCKCORE_REG + DA9052_ID_##_id, \ .vsel_mask = (1 (sbits)) - 1,\ + .apply_reg = DA9052_SUPPLY_REG, \ + .apply_bit = (abits), \ .enable_reg = DA9052_BUCKCORE_REG + DA9052_ID_##_id, \ .enable_mask = 1 (ebits),\ },\ .min_uV = (min) * 1000,\ .max_uV = (max) * 1000,\ .step_uV = (step) * 1000,\ - .activate_bit = (abits),\ } #define DA9052_DCDC(_id, step, min, max, sbits, ebits, abits) \ @@ -294,13 +264,14 @@ static struct regulator_ops da9052_ldo_ops =
[[PATCH] 1/3] dma: imx-dma: fix slow path issue in prep_dma_cyclic
When perparing cyclic_dma buffers by the sound layer, it will dump the following lockdep trace. The leading snd_pcm_action_single get called with read_lock_irq called. To fix this, we change the kcalloc call from GFP_KERNEL to GFP_ATOMIC. jARNING: at kernel/lockdep.c:2740 lockdep_trace_alloc+0xcc/0x114() DEBUG_LOCKS_WARN_ON(irqs_disabled_flags(flags)) Modules linked in: CPU: 0 PID: 832 Comm: aplay Not tainted 3.11.0-20130823+ #903 Backtrace: [c000b98c] (dump_backtrace+0x0/0x10c) from [c000bb28] (show_stack+0x18/0x1c) r6:c004c090 r5:0009 r4:c2e0bd18 r3:00404000 [c000bb10] (show_stack+0x0/0x1c) from [c02f397c] (dump_stack+0x20/0x28) [c02f395c] (dump_stack+0x0/0x28) from [c001531c] (warn_slowpath_common+0x54/0x70) [c00152c8] (warn_slowpath_common+0x0/0x70) from [c00153dc] (warn_slowpath_fmt+0x38/0x40) r8:4000 r7:a3b9 r6:80d0 r5:6093 r4:c2e0a000 r3:0009 [c00153a4] (warn_slowpath_fmt+0x0/0x40) from [c004c090] (lockdep_trace_alloc+0xcc/0x114) r3:c03955d8 r2:c03907db [c004bfc4] (lockdep_trace_alloc+0x0/0x114) from [c008f16c] (__kmalloc+0x34/0x118) r6:80d0 r5:c3800120 r4:80d0 r3:c040a0f8 [c008f138] (__kmalloc+0x0/0x118) from [c019c95c] (imxdma_prep_dma_cyclic+0x64/0x168) r7:a3b9 r6:0004 r5:c39d8420 r4:c3847150 [c019c8f8] (imxdma_prep_dma_cyclic+0x0/0x168) from [c024618c] (snd_dmaengine_pcm_trigger+0xa8/0x160) [c02460e4] (snd_dmaengine_pcm_trigger+0x0/0x160) from [c0241fa8] (soc_pcm_trigger+0x90/0xb4) r8:c058c7b0 r7:c3b8140c r6:c39da560 r5:0001 r4:c3b81000 [c0241f18] (soc_pcm_trigger+0x0/0xb4) from [c022ece4] (snd_pcm_do_start+0x2c/0x38) r7: r6:0003 r5:c058c7b0 r4:c3b81000 [c022ecb8] (snd_pcm_do_start+0x0/0x38) from [c022e958] (snd_pcm_action_single+0x40/0x6c) [c022e918] (snd_pcm_action_single+0x0/0x6c) from [c022ea64] (snd_pcm_action_lock_irq+0x7c/0x9c) r7:0003 r6:c3b810f0 r5:c3b810f0 r4:c3b81000 [c022e9e8] (snd_pcm_action_lock_irq+0x0/0x9c) from [c023009c] (snd_pcm_common_ioctl1+0x7f8/0xfd0) r8:c3b7f888 r7:005407b8 r6:c2c991c0 r5:c3b81000 r4:c3b81000 r3:4142 [c022f8a4] (snd_pcm_common_ioctl1+0x0/0xfd0) from [c023117c] (snd_pcm_playback_ioctl1+0x464/0x488) [c0230d18] (snd_pcm_playback_ioctl1+0x0/0x488) from [c02311d4] (snd_pcm_playback_ioctl+0x34/0x40) r8:c3b7f888 r7:4142 r6:0004 r5:c2c991c0 r4:005407b8 [c02311a0] (snd_pcm_playback_ioctl+0x0/0x40) from [c00a14a4] (vfs_ioctl+0x30/0x44) [c00a1474] (vfs_ioctl+0x0/0x44) from [c00a1fe8] (do_vfs_ioctl+0x55c/0x5c0) [c00a1a8c] (do_vfs_ioctl+0x0/0x5c0) from [c00a208c] (SyS_ioctl+0x40/0x68) [c00a204c] (SyS_ioctl+0x0/0x68) from [c0009380] (ret_fast_syscall+0x0/0x44) r8:c0009544 r7:0036 r6:bedeaa58 r5: r4:00c0 Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de --- drivers/dma/imx-dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c index 78f8ca5..442af61 100644 --- a/drivers/dma/imx-dma.c +++ b/drivers/dma/imx-dma.c @@ -883,7 +883,7 @@ static struct dma_async_tx_descriptor *imxdma_prep_dma_cyclic( kfree(imxdmac-sg_list); imxdmac-sg_list = kcalloc(periods + 1, - sizeof(struct scatterlist), GFP_KERNEL); + sizeof(struct scatterlist), GFP_ATOMIC); if (!imxdmac-sg_list) return NULL; -- 1.8.4.rc3 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[[PATCH] 0/3] imx-dma: fixes
Hello, this series is solving some lockdep issues in the imx-dma code. There are some list_head and deadlock issues in the code, that is running the implementation into unsafe situations. Regards, Michael Michael Grzeschik (3): dma: imx-dma: fix slow path issue in prep_dma_cyclic dma: imx-dma: fix lockdep issue between irqhandler and tasklet dma: imx-dma: fix callback path in tasklet drivers/dma/imx-dma.c | 31 +++ 1 file changed, 15 insertions(+), 16 deletions(-) -- 1.8.4.rc3 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[[PATCH] 3/3] dma: imx-dma: fix callback path in tasklet
We need to free the ld_active list head before jumping into the callback routine. Otherwise the callback could run into issue_pending and change our ld_active list head we just going to free. This will run the channel list into an currupted and undefined state. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de --- drivers/dma/imx-dma.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c index 247aa7c..55852c0 100644 --- a/drivers/dma/imx-dma.c +++ b/drivers/dma/imx-dma.c @@ -627,13 +627,11 @@ static void imxdma_tasklet(unsigned long data) if (list_empty(imxdmac-ld_active)) { /* Someone might have called terminate all */ - goto out; + spin_unlock_irqrestore(imxdma-lock, flags); + return; } desc = list_first_entry(imxdmac-ld_active, struct imxdma_desc, node); - if (desc-desc.callback) - desc-desc.callback(desc-desc.callback_param); - /* If we are dealing with a cyclic descriptor, keep it on ld_active * and dont mark the descriptor as complete. * Only in non-cyclic cases it would be marked as complete @@ -661,6 +659,10 @@ static void imxdma_tasklet(unsigned long data) } out: spin_unlock_irqrestore(imxdma-lock, flags); + + if (desc-desc.callback) + desc-desc.callback(desc-desc.callback_param); + } static int imxdma_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd, -- 1.8.4.rc3 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[[PATCH] 2/3] dma: imx-dma: fix lockdep issue between irqhandler and tasklet
/0xe0) from [c03e07dc] (start_kernel+0x28c/0x2d4) [ 403.783051] r6:c03fc484 r5: r4:c040a0e0 [ 403.787797] [c03e0550] (start_kernel+0x0/0x2d4) from [a0008040] (0xa0008040) Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de --- drivers/dma/imx-dma.c | 19 --- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c index 442af61..247aa7c 100644 --- a/drivers/dma/imx-dma.c +++ b/drivers/dma/imx-dma.c @@ -437,17 +437,18 @@ static void dma_irq_handle_channel(struct imxdma_channel *imxdmac) struct imxdma_engine *imxdma = imxdmac-imxdma; int chno = imxdmac-channel; struct imxdma_desc *desc; + unsigned long flags; - spin_lock(imxdma-lock); + spin_lock_irqsave(imxdma-lock, flags); if (list_empty(imxdmac-ld_active)) { - spin_unlock(imxdma-lock); + spin_unlock_irqrestore(imxdma-lock, flags); goto out; } desc = list_first_entry(imxdmac-ld_active, struct imxdma_desc, node); - spin_unlock(imxdma-lock); + spin_unlock_irqrestore(imxdma-lock, flags); if (desc-sg) { u32 tmp; @@ -519,7 +520,6 @@ static int imxdma_xfer_desc(struct imxdma_desc *d) { struct imxdma_channel *imxdmac = to_imxdma_chan(d-desc.chan); struct imxdma_engine *imxdma = imxdmac-imxdma; - unsigned long flags; int slot = -1; int i; @@ -527,7 +527,6 @@ static int imxdma_xfer_desc(struct imxdma_desc *d) switch (d-type) { case IMXDMA_DESC_INTERLEAVED: /* Try to get a free 2D slot */ - spin_lock_irqsave(imxdma-lock, flags); for (i = 0; i IMX_DMA_2D_SLOTS; i++) { if ((imxdma-slots_2d[i].count 0) ((imxdma-slots_2d[i].xsr != d-x) || @@ -537,10 +536,8 @@ static int imxdma_xfer_desc(struct imxdma_desc *d) slot = i; break; } - if (slot 0) { - spin_unlock_irqrestore(imxdma-lock, flags); + if (slot 0) return -EBUSY; - } imxdma-slots_2d[slot].xsr = d-x; imxdma-slots_2d[slot].ysr = d-y; @@ -549,7 +546,6 @@ static int imxdma_xfer_desc(struct imxdma_desc *d) imxdmac-slot_2d = slot; imxdmac-enabled_2d = true; - spin_unlock_irqrestore(imxdma-lock, flags); if (slot == IMX_DMA_2D_SLOT_A) { d-config_mem = ~CCR_MSEL_B; @@ -625,8 +621,9 @@ static void imxdma_tasklet(unsigned long data) struct imxdma_channel *imxdmac = (void *)data; struct imxdma_engine *imxdma = imxdmac-imxdma; struct imxdma_desc *desc; + unsigned long flags; - spin_lock(imxdma-lock); + spin_lock_irqsave(imxdma-lock, flags); if (list_empty(imxdmac-ld_active)) { /* Someone might have called terminate all */ @@ -663,7 +660,7 @@ static void imxdma_tasklet(unsigned long data) __func__, imxdmac-channel); } out: - spin_unlock(imxdma-lock); + spin_unlock_irqrestore(imxdma-lock, flags); } static int imxdma_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd, -- 1.8.4.rc3 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Allow MUSB DSPS to use force host mode
Hallo, On Fri, Nov 22, 2013 at 03:55:59PM +, Mark Jackson wrote: The IDDIG input pin is normally used to determine the USB mode (i.e. HOST or DEVICE). On some systems (e.g. AM335x) leaving this pin floating allows the USB mode to be set via software. This patch adds support for this via the device tree. Signed-off-by: Mark Jackson m...@newflow.co.uk --- .../devicetree/bindings/usb/am33xx-usb.txt |2 ++ drivers/usb/musb/musb_dsps.c | 14 ++ include/linux/usb/musb.h |1 + 3 files changed, 17 insertions(+) diff --git a/Documentation/devicetree/bindings/usb/am33xx-usb.txt b/Documentation/devicetree/bindings/usb/am33xx-usb.txt index 20c2ff2..560b7ff 100644 --- a/Documentation/devicetree/bindings/usb/am33xx-usb.txt +++ b/Documentation/devicetree/bindings/usb/am33xx-usb.txt @@ -47,6 +47,8 @@ USB - dmas: specifies the dma channels - dma-names: specifies the names of the channels. Use rxN for receive and txN for transmit endpoints. N specifies the endpoint number. +- ti,force-host: specifies that the IDDIG input be ignored and the device be + put into host mode regardless. You should always CC devicetree-discuss if adding new bindings. Why another binding anyway? We have the common binding dr_mode already. Please use this and of_usb_get_dr_mode from drivers/usb/usb-common.c instead. Thanks, Michael -- 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- | -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] mxc_nand: remove redundant stat counting
The stats count variable will already be incremented in the above framework-layer just after this callback. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de --- drivers/mtd/nand/mxc_nand.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c index 9dfdb06..a4bad11 100644 --- a/drivers/mtd/nand/mxc_nand.c +++ b/drivers/mtd/nand/mxc_nand.c @@ -677,7 +677,6 @@ static int mxc_nand_correct_data_v2_v3(struct mtd_info *mtd, u_char *dat, ecc_stat = 4; } while (--no_subpages); - mtd-ecc_stats.corrected += ret; pr_debug(%d Symbol Correctable RS-ECC Error\n, ret); return ret; -- 1.8.4.3 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/3] usb: chipidea: Fix Internal error: : 808 [#1] ARM related to STS flag
On Fri, Nov 29, 2013 at 10:07:49AM +0800, Chris Ruehl wrote: * init the sts flag to 0 (missed) * set the sts flag only if not 0 Signed-off-by: Chris Ruehl chris.ru...@gtsys.com.hk --- drivers/usb/chipidea/core.c |8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 5075407..1a6010e 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -245,6 +245,8 @@ static void hw_phymode_configure(struct ci_hdrc *ci) { u32 portsc, lpm, sts; + sts = 0; + This makes sense, but should be moved up to the variable declartion: - u32 portsc, lpm, sts; + u32 portsc, lpm, sts = 0; switch (ci-platdata-phy_mode) { case USBPHY_INTERFACE_MODE_UTMI: portsc = PORTSC_PTS(PTS_UTMI); @@ -273,10 +275,12 @@ static void hw_phymode_configure(struct ci_hdrc *ci) if (ci-hw_bank.lpm) { hw_write(ci, OP_DEVLC, DEVLC_PTS(7) | DEVLC_PTW, lpm); - hw_write(ci, OP_DEVLC, DEVLC_STS, sts); + if (sts) + hw_write(ci, OP_DEVLC, DEVLC_STS, sts); What is wrong with explicit setting DEVLC_STS to 0 if we know that we don't use serial phy mode? } else { hw_write(ci, OP_PORTSC, PORTSC_PTS(7) | PORTSC_PTW, portsc); - hw_write(ci, OP_PORTSC, PORTSC_STS, sts); + if ( sts ) + hw_write(ci, OP_PORTSC, PORTSC_STS, sts); } } ditto Regards, Michael -- 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- | -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2] mxc_nand: remove duplicated ecc_stats counting
The ecc_stats.corrected count variable will already be incremented in the above framework-layer just after this callback. Cc: sta...@vger.kernel.org Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de --- drivers/mtd/nand/mxc_nand.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c index 9dfdb06..a4bad11 100644 --- a/drivers/mtd/nand/mxc_nand.c +++ b/drivers/mtd/nand/mxc_nand.c @@ -677,7 +677,6 @@ static int mxc_nand_correct_data_v2_v3(struct mtd_info *mtd, u_char *dat, ecc_stat = 4; } while (--no_subpages); - mtd-ecc_stats.corrected += ret; pr_debug(%d Symbol Correctable RS-ECC Error\n, ret); return ret; -- 1.8.4.3 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] mfd: syscon: add inline nop functions to compile without option
The syscon interface can be used in different drivers to reach registers of other register range via phandle. The exported functions can only be used if the syscon interface is enabled. This patch fixes this by adding nop functions if the syscon is not selected in the config. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de --- include/linux/mfd/syscon.h | 25 + 1 file changed, 25 insertions(+) diff --git a/include/linux/mfd/syscon.h b/include/linux/mfd/syscon.h index b473577f..257938e 100644 --- a/include/linux/mfd/syscon.h +++ b/include/linux/mfd/syscon.h @@ -17,10 +17,35 @@ struct device_node; +#ifdef CONFIG_MFD_SYSCON + extern struct regmap *syscon_node_to_regmap(struct device_node *np); extern struct regmap *syscon_regmap_lookup_by_compatible(const char *s); extern struct regmap *syscon_regmap_lookup_by_pdevname(const char *s); extern struct regmap *syscon_regmap_lookup_by_phandle( struct device_node *np, const char *property); + +#else + +static inline struct regmap *syscon_node_to_regmap(struct device_node *np) +{ + return ERR_PTR(-ENODEV); +} +static inline struct regmap *syscon_regmap_lookup_by_compatible(const char *s) +{ + return ERR_PTR(-ENODEV); +} +static inline struct regmap *syscon_regmap_lookup_by_pdevname(const char *s) +{ + return ERR_PTR(-ENODEV); +} +static inline struct regmap *syscon_regmap_lookup_by_phandle( + struct device_node *np, + const char *property) +{ + return ERR_PTR(-ENODEV); +} +#endif + #endif /* __LINUX_MFD_SYSCON_H__ */ -- 1.8.4.3 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] mfd: syscon: add inline nop functions to compile without option
Hi, On Fri, Nov 29, 2013 at 04:15:56PM +0100, Michael Grzeschik wrote: The syscon interface can be used in different drivers to reach registers of other register range via phandle. The exported functions can only be used if the syscon interface is enabled. This patch fixes this by adding nop functions if the syscon is not selected in the config. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de --- forget this patch. It is already mainlined by Peter Chen. Thanks, Michael -- 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- | -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/3 v2] usb: chipidea: Fix Internal error: : 808 [#1] ARM related to STS flag
On Fri, Nov 29, 2013 at 03:19:45PM +0800, Chris Ruehl wrote: usb: chipidea: Fix Internal error: : 808 [#1] ARM related to STS flag * init the sts flag to 0 (missed) * set the sts flag only if not 0 Signed-off-by: Chris Ruehl chris.ru...@gtsys.com.hk --- drivers/usb/chipidea/core.c |8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 5075407..1a6010e 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -245,6 +245,8 @@ static void hw_phymode_configure(struct ci_hdrc *ci) { u32 portsc, lpm, sts = 0; switch (ci-platdata-phy_mode) { case USBPHY_INTERFACE_MODE_UTMI: portsc = PORTSC_PTS(PTS_UTMI); @@ -273,10 +275,12 @@ static void hw_phymode_configure(struct ci_hdrc *ci) if (ci-hw_bank.lpm) { hw_write(ci, OP_DEVLC, DEVLC_PTS(7) | DEVLC_PTW, lpm); - hw_write(ci, OP_DEVLC, DEVLC_STS, sts); + if (sts) + hw_write(ci, OP_DEVLC, DEVLC_STS, sts); } else { hw_write(ci, OP_PORTSC, PORTSC_PTS(7) | PORTSC_PTW, portsc); - hw_write(ci, OP_PORTSC, PORTSC_STS, sts); + if ( sts ) + hw_write(ci, OP_PORTSC, PORTSC_STS, sts); The conditions coding style is broken. } } Still don't get why a system with ehci compliant PORTSC register should not want to have the sts bit _explicitly_ set to 0 if we don't use serial phy mode. So NACK! Michael -- 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- | -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH RESEND] mfd: mc13xxx: Fix null pointer dereference in mc13xxx_common_init
On Sat, Nov 30, 2013 at 08:55:37AM +0400, Alexander Shiyan wrote: If this driver being loaded from devicetree, the pdata is NULL. This cause kernel Oops when fsl,mc13xxx-uses-codec and/or fsl,mc13xxx-uses-touch properties is specified. mc13xxx spi0.0: mc13783: rev: 3.3, fin: 0, fab: 0, icid: 2/0 Unable to handle kernel NULL pointer dereference at virtual address 0018 pgd = c0004000 [0018] *pgd= Internal error: Oops: 5 [#1] PREEMPT ARM CPU: 0 PID: 1 Comm: swapper Not tainted 3.12.0-next-20131105-4-g201dd34-dirty #5 task: c7833bc0 ti: c7834000 task.ti: c7834000 PC is at mc13xxx_common_init+0x1fc/0x280 LR is at mfd_add_device+0x2a8/0x308 pc : [c024875c]lr : [c0248d74]psr: 2013 sp : c7835d38 ip : 0002 fp : c786a160 r10: r9 : c786a170 r8 : r7 : c06eab74 r6 : r5 : r4 : c79ffa10 r3 : 0008 r2 : 2013 r1 : c05079c8 r0 : c79ffa10 Flags: nzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment kernel Control: 0005317f Table: a0004000 DAC: 0017 Process swapper (pid: 1, stack limit = 0xc78341c0) Stack: (0xc7835d38 to 0xc7836000) 5d20: c0507958 c79ffa10 5d40: c791ab80 009b c791ab80 c05de138 c023a998 c05a9854 c0293cf8 5d60: c0293ce0 c023a774 c023a998 c791ab80 c023a998 c79ffc00 c02393ac 5d80: c785a25c c7940e54 c791ab80 c791abb4 c791ab80 c023a4cc c791ab80 c05b2704 5da0: c791ab80 c02395e8 c791ab80 c791ab88 c0237938 c01d5ed8 5dc0: 6013 c791ab80 c791ab80 c791ab80 c786a170 c06eaa04 5de0: c786a170 c0294d08 0001 c79ffc00 c06eab74 c791ab80 c02953a8 5e00: c79f56a0 0063 01312d00 c79ffc00 c79ffd78 c79ffc00 5e20: c06eaa04 c79ffd70 c0296cbc c780a840 c02978c0 c051054c 5e40: c79ffd70 c787c1f0 c0462b1c 0002 c787c1f0 c786a170 5e60: c05b2864 c786a1a4 c05b2864 c05c5800 c0579430 c023b614 5e80: c023b5fc c786a170 c05de138 c023a774 c786a170 c05b2864 c786a1a4 5ea0: c023a994 c05b2864 c023a908 c0239034 c7825d6c c785e610 5ec0: c05b2864 c7a0bae0 c05a9138 c02397dc c051054c c01bd2f8 c05b2864 c05b2864 5ee0: c0585094 579da752 c023ad38 0006 c0585094 c0564a24 5f00: 047a 579da752 a053 c059b070 0001 5f20: c06eefc9 c044c6a0 00a7 c002cd48 c7835f5c c0036f44 c051aae4 c053d7f4 5f40: 0006 0006 c059b064 0006 0006 c0585094 c058db68 c0564480 5f60: c05850a0 c05c5800 00a7 c0564c18 0006 0006 c0564480 c7833bc0 5f80: c7835f9c c0036da4 c043013c 5fa0: c0430144 c0009490 5fc0: 5fe0: 0013 df7f9b78 3b477df6 [c024875c] (mc13xxx_common_init+0x1fc/0x280) from [c0293cf8] (spi_drv_probe+0x18/0x1c) [c0293cf8] (spi_drv_probe+0x18/0x1c) from [c023a774] (driver_probe_device+0x78/0x20c) [c023a774] (driver_probe_device+0x78/0x20c) from [c02393ac] (bus_for_each_drv+0x48/0x90) [c02393ac] (bus_for_each_drv+0x48/0x90) from [c023a4cc] (device_attach+0x74/0x80) [c023a4cc] (device_attach+0x74/0x80) from [c02395e8] (bus_probe_device+0x88/0xb0) [c02395e8] (bus_probe_device+0x88/0xb0) from [c0237938] (device_add+0x31c/0x4c4) [c0237938] (device_add+0x31c/0x4c4) from [c0294d08] (spi_add_device+0xa4/0x118) [c0294d08] (spi_add_device+0xa4/0x118) from [c02953a8] (spi_register_master+0x53c/0x6a0) [c02953a8] (spi_register_master+0x53c/0x6a0) from [c0296cbc] (spi_bitbang_start+0x88/0x100) [c0296cbc] (spi_bitbang_start+0x88/0x100) from [c02978c0] (spi_imx_probe+0x3a8/0x478) [c02978c0] (spi_imx_probe+0x3a8/0x478) from [c023b614] (platform_drv_probe+0x18/0x48) [c023b614] (platform_drv_probe+0x18/0x48) from [c023a774] (driver_probe_device+0x78/0x20c) [c023a774] (driver_probe_device+0x78/0x20c) from [c023a994] (__driver_attach+0x8c/0x90) [c023a994] (__driver_attach+0x8c/0x90) from [c0239034] (bus_for_each_dev+0x5c/0x8c) [c0239034] (bus_for_each_dev+0x5c/0x8c) from [c02397dc] (bus_add_driver+0xd4/0x1c8) [c02397dc] (bus_add_driver+0xd4/0x1c8) from [c023ad38] (driver_register+0x78/0xf4) [c023ad38] (driver_register+0x78/0xf4) from [c0564a24] (do_one_initcall+0x5c/0x168) [c0564a24] (do_one_initcall+0x5c/0x168) from [c0564c18] (kernel_init_freeable+0xe8/0x1a8) [c0564c18] (kernel_init_freeable+0xe8/0x1a8) from [c0430144] (kernel_init+0x8/0x110) [c0430144] (kernel_init+0x8/0x110) from [c0009490] (ret_from_fork+0x14/0x24) Code: eadb e3a03008 e1a4 e59f107c (e5962018) ---[ end trace 71265dd116f3967e ]--- Kernel panic - not syncing: Attempted to kill init! exitcode=0x000b Signed-off-by: Alexander Shiyan shc_w...@mail.ru --- drivers/mfd/mc13xxx-core.c | 8 ++--
Re: [PATCH RESEND] mfd: mc13xxx: Fix null pointer dereference in mc13xxx_common_init
On Mon, Dec 02, 2013 at 03:11:03PM +0400, Alexander Shiyan wrote: Понедельник, 2 декабря 2013, 10:56 UTC от Lee Jones lee.jo...@linaro.org: On Sat, 30 Nov 2013, Alexander Shiyan wrote: On Sat, Nov 30, 2013 at 08:55:37AM +0400, Alexander Shiyan wrote: If this driver being loaded from devicetree, the pdata is NULL. This cause kernel Oops when fsl,mc13xxx-uses-codec and/or fsl,mc13xxx-uses-touch properties is specified. mc13xxx spi0.0: mc13783: rev: 3.3, fin: 0, fab: 0, icid: 2/0 Unable to handle kernel NULL pointer dereference at virtual address 0018 ... - if (mc13xxx-flags MC13XXX_USE_TOUCHSCREEN) + if ((mc13xxx-flags MC13XXX_USE_CODEC) pdata) Why do we check for CODEC if the Touchscreen should be used? Oops, my fault, copy/paste bug. I'll send the corrected version. No, please don't. Just provide proper Device Tree support. I still have two incomplete MC13XXX DT-related patches. http://lists.infradead.org/pipermail/linux-arm-kernel/2013-June/175099.html http://lists.infradead.org/pipermail/linux-arm-kernel/2013-July/182116.html I'll resume to work on this (and CODEC TS too). When you keep working on it, you can also look into that tree: http://git.pengutronix.de/?p=mgr/linux.git;a=shortlog;h=refs/heads/v3.11/topic/mc13xxx I currently have no time and no capable hardware on my desk to keep working on this. But it would be great if this code will not keep rotting any further. Thanks, Michael -- 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- | -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] usb: dwc3: core: continue probe even if usb3 phy is not available
On Wed, Jun 26, 2013 at 03:46:45PM +0300, Alexander Shishkin wrote: Felipe Balbi ba...@ti.com writes: On Wed, Jun 26, 2013 at 05:37:19PM +0530, George Cherian wrote: On 6/26/2013 3:46 PM, Felipe Balbi wrote: Hi, On Wed, Jun 26, 2013 at 02:59:14PM +0530, George Cherian wrote: There can be configurations in which DWC3 is hoooked up only to USB2 PHY. In such cases we should not return -EPROBE_DEFER, rather continue probe even if there is no USB3 PHY. Signed-off-by: George Cherian george.cher...@ti.com --- drivers/usb/dwc3/core.c | 31 --- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index c35d49d..d5e6f3e 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -100,7 +100,9 @@ static void dwc3_core_soft_reset(struct dwc3 *dwc) dwc3_writel(dwc-regs, DWC3_GUSB2PHYCFG(0), reg); usb_phy_init(dwc-usb2_phy); -usb_phy_init(dwc-usb3_phy); + +if (dwc-usb3_phy) +usb_phy_init(dwc-usb3_phy); I would feel more comfortable if you would move our maximum_speed module parameter to DT with a property such as: snps,maximum_speed = highspeed; then on driver you could: okay ret = of_property_read_string(np, snps,maximum_speed, maximum_speed); if (ret 0) bailout(); if (strncmp(maximum_speed, superspeed, 10) == 0) { /* grab USB3 PHY, return EPROBE_DEFER if not found */ grab_usb3_phy(); } if ((strncmp(maximum_speed, highspeed, 9) == 0) || (strncmp(maximum_speed, fullspeed, 9) == 0) || (strncmp(maximum_speed, lowspeed, 8) == 0)) { /* grab USB2 PHY, return EPROBE_DEFER if not found */ grab_usb2_phy(); } this way, we depend solely on setting maximum_speed to highspeed for AM437x :-) In dra7xx one instance is superspeed and one instance highspeed. right, but in DT you will define both instances and each instance will have a seaparate snps,maximum_speed attribute :-) I'm now considering if we should make maximum_speed a generic attribute, Kishon ? Alex ? Alan ? anyone else needs such thing ? We have a force-full-speed attibute for chipidea on the way. This maximum_speed looks like a more generic alternative. Michael, what say you? The maximum_speed attribute sounds more reasonable. I will change my patch to it. Regards, Michael -- 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- | -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] usb: dwc3: core: continue probe even if usb3 phy is not available
Hi, On Thu, Jun 27, 2013 at 09:35:26AM +0300, Felipe Balbi wrote: Hi, On Thu, Jun 27, 2013 at 08:14:16AM +0200, Michael Grzeschik wrote: right, but in DT you will define both instances and each instance will have a seaparate snps,maximum_speed attribute :-) I'm now considering if we should make maximum_speed a generic attribute, Kishon ? Alex ? Alan ? anyone else needs such thing ? We have a force-full-speed attibute for chipidea on the way. This maximum_speed looks like a more generic alternative. Michael, what say you? The maximum_speed attribute sounds more reasonable. I will change my patch to it. thanks, perhaps we can add a generic helper in udc-core or usb-common ? As this function is not only udc specific, this should go into usb-common. But right, we should go with a helper here. I will write one in addition to my full-speed patch as first user of it. Thanks, Michael -- 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- | -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [[PATCH] 0/3] imx-dma: fixes
Hi Christoph, On Tue, Sep 24, 2013 at 08:35:03AM +0200, Christoph Fritz wrote: On Mon, 2013-09-23 at 09:49 +0530, Vinod Koul wrote: On Tue, Sep 17, 2013 at 03:56:05PM +0200, Michael Grzeschik wrote: Hello, this series is solving some lockdep issues in the imx-dma code. There are some list_head and deadlock issues in the code, that is running the implementation into unsafe situations. Thanks for this, I have trying to fix this with testing done by Christoph. I had similar set of fixes Christoph can you pls try runnning this on your setup and check and we can apply these Thanks for the update, I added Michaels imx-dma patchset to Kernel 3.4.62 and gave it a shot: In contrast to DMA-disabled, a 'dd' copy still results in a hung: dd if=/dev/zero of=/mnt/dd-test.bin count=102400 bs=1K Please see the full log from boot to hung with DEBUG enabled below. With 2.6.31, copying to an SD-Card with DMA enabled works flawlessly, this log is also below. Michael, any ideas? I suppose you have the same board? The hardware we tested these patches for/with was custom hardware. But yes, we have this board you refer. We will need to setup the same situation first for debugging. Did you realize that the stalling mem2dev transfer in 3.4.62 is generating this footprint: [ 60.579646] imx-dma imx-dma: imxdma_xfer_desc channel: 0 sg=c70ff000 sgcount=8 total length=32768 dev_addr=0x10014038 (mem2dev) [ 60.591192] imx-dma imx-dma: imxdma_sg_next channel: 0 dst 0x10014038, src 0xa5527000, size 0x1000 [ 60.600624] imx-dma imx-dma: imxdma_enable_hw channel 0 [ 60.605887] imx-dma imx-dma: imxdma_sg_next channel: 0 dst 0x10014038, src 0xa5525000, size 0x1000 [ 60.795424] imx-dma imx-dma: dma_irq_handler called, disr=0x0001 [ 60.801857] imx-dma imx-dma: imxdma_sg_next channel: 0 dst 0x10014038, src 0xa5523000, size 0x1000 [ 61.290221] imx-dma imx-dma: channel 0: watchdog timeout! Beside on 2.6.31 the same transfer results in no failure. [ 55.27] imxdma0: imx_dma_setup_sg sg=c7ae3800 sgcount=9 total length=32768 dev_addr=0x10014038 for write [ 55.28] imxdma0: next sg chunk dst 0x10014038, src 0xa73a1c00, size 0x1000 [ 55.29] imxdma0: imx_dma_enable [ 55.29] imxdma: dma_irq_handler called, disr=0x0001 [ 55.29] imxdma0: next sg chunk dst 0x10014038, src 0xa73a2c00, size 0x0400 [ 55.30] imxdma: dma_irq_handler called, disr=0x0001 [ 55.30] imxdma0: next sg chunk dst 0x10014038, src 0xa73a5000, size 0x1000 [ 55.32] imxdma: dma_irq_handler called, disr=0x0001 [ 55.32] imxdma0: next sg chunk dst 0x10014038, src 0xa73a7000, size 0x1000 [ 55.33] imxdma: dma_irq_handler called, disr=0x0001 [ 55.33] imxdma0: next sg chunk dst 0x10014038, src 0xa73a9000, size 0x1000 [ 55.34] imxdma: dma_irq_handler called, disr=0x0001 [ 55.34] imxdma0: next sg chunk dst 0x10014038, src 0xa73ab000, size 0x1000 [ 55.36] imxdma: dma_irq_handler called, disr=0x0001 [ 55.36] imxdma0: next sg chunk dst 0x10014038, src 0xa73ad000, size 0x1000 [ 55.38] imxdma: dma_irq_handler called, disr=0x0001 [ 55.38] imxdma0: next sg chunk dst 0x10014038, src 0xa73af000, size 0x1000 [ 55.39] imxdma: dma_irq_handler called, disr=0x0001 [ 55.39] imxdma0: next sg chunk dst 0x10014038, src 0xa73b1000, size 0x0c00 [ 55.40] imxdma: dma_irq_handler called, disr=0x0001 [ 55.41] imxdma0: imx_dma_disable It looks suspicious that the same same transfer in the newer kernel should take less amount of sg (sgcount=8 vs. sgcount=9) with the same amount of payload data. I don't think this issue is related to the patch series I posted. But anyway needs to be investigated. Regards, Michael -- 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- | -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] usb: dwc3: core: continue probe even if usb3 phy is not available
On Fri, Jun 28, 2013 at 09:00:00PM +0300, Felipe Balbi wrote: Hi, On Thu, Jun 27, 2013 at 10:30:33AM +0300, Felipe Balbi wrote: Hi, On Thu, Jun 27, 2013 at 09:24:08AM +0200, Michael Grzeschik wrote: right, but in DT you will define both instances and each instance will have a seaparate snps,maximum_speed attribute :-) I'm now considering if we should make maximum_speed a generic attribute, Kishon ? Alex ? Alan ? anyone else needs such thing ? We have a force-full-speed attibute for chipidea on the way. This maximum_speed looks like a more generic alternative. Michael, what say you? The maximum_speed attribute sounds more reasonable. I will change my patch to it. thanks, perhaps we can add a generic helper in udc-core or usb-common ? As this function is not only udc specific, this should go into usb-common. But right, we should go with a helper here. I will write one in addition to my full-speed patch as first user of it. alright, thanks :-) Michael, if you need any help with patching in maximum_speed attribute, let me know as I have some time to work on that part. Feel free to begin with anything. I am currently short on time. Do you need some pointers? Thanks, Michael -- 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- | -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATH v2] mxc_nand: use our own read_page function
Hi Brian, On Mon, Jul 14, 2014 at 12:19:47PM -0700, Brian Norris wrote: Hi Michael, On Fri, Jun 27, 2014 at 12:38:44PM +0200, Michael Grzeschik wrote: The current approach of the read_page function is to iterate over all subpages and call the correct_data function. The correct_data function currently does the same. It iterates over all subpages and checks for correctable and uncorrectable data. This redundant call for each subpage leads to miscalculations. Hmm, you certainly do have some statistic bugs, but I'm not sure you're solving this correctly. This driver sure has. This patch changes the driver to use its own read_page function in which we call the correct_data function only once per page. With that we do the failure and correct statistics counting inside this function. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de --- fixed printk to pr_debug drivers/mtd/nand/mxc_nand.c | 73 ++--- 1 file changed, 69 insertions(+), 4 deletions(-) diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c index a72d508..5f9e36d 100644 --- a/drivers/mtd/nand/mxc_nand.c +++ b/drivers/mtd/nand/mxc_nand.c @@ -141,6 +141,8 @@ struct mxc_nand_host; struct mxc_nand_devtype_data { void (*preset)(struct mtd_info *); + int (*read_page)(struct mtd_info *mtd, struct nand_chip *chip, + uint8_t *buf, int oob_required, int page); void (*send_cmd)(struct mxc_nand_host *, uint16_t, int); void (*send_addr)(struct mxc_nand_host *, uint16_t, int); void (*send_page)(struct mtd_info *, unsigned int); @@ -649,6 +651,59 @@ static int mxc_nand_correct_data_v1(struct mtd_info *mtd, u_char *dat, return 0; } +/** + * mxc_nand_read_page_hwecc_v2_v3 - [REPLACEABLE] hardware ECC based page read function Don't include the [REPLACEABLE] language here. That's mostly just used for code like nand_base, where we provide some defaults / helpers that may or may not be intended to allow overrides. (Not really the best approach, IMO, but that's beside the point.) So don't mark this in your low-level driver. It was a copy paste leftover. Thanks for the hint. + * @mtd: mtd info structure + * @chip: nand chip info structure + * @buf: buffer to store read data + * @oob_required: caller requires OOB data read to chip-oob_poi + * @page: page number to read + * + * Not for syndrome calculating ECC controllers which need a special oob layout. + */ +static int I don't think you want a line break here, to match the style of the rest of the driver. I used Lindent as I didn't know how to align it correctly. I will keep it in one line instead. +mxc_nand_read_page_hwecc_v2_v3(struct mtd_info *mtd, + struct nand_chip *chip, + uint8_t *buf, int oob_required, int page) +{ + int i, eccsize = chip-ecc.size; + struct nand_chip *nand_chip = mtd-priv; + struct mxc_nand_host *host = nand_chip-priv; + int eccbytes = chip-ecc.bytes; + int eccsteps = chip-ecc.steps; + uint8_t *p = buf; + uint8_t *ecc_calc = chip-buffers-ecccalc; + uint8_t *ecc_code = chip-buffers-ecccode; + uint32_t *eccpos = chip-ecc.layout-eccpos; + unsigned int max_bitflips = 0; + u32 ecc_stat, err; + int stat; + + ecc_stat = host-devtype_data-get_ecc_status(host); + for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) { + err = ecc_stat 0xf; drivers/mtd/nand/mxc_nand.c: In function 'mxc_nand_read_page_hwecc_v2_v3': drivers/mtd/nand/mxc_nand.c:679:16: warning: variable 'err' set but not used [-Wunused-but-set-variable] Is that intentional? No, this is also an leftover. Thanks for the hint. + chip-ecc.hwctl(mtd, NAND_ECC_READ); + chip-read_buf(mtd, p, eccsize); + chip-ecc.calculate(mtd, p, ecc_calc[i]); + ecc_stat = 4; You're also never using the value of ecc_stat, except to calculate other values which are never used. + Drop the extra blank line. + } + ecc_stat = host-devtype_data-get_ecc_status(host); Result unused? Ok, this is odd. I must have messed up my patch here. + chip-read_buf(mtd, chip-oob_poi, mtd-oobsize); + + for (i = 0; i chip-ecc.total; i++) + ecc_code[i] = chip-oob_poi[eccpos[i]]; + + eccsteps = chip-ecc.steps; + p = buf; + + stat = chip-ecc.correct(mtd, p, ecc_code[i], ecc_calc[i]); + max_bitflips = max_t(unsigned int, max_bitflips, stat); This is wrong. First, you probably don't want to cast 'stat' to unsigned, in case it's an error. Second, absent an error, this just resolves to: max_bitflips = stat; So you're not actually determining the maximum per-sector bitflips, you're just determining the total # of bitflips. + + return max_bitflips; So I think you
[PATCH 2/2] mxc_nand: use our own read_page function
The current approach of the read_page function is to iterate over all subpages and call the correct_data function. The correct_data function currently does the same. It iterates over all subpages and checks for correctable and uncorrectable data. This redundant call for each subpage leads to miscalculations. This patch changes the driver to use its own read_page function in which we call the correct_data function only once per page. With that we do the failure and correct statistics counting inside this function. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de --- drivers/mtd/nand/mxc_nand.c | 73 ++--- 1 file changed, 69 insertions(+), 4 deletions(-) diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c index 7fd495e..09e3682 100644 --- a/drivers/mtd/nand/mxc_nand.c +++ b/drivers/mtd/nand/mxc_nand.c @@ -141,6 +141,8 @@ struct mxc_nand_host; struct mxc_nand_devtype_data { void (*preset)(struct mtd_info *); + int (*read_page)(struct mtd_info *mtd, struct nand_chip *chip, + uint8_t *buf, int oob_required, int page); void (*send_cmd)(struct mxc_nand_host *, uint16_t, int); void (*send_addr)(struct mxc_nand_host *, uint16_t, int); void (*send_page)(struct mtd_info *, unsigned int); @@ -649,6 +651,59 @@ static int mxc_nand_correct_data_v1(struct mtd_info *mtd, u_char *dat, return 0; } +/** + * mxc_nand_read_page_hwecc_v2_v3 - [REPLACEABLE] hardware ECC based page read function + * @mtd: mtd info structure + * @chip: nand chip info structure + * @buf: buffer to store read data + * @oob_required: caller requires OOB data read to chip-oob_poi + * @page: page number to read + * + * Not for syndrome calculating ECC controllers which need a special oob layout. + */ +static int +mxc_nand_read_page_hwecc_v2_v3(struct mtd_info *mtd, + struct nand_chip *chip, + uint8_t *buf, int oob_required, int page) +{ + int i, eccsize = chip-ecc.size; + struct nand_chip *nand_chip = mtd-priv; + struct mxc_nand_host *host = nand_chip-priv; + int eccbytes = chip-ecc.bytes; + int eccsteps = chip-ecc.steps; + uint8_t *p = buf; + uint8_t *ecc_calc = chip-buffers-ecccalc; + uint8_t *ecc_code = chip-buffers-ecccode; + uint32_t *eccpos = chip-ecc.layout-eccpos; + unsigned int max_bitflips = 0; + u32 ecc_stat, err; + int stat; + + ecc_stat = host-devtype_data-get_ecc_status(host); + for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) { + err = ecc_stat 0xf; + chip-ecc.hwctl(mtd, NAND_ECC_READ); + chip-read_buf(mtd, p, eccsize); + chip-ecc.calculate(mtd, p, ecc_calc[i]); + ecc_stat = 4; + + } + ecc_stat = host-devtype_data-get_ecc_status(host); + chip-read_buf(mtd, chip-oob_poi, mtd-oobsize); + + for (i = 0; i chip-ecc.total; i++) + ecc_code[i] = chip-oob_poi[eccpos[i]]; + + eccsteps = chip-ecc.steps; + p = buf; + + stat = chip-ecc.correct(mtd, p, ecc_code[i], ecc_calc[i]); + max_bitflips = max_t(unsigned int, max_bitflips, stat); + + return max_bitflips; +} + + static int mxc_nand_correct_data_v2_v3(struct mtd_info *mtd, u_char *dat, u_char *read_ecc, u_char *calc_ecc) { @@ -656,7 +711,7 @@ static int mxc_nand_correct_data_v2_v3(struct mtd_info *mtd, u_char *dat, struct mxc_nand_host *host = nand_chip-priv; u32 ecc_stat, err; int no_subpages = 1; - int ret = 0; + int ret = 0, broken = 0; u8 ecc_bit_mask, err_limit = 0x1; ecc_bit_mask = 0xf; @@ -673,15 +728,21 @@ static int mxc_nand_correct_data_v2_v3(struct mtd_info *mtd, u_char *dat, do { err = ecc_stat ecc_bit_mask; if (err err_limit) { - printk(KERN_WARNING UnCorrectable RS-ECC Error\n); - return -1; + broken++; } else { ret += err; } ecc_stat = 4; } while (--no_subpages); - pr_debug(%d Symbol Correctable RS-ECC Error\n, ret); + mtd-ecc_stats.corrected += ret; + if (ret) + printk(%d Symbol Correctable RS-ECC Error\n, ret); + + mtd-ecc_stats.failed += broken; + if (broken) + printk(KERN_WARNING %d Symbol UnCorrectable RS-ECC Error\n, +broken); return ret; } @@ -1244,6 +1305,7 @@ static const struct mxc_nand_devtype_data imx27_nand_devtype_data = { /* v21: i.MX25, i.MX35 */ static const struct mxc_nand_devtype_data imx25_nand_devtype_data = { .preset = preset_v2, + .read_page = mxc_nand_read_page_hwecc_v2_v3, .send_cmd = send_cmd_v1_v2, .send_addr
[PATCH 1/2] mxc_nand: fix err_limit and err_mask
This patch fixes the error detection limits for the used eccsize of the 1, 4 and 8 bit eccmode. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de --- drivers/mtd/nand/mxc_nand.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c index cb6c845..7fd495e 100644 --- a/drivers/mtd/nand/mxc_nand.c +++ b/drivers/mtd/nand/mxc_nand.c @@ -657,10 +657,14 @@ static int mxc_nand_correct_data_v2_v3(struct mtd_info *mtd, u_char *dat, u32 ecc_stat, err; int no_subpages = 1; int ret = 0; - u8 ecc_bit_mask, err_limit; + u8 ecc_bit_mask, err_limit = 0x1; - ecc_bit_mask = (host-eccsize == 4) ? 0x7 : 0xf; - err_limit = (host-eccsize == 4) ? 0x4 : 0x8; + ecc_bit_mask = 0xf; + + if (host-eccsize == 4) + err_limit = 0x2; + else if (host-eccsize == 8) + err_limit = 0x4; no_subpages = mtd-writesize 9; -- 2.0.0 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/2] mxc_nand: use our own read_page function
On Thu, Jun 26, 2014 at 10:42:48PM +0200, Michael Grzeschik wrote: The current approach of the read_page function is to iterate over all subpages and call the correct_data function. The correct_data function currently does the same. It iterates over all subpages and checks for correctable and uncorrectable data. This redundant call for each subpage leads to miscalculations. This patch changes the driver to use its own read_page function in which we call the correct_data function only once per page. With that we do the failure and correct statistics counting inside this function. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de --- drivers/mtd/nand/mxc_nand.c | 73 ++--- 1 file changed, 69 insertions(+), 4 deletions(-) diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c index 7fd495e..09e3682 100644 --- a/drivers/mtd/nand/mxc_nand.c +++ b/drivers/mtd/nand/mxc_nand.c [snip] @@ -673,15 +728,21 @@ static int mxc_nand_correct_data_v2_v3(struct mtd_info *mtd, u_char *dat, do { err = ecc_stat ecc_bit_mask; if (err err_limit) { - printk(KERN_WARNING UnCorrectable RS-ECC Error\n); - return -1; + broken++; } else { ret += err; } ecc_stat = 4; } while (--no_subpages); - pr_debug(%d Symbol Correctable RS-ECC Error\n, ret); + mtd-ecc_stats.corrected += ret; + if (ret) + printk(%d Symbol Correctable RS-ECC Error\n, ret); This was ment to be pr_debug as before. -- 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- | -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATH v2] mxc_nand: use our own read_page function
The current approach of the read_page function is to iterate over all subpages and call the correct_data function. The correct_data function currently does the same. It iterates over all subpages and checks for correctable and uncorrectable data. This redundant call for each subpage leads to miscalculations. This patch changes the driver to use its own read_page function in which we call the correct_data function only once per page. With that we do the failure and correct statistics counting inside this function. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de --- fixed printk to pr_debug drivers/mtd/nand/mxc_nand.c | 73 ++--- 1 file changed, 69 insertions(+), 4 deletions(-) diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c index a72d508..5f9e36d 100644 --- a/drivers/mtd/nand/mxc_nand.c +++ b/drivers/mtd/nand/mxc_nand.c @@ -141,6 +141,8 @@ struct mxc_nand_host; struct mxc_nand_devtype_data { void (*preset)(struct mtd_info *); + int (*read_page)(struct mtd_info *mtd, struct nand_chip *chip, + uint8_t *buf, int oob_required, int page); void (*send_cmd)(struct mxc_nand_host *, uint16_t, int); void (*send_addr)(struct mxc_nand_host *, uint16_t, int); void (*send_page)(struct mtd_info *, unsigned int); @@ -649,6 +651,59 @@ static int mxc_nand_correct_data_v1(struct mtd_info *mtd, u_char *dat, return 0; } +/** + * mxc_nand_read_page_hwecc_v2_v3 - [REPLACEABLE] hardware ECC based page read function + * @mtd: mtd info structure + * @chip: nand chip info structure + * @buf: buffer to store read data + * @oob_required: caller requires OOB data read to chip-oob_poi + * @page: page number to read + * + * Not for syndrome calculating ECC controllers which need a special oob layout. + */ +static int +mxc_nand_read_page_hwecc_v2_v3(struct mtd_info *mtd, + struct nand_chip *chip, + uint8_t *buf, int oob_required, int page) +{ + int i, eccsize = chip-ecc.size; + struct nand_chip *nand_chip = mtd-priv; + struct mxc_nand_host *host = nand_chip-priv; + int eccbytes = chip-ecc.bytes; + int eccsteps = chip-ecc.steps; + uint8_t *p = buf; + uint8_t *ecc_calc = chip-buffers-ecccalc; + uint8_t *ecc_code = chip-buffers-ecccode; + uint32_t *eccpos = chip-ecc.layout-eccpos; + unsigned int max_bitflips = 0; + u32 ecc_stat, err; + int stat; + + ecc_stat = host-devtype_data-get_ecc_status(host); + for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) { + err = ecc_stat 0xf; + chip-ecc.hwctl(mtd, NAND_ECC_READ); + chip-read_buf(mtd, p, eccsize); + chip-ecc.calculate(mtd, p, ecc_calc[i]); + ecc_stat = 4; + + } + ecc_stat = host-devtype_data-get_ecc_status(host); + chip-read_buf(mtd, chip-oob_poi, mtd-oobsize); + + for (i = 0; i chip-ecc.total; i++) + ecc_code[i] = chip-oob_poi[eccpos[i]]; + + eccsteps = chip-ecc.steps; + p = buf; + + stat = chip-ecc.correct(mtd, p, ecc_code[i], ecc_calc[i]); + max_bitflips = max_t(unsigned int, max_bitflips, stat); + + return max_bitflips; +} + + static int mxc_nand_correct_data_v2_v3(struct mtd_info *mtd, u_char *dat, u_char *read_ecc, u_char *calc_ecc) { @@ -656,7 +711,7 @@ static int mxc_nand_correct_data_v2_v3(struct mtd_info *mtd, u_char *dat, struct mxc_nand_host *host = nand_chip-priv; u32 ecc_stat, err; int no_subpages = 1; - int ret = 0; + int ret = 0, broken = 0; u8 ecc_bit_mask, err_limit = 0x1; ecc_bit_mask = 0xf; @@ -673,15 +728,21 @@ static int mxc_nand_correct_data_v2_v3(struct mtd_info *mtd, u_char *dat, do { err = ecc_stat ecc_bit_mask; if (err err_limit) { - printk(KERN_WARNING UnCorrectable RS-ECC Error\n); - return -1; + broken++; } else { ret += err; } ecc_stat = 4; } while (--no_subpages); - pr_debug(%d Symbol Correctable RS-ECC Error\n, ret); + mtd-ecc_stats.corrected += ret; + if (ret) + pr_debug(%d Symbol Correctable RS-ECC Error\n, ret); + + mtd-ecc_stats.failed += broken; + if (broken) + printk(KERN_WARNING %d Symbol UnCorrectable RS-ECC Error\n, +broken); return ret; } @@ -1216,6 +1277,7 @@ static const struct mxc_nand_devtype_data imx27_nand_devtype_data = { /* v21: i.MX25, i.MX35 */ static const struct mxc_nand_devtype_data imx25_nand_devtype_data = { .preset = preset_v2, + .read_page = mxc_nand_read_page_hwecc_v2_v3, .send_cmd = send_cmd_v1_v2
Re: [PATCH v2 2/2] usb: chipidea: Add support for zynq usb host and device controller
Hi, On Fri, Jun 27, 2014 at 04:53:53PM +0530, Punnaiah Choudary Kalluri wrote: Zynq soc uses Chipidea/Synopsys usb IP core(CI13612). This patch adds necessary glue to allow the chipidea driver to work on zynq soc. Did you see the currently discussed patches for the generic chipidea glue? http://www.spinics.net/lists/linux-usb/msg109576.html Try to improve that code instead writing another version of this simple gluecode. Thanks, Michael -- 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- | -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATH v2] mxc_nand: use our own read_page function
Ping! On Fri, Jun 27, 2014 at 12:38:44PM +0200, Michael Grzeschik wrote: The current approach of the read_page function is to iterate over all subpages and call the correct_data function. The correct_data function currently does the same. It iterates over all subpages and checks for correctable and uncorrectable data. This redundant call for each subpage leads to miscalculations. This patch changes the driver to use its own read_page function in which we call the correct_data function only once per page. With that we do the failure and correct statistics counting inside this function. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de --- fixed printk to pr_debug drivers/mtd/nand/mxc_nand.c | 73 ++--- 1 file changed, 69 insertions(+), 4 deletions(-) diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c index a72d508..5f9e36d 100644 --- a/drivers/mtd/nand/mxc_nand.c +++ b/drivers/mtd/nand/mxc_nand.c @@ -141,6 +141,8 @@ struct mxc_nand_host; struct mxc_nand_devtype_data { void (*preset)(struct mtd_info *); + int (*read_page)(struct mtd_info *mtd, struct nand_chip *chip, + uint8_t *buf, int oob_required, int page); void (*send_cmd)(struct mxc_nand_host *, uint16_t, int); void (*send_addr)(struct mxc_nand_host *, uint16_t, int); void (*send_page)(struct mtd_info *, unsigned int); @@ -649,6 +651,59 @@ static int mxc_nand_correct_data_v1(struct mtd_info *mtd, u_char *dat, return 0; } +/** + * mxc_nand_read_page_hwecc_v2_v3 - [REPLACEABLE] hardware ECC based page read function + * @mtd: mtd info structure + * @chip: nand chip info structure + * @buf: buffer to store read data + * @oob_required: caller requires OOB data read to chip-oob_poi + * @page: page number to read + * + * Not for syndrome calculating ECC controllers which need a special oob layout. + */ +static int +mxc_nand_read_page_hwecc_v2_v3(struct mtd_info *mtd, +struct nand_chip *chip, +uint8_t *buf, int oob_required, int page) +{ + int i, eccsize = chip-ecc.size; + struct nand_chip *nand_chip = mtd-priv; + struct mxc_nand_host *host = nand_chip-priv; + int eccbytes = chip-ecc.bytes; + int eccsteps = chip-ecc.steps; + uint8_t *p = buf; + uint8_t *ecc_calc = chip-buffers-ecccalc; + uint8_t *ecc_code = chip-buffers-ecccode; + uint32_t *eccpos = chip-ecc.layout-eccpos; + unsigned int max_bitflips = 0; + u32 ecc_stat, err; + int stat; + + ecc_stat = host-devtype_data-get_ecc_status(host); + for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) { + err = ecc_stat 0xf; + chip-ecc.hwctl(mtd, NAND_ECC_READ); + chip-read_buf(mtd, p, eccsize); + chip-ecc.calculate(mtd, p, ecc_calc[i]); + ecc_stat = 4; + + } + ecc_stat = host-devtype_data-get_ecc_status(host); + chip-read_buf(mtd, chip-oob_poi, mtd-oobsize); + + for (i = 0; i chip-ecc.total; i++) + ecc_code[i] = chip-oob_poi[eccpos[i]]; + + eccsteps = chip-ecc.steps; + p = buf; + + stat = chip-ecc.correct(mtd, p, ecc_code[i], ecc_calc[i]); + max_bitflips = max_t(unsigned int, max_bitflips, stat); + + return max_bitflips; +} + + static int mxc_nand_correct_data_v2_v3(struct mtd_info *mtd, u_char *dat, u_char *read_ecc, u_char *calc_ecc) { @@ -656,7 +711,7 @@ static int mxc_nand_correct_data_v2_v3(struct mtd_info *mtd, u_char *dat, struct mxc_nand_host *host = nand_chip-priv; u32 ecc_stat, err; int no_subpages = 1; - int ret = 0; + int ret = 0, broken = 0; u8 ecc_bit_mask, err_limit = 0x1; ecc_bit_mask = 0xf; @@ -673,15 +728,21 @@ static int mxc_nand_correct_data_v2_v3(struct mtd_info *mtd, u_char *dat, do { err = ecc_stat ecc_bit_mask; if (err err_limit) { - printk(KERN_WARNING UnCorrectable RS-ECC Error\n); - return -1; + broken++; } else { ret += err; } ecc_stat = 4; } while (--no_subpages); - pr_debug(%d Symbol Correctable RS-ECC Error\n, ret); + mtd-ecc_stats.corrected += ret; + if (ret) + pr_debug(%d Symbol Correctable RS-ECC Error\n, ret); + + mtd-ecc_stats.failed += broken; + if (broken) + printk(KERN_WARNING %d Symbol UnCorrectable RS-ECC Error\n, + broken); return ret; } @@ -1216,6 +1277,7 @@ static const struct mxc_nand_devtype_data imx27_nand_devtype_data = { /* v21: i.MX25, i.MX35 */ static const struct mxc_nand_devtype_data imx25_nand_devtype_data = { .preset = preset_v2
Re: [PATH v2] mxc_nand: use our own read_page function
@David: Ping! Some comments on this patch would probably help to get it mainline. :) Regards, Michael On Sat, Jul 05, 2014 at 04:45:21PM +0200, Michael Grzeschik wrote: Ping! On Fri, Jun 27, 2014 at 12:38:44PM +0200, Michael Grzeschik wrote: The current approach of the read_page function is to iterate over all subpages and call the correct_data function. The correct_data function currently does the same. It iterates over all subpages and checks for correctable and uncorrectable data. This redundant call for each subpage leads to miscalculations. This patch changes the driver to use its own read_page function in which we call the correct_data function only once per page. With that we do the failure and correct statistics counting inside this function. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de --- fixed printk to pr_debug drivers/mtd/nand/mxc_nand.c | 73 ++--- 1 file changed, 69 insertions(+), 4 deletions(-) diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c index a72d508..5f9e36d 100644 --- a/drivers/mtd/nand/mxc_nand.c +++ b/drivers/mtd/nand/mxc_nand.c @@ -141,6 +141,8 @@ struct mxc_nand_host; struct mxc_nand_devtype_data { void (*preset)(struct mtd_info *); + int (*read_page)(struct mtd_info *mtd, struct nand_chip *chip, + uint8_t *buf, int oob_required, int page); void (*send_cmd)(struct mxc_nand_host *, uint16_t, int); void (*send_addr)(struct mxc_nand_host *, uint16_t, int); void (*send_page)(struct mtd_info *, unsigned int); @@ -649,6 +651,59 @@ static int mxc_nand_correct_data_v1(struct mtd_info *mtd, u_char *dat, return 0; } +/** + * mxc_nand_read_page_hwecc_v2_v3 - [REPLACEABLE] hardware ECC based page read function + * @mtd: mtd info structure + * @chip: nand chip info structure + * @buf: buffer to store read data + * @oob_required: caller requires OOB data read to chip-oob_poi + * @page: page number to read + * + * Not for syndrome calculating ECC controllers which need a special oob layout. + */ +static int +mxc_nand_read_page_hwecc_v2_v3(struct mtd_info *mtd, + struct nand_chip *chip, + uint8_t *buf, int oob_required, int page) +{ + int i, eccsize = chip-ecc.size; + struct nand_chip *nand_chip = mtd-priv; + struct mxc_nand_host *host = nand_chip-priv; + int eccbytes = chip-ecc.bytes; + int eccsteps = chip-ecc.steps; + uint8_t *p = buf; + uint8_t *ecc_calc = chip-buffers-ecccalc; + uint8_t *ecc_code = chip-buffers-ecccode; + uint32_t *eccpos = chip-ecc.layout-eccpos; + unsigned int max_bitflips = 0; + u32 ecc_stat, err; + int stat; + + ecc_stat = host-devtype_data-get_ecc_status(host); + for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) { + err = ecc_stat 0xf; + chip-ecc.hwctl(mtd, NAND_ECC_READ); + chip-read_buf(mtd, p, eccsize); + chip-ecc.calculate(mtd, p, ecc_calc[i]); + ecc_stat = 4; + + } + ecc_stat = host-devtype_data-get_ecc_status(host); + chip-read_buf(mtd, chip-oob_poi, mtd-oobsize); + + for (i = 0; i chip-ecc.total; i++) + ecc_code[i] = chip-oob_poi[eccpos[i]]; + + eccsteps = chip-ecc.steps; + p = buf; + + stat = chip-ecc.correct(mtd, p, ecc_code[i], ecc_calc[i]); + max_bitflips = max_t(unsigned int, max_bitflips, stat); + + return max_bitflips; +} + + static int mxc_nand_correct_data_v2_v3(struct mtd_info *mtd, u_char *dat, u_char *read_ecc, u_char *calc_ecc) { @@ -656,7 +711,7 @@ static int mxc_nand_correct_data_v2_v3(struct mtd_info *mtd, u_char *dat, struct mxc_nand_host *host = nand_chip-priv; u32 ecc_stat, err; int no_subpages = 1; - int ret = 0; + int ret = 0, broken = 0; u8 ecc_bit_mask, err_limit = 0x1; ecc_bit_mask = 0xf; @@ -673,15 +728,21 @@ static int mxc_nand_correct_data_v2_v3(struct mtd_info *mtd, u_char *dat, do { err = ecc_stat ecc_bit_mask; if (err err_limit) { - printk(KERN_WARNING UnCorrectable RS-ECC Error\n); - return -1; + broken++; } else { ret += err; } ecc_stat = 4; } while (--no_subpages); - pr_debug(%d Symbol Correctable RS-ECC Error\n, ret); + mtd-ecc_stats.corrected += ret; + if (ret) + pr_debug(%d Symbol Correctable RS-ECC Error\n, ret); + + mtd-ecc_stats.failed += broken; + if (broken) + printk(KERN_WARNING %d Symbol UnCorrectable RS-ECC Error\n, +broken); return ret; } @@ -1216,6 +1277,7 @@ static const struct
Re: [PATCH 0/5] ARCNET: add support for EAE multi interfac card
On Sun, Sep 28, 2014 at 05:01:50PM -0400, David Miller wrote: From: David Miller da...@davemloft.net Date: Sun, 28 Sep 2014 16:44:21 -0400 (EDT) From: Michael Grzeschik m.grzesc...@pengutronix.de Date: Wed, 24 Sep 2014 15:41:48 +0200 this series adds support for the PLX Bridge based multi interface pci cards and adds support to change device address on com200xx chips during runtime. This series is based on v3.17-rc6. Series applied to net-next, thanks. I had to revert, this breaks the build: drivers/net/arcnet/com20020_cs.c:115:8: error: redefinition of ‘struct com20020_dev’ struct com20020_dev { ^ In file included from drivers/net/arcnet/com20020_cs.c:43:0: include/linux/com20020.h:66:8: note: originally defined here struct com20020_dev { ^ make[3]: *** [drivers/net/arcnet/com20020_cs.o] Error 1 make[2]: *** [drivers/net/arcnet] Error 2 make[2]: *** Waiting for unfinished jobs make[1]: *** [drivers/net] Error 2 make[1]: *** Waiting for unfinished jobs make: *** [drivers] Error 2 Oh, I didn't look into the other com20020 drivers. I will fix it and send v2. Thanks, Michael -- 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- | -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 5/5] ARCNET: enable eae arcnet card support
This patch adds support for the EAE arcnet cards which has two Interfaces. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de --- drivers/net/arcnet/com20020-pci.c | 16 1 file changed, 16 insertions(+) diff --git a/drivers/net/arcnet/com20020-pci.c b/drivers/net/arcnet/com20020-pci.c index fe87576..6c99ff0 100644 --- a/drivers/net/arcnet/com20020-pci.c +++ b/drivers/net/arcnet/com20020-pci.c @@ -211,6 +211,16 @@ static struct com20020_pci_card_info card_info_sohard = { .flags = ARC_CAN_10MBIT, }; +static struct com20020_pci_card_info card_info_eae = { + .name = EAE PLX-PCI, + .devcount = 2, + .chan_map_tbl = { + { 2, 0x00, 0x08 }, + { 2, 0x08, 0x08 } + }, + .flags = ARC_CAN_10MBIT, +}; + static const struct pci_device_id com20020pci_id_table[] = { { 0x1571, 0xa001, @@ -345,6 +355,12 @@ static const struct pci_device_id com20020pci_id_table[] = { (kernel_ulong_t)card_info_sohard }, { + 0x10B5, 0x9050, + 0x10B5, 0x3292, + 0, 0, + (kernel_ulong_t)card_info_eae + }, + { 0x14BA, 0x6000, PCI_ANY_ID, PCI_ANY_ID, 0, 0, -- 2.1.0 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 0/5] ARCNET: add support for EAE multi interfac card
Hello, this series adds support for the PLX Bridge based multi interface pci cards and adds support to change device address on com200xx chips during runtime. This series is based on v3.17-rc7. It is fixed for build against com20020_cs. Thanks, Michael Michael Grzeschik (5): ARCNET: return IRQ_NONE if the interface isn't running ARCNET: add com20020_set_hwddr to change address ARCNET: add com20020 PCI IDs with metadata ARCNET: add support for multi interfaces on com20020 ARCNET: enable eae arcnet card support drivers/net/arcnet/arcnet.c | 2 +- drivers/net/arcnet/com20020-pci.c | 369 +- drivers/net/arcnet/com20020.c | 14 ++ drivers/net/arcnet/com20020_cs.c | 4 - include/linux/com20020.h | 29 +++ 5 files changed, 330 insertions(+), 88 deletions(-) -- 2.1.0 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 2/5] ARCNET: add com20020_set_hwddr to change address
This patch adds com20020_set_hwaddr to make it possible to change the hwaddr on runtime. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de --- drivers/net/arcnet/com20020.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/drivers/net/arcnet/com20020.c b/drivers/net/arcnet/com20020.c index 7b96c5f..1a84378 100644 --- a/drivers/net/arcnet/com20020.c +++ b/drivers/net/arcnet/com20020.c @@ -149,11 +149,25 @@ int com20020_check(struct net_device *dev) return 0; } +static int com20020_set_hwaddr(struct net_device *dev, void *addr) +{ + int ioaddr = dev-base_addr; + struct arcnet_local *lp = netdev_priv(dev); + struct sockaddr *hwaddr = addr; + + memcpy(dev-dev_addr, hwaddr-sa_data, 1); + SET_SUBADR(SUB_NODE); + outb(dev-dev_addr[0], _XREG); + + return 0; +} + const struct net_device_ops com20020_netdev_ops = { .ndo_open = arcnet_open, .ndo_stop = arcnet_close, .ndo_start_xmit = arcnet_send_packet, .ndo_tx_timeout = arcnet_timeout, + .ndo_set_mac_address = com20020_set_hwaddr, .ndo_set_rx_mode = com20020_set_mc_list, }; -- 2.1.0 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 1/5] ARCNET: return IRQ_NONE if the interface isn't running
The interrupt handler needs to return IRQ_NONE in case two devices are used with the shared interrupt handler. Otherwise it could steal interrupts from the other interface. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de --- drivers/net/arcnet/arcnet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/arcnet/arcnet.c b/drivers/net/arcnet/arcnet.c index 3b790de..09de683 100644 --- a/drivers/net/arcnet/arcnet.c +++ b/drivers/net/arcnet/arcnet.c @@ -777,7 +777,7 @@ irqreturn_t arcnet_interrupt(int irq, void *dev_id) ACOMMAND(CFLAGScmd | RESETclear); AINTMASK(0); spin_unlock(lp-lock); - return IRQ_HANDLED; + return retval; } BUGMSG(D_DURING, in arcnet_inthandler (status=%Xh, intmask=%Xh)\n, -- 2.1.0 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 3/5] ARCNET: add com20020 PCI IDs with metadata
This patch adds metadata for the com20020 to prepare for devices with multiple io address areas with multi card interfaces. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de --- drivers/net/arcnet/com20020-pci.c | 216 -- include/linux/com20020.h | 16 +++ 2 files changed, 197 insertions(+), 35 deletions(-) diff --git a/drivers/net/arcnet/com20020-pci.c b/drivers/net/arcnet/com20020-pci.c index 7bb292e..f9e5552 100644 --- a/drivers/net/arcnet/com20020-pci.c +++ b/drivers/net/arcnet/com20020-pci.c @@ -63,6 +63,8 @@ MODULE_LICENSE(GPL); static int com20020pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) { + struct com20020_pci_channel_map *cm; + struct com20020_pci_card_info *ci; struct net_device *dev; struct arcnet_local *lp; int ioaddr, err; @@ -75,19 +77,15 @@ static int com20020pci_probe(struct pci_dev *pdev, const struct pci_device_id *i dev-netdev_ops = com20020_netdev_ops; + ci = (struct com20020_pci_card_info *)id-driver_data; + lp = netdev_priv(dev); pci_set_drvdata(pdev, dev); - // SOHARD needs PCI base addr 4 - if (pdev-vendor==0x10B5) { - BUGMSG(D_NORMAL, SOHARD\n); - ioaddr = pci_resource_start(pdev, 4); - } - else { - BUGMSG(D_NORMAL, Contemporary Controls\n); - ioaddr = pci_resource_start(pdev, 2); - } + cm = ci-chan_map_tbl[0]; + BUGMSG(D_NORMAL, %s Controls\n, ci-name); + ioaddr = pci_resource_start(pdev, cm-bar); if (!request_region(ioaddr, ARCNET_TOTAL_SIZE, com20020-pci)) { BUGMSG(D_INIT, IO region %xh-%xh already allocated.\n, @@ -105,7 +103,7 @@ static int com20020pci_probe(struct pci_dev *pdev, const struct pci_device_id *i dev-irq = pdev-irq; dev-dev_addr[0] = node; lp-card_name = PCI COM20020; - lp-card_flags = id-driver_data; + lp-card_flags = ci-flags; lp-backplane = backplane; lp-clockp = clockp 7; lp-clockm = clockm 3; @@ -144,32 +142,180 @@ static void com20020pci_remove(struct pci_dev *pdev) free_netdev(dev); } +static struct com20020_pci_card_info card_info_10mbit = { + .name = ARC-PCI, + .devcount = 1, + .chan_map_tbl = { + { 2, 0x00, 0x08 }, + }, + .flags = ARC_CAN_10MBIT, +}; + +static struct com20020_pci_card_info card_info_5mbit = { + .name = ARC-PCI, + .devcount = 1, + .chan_map_tbl = { + { 2, 0x00, 0x08 }, + }, + .flags = ARC_IS_5MBIT, +}; + +static struct com20020_pci_card_info card_info_sohard = { + .name = PLX-PCI, + .devcount = 1, + /* SOHARD needs PCI base addr 4 */ + .chan_map_tbl = { + {4, 0x00, 0x08}, + }, + .flags = ARC_CAN_10MBIT, +}; + static const struct pci_device_id com20020pci_id_table[] = { - { 0x1571, 0xa001, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, - { 0x1571, 0xa002, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, - { 0x1571, 0xa003, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, - { 0x1571, 0xa004, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, - { 0x1571, 0xa005, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, - { 0x1571, 0xa006, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, - { 0x1571, 0xa007, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, - { 0x1571, 0xa008, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, - { 0x1571, 0xa009, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_IS_5MBIT }, - { 0x1571, 0xa00a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_IS_5MBIT }, - { 0x1571, 0xa00b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_IS_5MBIT }, - { 0x1571, 0xa00c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_IS_5MBIT }, - { 0x1571, 0xa00d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_IS_5MBIT }, - { 0x1571, 0xa00e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_IS_5MBIT }, - { 0x1571, 0xa201, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_CAN_10MBIT }, - { 0x1571, 0xa202, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_CAN_10MBIT }, - { 0x1571, 0xa203, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_CAN_10MBIT }, - { 0x1571, 0xa204, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_CAN_10MBIT }, - { 0x1571, 0xa205, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_CAN_10MBIT }, - { 0x1571, 0xa206, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_CAN_10MBIT }, - { 0x10B5, 0x9030, 0x10B5, 0x2978, 0, 0, ARC_CAN_10MBIT }, - { 0x10B5, 0x9050, 0x10B5, 0x2273, 0, 0, ARC_CAN_10MBIT }, - { 0x14BA, 0x6000, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_CAN_10MBIT }, - { 0x10B5, 0x2200, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_CAN_10MBIT }, - {0,} + { + 0x1571, 0xa001, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + 0, + }, + { + 0x1571, 0xa002, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + 0, + }, + { + 0x1571, 0xa003, + PCI_ANY_ID
[PATCH v2 4/5] ARCNET: add support for multi interfaces on com20020
The com20020-pci driver is currently designed to instance one netdev with one pci device. This patch adds support to instance many cards with one pci device, depending on the device data in the private data. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de --- v1 - v2: fixed build of com20020_cs by using common struct com20020_dev drivers/net/arcnet/com20020-pci.c | 149 -- drivers/net/arcnet/com20020_cs.c | 4 - include/linux/com20020.h | 15 +++- 3 files changed, 109 insertions(+), 59 deletions(-) diff --git a/drivers/net/arcnet/com20020-pci.c b/drivers/net/arcnet/com20020-pci.c index f9e5552..fe87576 100644 --- a/drivers/net/arcnet/com20020-pci.c +++ b/drivers/net/arcnet/com20020-pci.c @@ -38,6 +38,7 @@ #include linux/pci.h #include linux/arcdevice.h #include linux/com20020.h +#include linux/list.h #include asm/io.h @@ -61,85 +62,125 @@ module_param(clockp, int, 0); module_param(clockm, int, 0); MODULE_LICENSE(GPL); +static void com20020pci_remove(struct pci_dev *pdev); + static int com20020pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) { - struct com20020_pci_channel_map *cm; struct com20020_pci_card_info *ci; struct net_device *dev; struct arcnet_local *lp; - int ioaddr, err; + struct com20020_priv *priv; + int i, ioaddr, ret; + struct resource *r; if (pci_enable_device(pdev)) return -EIO; - dev = alloc_arcdev(device); - if (!dev) - return -ENOMEM; - - dev-netdev_ops = com20020_netdev_ops; + priv = devm_kzalloc(pdev-dev, sizeof(struct com20020_priv), + GFP_KERNEL); ci = (struct com20020_pci_card_info *)id-driver_data; + priv-ci = ci; - lp = netdev_priv(dev); + INIT_LIST_HEAD(priv-list_dev); - pci_set_drvdata(pdev, dev); - cm = ci-chan_map_tbl[0]; - BUGMSG(D_NORMAL, %s Controls\n, ci-name); - ioaddr = pci_resource_start(pdev, cm-bar); + for (i = 0; i ci-devcount; i++) { + struct com20020_pci_channel_map *cm = ci-chan_map_tbl[i]; + struct com20020_dev *card; - if (!request_region(ioaddr, ARCNET_TOTAL_SIZE, com20020-pci)) { - BUGMSG(D_INIT, IO region %xh-%xh already allocated.\n, - ioaddr, ioaddr + ARCNET_TOTAL_SIZE - 1); - err = -EBUSY; - goto out_dev; - } + dev = alloc_arcdev(device); + if (!dev) { + ret = -ENOMEM; + goto out_port; + } - // Dummy access after Reset - // ARCNET controller needs this access to detect bustype - outb(0x00,ioaddr+1); - inb(ioaddr+1); - - dev-base_addr = ioaddr; - dev-irq = pdev-irq; - dev-dev_addr[0] = node; - lp-card_name = PCI COM20020; - lp-card_flags = ci-flags; - lp-backplane = backplane; - lp-clockp = clockp 7; - lp-clockm = clockm 3; - lp-timeout = timeout; - lp-hw.owner = THIS_MODULE; - - if (ASTATUS() == 0xFF) { - BUGMSG(D_NORMAL, IO address %Xh was reported by PCI BIOS, - but seems empty!\n, ioaddr); - err = -EIO; - goto out_port; - } - if (com20020_check(dev)) { - err = -EIO; - goto out_port; + dev-netdev_ops = com20020_netdev_ops; + + lp = netdev_priv(dev); + + BUGMSG(D_NORMAL, %s Controls\n, ci-name); + ioaddr = pci_resource_start(pdev, cm-bar) + cm-offset; + + r = devm_request_region(pdev-dev, ioaddr, cm-size, + com20020-pci); + if (!r) { + pr_err(IO region %xh-%xh already allocated.\n, + ioaddr, ioaddr + cm-size - 1); + ret = -EBUSY; + goto out_port; + } + + /* Dummy access after Reset +* ARCNET controller needs +* this access to detect bustype +*/ + outb(0x00, ioaddr + 1); + inb(ioaddr + 1); + + dev-base_addr = ioaddr; + dev-dev_addr[0] = node; + dev-irq = pdev-irq; + lp-card_name = PCI COM20020; + lp-card_flags = ci-flags; + lp-backplane = backplane; + lp-clockp = clockp 7; + lp-clockm = clockm 3; + lp-timeout = timeout; + lp-hw.owner = THIS_MODULE; + + if (ASTATUS() == 0xFF) { + pr_err(IO address %Xh is empty!\n, ioaddr); + ret = -EIO; + goto out_port; + } + if (com20020_check(dev)) { + ret
[PATCH 5/5] ARCNET: enable eae arcnet card support
This patch adds support for the EAE arcnet cards which has two Interfaces. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de --- drivers/net/arcnet/com20020-pci.c | 16 1 file changed, 16 insertions(+) diff --git a/drivers/net/arcnet/com20020-pci.c b/drivers/net/arcnet/com20020-pci.c index 7437174c..d17e1c7 100644 --- a/drivers/net/arcnet/com20020-pci.c +++ b/drivers/net/arcnet/com20020-pci.c @@ -211,6 +211,16 @@ static struct com20020_pci_card_info card_info_sohard = { .flags = ARC_CAN_10MBIT, }; +static struct com20020_pci_card_info card_info_eae = { + .name = EAE PLX-PCI, + .devcount = 2, + .chan_map_tbl = { + { 2, 0x00, 0x08 }, + { 2, 0x08, 0x08 } + }, + .flags = ARC_CAN_10MBIT, +}; + static DEFINE_PCI_DEVICE_TABLE(com20020pci_id_table) = { { 0x1571, 0xa001, @@ -345,6 +355,12 @@ static DEFINE_PCI_DEVICE_TABLE(com20020pci_id_table) = { (kernel_ulong_t)card_info_sohard }, { + 0x10B5, 0x9050, + 0x10B5, 0x3292, + 0, 0, + (kernel_ulong_t)card_info_eae + }, + { 0x14BA, 0x6000, PCI_ANY_ID, PCI_ANY_ID, 0, 0, -- 2.1.0 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 0/5] ARCNET: add support for EAE multi interfac card
This series adds support for the PLX bridge based multi interface pci cards and adds support to change device address on com200xx chips during runtime. Thanks, Michael Michael Grzeschik (5): ARCNET: return IRQ_NONE if the interface isn't running ARCNET: add com20020_set_hwddr to change address ARCNET: add com20020 PCI IDs with metadata ARCNET: add support for multi interfaces on com20020 ARCNET: enable eae arcnet card support drivers/net/arcnet/arcnet.c | 2 +- drivers/net/arcnet/com20020-pci.c | 369 +- drivers/net/arcnet/com20020.c | 14 ++ include/linux/com20020.h | 29 +++ 4 files changed, 330 insertions(+), 84 deletions(-) -- 2.1.0 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/5] ARCNET: return IRQ_NONE if the interface isn't running
The interrupt handler needs to return IRQ_NONE in case two devices are used with the shared interrupt handler. Otherwise it could steal interrupts from the other interface. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de --- drivers/net/arcnet/arcnet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/arcnet/arcnet.c b/drivers/net/arcnet/arcnet.c index a956053..abcbd3c 100644 --- a/drivers/net/arcnet/arcnet.c +++ b/drivers/net/arcnet/arcnet.c @@ -776,7 +776,7 @@ irqreturn_t arcnet_interrupt(int irq, void *dev_id) ACOMMAND(CFLAGScmd | RESETclear); AINTMASK(0); spin_unlock(lp-lock); - return IRQ_HANDLED; + return retval; } BUGMSG(D_DURING, in arcnet_inthandler (status=%Xh, intmask=%Xh)\n, -- 2.1.0 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/5] ARCNET: add com20020_set_hwddr to change address
This patch adds com20020_set_hwaddr to make it possible to change the hwaddr on runtime. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de --- drivers/net/arcnet/com20020.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/drivers/net/arcnet/com20020.c b/drivers/net/arcnet/com20020.c index 7b96c5f..1a84378 100644 --- a/drivers/net/arcnet/com20020.c +++ b/drivers/net/arcnet/com20020.c @@ -149,11 +149,25 @@ int com20020_check(struct net_device *dev) return 0; } +static int com20020_set_hwaddr(struct net_device *dev, void *addr) +{ + int ioaddr = dev-base_addr; + struct arcnet_local *lp = netdev_priv(dev); + struct sockaddr *hwaddr = addr; + + memcpy(dev-dev_addr, hwaddr-sa_data, 1); + SET_SUBADR(SUB_NODE); + outb(dev-dev_addr[0], _XREG); + + return 0; +} + const struct net_device_ops com20020_netdev_ops = { .ndo_open = arcnet_open, .ndo_stop = arcnet_close, .ndo_start_xmit = arcnet_send_packet, .ndo_tx_timeout = arcnet_timeout, + .ndo_set_mac_address = com20020_set_hwaddr, .ndo_set_rx_mode = com20020_set_mc_list, }; -- 2.1.0 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 4/5] ARCNET: add support for multi interfaces on com20020
The com20020-pci driver is currently designed to instance one netdev with one pci device. This patch adds support to instance many cards with one pci device, depending on the device data in the private data. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de --- drivers/net/arcnet/com20020-pci.c | 149 -- include/linux/com20020.h | 15 +++- 2 files changed, 109 insertions(+), 55 deletions(-) diff --git a/drivers/net/arcnet/com20020-pci.c b/drivers/net/arcnet/com20020-pci.c index d08d539..7437174c 100644 --- a/drivers/net/arcnet/com20020-pci.c +++ b/drivers/net/arcnet/com20020-pci.c @@ -38,6 +38,7 @@ #include linux/pci.h #include linux/arcdevice.h #include linux/com20020.h +#include linux/list.h #include asm/io.h @@ -61,85 +62,125 @@ module_param(clockp, int, 0); module_param(clockm, int, 0); MODULE_LICENSE(GPL); +static void com20020pci_remove(struct pci_dev *pdev); + static int com20020pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) { - struct com20020_pci_channel_map *cm; struct com20020_pci_card_info *ci; struct net_device *dev; struct arcnet_local *lp; - int ioaddr, err; + struct com20020_priv *priv; + int i, ioaddr, ret; + struct resource *r; if (pci_enable_device(pdev)) return -EIO; - dev = alloc_arcdev(device); - if (!dev) - return -ENOMEM; - - dev-netdev_ops = com20020_netdev_ops; + priv = devm_kzalloc(pdev-dev, sizeof(struct com20020_priv), + GFP_KERNEL); ci = (struct com20020_pci_card_info *)id-driver_data; + priv-ci = ci; - lp = netdev_priv(dev); + INIT_LIST_HEAD(priv-list_dev); - pci_set_drvdata(pdev, dev); - cm = ci-chan_map_tbl[0]; - BUGMSG(D_NORMAL, %s Controls\n, ci-name); - ioaddr = pci_resource_start(pdev, cm-bar); + for (i = 0; i ci-devcount; i++) { + struct com20020_pci_channel_map *cm = ci-chan_map_tbl[i]; + struct com20020_dev *card; - if (!request_region(ioaddr, ARCNET_TOTAL_SIZE, com20020-pci)) { - BUGMSG(D_INIT, IO region %xh-%xh already allocated.\n, - ioaddr, ioaddr + ARCNET_TOTAL_SIZE - 1); - err = -EBUSY; - goto out_dev; - } + dev = alloc_arcdev(device); + if (!dev) { + ret = -ENOMEM; + goto out_port; + } - // Dummy access after Reset - // ARCNET controller needs this access to detect bustype - outb(0x00,ioaddr+1); - inb(ioaddr+1); - - dev-base_addr = ioaddr; - dev-irq = pdev-irq; - dev-dev_addr[0] = node; - lp-card_name = PCI COM20020; - lp-card_flags = ci-flags; - lp-backplane = backplane; - lp-clockp = clockp 7; - lp-clockm = clockm 3; - lp-timeout = timeout; - lp-hw.owner = THIS_MODULE; - - if (ASTATUS() == 0xFF) { - BUGMSG(D_NORMAL, IO address %Xh was reported by PCI BIOS, - but seems empty!\n, ioaddr); - err = -EIO; - goto out_port; - } - if (com20020_check(dev)) { - err = -EIO; - goto out_port; + dev-netdev_ops = com20020_netdev_ops; + + lp = netdev_priv(dev); + + BUGMSG(D_NORMAL, %s Controls\n, ci-name); + ioaddr = pci_resource_start(pdev, cm-bar) + cm-offset; + + r = devm_request_region(pdev-dev, ioaddr, cm-size, + com20020-pci); + if (!r) { + pr_err(IO region %xh-%xh already allocated.\n, + ioaddr, ioaddr + cm-size - 1); + ret = -EBUSY; + goto out_port; + } + + /* Dummy access after Reset +* ARCNET controller needs +* this access to detect bustype +*/ + outb(0x00, ioaddr + 1); + inb(ioaddr + 1); + + dev-base_addr = ioaddr; + dev-dev_addr[0] = node; + dev-irq = pdev-irq; + lp-card_name = PCI COM20020; + lp-card_flags = ci-flags; + lp-backplane = backplane; + lp-clockp = clockp 7; + lp-clockm = clockm 3; + lp-timeout = timeout; + lp-hw.owner = THIS_MODULE; + + if (ASTATUS() == 0xFF) { + pr_err(IO address %Xh is empty!\n, ioaddr); + ret = -EIO; + goto out_port; + } + if (com20020_check(dev)) { + ret = -EIO; + goto out_port; + } + + card = devm_kzalloc(pdev-dev
[PATCH 3/5] ARCNET: add com20020 PCI IDs with metadata
This patch adds metadata for the com20020 to prepare for devices with multiple io address areas with multi card interfaces. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de --- drivers/net/arcnet/com20020-pci.c | 216 -- include/linux/com20020.h | 16 +++ 2 files changed, 197 insertions(+), 35 deletions(-) diff --git a/drivers/net/arcnet/com20020-pci.c b/drivers/net/arcnet/com20020-pci.c index cbc44f5..d08d539 100644 --- a/drivers/net/arcnet/com20020-pci.c +++ b/drivers/net/arcnet/com20020-pci.c @@ -63,6 +63,8 @@ MODULE_LICENSE(GPL); static int com20020pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) { + struct com20020_pci_channel_map *cm; + struct com20020_pci_card_info *ci; struct net_device *dev; struct arcnet_local *lp; int ioaddr, err; @@ -75,19 +77,15 @@ static int com20020pci_probe(struct pci_dev *pdev, const struct pci_device_id *i dev-netdev_ops = com20020_netdev_ops; + ci = (struct com20020_pci_card_info *)id-driver_data; + lp = netdev_priv(dev); pci_set_drvdata(pdev, dev); - // SOHARD needs PCI base addr 4 - if (pdev-vendor==0x10B5) { - BUGMSG(D_NORMAL, SOHARD\n); - ioaddr = pci_resource_start(pdev, 4); - } - else { - BUGMSG(D_NORMAL, Contemporary Controls\n); - ioaddr = pci_resource_start(pdev, 2); - } + cm = ci-chan_map_tbl[0]; + BUGMSG(D_NORMAL, %s Controls\n, ci-name); + ioaddr = pci_resource_start(pdev, cm-bar); if (!request_region(ioaddr, ARCNET_TOTAL_SIZE, com20020-pci)) { BUGMSG(D_INIT, IO region %xh-%xh already allocated.\n, @@ -105,7 +103,7 @@ static int com20020pci_probe(struct pci_dev *pdev, const struct pci_device_id *i dev-irq = pdev-irq; dev-dev_addr[0] = node; lp-card_name = PCI COM20020; - lp-card_flags = id-driver_data; + lp-card_flags = ci-flags; lp-backplane = backplane; lp-clockp = clockp 7; lp-clockm = clockm 3; @@ -144,32 +142,180 @@ static void com20020pci_remove(struct pci_dev *pdev) free_netdev(dev); } +static struct com20020_pci_card_info card_info_10mbit = { + .name = ARC-PCI, + .devcount = 1, + .chan_map_tbl = { + { 2, 0x00, 0x08 }, + }, + .flags = ARC_CAN_10MBIT, +}; + +static struct com20020_pci_card_info card_info_5mbit = { + .name = ARC-PCI, + .devcount = 1, + .chan_map_tbl = { + { 2, 0x00, 0x08 }, + }, + .flags = ARC_IS_5MBIT, +}; + +static struct com20020_pci_card_info card_info_sohard = { + .name = PLX-PCI, + .devcount = 1, + /* SOHARD needs PCI base addr 4 */ + .chan_map_tbl = { + {4, 0x00, 0x08}, + }, + .flags = ARC_CAN_10MBIT, +}; + static DEFINE_PCI_DEVICE_TABLE(com20020pci_id_table) = { - { 0x1571, 0xa001, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, - { 0x1571, 0xa002, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, - { 0x1571, 0xa003, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, - { 0x1571, 0xa004, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, - { 0x1571, 0xa005, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, - { 0x1571, 0xa006, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, - { 0x1571, 0xa007, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, - { 0x1571, 0xa008, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, - { 0x1571, 0xa009, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_IS_5MBIT }, - { 0x1571, 0xa00a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_IS_5MBIT }, - { 0x1571, 0xa00b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_IS_5MBIT }, - { 0x1571, 0xa00c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_IS_5MBIT }, - { 0x1571, 0xa00d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_IS_5MBIT }, - { 0x1571, 0xa00e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_IS_5MBIT }, - { 0x1571, 0xa201, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_CAN_10MBIT }, - { 0x1571, 0xa202, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_CAN_10MBIT }, - { 0x1571, 0xa203, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_CAN_10MBIT }, - { 0x1571, 0xa204, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_CAN_10MBIT }, - { 0x1571, 0xa205, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_CAN_10MBIT }, - { 0x1571, 0xa206, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_CAN_10MBIT }, - { 0x10B5, 0x9030, 0x10B5, 0x2978, 0, 0, ARC_CAN_10MBIT }, - { 0x10B5, 0x9050, 0x10B5, 0x2273, 0, 0, ARC_CAN_10MBIT }, - { 0x14BA, 0x6000, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_CAN_10MBIT }, - { 0x10B5, 0x2200, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_CAN_10MBIT }, - {0,} + { + 0x1571, 0xa001, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + 0, + }, + { + 0x1571, 0xa002, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + 0, + }, + { + 0x1571, 0xa003, + PCI_ANY_ID
Re: [PATCH 0/5] ARCNET: add support for EAE multi interfac card
Hi, On Wed, Sep 24, 2014 at 01:01:58PM +0200, Michael Grzeschik wrote: This series adds support for the PLX bridge based multi interface pci cards and adds support to change device address on com200xx chips during runtime. Thanks, Michael Michael Grzeschik (5): ARCNET: return IRQ_NONE if the interface isn't running ARCNET: add com20020_set_hwddr to change address ARCNET: add com20020 PCI IDs with metadata ARCNET: add support for multi interfaces on com20020 ARCNET: enable eae arcnet card support drivers/net/arcnet/arcnet.c | 2 +- drivers/net/arcnet/com20020-pci.c | 369 +- drivers/net/arcnet/com20020.c | 14 ++ include/linux/com20020.h | 29 +++ 4 files changed, 330 insertions(+), 84 deletions(-) -- 2.1.0 This series was based on v3.16 and does not apply on master. Who could expect somebody else be patching the arcnet dir in this century. :) Will send a newer series in some minutes. Michael Grzeschik -- 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- | -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 0/5] ARCNET: add support for EAE multi interfac card
Hello, this series adds support for the PLX Bridge based multi interface pci cards and adds support to change device address on com200xx chips during runtime. This series is based on v3.17-rc6. Thanks, Michael Michael Grzeschik (5): ARCNET: return IRQ_NONE if the interface isn't running ARCNET: add com20020_set_hwddr to change address ARCNET: add com20020 PCI IDs with metadata ARCNET: add support for multi interfaces on com20020 ARCNET: enable eae arcnet card support drivers/net/arcnet/arcnet.c | 2 +- drivers/net/arcnet/com20020-pci.c | 369 +- drivers/net/arcnet/com20020.c | 14 ++ include/linux/com20020.h | 29 +++ 4 files changed, 330 insertions(+), 84 deletions(-) -- 2.1.0 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 5/5] ARCNET: enable eae arcnet card support
This patch adds support for the EAE arcnet cards which has two Interfaces. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de --- drivers/net/arcnet/com20020-pci.c | 16 1 file changed, 16 insertions(+) diff --git a/drivers/net/arcnet/com20020-pci.c b/drivers/net/arcnet/com20020-pci.c index fe87576..6c99ff0 100644 --- a/drivers/net/arcnet/com20020-pci.c +++ b/drivers/net/arcnet/com20020-pci.c @@ -211,6 +211,16 @@ static struct com20020_pci_card_info card_info_sohard = { .flags = ARC_CAN_10MBIT, }; +static struct com20020_pci_card_info card_info_eae = { + .name = EAE PLX-PCI, + .devcount = 2, + .chan_map_tbl = { + { 2, 0x00, 0x08 }, + { 2, 0x08, 0x08 } + }, + .flags = ARC_CAN_10MBIT, +}; + static const struct pci_device_id com20020pci_id_table[] = { { 0x1571, 0xa001, @@ -345,6 +355,12 @@ static const struct pci_device_id com20020pci_id_table[] = { (kernel_ulong_t)card_info_sohard }, { + 0x10B5, 0x9050, + 0x10B5, 0x3292, + 0, 0, + (kernel_ulong_t)card_info_eae + }, + { 0x14BA, 0x6000, PCI_ANY_ID, PCI_ANY_ID, 0, 0, -- 2.1.0 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3/5] ARCNET: add com20020 PCI IDs with metadata
This patch adds metadata for the com20020 to prepare for devices with multiple io address areas with multi card interfaces. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de --- drivers/net/arcnet/com20020-pci.c | 216 -- include/linux/com20020.h | 16 +++ 2 files changed, 197 insertions(+), 35 deletions(-) diff --git a/drivers/net/arcnet/com20020-pci.c b/drivers/net/arcnet/com20020-pci.c index 7bb292e..f9e5552 100644 --- a/drivers/net/arcnet/com20020-pci.c +++ b/drivers/net/arcnet/com20020-pci.c @@ -63,6 +63,8 @@ MODULE_LICENSE(GPL); static int com20020pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) { + struct com20020_pci_channel_map *cm; + struct com20020_pci_card_info *ci; struct net_device *dev; struct arcnet_local *lp; int ioaddr, err; @@ -75,19 +77,15 @@ static int com20020pci_probe(struct pci_dev *pdev, const struct pci_device_id *i dev-netdev_ops = com20020_netdev_ops; + ci = (struct com20020_pci_card_info *)id-driver_data; + lp = netdev_priv(dev); pci_set_drvdata(pdev, dev); - // SOHARD needs PCI base addr 4 - if (pdev-vendor==0x10B5) { - BUGMSG(D_NORMAL, SOHARD\n); - ioaddr = pci_resource_start(pdev, 4); - } - else { - BUGMSG(D_NORMAL, Contemporary Controls\n); - ioaddr = pci_resource_start(pdev, 2); - } + cm = ci-chan_map_tbl[0]; + BUGMSG(D_NORMAL, %s Controls\n, ci-name); + ioaddr = pci_resource_start(pdev, cm-bar); if (!request_region(ioaddr, ARCNET_TOTAL_SIZE, com20020-pci)) { BUGMSG(D_INIT, IO region %xh-%xh already allocated.\n, @@ -105,7 +103,7 @@ static int com20020pci_probe(struct pci_dev *pdev, const struct pci_device_id *i dev-irq = pdev-irq; dev-dev_addr[0] = node; lp-card_name = PCI COM20020; - lp-card_flags = id-driver_data; + lp-card_flags = ci-flags; lp-backplane = backplane; lp-clockp = clockp 7; lp-clockm = clockm 3; @@ -144,32 +142,180 @@ static void com20020pci_remove(struct pci_dev *pdev) free_netdev(dev); } +static struct com20020_pci_card_info card_info_10mbit = { + .name = ARC-PCI, + .devcount = 1, + .chan_map_tbl = { + { 2, 0x00, 0x08 }, + }, + .flags = ARC_CAN_10MBIT, +}; + +static struct com20020_pci_card_info card_info_5mbit = { + .name = ARC-PCI, + .devcount = 1, + .chan_map_tbl = { + { 2, 0x00, 0x08 }, + }, + .flags = ARC_IS_5MBIT, +}; + +static struct com20020_pci_card_info card_info_sohard = { + .name = PLX-PCI, + .devcount = 1, + /* SOHARD needs PCI base addr 4 */ + .chan_map_tbl = { + {4, 0x00, 0x08}, + }, + .flags = ARC_CAN_10MBIT, +}; + static const struct pci_device_id com20020pci_id_table[] = { - { 0x1571, 0xa001, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, - { 0x1571, 0xa002, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, - { 0x1571, 0xa003, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, - { 0x1571, 0xa004, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, - { 0x1571, 0xa005, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, - { 0x1571, 0xa006, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, - { 0x1571, 0xa007, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, - { 0x1571, 0xa008, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, - { 0x1571, 0xa009, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_IS_5MBIT }, - { 0x1571, 0xa00a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_IS_5MBIT }, - { 0x1571, 0xa00b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_IS_5MBIT }, - { 0x1571, 0xa00c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_IS_5MBIT }, - { 0x1571, 0xa00d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_IS_5MBIT }, - { 0x1571, 0xa00e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_IS_5MBIT }, - { 0x1571, 0xa201, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_CAN_10MBIT }, - { 0x1571, 0xa202, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_CAN_10MBIT }, - { 0x1571, 0xa203, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_CAN_10MBIT }, - { 0x1571, 0xa204, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_CAN_10MBIT }, - { 0x1571, 0xa205, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_CAN_10MBIT }, - { 0x1571, 0xa206, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_CAN_10MBIT }, - { 0x10B5, 0x9030, 0x10B5, 0x2978, 0, 0, ARC_CAN_10MBIT }, - { 0x10B5, 0x9050, 0x10B5, 0x2273, 0, 0, ARC_CAN_10MBIT }, - { 0x14BA, 0x6000, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_CAN_10MBIT }, - { 0x10B5, 0x2200, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ARC_CAN_10MBIT }, - {0,} + { + 0x1571, 0xa001, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + 0, + }, + { + 0x1571, 0xa002, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + 0, + }, + { + 0x1571, 0xa003, + PCI_ANY_ID
[PATCH 1/5] ARCNET: return IRQ_NONE if the interface isn't running
The interrupt handler needs to return IRQ_NONE in case two devices are used with the shared interrupt handler. Otherwise it could steal interrupts from the other interface. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de --- drivers/net/arcnet/arcnet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/arcnet/arcnet.c b/drivers/net/arcnet/arcnet.c index 3b790de..09de683 100644 --- a/drivers/net/arcnet/arcnet.c +++ b/drivers/net/arcnet/arcnet.c @@ -777,7 +777,7 @@ irqreturn_t arcnet_interrupt(int irq, void *dev_id) ACOMMAND(CFLAGScmd | RESETclear); AINTMASK(0); spin_unlock(lp-lock); - return IRQ_HANDLED; + return retval; } BUGMSG(D_DURING, in arcnet_inthandler (status=%Xh, intmask=%Xh)\n, -- 2.1.0 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 4/5] ARCNET: add support for multi interfaces on com20020
The com20020-pci driver is currently designed to instance one netdev with one pci device. This patch adds support to instance many cards with one pci device, depending on the device data in the private data. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de --- drivers/net/arcnet/com20020-pci.c | 149 -- include/linux/com20020.h | 15 +++- 2 files changed, 109 insertions(+), 55 deletions(-) diff --git a/drivers/net/arcnet/com20020-pci.c b/drivers/net/arcnet/com20020-pci.c index f9e5552..fe87576 100644 --- a/drivers/net/arcnet/com20020-pci.c +++ b/drivers/net/arcnet/com20020-pci.c @@ -38,6 +38,7 @@ #include linux/pci.h #include linux/arcdevice.h #include linux/com20020.h +#include linux/list.h #include asm/io.h @@ -61,85 +62,125 @@ module_param(clockp, int, 0); module_param(clockm, int, 0); MODULE_LICENSE(GPL); +static void com20020pci_remove(struct pci_dev *pdev); + static int com20020pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) { - struct com20020_pci_channel_map *cm; struct com20020_pci_card_info *ci; struct net_device *dev; struct arcnet_local *lp; - int ioaddr, err; + struct com20020_priv *priv; + int i, ioaddr, ret; + struct resource *r; if (pci_enable_device(pdev)) return -EIO; - dev = alloc_arcdev(device); - if (!dev) - return -ENOMEM; - - dev-netdev_ops = com20020_netdev_ops; + priv = devm_kzalloc(pdev-dev, sizeof(struct com20020_priv), + GFP_KERNEL); ci = (struct com20020_pci_card_info *)id-driver_data; + priv-ci = ci; - lp = netdev_priv(dev); + INIT_LIST_HEAD(priv-list_dev); - pci_set_drvdata(pdev, dev); - cm = ci-chan_map_tbl[0]; - BUGMSG(D_NORMAL, %s Controls\n, ci-name); - ioaddr = pci_resource_start(pdev, cm-bar); + for (i = 0; i ci-devcount; i++) { + struct com20020_pci_channel_map *cm = ci-chan_map_tbl[i]; + struct com20020_dev *card; - if (!request_region(ioaddr, ARCNET_TOTAL_SIZE, com20020-pci)) { - BUGMSG(D_INIT, IO region %xh-%xh already allocated.\n, - ioaddr, ioaddr + ARCNET_TOTAL_SIZE - 1); - err = -EBUSY; - goto out_dev; - } + dev = alloc_arcdev(device); + if (!dev) { + ret = -ENOMEM; + goto out_port; + } - // Dummy access after Reset - // ARCNET controller needs this access to detect bustype - outb(0x00,ioaddr+1); - inb(ioaddr+1); - - dev-base_addr = ioaddr; - dev-irq = pdev-irq; - dev-dev_addr[0] = node; - lp-card_name = PCI COM20020; - lp-card_flags = ci-flags; - lp-backplane = backplane; - lp-clockp = clockp 7; - lp-clockm = clockm 3; - lp-timeout = timeout; - lp-hw.owner = THIS_MODULE; - - if (ASTATUS() == 0xFF) { - BUGMSG(D_NORMAL, IO address %Xh was reported by PCI BIOS, - but seems empty!\n, ioaddr); - err = -EIO; - goto out_port; - } - if (com20020_check(dev)) { - err = -EIO; - goto out_port; + dev-netdev_ops = com20020_netdev_ops; + + lp = netdev_priv(dev); + + BUGMSG(D_NORMAL, %s Controls\n, ci-name); + ioaddr = pci_resource_start(pdev, cm-bar) + cm-offset; + + r = devm_request_region(pdev-dev, ioaddr, cm-size, + com20020-pci); + if (!r) { + pr_err(IO region %xh-%xh already allocated.\n, + ioaddr, ioaddr + cm-size - 1); + ret = -EBUSY; + goto out_port; + } + + /* Dummy access after Reset +* ARCNET controller needs +* this access to detect bustype +*/ + outb(0x00, ioaddr + 1); + inb(ioaddr + 1); + + dev-base_addr = ioaddr; + dev-dev_addr[0] = node; + dev-irq = pdev-irq; + lp-card_name = PCI COM20020; + lp-card_flags = ci-flags; + lp-backplane = backplane; + lp-clockp = clockp 7; + lp-clockm = clockm 3; + lp-timeout = timeout; + lp-hw.owner = THIS_MODULE; + + if (ASTATUS() == 0xFF) { + pr_err(IO address %Xh is empty!\n, ioaddr); + ret = -EIO; + goto out_port; + } + if (com20020_check(dev)) { + ret = -EIO; + goto out_port; + } + + card = devm_kzalloc(pdev-dev
[PATCH 2/5] ARCNET: add com20020_set_hwddr to change address
This patch adds com20020_set_hwaddr to make it possible to change the hwaddr on runtime. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de --- drivers/net/arcnet/com20020.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/drivers/net/arcnet/com20020.c b/drivers/net/arcnet/com20020.c index 7b96c5f..1a84378 100644 --- a/drivers/net/arcnet/com20020.c +++ b/drivers/net/arcnet/com20020.c @@ -149,11 +149,25 @@ int com20020_check(struct net_device *dev) return 0; } +static int com20020_set_hwaddr(struct net_device *dev, void *addr) +{ + int ioaddr = dev-base_addr; + struct arcnet_local *lp = netdev_priv(dev); + struct sockaddr *hwaddr = addr; + + memcpy(dev-dev_addr, hwaddr-sa_data, 1); + SET_SUBADR(SUB_NODE); + outb(dev-dev_addr[0], _XREG); + + return 0; +} + const struct net_device_ops com20020_netdev_ops = { .ndo_open = arcnet_open, .ndo_stop = arcnet_close, .ndo_start_xmit = arcnet_send_packet, .ndo_tx_timeout = arcnet_timeout, + .ndo_set_mac_address = com20020_set_hwaddr, .ndo_set_rx_mode = com20020_set_mc_list, }; -- 2.1.0 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] com20020-pci: add support for eae single card
Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de --- drivers/net/arcnet/com20020-pci.c | 21 ++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/drivers/net/arcnet/com20020-pci.c b/drivers/net/arcnet/com20020-pci.c index 945f532..96edc13 100644 --- a/drivers/net/arcnet/com20020-pci.c +++ b/drivers/net/arcnet/com20020-pci.c @@ -214,8 +214,17 @@ static struct com20020_pci_card_info card_info_sohard = { .flags = ARC_CAN_10MBIT, }; -static struct com20020_pci_card_info card_info_eae = { - .name = EAE PLX-PCI, +static struct com20020_pci_card_info card_info_eae_arc1 = { + .name = EAE PLX-PCI ARC1, + .devcount = 1, + .chan_map_tbl = { + { 2, 0x00, 0x08 }, + }, + .flags = ARC_CAN_10MBIT, +}; + +static struct com20020_pci_card_info card_info_eae_ma1 = { + .name = EAE PLX-PCI MA1, .devcount = 2, .chan_map_tbl = { { 2, 0x00, 0x08 }, @@ -359,9 +368,15 @@ static const struct pci_device_id com20020pci_id_table[] = { }, { 0x10B5, 0x9050, + 0x10B5, 0x3263, + 0, 0, + (kernel_ulong_t)card_info_eae_arc1 + }, + { + 0x10B5, 0x9050, 0x10B5, 0x3292, 0, 0, - (kernel_ulong_t)card_info_eae + (kernel_ulong_t)card_info_eae_ma1 }, { 0x14BA, 0x6000, -- 2.1.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 05/21] ARCNET: remove unneeded macros
The simple macros ARCRESET, ACOMMAND, ASTATUS, AINTMASK are unnecessary indirections to the use of registers. This patch removes them and improves the readability of the code. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de --- drivers/net/arcnet/arcnet.c | 68 +++-- include/linux/arcdevice.h | 7 - 2 files changed, 35 insertions(+), 40 deletions(-) diff --git a/drivers/net/arcnet/arcnet.c b/drivers/net/arcnet/arcnet.c index f83034c..4990b0d 100644 --- a/drivers/net/arcnet/arcnet.c +++ b/drivers/net/arcnet/arcnet.c @@ -382,7 +382,7 @@ int arcnet_open(struct net_device *dev) * time, actually reset it. */ error = -ENODEV; - if (ARCRESET(0) ARCRESET(1)) + if (lp-hw.reset(dev, 0) lp-hw.reset(dev, 1)) goto out_module_put; newmtu = choose_mtu(); @@ -427,22 +427,22 @@ int arcnet_open(struct net_device *dev) DOS networking programs!\n); BUGMSG(D_DEBUG, %s: %d: %s\n,__FILE__,__LINE__,__func__); - if (ASTATUS() RESETflag) { + if (lp-hw.status(dev) RESETflag) { BUGMSG(D_DEBUG, %s: %d: %s\n,__FILE__,__LINE__,__func__); - ACOMMAND(CFLAGScmd | RESETclear); + lp-hw.command(dev, CFLAGScmd | RESETclear); } BUGMSG(D_DEBUG, %s: %d: %s\n,__FILE__,__LINE__,__func__); /* make sure we're ready to receive IRQ's. */ - AINTMASK(0); + lp-hw.intmask(dev, 0); udelay(1); /* give it time to set the mask before * we reset it again. (may not even be * necessary) */ BUGMSG(D_DEBUG, %s: %d: %s\n,__FILE__,__LINE__,__func__); lp-intmask = NORXflag | RECONflag; - AINTMASK(lp-intmask); + lp-hw.intmask(dev, lp-intmask); BUGMSG(D_DEBUG, %s: %d: %s\n,__FILE__,__LINE__,__func__); netif_start_queue(dev); @@ -463,9 +463,9 @@ int arcnet_close(struct net_device *dev) netif_stop_queue(dev); /* flush TX and disable RX */ - AINTMASK(0); - ACOMMAND(NOTXcmd); /* stop transmit */ - ACOMMAND(NORXcmd); /* disable receive */ + lp-hw.intmask(dev, 0); + lp-hw.command(dev, NOTXcmd); /* stop transmit */ + lp-hw.command(dev, NORXcmd); /* disable receive */ mdelay(1); /* shut down the card */ @@ -545,7 +545,7 @@ netdev_tx_t arcnet_send_packet(struct sk_buff *skb, BUGMSG(D_DURING, transmit requested (status=%Xh, txbufs=%d/%d, len=%d, protocol %x)\n, - ASTATUS(), lp-cur_tx, lp-next_tx, skb-len,skb-protocol); + lp-hw.status(dev), lp-cur_tx, lp-next_tx, skb-len, skb-protocol); pkt = (struct archdr *) skb-data; soft = pkt-soft.rfc1201; @@ -566,7 +566,7 @@ netdev_tx_t arcnet_send_packet(struct sk_buff *skb, netif_stop_queue(dev); spin_lock_irqsave(lp-lock, flags); - AINTMASK(0); + lp-hw.intmask(dev, 0); if (lp-next_tx == -1) { txbuf = get_arcbuf(dev); } else { @@ -601,14 +601,16 @@ netdev_tx_t arcnet_send_packet(struct sk_buff *skb, freeskb = 0; } - BUGMSG(D_DEBUG, %s: %d: %s, status: %x\n,__FILE__,__LINE__,__func__,ASTATUS()); + BUGMSG(D_DEBUG, %s: %d: %s, status: %x\n, + __FILE__, __LINE__, __func__, lp-hw.status(dev)); /* make sure we didn't ignore a TX IRQ while we were in here */ - AINTMASK(0); + lp-hw.intmask(dev, 0); - BUGMSG(D_DEBUG, %s: %d: %s\n,__FILE__,__LINE__,__func__); + BUGMSG(D_DEBUG, %s: %d: %s\n, __FILE__, __LINE__, __func__); lp-intmask |= TXFREEflag|EXCNAKflag; - AINTMASK(lp-intmask); - BUGMSG(D_DEBUG, %s: %d: %s, status: %x\n,__FILE__,__LINE__,__func__,ASTATUS()); + lp-hw.intmask(dev, lp-intmask); + BUGMSG(D_DEBUG, %s: %d: %s, status: %x\n, + __FILE__, __LINE__, __func__, lp-hw.status(dev)); spin_unlock_irqrestore(lp-lock, flags); if (freeskb) { @@ -627,7 +629,7 @@ static int go_tx(struct net_device *dev) struct arcnet_local *lp = netdev_priv(dev); BUGMSG(D_DURING, go_tx: status=%Xh, intmask=%Xh, next_tx=%d, cur_tx=%d\n, - ASTATUS(), lp-intmask, lp-next_tx, lp-cur_tx); + lp-hw.status(dev), lp-intmask, lp-next_tx, lp-cur_tx); if (lp-cur_tx != -1 || lp-next_tx == -1) return 0; @@ -638,7 +640,7 @@ static int go_tx(struct net_device *dev) lp-next_tx = -1; /* start sending */ - ACOMMAND(TXcmd | (lp-cur_tx 3)); + lp-hw.command(dev, TXcmd | (lp-cur_tx 3)); dev-stats.tx_packets++; lp-lasttrans_dest = lp-lastload_dest; @@ -655,7 +657,7 @@ void arcnet_timeout(struct net_device *dev) { unsigned long flags; struct arcnet_local *lp = netdev_priv(dev
[PATCH 06/21] ARCNET: com20020: remove unneeded macros
The macros SET_SUBADR, ARCRESET, ARCRESET0, ACOMMAND, ASTATUS, AINTMASK and ADIAGSTATUS are unnecessary indirections to the use of registers. This patch removes them and improves the readability of the code. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de --- drivers/net/arcnet/com20020-isa.c | 2 +- drivers/net/arcnet/com20020-pci.c | 2 +- drivers/net/arcnet/com20020.c | 56 ++- include/linux/com20020.h | 33 --- 4 files changed, 34 insertions(+), 59 deletions(-) diff --git a/drivers/net/arcnet/com20020-isa.c b/drivers/net/arcnet/com20020-isa.c index d8746ca..c674511 100644 --- a/drivers/net/arcnet/com20020-isa.c +++ b/drivers/net/arcnet/com20020-isa.c @@ -68,7 +68,7 @@ static int __init com20020isa_probe(struct net_device *dev) ioaddr, ioaddr + ARCNET_TOTAL_SIZE - 1); return -ENXIO; } - if (ASTATUS() == 0xFF) { + if (inb(_STATUS) == 0xFF) { BUGMSG(D_NORMAL, IO address %x empty\n, ioaddr); err = -ENODEV; goto out; diff --git a/drivers/net/arcnet/com20020-pci.c b/drivers/net/arcnet/com20020-pci.c index 9fa4eee..18c0b1f 100644 --- a/drivers/net/arcnet/com20020-pci.c +++ b/drivers/net/arcnet/com20020-pci.c @@ -132,7 +132,7 @@ static int com20020pci_probe(struct pci_dev *pdev, const struct pci_device_id *i lp-timeout = timeout; lp-hw.owner = THIS_MODULE; - if (ASTATUS() == 0xFF) { + if (inb(_STATUS) == 0xFF) { pr_err(IO address %Xh is empty!\n, ioaddr); ret = -EIO; goto out_port; diff --git a/drivers/net/arcnet/com20020.c b/drivers/net/arcnet/com20020.c index 0d84f6c..ed0cdd3 100644 --- a/drivers/net/arcnet/com20020.c +++ b/drivers/net/arcnet/com20020.c @@ -91,7 +91,10 @@ int com20020_check(struct net_device *dev) int ioaddr = dev-base_addr, status; struct arcnet_local *lp = netdev_priv(dev); - ARCRESET0; + /* reset the card */ + outb(0x18 | 0x80, _CONFIG); + udelay(5); + outb(0x18, _CONFIG); mdelay(RESETtime); lp-setup = lp-clockm ? 0 : (lp-clockp 1); @@ -101,12 +104,13 @@ int com20020_check(struct net_device *dev) /* Enable P1Mode for backplane mode */ lp-setup = lp-setup | P1MODE; - SET_SUBADR(SUB_SETUP1); + lp-config = (lp-config ~0x03) | SUB_SETUP1; + outb(lp-config, _CONFIG); outb(lp-setup, _XREG); if (lp-clockm != 0) { - SET_SUBADR(SUB_SETUP2); + outb(SUB_SETUP2, _SUBADR); outb(lp-setup2, _XREG); /* must now write the magic restart operation command */ @@ -116,10 +120,10 @@ int com20020_check(struct net_device *dev) lp-config = 0x21 | (lp-timeout 3) | (lp-backplane 2); /* set node ID to 0x42 (but transmitter is disabled, so it's okay) */ - SETCONF; + outb(lp-config, _CONFIG); outb(0x42, ioaddr + BUS_ALIGN*7); - status = ASTATUS(); + status = inb(_STATUS); if ((status 0x99) != (NORXflag | TXFREEflag | RESETflag)) { BUGMSG(D_NORMAL, status invalid (%Xh).\n, status); @@ -131,9 +135,9 @@ int com20020_check(struct net_device *dev) outb(0x39, _CONFIG); outb(inb(ioaddr + BUS_ALIGN*8), ioaddr + BUS_ALIGN*7); - ACOMMAND(CFLAGScmd | RESETclear | CONFIGclear); + outb((CFLAGScmd | RESETclear | CONFIGclear), _COMMAND); - status = ASTATUS(); + status = inb(_STATUS); BUGMSG(D_INIT_REASONS, status after reset acknowledged: %X\n, status); @@ -156,7 +160,8 @@ static int com20020_set_hwaddr(struct net_device *dev, void *addr) struct sockaddr *hwaddr = addr; memcpy(dev-dev_addr, hwaddr-sa_data, 1); - SET_SUBADR(SUB_NODE); + lp-config = (lp-config ~0x03) | SUB_NODE; + outb(lp-config, _CONFIG); outb(dev-dev_addr[0], _XREG); return 0; @@ -195,12 +200,13 @@ int com20020_found(struct net_device *dev, int shared) if (!dev-dev_addr[0]) dev-dev_addr[0] = inb(ioaddr + BUS_ALIGN*8); /* FIXME: do this some other way! */ - SET_SUBADR(SUB_SETUP1); + lp-config = (lp-config ~0x03) | SUB_SETUP1; + outb(lp-config, _CONFIG); outb(lp-setup, _XREG); if (lp-card_flags ARC_CAN_10MBIT) { - SET_SUBADR(SUB_SETUP2); + outb(SUB_SETUP2, _SUBADR); outb(lp-setup2, _XREG); /* must now write the magic restart operation command */ @@ -210,7 +216,7 @@ int com20020_found(struct net_device *dev, int shared) lp-config = 0x20 | (lp-timeout 3) | (lp-backplane 2) | 1; /* Default 0x38 + register: Node ID */ - SETCONF; + outb(lp-config, _CONFIG); outb(dev-dev_addr[0], _XREG
[PATCH 08/21] ARCNET: com90io: remove unneeded macros
The simple macros ARCRESET, ACOMMAND, ASTATUS, AINTMASK are unnecessary indirections to the use of registers. This patch removes them and improves the readability of the code. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de --- drivers/net/arcnet/com90io.c | 36 +--- 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/drivers/net/arcnet/com90io.c b/drivers/net/arcnet/com90io.c index b1279af..6bc6366 100644 --- a/drivers/net/arcnet/com90io.c +++ b/drivers/net/arcnet/com90io.c @@ -69,16 +69,6 @@ static void com90io_copy_from_card(struct net_device *dev, int bufnum, int offse #define _ADDR_LO (ioaddr+14) #define _CONFIG (ioaddr+2)/* Configuration register */ -#undef ASTATUS -#undef ACOMMAND -#undef AINTMASK - -#define ASTATUS() inb(_STATUS) -#define ACOMMAND(cmd) outb((cmd),_COMMAND) -#define AINTMASK(msk) outb((msk),_INTMASK) -#define SETCONF() outb((lp-config),_CONFIG) - - / * * * IO-mapped operation routines * @@ -164,14 +154,14 @@ static int __init com90io_probe(struct net_device *dev) ioaddr, ioaddr + ARCNET_TOTAL_SIZE - 1); return -ENXIO; } - if (ASTATUS() == 0xFF) { + if (inb(_STATUS) == 0xFF) { BUGMSG(D_INIT_REASONS, IO address %x empty\n, ioaddr); goto err_out; } inb(_RESET); mdelay(RESETtime); - status = ASTATUS(); + status = inb(_STATUS); if ((status 0x9D) != (NORXflag | RECONflag | TXFREEflag | RESETflag)) { BUGMSG(D_INIT_REASONS, Status invalid (%Xh).\n, status); @@ -179,11 +169,11 @@ static int __init com90io_probe(struct net_device *dev) } BUGMSG(D_INIT_REASONS, Status after reset: %X\n, status); - ACOMMAND(CFLAGScmd | RESETclear | CONFIGclear); + outb(CFLAGScmd | RESETclear | CONFIGclear, _COMMAND); BUGMSG(D_INIT_REASONS, Status after reset acknowledged: %X\n, status); - status = ASTATUS(); + status = inb(_STATUS); if (status RESETflag) { BUGMSG(D_INIT_REASONS, Eternal reset (status=%Xh)\n, status); @@ -259,7 +249,7 @@ static int __init com90io_found(struct net_device *dev) lp-hw.copy_from_card = com90io_copy_from_card; lp-config = (0x16 | IOMAPflag) ~ENABLE16flag; - SETCONF(); + outb(lp-config, _CONFIG); /* get and check the station ID from offset 1 in shmem */ @@ -293,7 +283,7 @@ static int com90io_reset(struct net_device *dev, int really_reset) struct arcnet_local *lp = netdev_priv(dev); short ioaddr = dev-base_addr; - BUGMSG(D_INIT, Resetting %s (status=%02Xh)\n, dev-name, ASTATUS()); + BUGMSG(D_INIT, Resetting %s (status=%02Xh)\n, dev-name, inb(_STATUS)); if (really_reset) { /* reset the card */ @@ -302,10 +292,10 @@ static int com90io_reset(struct net_device *dev, int really_reset) } /* Set the thing to IO-mapped, 8-bit mode */ lp-config = (0x1C | IOMAPflag) ~ENABLE16flag; - SETCONF(); + outb(lp-config, _CONFIG); - ACOMMAND(CFLAGScmd | RESETclear); /* clear flags end reset */ - ACOMMAND(CFLAGScmd | CONFIGclear); + outb(CFLAGScmd | RESETclear, _COMMAND); /* clear flags end reset */ + outb(CFLAGScmd | CONFIGclear, _COMMAND); /* verify that the ARCnet signature byte is present */ if (get_buffer_byte(dev, 0) != TESTvalue) { @@ -313,7 +303,7 @@ static int com90io_reset(struct net_device *dev, int really_reset) return 1; } /* enable extended (512-byte) packets */ - ACOMMAND(CONFIGcmd | EXTconf); + outb(CONFIGcmd | EXTconf, _COMMAND); /* done! return success. */ return 0; @@ -324,7 +314,7 @@ static void com90io_command(struct net_device *dev, int cmd) { short ioaddr = dev-base_addr; - ACOMMAND(cmd); + outb(cmd, _COMMAND); } @@ -332,7 +322,7 @@ static int com90io_status(struct net_device *dev) { short ioaddr = dev-base_addr; - return ASTATUS(); + return inb(_STATUS); } @@ -340,7 +330,7 @@ static void com90io_setmask(struct net_device *dev, int mask) { short ioaddr = dev-base_addr; - AINTMASK(mask); + outb(mask, _INTMASK); } static void com90io_copy_to_card(struct net_device *dev, int bufnum, int offset, -- 2.1.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 03/21] ARCNET: capmode: fix transfer length
The commit 52edc17f94f7bd4d9 (bugfixes and new hardware support for arcnet driver) adds fixes for the packet length calculations in arc-rawmode. As the capmode protocol is derived from the arc-rawmode code, the capmode also needs the fixes. rx(): - Fixed error in received packet lengths; 256 byte packets were being received as 257 bytes packets. prepare_tx(): - Fixed error in transmit length calcs; 257 byte packets were being transmitted as 260 byte packets. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de --- drivers/net/arcnet/capmode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/arcnet/capmode.c b/drivers/net/arcnet/capmode.c index 42fce91..b6868a2 100644 --- a/drivers/net/arcnet/capmode.c +++ b/drivers/net/arcnet/capmode.c @@ -49,7 +49,7 @@ static void rx(struct net_device *dev, int bufnum, BUGMSG(D_DURING, it's a raw(cap) packet (length=%d)\n, length); - if (length = MinTU) + if (length MTU) ofs = 512 - length; else ofs = 256 - length; @@ -156,7 +156,7 @@ static int prepare_tx(struct net_device *dev, struct archdr *pkt, int length, length, XMTU); length = XMTU; } - if (length MinTU) { + if (length = MinTU) { hard-offset[0] = 0; hard-offset[1] = ofs = 512 - length; } else if (length MTU) { -- 2.1.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 14/21] ARCNET: arc-rawmode: reorder module functions
This patch moves the module_init and module_exit patches to the end of the file. It also replaces the printk with pr_info. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de --- drivers/net/arcnet/arc-rawmode.c | 87 ++-- 1 file changed, 38 insertions(+), 49 deletions(-) diff --git a/drivers/net/arcnet/arc-rawmode.c b/drivers/net/arcnet/arc-rawmode.c index b603470..68466b3 100644 --- a/drivers/net/arcnet/arc-rawmode.c +++ b/drivers/net/arcnet/arc-rawmode.c @@ -35,55 +35,6 @@ #define VERSION arcnet: raw mode (`r') encapsulation support loaded.\n - -static void rx(struct net_device *dev, int bufnum, - struct archdr *pkthdr, int length); -static int build_header(struct sk_buff *skb, struct net_device *dev, - unsigned short type, uint8_t daddr); -static int prepare_tx(struct net_device *dev, struct archdr *pkt, int length, - int bufnum); - -static struct ArcProto rawmode_proto = -{ - .suffix = 'r', - .mtu= XMTU, - .rx = rx, - .build_header = build_header, - .prepare_tx = prepare_tx, - .continue_tx= NULL, - .ack_tx = NULL -}; - - -static int __init arcnet_raw_init(void) -{ - int count; - - printk(VERSION); - - for (count = 0; count 256; count++) - if (arc_proto_map[count] == arc_proto_default) - arc_proto_map[count] = rawmode_proto; - - /* for raw mode, we only set the bcast proto if there's no better one */ - if (arc_bcast_proto == arc_proto_default) - arc_bcast_proto = rawmode_proto; - - arc_proto_default = rawmode_proto; - return 0; -} - -static void __exit arcnet_raw_exit(void) -{ - arcnet_unregister_proto(rawmode_proto); -} - -module_init(arcnet_raw_init); -module_exit(arcnet_raw_exit); - -MODULE_LICENSE(GPL); - - /* packet receiver */ static void rx(struct net_device *dev, int bufnum, struct archdr *pkthdr, int length) @@ -201,3 +152,41 @@ static int prepare_tx(struct net_device *dev, struct archdr *pkt, int length, return 1; /* done */ } + +static struct ArcProto rawmode_proto = { + .suffix = 'r', + .mtu= XMTU, + .rx = rx, + .build_header = build_header, + .prepare_tx = prepare_tx, + .continue_tx= NULL, + .ack_tx = NULL +}; + +static int __init arcnet_raw_init(void) +{ + int count; + + pr_info(VERSION); + + for (count = 0; count 256; count++) + if (arc_proto_map[count] == arc_proto_default) + arc_proto_map[count] = rawmode_proto; + + /* for raw mode, we only set the bcast proto if there's no better one */ + if (arc_bcast_proto == arc_proto_default) + arc_bcast_proto = rawmode_proto; + + arc_proto_default = rawmode_proto; + return 0; +} + +static void __exit arcnet_raw_exit(void) +{ + arcnet_unregister_proto(rawmode_proto); +} + +module_init(arcnet_raw_init); +module_exit(arcnet_raw_exit); + +MODULE_LICENSE(GPL); -- 2.1.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 00/21] ARCNET: Defibrillation
Hi! This patch series tries to reanimate the ARCNET hardware layer to be somehow readable and maintainable again. It includes a lot of cleanup patches. It also adds some fixes which leads the layer to become usable again. And as a special treatment it adds more features like correct loading and unloading of the com20020 card. Cheers, Michael Michael Grzeschik (21): com20020-pci: add dev_port for udev handling ARCNET: fix hard_header_len limit ARCNET: capmode: fix transfer length ARCNET: whitespace, tab and codingstyle fixes ARCNET: remove unneeded macros ARCNET: com20020: remove unneeded macros ARCNET: rimi: remove unneeded macros ARCNET: com90io: remove unneeded macros ARCNET: com90xx: remove unneeded macros ARCNET: com20020: fix ioaddr prefixes ARCNET: rimi: fix ioaddr prefixes ARCNET: com90io: fix ioaddr prefixes ARCNET: com90xx: fix ioaddr prefixes ARCNET: arc-rawmode: reorder module functions ARCNET: capmode: remove extra function and use C99 in struct ARCNET: capmode: move dev_free_skb to its only user ARCNET: com20020: replace magic numbers with readable macros ARCNET: com20020: remove obsolete BUS_ALIGN offset factor ARCNET: com20020: add enable and disable device on open/close ARCNET: com20020-pci: reformat structs to C99 format ARCNET: com20020-pci: add rotary index support drivers/net/arcnet/arc-rawmode.c | 91 +--- drivers/net/arcnet/arc-rimi.c | 42 ++ drivers/net/arcnet/arcnet.c | 192 +++- drivers/net/arcnet/capmode.c | 32 ++-- drivers/net/arcnet/com20020-isa.c | 4 +- drivers/net/arcnet/com20020-pci.c | 66 - drivers/net/arcnet/com20020.c | 152 +++ drivers/net/arcnet/com20020_cs.c | 302 ++ drivers/net/arcnet/com90io.c | 98 ++--- drivers/net/arcnet/com90xx.c | 65 include/linux/arcdevice.h | 15 +- include/linux/com20020.h | 69 +++-- include/uapi/linux/if_arcnet.h| 48 +++--- 13 files changed, 572 insertions(+), 604 deletions(-) -- 2.1.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 16/21] ARCNET: capmode: move dev_free_skb to its only user
The call for dev_free_skb is done only once. This patch moves its call to its only user and removes the obsolete condition variable. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de --- drivers/net/arcnet/arcnet.c | 10 ++ 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/net/arcnet/arcnet.c b/drivers/net/arcnet/arcnet.c index 4990b0d..5eec14d 100644 --- a/drivers/net/arcnet/arcnet.c +++ b/drivers/net/arcnet/arcnet.c @@ -541,7 +541,7 @@ netdev_tx_t arcnet_send_packet(struct sk_buff *skb, struct ArcProto *proto; int txbuf; unsigned long flags; - int freeskb, retval; + int retval; BUGMSG(D_DURING, transmit requested (status=%Xh, txbufs=%d/%d, len=%d, protocol %x)\n, @@ -578,15 +578,13 @@ netdev_tx_t arcnet_send_packet(struct sk_buff *skb, /* done right away and we don't want to acknowledge the package later - forget about it now */ dev-stats.tx_bytes += skb-len; - freeskb = 1; + dev_kfree_skb(skb); } else { /* do it the 'split' way */ lp-outgoing.proto = proto; lp-outgoing.skb = skb; lp-outgoing.pkt = pkt; - freeskb = 0; - if (proto-continue_tx proto-continue_tx(dev, txbuf)) { BUGMSG(D_NORMAL, @@ -598,7 +596,6 @@ netdev_tx_t arcnet_send_packet(struct sk_buff *skb, lp-next_tx = txbuf; } else { retval = NETDEV_TX_BUSY; - freeskb = 0; } BUGMSG(D_DEBUG, %s: %d: %s, status: %x\n, @@ -613,9 +610,6 @@ netdev_tx_t arcnet_send_packet(struct sk_buff *skb, __FILE__, __LINE__, __func__, lp-hw.status(dev)); spin_unlock_irqrestore(lp-lock, flags); - if (freeskb) { - dev_kfree_skb(skb); - } return retval; /* no need to try again */ } -- 2.1.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 09/21] ARCNET: com90xx: remove unneeded macros
The simple macros ARCRESET, ACOMMAND, ASTATUS, AINTMASK are unnecessary indirections to the use of registers. This patch removes them and improves the readability of the code. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de --- drivers/net/arcnet/com90xx.c | 35 +-- 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/drivers/net/arcnet/com90xx.c b/drivers/net/arcnet/com90xx.c index 03bd71c..2b99a04 100644 --- a/drivers/net/arcnet/com90xx.c +++ b/drivers/net/arcnet/com90xx.c @@ -89,15 +89,6 @@ static int numcards; #define _ADDR_HI (ioaddr+15) /* Control registers for said */ #define _ADDR_LO (ioaddr+14) -#undef ASTATUS -#undef ACOMMAND -#undef AINTMASK - -#define ASTATUS() inb(_STATUS) -#define ACOMMAND(cmd) outb((cmd),_COMMAND) -#define AINTMASK(msk) outb((msk),_INTMASK) - - static int com90xx_skip_probe __initdata = 0; /* Module parameters */ @@ -175,7 +166,7 @@ static void __init com90xx_probe(void) *port-- = ports[--numports]; continue; } - if (ASTATUS() == 0xFF) { + if (inb(_STATUS) == 0xFF) { BUGMSG2(D_INIT_REASONS, (empty)\n); BUGMSG2(D_INIT_REASONS, S1: ); BUGLVL(D_INIT_REASONS) numprint = 0; @@ -317,7 +308,7 @@ static void __init com90xx_probe(void) BUGMSG2(D_INIT, %Xh , *port); ioaddr = *port; - status = ASTATUS(); + status = inb(_STATUS); if ((status 0x9D) != (NORXflag | RECONflag | TXFREEflag | RESETflag)) { @@ -328,8 +319,8 @@ static void __init com90xx_probe(void) *port-- = ports[--numports]; continue; } - ACOMMAND(CFLAGScmd | RESETclear | CONFIGclear); - status = ASTATUS(); + outb(CFLAGScmd | RESETclear | CONFIGclear, _COMMAND); + status = inb(_STATUS); if (status RESETflag) { BUGMSG2(D_INIT_REASONS, (eternal reset, status=%Xh)\n, status); @@ -348,9 +339,9 @@ static void __init com90xx_probe(void) * we tell it to start receiving. */ airqmask = probe_irq_on(); - AINTMASK(NORXflag); + outb(NORXflag, _INTMASK); udelay(1); - AINTMASK(0); + outb(0, _INTMASK); airq = probe_irq_off(airqmask); if (airq = 0) { @@ -557,7 +548,7 @@ static void com90xx_command(struct net_device *dev, int cmd) { short ioaddr = dev-base_addr; - ACOMMAND(cmd); + outb(cmd, _COMMAND); } @@ -565,7 +556,7 @@ static int com90xx_status(struct net_device *dev) { short ioaddr = dev-base_addr; - return ASTATUS(); + return inb(_STATUS); } @@ -573,7 +564,7 @@ static void com90xx_setmask(struct net_device *dev, int mask) { short ioaddr = dev-base_addr; - AINTMASK(mask); + outb(mask, _INTMASK); } @@ -590,15 +581,15 @@ static int com90xx_reset(struct net_device *dev, int really_reset) struct arcnet_local *lp = netdev_priv(dev); short ioaddr = dev-base_addr; - BUGMSG(D_INIT, Resetting (status=%02Xh)\n, ASTATUS()); + BUGMSG(D_INIT, Resetting (status=%02Xh)\n, inb(_STATUS)); if (really_reset) { /* reset the card */ inb(_RESET); mdelay(RESETtime); } - ACOMMAND(CFLAGScmd | RESETclear); /* clear flags end reset */ - ACOMMAND(CFLAGScmd | CONFIGclear); + outb(CFLAGScmd | RESETclear, _COMMAND); /* clear flags end reset */ + outb(CFLAGScmd | CONFIGclear, _COMMAND); /* don't do this until we verify that it doesn't hurt older cards! */ /* outb(inb(_CONFIG) | ENABLE16flag, _CONFIG); */ @@ -610,7 +601,7 @@ static int com90xx_reset(struct net_device *dev, int really_reset) return 1; } /* enable extended (512-byte) packets */ - ACOMMAND(CONFIGcmd | EXTconf); + outb(CONFIGcmd | EXTconf, _COMMAND); /* clean out all the memory to make debugging make more sense :) */ BUGLVL(D_DURING) -- 2.1.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 17/21] ARCNET: com20020: replace magic numbers with readable macros
This patch replaces all magic numbers in the driver with proper named macros. For the case of XTOcfg and STARTIOcmd it introduces the new macros. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de --- drivers/net/arcnet/com20020.c | 21 +++-- include/linux/arcdevice.h | 1 + include/linux/com20020.h | 1 + 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/drivers/net/arcnet/com20020.c b/drivers/net/arcnet/com20020.c index 4b4bb96..27ad484 100644 --- a/drivers/net/arcnet/com20020.c +++ b/drivers/net/arcnet/com20020.c @@ -92,9 +92,9 @@ int com20020_check(struct net_device *dev) struct arcnet_local *lp = netdev_priv(dev); /* reset the card */ - outb(0x18 | 0x80, ioaddr + _CONFIG); + outb(XTOcfg(3) | RESETcfg, ioaddr + _CONFIG); udelay(5); - outb(0x18, ioaddr + _CONFIG); + outb(XTOcfg(3), ioaddr + _CONFIG); mdelay(RESETtime); lp-setup = lp-clockm ? 0 : (lp-clockp 1); @@ -115,13 +115,13 @@ int com20020_check(struct net_device *dev) /* must now write the magic restart operation command */ mdelay(1); - outb(0x18, ioaddr + _COMMAND); + outb(STARTIOcmd, ioaddr + _COMMAND); } - lp-config = 0x21 | (lp-timeout 3) | (lp-backplane 2); + lp-config = TXENcfg | (lp-timeout 3) | (lp-backplane 2) | SUB_NODE; /* set node ID to 0x42 (but transmitter is disabled, so it's okay) */ outb(lp-config, ioaddr + _CONFIG); - outb(0x42, ioaddr + BUS_ALIGN*7); + outb(0x42, ioaddr + _XREG); status = inb(ioaddr + _STATUS); @@ -132,8 +132,9 @@ int com20020_check(struct net_device *dev) BUGMSG(D_INIT_REASONS, status after reset: %X\n, status); /* Enable TX */ - outb(0x39, ioaddr + _CONFIG); - outb(inb(ioaddr + BUS_ALIGN*8), ioaddr + BUS_ALIGN*7); + lp-config |= TXENcfg; + outb(lp-config, ioaddr + _CONFIG); + outb(inb(ioaddr + BUS_ALIGN * 8), ioaddr + _XREG); outb((CFLAGScmd | RESETclear | CONFIGclear), ioaddr + _COMMAND); @@ -212,10 +213,10 @@ int com20020_found(struct net_device *dev, int shared) /* must now write the magic restart operation command */ mdelay(1); - outb(0x18, ioaddr + _COMMAND); + outb(STARTIOcmd, ioaddr + _COMMAND); } - lp-config = 0x20 | (lp-timeout 3) | (lp-backplane 2) | 1; + lp-config = TXENcfg | (lp-timeout 3) | (lp-backplane 2) | SUB_NODE; /* Default 0x38 + register: Node ID */ outb(lp-config, ioaddr + _CONFIG); outb(dev-dev_addr[0], ioaddr + _XREG); @@ -276,7 +277,7 @@ static int com20020_reset(struct net_device *dev, int really_reset) if (really_reset) { /* reset the card */ - outb(lp-config | 0x80, ioaddr + _CONFIG); + outb(lp-config | RESETcfg, ioaddr + _CONFIG); udelay(5); outb(lp-config, ioaddr + _CONFIG); mdelay(RESETtime * 2); /* COM20020 seems to be slower sometimes */ diff --git a/include/linux/arcdevice.h b/include/linux/arcdevice.h index c20f100..bc3b085 100644 --- a/include/linux/arcdevice.h +++ b/include/linux/arcdevice.h @@ -155,6 +155,7 @@ extern int arcnet_debug; #define CONFIGcmd 0x05 /* define configuration */ #define CFLAGScmd 0x06 /* clear flags */ #define TESTcmd 0x07 /* load test flags */ +#define STARTIOcmd 0x18 /* start internal operation */ /* flags for clear flags command */ #define RESETclear 0x08 /* power-on-reset */ diff --git a/include/linux/com20020.h b/include/linux/com20020.h index c2d8647..f194b74 100644 --- a/include/linux/com20020.h +++ b/include/linux/com20020.h @@ -92,6 +92,7 @@ struct com20020_dev { /* in the CONFIG register */ #define RESETcfg 0x80/* put card in reset state */ #define TXENcfg0x20/* enable TX */ +#define XTOcfg(x) ((x) 3) /* extended timeout */ /* in SETUP register */ #define PROMISCset 0x10/* enable RCV_ALL */ -- 2.1.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 21/21] ARCNET: com20020-pci: add rotary index support
The EAE PLX-PCI card has a special rotary encoder to configure the address of every card individually. We take this information for the initial setup of the cards dev_id. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de --- drivers/net/arcnet/com20020-pci.c | 28 include/linux/com20020.h | 4 2 files changed, 32 insertions(+) diff --git a/drivers/net/arcnet/com20020-pci.c b/drivers/net/arcnet/com20020-pci.c index de8c894..308adb9 100644 --- a/drivers/net/arcnet/com20020-pci.c +++ b/drivers/net/arcnet/com20020-pci.c @@ -67,6 +67,7 @@ static void com20020pci_remove(struct pci_dev *pdev); static int com20020pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) { struct com20020_pci_card_info *ci; + struct com20020_pci_channel_map *mm; struct net_device *dev; struct arcnet_local *lp; struct com20020_priv *priv; @@ -83,9 +84,21 @@ static int com20020pci_probe(struct pci_dev *pdev, const struct pci_device_id *i ci = (struct com20020_pci_card_info *)id-driver_data; priv-ci = ci; + mm = ci-misc_map; INIT_LIST_HEAD(priv-list_dev); + if (mm-size) { + ioaddr = pci_resource_start(pdev, mm-bar) + mm-offset; + r = devm_request_region(pdev-dev, ioaddr, mm-size, + com20020-pci); + if (!r) { + pr_err(IO region %xh-%xh already allocated.\n, + ioaddr, ioaddr + mm-size - 1); + return -EBUSY; + } + priv-misc = ioaddr; + } for (i = 0; i ci-devcount; i++) { struct com20020_pci_channel_map *cm = ci-chan_map_tbl[i]; @@ -132,6 +145,9 @@ static int com20020pci_probe(struct pci_dev *pdev, const struct pci_device_id *i lp-timeout = timeout; lp-hw.owner = THIS_MODULE; + /* Get the dev_id from the PLX rotary coder */ + dev-dev_id = inb(priv-misc + ci-rotary) 4; + if (inb(_STATUS) == 0xFF) { pr_err(IO address %Xh is empty!\n, ioaddr); ret = -EIO; @@ -237,6 +253,12 @@ static struct com20020_pci_card_info card_info_eae_arc1 = { .size = 0x08, }, }, + .misc_map = { + .bar = 2, + .offset = 0x10, + .size = 0x04, + }, + .rotary = 0x0, .flags = ARC_CAN_10MBIT, }; @@ -254,6 +276,12 @@ static struct com20020_pci_card_info card_info_eae_ma1 = { .size = 0x08, } }, + .misc_map = { + .bar = 2, + .offset = 0x10, + .size = 0x04, + }, + .rotary = 0x0, .flags = ARC_CAN_10MBIT, }; diff --git a/include/linux/com20020.h b/include/linux/com20020.h index 939d69d..8028ef8 100644 --- a/include/linux/com20020.h +++ b/include/linux/com20020.h @@ -47,6 +47,9 @@ struct com20020_pci_card_info { int devcount; struct com20020_pci_channel_map chan_map_tbl[PLX_PCI_MAX_CARDS]; + struct com20020_pci_channel_map misc_map; + + int rotary; unsigned int flags; }; @@ -54,6 +57,7 @@ struct com20020_pci_card_info { struct com20020_priv { struct com20020_pci_card_info *ci; struct list_head list_dev; + int __iomem misc; }; struct com20020_dev { -- 2.1.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 04/21] ARCNET: whitespace, tab and codingstyle fixes
This patch removes trailing whitespaces in the whole the ARCNET layer. It also replaces the use of space with tabs and changes fixes the codingstyle on those lines. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de --- drivers/net/arcnet/arc-rawmode.c | 4 +- drivers/net/arcnet/arc-rimi.c | 2 +- drivers/net/arcnet/arcnet.c | 116 +++ drivers/net/arcnet/com20020-isa.c | 2 +- drivers/net/arcnet/com20020.c | 13 +- drivers/net/arcnet/com20020_cs.c | 298 ++ drivers/net/arcnet/com90io.c | 2 +- drivers/net/arcnet/com90xx.c | 4 +- include/linux/arcdevice.h | 7 +- include/linux/com20020.h | 4 +- include/uapi/linux/if_arcnet.h| 48 +++--- 11 files changed, 239 insertions(+), 261 deletions(-) diff --git a/drivers/net/arcnet/arc-rawmode.c b/drivers/net/arcnet/arc-rawmode.c index 705e6ce..b603470 100644 --- a/drivers/net/arcnet/arc-rawmode.c +++ b/drivers/net/arcnet/arc-rawmode.c @@ -1,6 +1,6 @@ /* * Linux ARCnet driver - raw mode packet encapsulation (no soft headers) - * + * * Written 1994-1999 by Avery Pennarun. * Derived from skeleton.c by Donald Becker. * @@ -150,7 +150,7 @@ static int build_header(struct sk_buff *skb, struct net_device *dev, /* see linux/net/ethernet/eth.c to see where I got the following */ if (dev-flags (IFF_LOOPBACK | IFF_NOARP)) { - /* + /* * FIXME: fill in the last byte of the dest ipaddr here to better * comply with RFC1051 in noarp mode. */ diff --git a/drivers/net/arcnet/arc-rimi.c b/drivers/net/arcnet/arc-rimi.c index b8b4c7b..4c95d3c 100644 --- a/drivers/net/arcnet/arc-rimi.c +++ b/drivers/net/arcnet/arc-rimi.c @@ -1,6 +1,6 @@ /* * Linux ARCnet driver - RIM I (entirely mem-mapped) cards - * + * * Written 1994-1999 by Avery Pennarun. * Written 1999-2000 by Martin Mares m...@ucw.cz. * Derived from skeleton.c by Donald Becker. diff --git a/drivers/net/arcnet/arcnet.c b/drivers/net/arcnet/arcnet.c index 816d0e9..f83034c 100644 --- a/drivers/net/arcnet/arcnet.c +++ b/drivers/net/arcnet/arcnet.c @@ -1,6 +1,6 @@ /* * Linux ARCnet driver - device-independent routines - * + * * Written 1997 by David Woodhouse. * Written 1994-1999 by Avery Pennarun. * Written 1999-2000 by Martin Mares m...@ucw.cz. @@ -20,12 +20,12 @@ * modified by SRC, incorporated herein by reference. * * ** - * + * * The change log is now in a file called ChangeLog in this directory. * * Sources: * - Crynwr arcnet.com/arcether.com packet drivers. - * - arcnet.c v0.00 dated 1/1/94 and apparently by + * - arcnet.c v0.00 dated 1/1/94 and apparently by * Donald Becker - it didn't work :) * - skeleton.c v0.05 dated 11/16/93 by Donald Becker * (from Linux Kernel 1.1.45) @@ -168,7 +168,6 @@ void arcnet_dump_skb(struct net_device *dev, EXPORT_SYMBOL(arcnet_dump_skb); #endif - /* * Dump the contents of an ARCnet buffer */ @@ -184,11 +183,11 @@ static void arcnet_dump_packet(struct net_device *dev, int bufnum, /* hw.copy_from_card expects IRQ context so take the IRQ lock to keep it single threaded */ - if(take_arcnet_lock) + if (take_arcnet_lock) spin_lock_irqsave(lp-lock, flags); lp-hw.copy_from_card(dev, bufnum, 0, buf, 512); - if(take_arcnet_lock) + if (take_arcnet_lock) spin_unlock_irqrestore(lp-lock, flags); /* if the offset[0] byte is nonzero, this is a 256-byte packet */ @@ -229,11 +228,10 @@ void arcnet_unregister_proto(struct ArcProto *proto) } } - /* * Add a buffer to the queue. Only the interrupt handler is allowed to do * this, unless interrupts are disabled. - * + * * Note: we don't check for a full queue, since there aren't enough buffers * to more than fill it. */ @@ -248,13 +246,12 @@ static void release_arcbuf(struct net_device *dev, int bufnum) BUGLVL(D_DURING) { BUGMSG(D_DURING, release_arcbuf: freed #%d; buffer queue is now: , bufnum); - for (i = lp-next_buf; i != lp-first_free_buf; i = (i+1) % 5) + for (i = lp-next_buf; i != lp-first_free_buf; i = (i + 1) % 5) BUGMSG2(D_DURING, #%d , lp-buf_queue[i]); BUGMSG2(D_DURING, \n); } } - /* * Get a buffer from the queue. If this returns -1, there are no buffers * available. @@ -284,7 +281,7 @@ static int get_arcbuf(struct net_device *dev) BUGLVL(D_DURING) { BUGMSG(D_DURING, get_arcbuf: got #%d; buffer queue is now: , buf); - for (i = lp-next_buf; i != lp-first_free_buf; i = (i+1) % 5) + for (i = lp-next_buf; i != lp-first_free_buf; i = (i + 1) % 5) BUGMSG2(D_DURING, #%d , lp-buf_queue[i]); BUGMSG2(D_DURING, \n
[PATCH 19/21] ARCNET: com20020: add enable and disable device on open/close
This patch changes the driver to properly work with the linux netif interface. The controller gets enabled on open and disabled on close. Therefor it removes every bogus start of the xceiver. It only gets enabled on com20020_open and disabled on com20020_close. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de --- drivers/net/arcnet/com20020.c | 41 ++--- 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/drivers/net/arcnet/com20020.c b/drivers/net/arcnet/com20020.c index 1dbc748..713eb5d 100644 --- a/drivers/net/arcnet/com20020.c +++ b/drivers/net/arcnet/com20020.c @@ -118,7 +118,7 @@ int com20020_check(struct net_device *dev) outb(STARTIOcmd, ioaddr + _COMMAND); } - lp-config = TXENcfg | (lp-timeout 3) | (lp-backplane 2) | SUB_NODE; + lp-config = (lp-timeout 3) | (lp-backplane 2) | SUB_NODE; /* set node ID to 0x42 (but transmitter is disabled, so it's okay) */ outb(lp-config, ioaddr + _CONFIG); outb(0x42, ioaddr + _XREG); @@ -131,11 +131,6 @@ int com20020_check(struct net_device *dev) } BUGMSG(D_INIT_REASONS, status after reset: %X\n, status); - /* Enable TX */ - lp-config |= TXENcfg; - outb(lp-config, ioaddr + _CONFIG); - outb(inb(ioaddr + 8), ioaddr + _XREG); - outb((CFLAGScmd | RESETclear | CONFIGclear), ioaddr + _COMMAND); status = inb(ioaddr + _STATUS); @@ -169,9 +164,33 @@ static int com20020_set_hwaddr(struct net_device *dev, void *addr) return 0; } +int com20020_netdev_open(struct net_device *dev) +{ + int ioaddr = dev-base_addr; + struct arcnet_local *lp = netdev_priv(dev); + + lp-config |= TXENcfg; + outb(lp-config, ioaddr + _CONFIG); + + return arcnet_open(dev); +} + +int com20020_netdev_close(struct net_device *dev) +{ + int ioaddr = dev-base_addr; + struct arcnet_local *lp = netdev_priv(dev); + + arcnet_close(dev); + + /* disable transmitter */ + lp-config = ~TXENcfg; + outb(lp-config, ioaddr + _CONFIG); + return 0; +} + const struct net_device_ops com20020_netdev_ops = { - .ndo_open = arcnet_open, - .ndo_stop = arcnet_close, + .ndo_open = com20020_netdev_open, + .ndo_stop = com20020_netdev_close, .ndo_start_xmit = arcnet_send_packet, .ndo_tx_timeout = arcnet_timeout, .ndo_set_mac_address = com20020_set_hwaddr, @@ -216,8 +235,8 @@ int com20020_found(struct net_device *dev, int shared) outb(STARTIOcmd, ioaddr + _COMMAND); } - lp-config = TXENcfg | (lp-timeout 3) | (lp-backplane 2) | SUB_NODE; - /* Default 0x38 + register: Node ID */ + lp-config = (lp-timeout 3) | (lp-backplane 2) | SUB_NODE; + /* Default 0x18 + register: Node ID */ outb(lp-config, ioaddr + _CONFIG); outb(dev-dev_addr[0], ioaddr + _XREG); @@ -270,7 +289,7 @@ static int com20020_reset(struct net_device *dev, int really_reset) dev-name, inb(ioaddr + _STATUS)); BUGMSG(D_DEBUG, %s: %d: %s\n,__FILE__,__LINE__,__func__); - lp-config = TXENcfg | (lp-timeout 3) | (lp-backplane 2); + lp-config |= (lp-timeout 3) | (lp-backplane 2); /* power-up defaults */ outb(lp-config, ioaddr + _CONFIG); BUGMSG(D_DEBUG, %s: %d: %s\n,__FILE__,__LINE__,__func__); -- 2.1.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 10/21] ARCNET: com20020: fix ioaddr prefixes
This patch removes the use of the variable ioaddr in the macros and uses it directly in the calling functions. This improves the readability of the code and changes the macros to be used as offsets. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de --- drivers/net/arcnet/com20020-isa.c | 2 +- drivers/net/arcnet/com20020.c | 89 --- drivers/net/arcnet/com20020_cs.c | 6 +-- include/linux/com20020.h | 20 - 4 files changed, 59 insertions(+), 58 deletions(-) diff --git a/drivers/net/arcnet/com20020-isa.c b/drivers/net/arcnet/com20020-isa.c index c674511..3e5be24 100644 --- a/drivers/net/arcnet/com20020-isa.c +++ b/drivers/net/arcnet/com20020-isa.c @@ -68,7 +68,7 @@ static int __init com20020isa_probe(struct net_device *dev) ioaddr, ioaddr + ARCNET_TOTAL_SIZE - 1); return -ENXIO; } - if (inb(_STATUS) == 0xFF) { + if (inb(ioaddr + _STATUS) == 0xFF) { BUGMSG(D_NORMAL, IO address %x empty\n, ioaddr); err = -ENODEV; goto out; diff --git a/drivers/net/arcnet/com20020.c b/drivers/net/arcnet/com20020.c index ed0cdd3..4b4bb96 100644 --- a/drivers/net/arcnet/com20020.c +++ b/drivers/net/arcnet/com20020.c @@ -63,11 +63,11 @@ static void com20020_copy_from_card(struct net_device *dev, int bufnum, int ioaddr = dev-base_addr, ofs = 512 * bufnum + offset; /* set up the address register */ - outb((ofs 8) | RDDATAflag | AUTOINCflag, _ADDR_HI); - outb(ofs 0xff, _ADDR_LO); + outb((ofs 8) | RDDATAflag | AUTOINCflag, ioaddr + _ADDR_HI); + outb(ofs 0xff, ioaddr + _ADDR_LO); /* copy the data */ - TIME(insb, count, insb(_MEMDATA, buf, count)); + TIME(insb, count, insb(ioaddr + _MEMDATA, buf, count)); } @@ -77,11 +77,11 @@ static void com20020_copy_to_card(struct net_device *dev, int bufnum, int ioaddr = dev-base_addr, ofs = 512 * bufnum + offset; /* set up the address register */ - outb((ofs 8) | AUTOINCflag, _ADDR_HI); - outb(ofs 0xff, _ADDR_LO); + outb((ofs 8) | AUTOINCflag, ioaddr + _ADDR_HI); + outb(ofs 0xff, ioaddr + _ADDR_LO); /* copy the data */ - TIME(outsb, count, outsb(_MEMDATA, buf, count)); + TIME(outsb, count, outsb(ioaddr + _MEMDATA, buf, count)); } @@ -92,9 +92,9 @@ int com20020_check(struct net_device *dev) struct arcnet_local *lp = netdev_priv(dev); /* reset the card */ - outb(0x18 | 0x80, _CONFIG); + outb(0x18 | 0x80, ioaddr + _CONFIG); udelay(5); - outb(0x18, _CONFIG); + outb(0x18, ioaddr + _CONFIG); mdelay(RESETtime); lp-setup = lp-clockm ? 0 : (lp-clockp 1); @@ -105,25 +105,25 @@ int com20020_check(struct net_device *dev) lp-setup = lp-setup | P1MODE; lp-config = (lp-config ~0x03) | SUB_SETUP1; - outb(lp-config, _CONFIG); - outb(lp-setup, _XREG); + outb(lp-config, ioaddr + _CONFIG); + outb(lp-setup, ioaddr + _XREG); if (lp-clockm != 0) { - outb(SUB_SETUP2, _SUBADR); - outb(lp-setup2, _XREG); + outb(SUB_SETUP2, ioaddr + _SUBADR); + outb(lp-setup2, ioaddr + _XREG); /* must now write the magic restart operation command */ mdelay(1); - outb(0x18, _COMMAND); + outb(0x18, ioaddr + _COMMAND); } lp-config = 0x21 | (lp-timeout 3) | (lp-backplane 2); /* set node ID to 0x42 (but transmitter is disabled, so it's okay) */ - outb(lp-config, _CONFIG); + outb(lp-config, ioaddr + _CONFIG); outb(0x42, ioaddr + BUS_ALIGN*7); - status = inb(_STATUS); + status = inb(ioaddr + _STATUS); if ((status 0x99) != (NORXflag | TXFREEflag | RESETflag)) { BUGMSG(D_NORMAL, status invalid (%Xh).\n, status); @@ -132,20 +132,21 @@ int com20020_check(struct net_device *dev) BUGMSG(D_INIT_REASONS, status after reset: %X\n, status); /* Enable TX */ - outb(0x39, _CONFIG); + outb(0x39, ioaddr + _CONFIG); outb(inb(ioaddr + BUS_ALIGN*8), ioaddr + BUS_ALIGN*7); - outb((CFLAGScmd | RESETclear | CONFIGclear), _COMMAND); + outb((CFLAGScmd | RESETclear | CONFIGclear), ioaddr + _COMMAND); - status = inb(_STATUS); + status = inb(ioaddr + _STATUS); BUGMSG(D_INIT_REASONS, status after reset acknowledged: %X\n, status); /* Read first location of memory */ - outb(0 | RDDATAflag | AUTOINCflag, _ADDR_HI); - outb(0, _ADDR_LO); + outb(0 | RDDATAflag | AUTOINCflag, ioaddr + _ADDR_HI); + outb(0, ioaddr + _ADDR_LO); - if ((status = inb(_MEMDATA)) != TESTvalue) { + status = inb(ioaddr + _MEMDATA); + if (status != TESTvalue) { BUGMSG(D_NORMAL, Signature byte
[PATCH 15/21] ARCNET: capmode: remove extra function and use C99 in struct
This patch cleans the capmode protocol module. It removes the obsolete function arcnet_cap_init and uses the C99 struct definition. It also replaces printk with pr_info. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de --- drivers/net/arcnet/capmode.c | 28 +++- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/drivers/net/arcnet/capmode.c b/drivers/net/arcnet/capmode.c index b6868a2..91ec9fa 100644 --- a/drivers/net/arcnet/capmode.c +++ b/drivers/net/arcnet/capmode.c @@ -229,22 +229,22 @@ free_outskb: return 0; } -static struct ArcProto capmode_proto = -{ - 'r', - XMTU, - 0, - rx, - build_header, - prepare_tx, - NULL, - ack_tx +static struct ArcProto capmode_proto = { + .suffix = 'r', + .mtu= XMTU, + .rx = rx, + .build_header = build_header, + .prepare_tx = prepare_tx, + .continue_tx= NULL, + .ack_tx = ack_tx }; -static void arcnet_cap_init(void) +static int __init capmode_module_init(void) { int count; + pr_info(VERSION); + for (count = 1; count = 8; count++) if (arc_proto_map[count] == arc_proto_default) arc_proto_map[count] = capmode_proto; @@ -255,12 +255,6 @@ static void arcnet_cap_init(void) arc_proto_default = capmode_proto; arc_raw_proto = capmode_proto; -} - -static int __init capmode_module_init(void) -{ - printk(VERSION); - arcnet_cap_init(); return 0; } -- 2.1.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 01/21] com20020-pci: add dev_port for udev handling
This patch sets the dev_port according to the index of the card. This can be used by udev to name the ports in userspace. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de --- drivers/net/arcnet/com20020-pci.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/arcnet/com20020-pci.c b/drivers/net/arcnet/com20020-pci.c index 96edc13..9fa4eee 100644 --- a/drivers/net/arcnet/com20020-pci.c +++ b/drivers/net/arcnet/com20020-pci.c @@ -96,6 +96,7 @@ static int com20020pci_probe(struct pci_dev *pdev, const struct pci_device_id *i ret = -ENOMEM; goto out_port; } + dev-dev_port = i; dev-netdev_ops = com20020_netdev_ops; -- 2.1.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 02/21] ARCNET: fix hard_header_len limit
The commit 9c7077622dd9 (packet: make packet_snd fail on len smaller than l2 header) adds the check for minimum packet length of the used l2. For arcnet the hardware header length is not the complete archdr which includes hard + soft header. This patch changes the length to sizeof(arc_hardware). Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de --- drivers/net/arcnet/arcnet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/arcnet/arcnet.c b/drivers/net/arcnet/arcnet.c index 10f71c73..816d0e9 100644 --- a/drivers/net/arcnet/arcnet.c +++ b/drivers/net/arcnet/arcnet.c @@ -326,7 +326,7 @@ static void arcdev_setup(struct net_device *dev) dev-type = ARPHRD_ARCNET; dev-netdev_ops = arcnet_netdev_ops; dev-header_ops = arcnet_header_ops; - dev-hard_header_len = sizeof(struct archdr); + dev-hard_header_len = sizeof(struct arc_hardware); dev-mtu = choose_mtu(); dev-addr_len = ARCNET_ALEN; -- 2.1.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 11/21] ARCNET: rimi: fix ioaddr prefixes
This patch removes the use of the variable ioaddr in the macros and uses it directly in the calling functions. This improves the readability of the code and changes the macros to be used as offsets. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de --- drivers/net/arcnet/arc-rimi.c | 30 +++--- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/net/arcnet/arc-rimi.c b/drivers/net/arcnet/arc-rimi.c index c920b86..6e28a51 100644 --- a/drivers/net/arcnet/arc-rimi.c +++ b/drivers/net/arcnet/arc-rimi.c @@ -60,14 +60,14 @@ static void arcrimi_copy_from_card(struct net_device *dev, int bufnum, int offse #define MIRROR_SIZE (BUFFER_SIZE*4) /* COM 9026 controller chip -- ARCnet register addresses */ -#define _INTMASK (ioaddr+0)/* writable */ -#define _STATUS (ioaddr+0)/* readable */ -#define _COMMAND (ioaddr+1)/* writable, returns random vals on read (?) */ -#define _RESET (ioaddr+8) /* software reset (on read) */ -#define _MEMDATA (ioaddr+12) /* Data port for IO-mapped memory */ -#define _ADDR_HI (ioaddr+15) /* Control registers for said */ -#define _ADDR_LO (ioaddr+14) -#define _CONFIG (ioaddr+2)/* Configuration register */ +#define _INTMASK 0 /* writable */ +#define _STATUS0 /* readable */ +#define _COMMAND 1 /* writable, returns random vals on read (?) */ +#define _RESET 8 /* software reset (on read) */ +#define _MEMDATA 12 /* Data port for IO-mapped memory */ +#define _ADDR_HI 15 /* Control registers for said */ +#define _ADDR_LO 14 +#define _CONFIG2 /* Configuration register */ /* * We cannot probe for a RIM I card; one reason is I don't know how to reset @@ -253,17 +253,17 @@ static int arcrimi_reset(struct net_device *dev, int really_reset) struct arcnet_local *lp = netdev_priv(dev); void __iomem *ioaddr = lp-mem_start + 0x800; - BUGMSG(D_INIT, Resetting %s (status=%02Xh)\n, dev-name, readb(_STATUS)); + BUGMSG(D_INIT, Resetting %s (status=%02Xh)\n, dev-name, readb(ioaddr + _STATUS)); if (really_reset) { writeb(TESTvalue, ioaddr - 0x800); /* fake reset */ return 0; } - writeb(CFLAGScmd | RESETclear, _COMMAND); /* clear flags end reset */ - writeb(CFLAGScmd | CONFIGclear, _COMMAND); + writeb(CFLAGScmd | RESETclear, ioaddr + _COMMAND); /* clear flags end reset */ + writeb(CFLAGScmd | CONFIGclear, ioaddr + _COMMAND); /* enable extended (512-byte) packets */ - writeb(CONFIGcmd | EXTconf, _COMMAND); + writeb(CONFIGcmd | EXTconf, ioaddr + _COMMAND); /* done! return success. */ return 0; @@ -274,7 +274,7 @@ static void arcrimi_setmask(struct net_device *dev, int mask) struct arcnet_local *lp = netdev_priv(dev); void __iomem *ioaddr = lp-mem_start + 0x800; - writeb(mask, _INTMASK); + writeb(mask, ioaddr + _INTMASK); } static int arcrimi_status(struct net_device *dev) @@ -282,7 +282,7 @@ static int arcrimi_status(struct net_device *dev) struct arcnet_local *lp = netdev_priv(dev); void __iomem *ioaddr = lp-mem_start + 0x800; - return readb(_STATUS); + return readb(ioaddr + _STATUS); } static void arcrimi_command(struct net_device *dev, int cmd) @@ -290,7 +290,7 @@ static void arcrimi_command(struct net_device *dev, int cmd) struct arcnet_local *lp = netdev_priv(dev); void __iomem *ioaddr = lp-mem_start + 0x800; - writeb(cmd, _COMMAND); + writeb(cmd, ioaddr + _COMMAND); } static void arcrimi_copy_to_card(struct net_device *dev, int bufnum, int offset, -- 2.1.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 07/21] ARCNET: rimi: remove unneeded macros
The simple macros ARCRESET, ACOMMAND, ASTATUS, AINTMASK are unnecessary indirections to the use of registers. This patch removes them and improves the readability of the code. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de --- drivers/net/arcnet/arc-rimi.c | 24 +++- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/drivers/net/arcnet/arc-rimi.c b/drivers/net/arcnet/arc-rimi.c index 4c95d3c..c920b86 100644 --- a/drivers/net/arcnet/arc-rimi.c +++ b/drivers/net/arcnet/arc-rimi.c @@ -69,16 +69,6 @@ static void arcrimi_copy_from_card(struct net_device *dev, int bufnum, int offse #define _ADDR_LO (ioaddr+14) #define _CONFIG (ioaddr+2)/* Configuration register */ -#undef ASTATUS -#undef ACOMMAND -#undef AINTMASK - -#define ASTATUS() readb(_STATUS) -#define ACOMMAND(cmd) writeb((cmd),_COMMAND) -#define AINTMASK(msk) writeb((msk),_INTMASK) -#define SETCONF() writeb(lp-config,_CONFIG) - - /* * We cannot probe for a RIM I card; one reason is I don't know how to reset * them. In fact, we can't even get their node ID automatically. So, we @@ -263,17 +253,17 @@ static int arcrimi_reset(struct net_device *dev, int really_reset) struct arcnet_local *lp = netdev_priv(dev); void __iomem *ioaddr = lp-mem_start + 0x800; - BUGMSG(D_INIT, Resetting %s (status=%02Xh)\n, dev-name, ASTATUS()); + BUGMSG(D_INIT, Resetting %s (status=%02Xh)\n, dev-name, readb(_STATUS)); if (really_reset) { writeb(TESTvalue, ioaddr - 0x800); /* fake reset */ return 0; } - ACOMMAND(CFLAGScmd | RESETclear); /* clear flags end reset */ - ACOMMAND(CFLAGScmd | CONFIGclear); + writeb(CFLAGScmd | RESETclear, _COMMAND); /* clear flags end reset */ + writeb(CFLAGScmd | CONFIGclear, _COMMAND); /* enable extended (512-byte) packets */ - ACOMMAND(CONFIGcmd | EXTconf); + writeb(CONFIGcmd | EXTconf, _COMMAND); /* done! return success. */ return 0; @@ -284,7 +274,7 @@ static void arcrimi_setmask(struct net_device *dev, int mask) struct arcnet_local *lp = netdev_priv(dev); void __iomem *ioaddr = lp-mem_start + 0x800; - AINTMASK(mask); + writeb(mask, _INTMASK); } static int arcrimi_status(struct net_device *dev) @@ -292,7 +282,7 @@ static int arcrimi_status(struct net_device *dev) struct arcnet_local *lp = netdev_priv(dev); void __iomem *ioaddr = lp-mem_start + 0x800; - return ASTATUS(); + return readb(_STATUS); } static void arcrimi_command(struct net_device *dev, int cmd) @@ -300,7 +290,7 @@ static void arcrimi_command(struct net_device *dev, int cmd) struct arcnet_local *lp = netdev_priv(dev); void __iomem *ioaddr = lp-mem_start + 0x800; - ACOMMAND(cmd); + writeb(cmd, _COMMAND); } static void arcrimi_copy_to_card(struct net_device *dev, int bufnum, int offset, -- 2.1.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 12/21] ARCNET: com90io: fix ioaddr prefixes
This patch removes the use of the variable ioaddr in the macros and uses it directly in the calling functions. This improves the readability of the code and changes the macros to be used as offsets. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de --- drivers/net/arcnet/com90io.c | 86 ++-- 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/drivers/net/arcnet/com90io.c b/drivers/net/arcnet/com90io.c index 6bc6366..df7314d 100644 --- a/drivers/net/arcnet/com90io.c +++ b/drivers/net/arcnet/com90io.c @@ -60,14 +60,14 @@ static void com90io_copy_from_card(struct net_device *dev, int bufnum, int offse #define ARCNET_TOTAL_SIZE 16 /* COM 9026 controller chip -- ARCnet register addresses */ -#define _INTMASK (ioaddr+0)/* writable */ -#define _STATUS (ioaddr+0)/* readable */ -#define _COMMAND (ioaddr+1)/* writable, returns random vals on read (?) */ -#define _RESET (ioaddr+8) /* software reset (on read) */ -#define _MEMDATA (ioaddr+12) /* Data port for IO-mapped memory */ -#define _ADDR_HI (ioaddr+15) /* Control registers for said */ -#define _ADDR_LO (ioaddr+14) -#define _CONFIG (ioaddr+2)/* Configuration register */ +#define _INTMASK 0 /* writable */ +#define _STATUS0 /* readable */ +#define _COMMAND 1 /* writable, returns random vals on read (?) */ +#define _RESET 8 /* software reset (on read) */ +#define _MEMDATA 12 /* Data port for IO-mapped memory */ +#define _ADDR_HI 15 /* Control registers for said */ +#define _ADDR_LO 14 +#define _CONFIG2 /* Configuration register */ / * * @@ -82,10 +82,10 @@ static u_char get_buffer_byte(struct net_device *dev, unsigned offset) { int ioaddr = dev-base_addr; - outb(offset 8, _ADDR_HI); - outb(offset 0xff, _ADDR_LO); + outb(offset 8, ioaddr + _ADDR_HI); + outb(offset 0xff, ioaddr + _ADDR_LO); - return inb(_MEMDATA); + return inb(ioaddr + _MEMDATA); } #ifdef ONE_AT_A_TIME_TX @@ -93,10 +93,10 @@ static void put_buffer_byte(struct net_device *dev, unsigned offset, u_char datu { int ioaddr = dev-base_addr; - outb(offset 8, _ADDR_HI); - outb(offset 0xff, _ADDR_LO); + outb(offset 8, ioaddr + _ADDR_HI); + outb(offset 0xff, ioaddr + _ADDR_LO); - outb(datum, _MEMDATA); + outb(datum, ioaddr + _MEMDATA); } #endif @@ -106,14 +106,14 @@ static void get_whole_buffer(struct net_device *dev, unsigned offset, unsigned l { int ioaddr = dev-base_addr; - outb((offset 8) | AUTOINCflag, _ADDR_HI); - outb(offset 0xff, _ADDR_LO); + outb((offset 8) | AUTOINCflag, ioaddr + _ADDR_HI); + outb(offset 0xff, ioaddr + _ADDR_LO); while (length--) #ifdef ONE_AT_A_TIME_RX *(dest++) = get_buffer_byte(dev, offset++); #else - *(dest++) = inb(_MEMDATA); + *(dest++) = inb(ioaddr + _MEMDATA); #endif } @@ -121,14 +121,14 @@ static void put_whole_buffer(struct net_device *dev, unsigned offset, unsigned l { int ioaddr = dev-base_addr; - outb((offset 8) | AUTOINCflag, _ADDR_HI); - outb(offset 0xff, _ADDR_LO); + outb((offset 8) | AUTOINCflag, ioaddr + _ADDR_HI); + outb(offset 0xff, ioaddr + _ADDR_LO); while (length--) #ifdef ONE_AT_A_TIME_TX put_buffer_byte(dev, offset++, *(dest++)); #else - outb(*(dest++), _MEMDATA); + outb(*(dest++), ioaddr + _MEMDATA); #endif } @@ -154,14 +154,14 @@ static int __init com90io_probe(struct net_device *dev) ioaddr, ioaddr + ARCNET_TOTAL_SIZE - 1); return -ENXIO; } - if (inb(_STATUS) == 0xFF) { + if (inb(ioaddr + _STATUS) == 0xFF) { BUGMSG(D_INIT_REASONS, IO address %x empty\n, ioaddr); goto err_out; } - inb(_RESET); + inb(ioaddr + _RESET); mdelay(RESETtime); - status = inb(_STATUS); + status = inb(ioaddr + _STATUS); if ((status 0x9D) != (NORXflag | RECONflag | TXFREEflag | RESETflag)) { BUGMSG(D_INIT_REASONS, Status invalid (%Xh).\n, status); @@ -169,24 +169,24 @@ static int __init com90io_probe(struct net_device *dev) } BUGMSG(D_INIT_REASONS, Status after reset: %X\n, status); - outb(CFLAGScmd | RESETclear | CONFIGclear, _COMMAND); + outb(CFLAGScmd | RESETclear | CONFIGclear, ioaddr + _COMMAND); BUGMSG(D_INIT_REASONS, Status after reset acknowledged: %X\n, status); - status = inb(_STATUS); + status = inb(ioaddr + _STATUS); if (status RESETflag) { BUGMSG(D_INIT_REASONS, Eternal
[PATCH 20/21] ARCNET: com20020-pci: reformat structs to C99 format
This patch changes the macro definitions to match the C99 formating. This improves the readability. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de --- drivers/net/arcnet/com20020-pci.c | 35 +-- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/drivers/net/arcnet/com20020-pci.c b/drivers/net/arcnet/com20020-pci.c index 18c0b1f..de8c894 100644 --- a/drivers/net/arcnet/com20020-pci.c +++ b/drivers/net/arcnet/com20020-pci.c @@ -191,7 +191,11 @@ static struct com20020_pci_card_info card_info_10mbit = { .name = ARC-PCI, .devcount = 1, .chan_map_tbl = { - { 2, 0x00, 0x08 }, + { + .bar = 2, + .offset = 0x00, + .size = 0x08, + }, }, .flags = ARC_CAN_10MBIT, }; @@ -200,7 +204,11 @@ static struct com20020_pci_card_info card_info_5mbit = { .name = ARC-PCI, .devcount = 1, .chan_map_tbl = { - { 2, 0x00, 0x08 }, + { + .bar = 2, + .offset = 0x00, + .size = 0x08, + }, }, .flags = ARC_IS_5MBIT, }; @@ -210,7 +218,11 @@ static struct com20020_pci_card_info card_info_sohard = { .devcount = 1, /* SOHARD needs PCI base addr 4 */ .chan_map_tbl = { - {4, 0x00, 0x08}, + { + .bar = 4, + .offset = 0x00, + .size = 0x08 + }, }, .flags = ARC_CAN_10MBIT, }; @@ -219,7 +231,11 @@ static struct com20020_pci_card_info card_info_eae_arc1 = { .name = EAE PLX-PCI ARC1, .devcount = 1, .chan_map_tbl = { - { 2, 0x00, 0x08 }, + { + .bar = 2, + .offset = 0x00, + .size = 0x08, + }, }, .flags = ARC_CAN_10MBIT, }; @@ -228,8 +244,15 @@ static struct com20020_pci_card_info card_info_eae_ma1 = { .name = EAE PLX-PCI MA1, .devcount = 2, .chan_map_tbl = { - { 2, 0x00, 0x08 }, - { 2, 0x08, 0x08 } + { + .bar = 2, + .offset = 0x00, + .size = 0x08, + }, { + .bar = 2, + .offset = 0x08, + .size = 0x08, + } }, .flags = ARC_CAN_10MBIT, }; -- 2.1.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 13/21] ARCNET: com90xx: fix ioaddr prefixes
This patch removes the use of the variable ioaddr in the macros and uses it directly in the calling functions. This improves the readability of the code and changes the macros to be used as offsets. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de --- drivers/net/arcnet/com90xx.c | 52 ++-- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/drivers/net/arcnet/com90xx.c b/drivers/net/arcnet/com90xx.c index 2b99a04..d8a9fe5 100644 --- a/drivers/net/arcnet/com90xx.c +++ b/drivers/net/arcnet/com90xx.c @@ -80,14 +80,14 @@ static int numcards; #define MIRROR_SIZE (BUFFER_SIZE*4) /* COM 9026 controller chip -- ARCnet register addresses */ -#define _INTMASK (ioaddr+0)/* writable */ -#define _STATUS (ioaddr+0)/* readable */ -#define _COMMAND (ioaddr+1)/* writable, returns random vals on read (?) */ -#define _CONFIG (ioaddr+2)/* Configuration register */ -#define _RESET (ioaddr+8)/* software reset (on read) */ -#define _MEMDATA (ioaddr+12) /* Data port for IO-mapped memory */ -#define _ADDR_HI (ioaddr+15) /* Control registers for said */ -#define _ADDR_LO (ioaddr+14) +#define _INTMASK 0 /* writable */ +#define _STATUS0 /* readable */ +#define _COMMAND 1 /* writable, returns random vals on read (?) */ +#define _CONFIG2 /* Configuration register */ +#define _RESET 8 /* software reset (on read) */ +#define _MEMDATA 12 /* Data port for IO-mapped memory */ +#define _ADDR_HI 15 /* Control registers for said */ +#define _ADDR_LO 14 static int com90xx_skip_probe __initdata = 0; @@ -166,7 +166,7 @@ static void __init com90xx_probe(void) *port-- = ports[--numports]; continue; } - if (inb(_STATUS) == 0xFF) { + if (inb(ioaddr + _STATUS) == 0xFF) { BUGMSG2(D_INIT_REASONS, (empty)\n); BUGMSG2(D_INIT_REASONS, S1: ); BUGLVL(D_INIT_REASONS) numprint = 0; @@ -174,7 +174,7 @@ static void __init com90xx_probe(void) *port-- = ports[--numports]; continue; } - inb(_RESET);/* begin resetting card */ + inb(ioaddr + _RESET); /* begin resetting card */ BUGMSG2(D_INIT_REASONS, \n); BUGMSG2(D_INIT_REASONS, S1: ); @@ -308,7 +308,7 @@ static void __init com90xx_probe(void) BUGMSG2(D_INIT, %Xh , *port); ioaddr = *port; - status = inb(_STATUS); + status = inb(ioaddr + _STATUS); if ((status 0x9D) != (NORXflag | RECONflag | TXFREEflag | RESETflag)) { @@ -319,8 +319,8 @@ static void __init com90xx_probe(void) *port-- = ports[--numports]; continue; } - outb(CFLAGScmd | RESETclear | CONFIGclear, _COMMAND); - status = inb(_STATUS); + outb(CFLAGScmd | RESETclear | CONFIGclear, ioaddr + _COMMAND); + status = inb(ioaddr + _STATUS); if (status RESETflag) { BUGMSG2(D_INIT_REASONS, (eternal reset, status=%Xh)\n, status); @@ -339,9 +339,9 @@ static void __init com90xx_probe(void) * we tell it to start receiving. */ airqmask = probe_irq_on(); - outb(NORXflag, _INTMASK); + outb(NORXflag, ioaddr + _INTMASK); udelay(1); - outb(0, _INTMASK); + outb(0, ioaddr + _INTMASK); airq = probe_irq_off(airqmask); if (airq = 0) { @@ -367,14 +367,14 @@ static void __init com90xx_probe(void) */ #ifdef FAST_PROBE if (numports 1 || numshmems 1) { - inb(_RESET); + inb(ioaddr + _RESET); mdelay(RESETtime); } else { /* just one shmem and port, assume they match */ writeb(TESTvalue, iomem[0]); } #else - inb(_RESET); + inb(ioaddr + _RESET); mdelay(RESETtime); #endif @@ -548,7 +548,7 @@ static void com90xx_command(struct net_device *dev, int cmd) { short ioaddr = dev-base_addr; - outb(cmd, _COMMAND); + outb(cmd, ioaddr + _COMMAND); } @@ -556,7 +556,7 @@ static int com90xx_status(struct net_device *dev) { short ioaddr = dev-base_addr; - return inb(_STATUS); + return inb(ioaddr + _STATUS); } @@ -564,7 +564,7 @@ static void com90xx_setmask(struct net_device *dev, int mask
[PATCH 18/21] ARCNET: com20020: remove obsolete BUS_ALIGN offset factor
This patch removes the obsolete macro BUS_ALIGN as the kernel option CONFIG_SA1100_CT6001 is not longer available. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de --- drivers/net/arcnet/com20020.c | 4 ++-- include/linux/com20020.h | 27 ++- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/drivers/net/arcnet/com20020.c b/drivers/net/arcnet/com20020.c index 27ad484..1dbc748 100644 --- a/drivers/net/arcnet/com20020.c +++ b/drivers/net/arcnet/com20020.c @@ -134,7 +134,7 @@ int com20020_check(struct net_device *dev) /* Enable TX */ lp-config |= TXENcfg; outb(lp-config, ioaddr + _CONFIG); - outb(inb(ioaddr + BUS_ALIGN * 8), ioaddr + _XREG); + outb(inb(ioaddr + 8), ioaddr + _XREG); outb((CFLAGScmd | RESETclear | CONFIGclear), ioaddr + _COMMAND); @@ -200,7 +200,7 @@ int com20020_found(struct net_device *dev, int shared) lp-hw.close = com20020_close; if (!dev-dev_addr[0]) - dev-dev_addr[0] = inb(ioaddr + BUS_ALIGN*8); /* FIXME: do this some other way! */ + dev-dev_addr[0] = inb(ioaddr + 8); /* FIXME: do this some other way! */ lp-config = (lp-config ~0x03) | SUB_SETUP1; outb(lp-config, ioaddr + _CONFIG); diff --git a/include/linux/com20020.h b/include/linux/com20020.h index f194b74..939d69d 100644 --- a/include/linux/com20020.h +++ b/include/linux/com20020.h @@ -34,13 +34,6 @@ extern const struct net_device_ops com20020_netdev_ops; /* The number of low I/O ports used by the card. */ #define ARCNET_TOTAL_SIZE 8 -/* various register addresses */ -#ifdef CONFIG_SA1100_CT6001 -#define BUS_ALIGN 2 /* 8 bit device on a 16 bit bus - needs padding */ -#else -#define BUS_ALIGN 1 -#endif - #define PLX_PCI_MAX_CARDS 2 struct com20020_pci_channel_map { @@ -71,16 +64,16 @@ struct com20020_dev { int index; }; -#define _INTMASK (BUS_ALIGN*0)/* writable */ -#define _STATUS (BUS_ALIGN*0)/* readable */ -#define _COMMAND (BUS_ALIGN*1)/* standard arcnet commands */ -#define _DIAGSTAT (BUS_ALIGN*1)/* diagnostic status register */ -#define _ADDR_HI (BUS_ALIGN*2)/* control registers for IO-mapped memory */ -#define _ADDR_LO (BUS_ALIGN*3) -#define _MEMDATA (BUS_ALIGN*4)/* data port for IO-mapped memory */ -#define _SUBADR (BUS_ALIGN*5)/* the extended port _XREG refers to */ -#define _CONFIG (BUS_ALIGN*6)/* configuration register */ -#define _XREG (BUS_ALIGN*7)/* extra registers (indexed by _CONFIG +#define _INTMASK 0/* writable */ +#define _STATUS 0/* readable */ +#define _COMMAND 1/* standard arcnet commands */ +#define _DIAGSTAT 1/* diagnostic status register */ +#define _ADDR_HI 2/* control registers for IO-mapped memory */ +#define _ADDR_LO 3 +#define _MEMDATA 4/* data port for IO-mapped memory */ +#define _SUBADR 5/* the extended port _XREG refers to */ +#define _CONFIG 6/* configuration register */ +#define _XREG 7/* extra registers (indexed by _CONFIG or _SUBADR) */ /* in the ADDR_HI register */ -- 2.1.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 00/21] ARCNET: Defibrillation
Hi! On Fri, Apr 24, 2015 at 11:58:53PM -0400, David Miller wrote: From: Marc Kleine-Budde m...@pengutronix.de Date: Fri, 24 Apr 2015 23:14:41 +0200 On 04/24/2015 08:47 PM, Joe Perches wrote: On Fri, 2015-04-24 at 19:20 +0200, Michael Grzeschik wrote: Hi! Hello. This patch series tries to reanimate the ARCNET hardware layer to be somehow readable and maintainable again. It includes a lot of cleanup patches. It also adds some fixes which leads the layer to become usable again. And as a special treatment it adds more features like correct loading and unloading of the com20020 card. Wow. Good for you, but why? Does anyone still use these? Yes, there are parts of the industry where old machines are retrofitted with new hardware...and a lot of these machines still talk ARCNET :) But the real issue is, this layer is development wise in the same category as the IDE layer. Any non-trivial change is nothing but pure risk, especially given the low level of test coverage the code gets. Do you count coding style patches as non-trivial or trivial patches? So I really only want to see the most critical obvious bug fixes submitted for this layer and drivers. The cleanup changes I submitted should not change the actual behaviour. Replacing the register access macros with their equivalent outb/inb seems pretty obvious. What is your opinion on those? I see that the ARCNET: whitespace, tab and codingstyle fixes patch is pretty mixed up and not very reliable. But Joe has sent me a nice series for the cleanup. And no I will not accept an argument stating that you have to restructure and clean this code up in order to fix the bugs. That's bogus. OK. I have the following patches in this series which fix bugs found during my development: com20020-pci: add dev_port for udev handling ARCNET: fix hard_header_len limit ARCNET: com20020: add enable and disable device on open/close I would send a new series containing only those patches with more detailed patch descriptions, if that's fine with you? Regards, Michael -- 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- | -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 06/21] ARCNET: com20020: remove unneeded macros
On Fri, Apr 24, 2015 at 04:04:45PM -0700, Joe Perches wrote: On Fri, 2015-04-24 at 19:20 +0200, Michael Grzeschik wrote: The macros SET_SUBADR, ARCRESET, ARCRESET0, ACOMMAND, ASTATUS, AINTMASK and ADIAGSTATUS are unnecessary indirections to the use of registers. This patch removes them and improves the readability of the code. This breaks compilation. Please compile test your patches before sending them. Sorry, but I can not reproduce this break. What was your base you applied this series on? Can you send me the failure you get? Thanks, Michael -- 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- | -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 00/21] ARCNET: Defibrillation
Hi, and sorry for the delay. On Wed, Apr 29, 2015 at 08:49:25PM -0700, Joe Perches wrote: On Mon, 2015-04-27 at 16:57 +0200, Michael Grzeschik wrote: Hi! On Fri, Apr 24, 2015 at 11:58:53PM -0400, David Miller wrote: From: Marc Kleine-Budde m...@pengutronix.de Date: Fri, 24 Apr 2015 23:14:41 +0200 On 04/24/2015 08:47 PM, Joe Perches wrote: On Fri, 2015-04-24 at 19:20 +0200, Michael Grzeschik wrote: Hi! Hello. This patch series tries to reanimate the ARCNET hardware layer to be somehow readable and maintainable again. It includes a lot of cleanup patches. It also adds some fixes which leads the layer to become usable again. And as a special treatment it adds more features like correct loading and unloading of the com20020 card. Wow. Good for you, but why? Does anyone still use these? Yes, there are parts of the industry where old machines are retrofitted with new hardware...and a lot of these machines still talk ARCNET :) But the real issue is, this layer is development wise in the same category as the IDE layer. Any non-trivial change is nothing but pure risk, especially given the low level of test coverage the code gets. Do you count coding style patches as non-trivial or trivial patches? So I really only want to see the most critical obvious bug fixes submitted for this layer and drivers. The cleanup changes I submitted should not change the actual behaviour. Replacing the register access macros with their equivalent outb/inb seems pretty obvious. What is your opinion on those? I see that the ARCNET: whitespace, tab and codingstyle fixes patch is pretty mixed up and not very reliable. But Joe has sent me a nice series for the cleanup. And no I will not accept an argument stating that you have to restructure and clean this code up in order to fix the bugs. That's bogus. OK. I have the following patches in this series which fix bugs found during my development: com20020-pci: add dev_port for udev handling ARCNET: fix hard_header_len limit ARCNET: com20020: add enable and disable device on open/close I would send a new series containing only those patches with more detailed patch descriptions, if that's fine with you? I was away for a few days and while out I did another restructuring of all the inb/outb/readb/writeb code removing all the AFOO macros. It removes all the dependencies on ioaddr and names all the offsets with new defines. I could post if you like. Sure, you should do that! I will rework my patches on top of them. I think it's a lot cleaner and easier to read. OK! I would like to know what David things about the whole work. Thanks, Michael -- 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- | -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] MAINTAINERS: add arcnet and take maintainership
Add entry for arcnet to MAINTAINERS file and add myself as the maintainer of the subsystem. Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de Cc: da...@davemloft.net Cc: j...@perches.com --- As I have a test coverage of com20020 based arcnet systems I would like to take the responsibility of maintaining the subsystem. MAINTAINERS | 6 ++ 1 file changed, 6 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 9289ecb..08f1a41 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -790,6 +790,12 @@ S: Maintained F: drivers/video/fbdev/arcfb.c F: drivers/video/fbdev/core/fb_defio.c +ARCNET NETWORK LAYER +M: Michael Grzeschik m.grzesc...@pengutronix.de +L: net...@vger.kernel.org +S: Maintained +F: drivers/net/arcnet/ + ARM MFM AND FLOPPY DRIVERS M: Ian Molton sp...@f2s.com S: Maintained -- 2.1.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] ARCNET: fix hard_header_len limit
The commit 9c7077622dd9 (packet: make packet_snd fail on len smaller than l2 header) adds the check for minimum packet length of the used l2. For arcnet the hardware header length is not the complete archdr which includes hard + soft header. This patch changes the length to sizeof(arc_hardware). Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de --- drivers/net/arcnet/arcnet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/arcnet/arcnet.c b/drivers/net/arcnet/arcnet.c index 10f71c73..816d0e9 100644 --- a/drivers/net/arcnet/arcnet.c +++ b/drivers/net/arcnet/arcnet.c @@ -326,7 +326,7 @@ static void arcdev_setup(struct net_device *dev) dev-type = ARPHRD_ARCNET; dev-netdev_ops = arcnet_netdev_ops; dev-header_ops = arcnet_header_ops; - dev-hard_header_len = sizeof(struct archdr); + dev-hard_header_len = sizeof(struct arc_hardware); dev-mtu = choose_mtu(); dev-addr_len = ARCNET_ALEN; -- 2.1.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] ARCNET: fix hard_header_len limit
On Thu, Jul 30, 2015 at 11:16:36AM -0700, David Miller wrote: From: Michael Grzeschik m.grzesc...@pengutronix.de Date: Thu, 30 Jul 2015 15:34:36 +0200 The commit 9c7077622dd9 (packet: make packet_snd fail on len smaller than l2 header) adds the check for minimum packet length of the used l2. For arcnet the hardware header length is not the complete archdr which includes hard + soft header. This patch changes the length to sizeof(arc_hardware). Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de The hard header len is used for other purposes as well, are you sure those don't get broken by this change? Its meaning is to represent the amount of the hardware (link layer) data of one packet. Which other purposes do you mean? Can you point to some code? Code assumes that if the data at the SKB mac pointer is taken, for dev-hard_header_len bytes, that is exactly the link layer header. And that this can be used to compare two MAC headers, copy the MAC header from one packet to another, etc. The link layer size of arcnet is 4 bytes long. 1 byte source, 1 byte dest and two offset bytes. As described by struct arc_hardware in if_arcnet.h . The above condition is fulfilled when the mac pointer is 0. The following pending bytes of struct archdr have a variable meaning depending of the used protocol and are represented by an union. (network layer) In the case of raw packets, the payload comes immediately after the hard_header. Thanks, Michael -- 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- | -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] ARCNET: fix hard_header_len limit
On Wed, Aug 05, 2015 at 05:34:51PM +0200, Michael Grzeschik wrote: > On Thu, Jul 30, 2015 at 11:16:36AM -0700, David Miller wrote: > > From: Michael Grzeschik <m.grzesc...@pengutronix.de> > > Date: Thu, 30 Jul 2015 15:34:36 +0200 > > > > > The commit <9c7077622dd9> ("packet: make packet_snd fail on len smaller > > > than l2 header") adds the check for minimum packet length of the used l2. > > > For arcnet the hardware header length is not the complete archdr which > > > includes hard + soft header. This patch changes the length to > > > sizeof(arc_hardware). > > > > > > Signed-off-by: Michael Grzeschik <m.grzesc...@pengutronix.de> > > > > The hard header len is used for other purposes as well, are you sure > > those don't get broken by this change? > > Its meaning is to represent the amount of the hardware (link layer) > data of one packet. > > Which other purposes do you mean? > Can you point to some code? > > > Code assumes that if the data at the SKB mac pointer is taken, for > > dev->hard_header_len bytes, that is exactly the link layer header. > > And that this can be used to compare two MAC headers, copy the > > MAC header from one packet to another, etc. > > The link layer size of arcnet is 4 bytes long. 1 byte source, 1 byte > dest and two offset bytes. As described by struct arc_hardware in > if_arcnet.h . The above condition is fulfilled when the mac pointer > is 0. > > The following pending bytes of struct archdr have a variable meaning > depending of the used protocol and are represented by an union. > (network layer) > > In the case of raw packets, the payload comes immediately after the > hard_header. > Ping! I have the cleanup patches from Joe Perches and several ARCNET patches on top, waiting to be posted on the list. What is your Opinion to my Maintainer Request I send some weeks ago? Michael -- 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- | -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH][RESEND] ARCNET: fix hard_header_len limit
For arcnet the bare minimum header only contains the 4 bytes to specify source, dest and offset (1, 1 and 2 bytes respectively). The corresponding struct is struct arc_hardware. The struct archdr contains additionally a union of possible soft headers. When doing $insertusecasehere packets might well include short (or even no?) soft headers. For this reason only use arc_hardware instead of archdr to determine the hard_header_len for an arcnet device. Signed-off-by: Michael Grzeschik <m.grzesc...@pengutronix.de> --- drivers/net/arcnet/arcnet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/arcnet/arcnet.c b/drivers/net/arcnet/arcnet.c index 10f71c73..816d0e9 100644 --- a/drivers/net/arcnet/arcnet.c +++ b/drivers/net/arcnet/arcnet.c @@ -326,7 +326,7 @@ static void arcdev_setup(struct net_device *dev) dev->type = ARPHRD_ARCNET; dev->netdev_ops = _netdev_ops; dev->header_ops = _header_ops; - dev->hard_header_len = sizeof(struct archdr); + dev->hard_header_len = sizeof(struct arc_hardware); dev->mtu = choose_mtu(); dev->addr_len = ARCNET_ALEN; -- 2.5.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH][RESEND] MAINTAINERS: add arcnet and take maintainership
Add entry for arcnet to MAINTAINERS file and add myself as the maintainer of the subsystem. Signed-off-by: Michael Grzeschik <m.grzesc...@pengutronix.de> Cc: da...@davemloft.net Cc: j...@perches.com --- MAINTAINERS | 7 +++ 1 file changed, 7 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 7ba7ab7..0a015f7 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -808,6 +808,13 @@ S: Maintained F: drivers/video/fbdev/arcfb.c F: drivers/video/fbdev/core/fb_defio.c +ARCNET NETWORK LAYER +M: Michael Grzeschik <m.grzesc...@pengutronix.de> +L: net...@vger.kernel.org +S: Maintained +F: drivers/net/arcnet/ +F: include/uapi/linux/if_arcnet.h + ARM MFM AND FLOPPY DRIVERS M: Ian Molton <sp...@f2s.com> S: Maintained -- 2.5.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v3] can: c_can: add xceiver enable/disable support
This patch adds support to enable and disable the xceiver in case it's switchable by the regulator framework. Signed-off-by: Michael Grzeschik <m.grzesc...@pengutronix.de> --- v1 -> v2: - always returning PTR_ERR in case devm_regulator_get fails - removed inline wrapper functions with checks for xceiver == NULL v2 -> v3: - adding documentation for the devicetree binding (already generic) Documentation/devicetree/bindings/net/can/c_can.txt | 2 ++ drivers/net/can/c_can/c_can.c | 12 drivers/net/can/c_can/c_can.h | 1 + 3 files changed, 15 insertions(+) diff --git a/Documentation/devicetree/bindings/net/can/c_can.txt b/Documentation/devicetree/bindings/net/can/c_can.txt index 5a1d8b0..a36fea2 100644 --- a/Documentation/devicetree/bindings/net/can/c_can.txt +++ b/Documentation/devicetree/bindings/net/can/c_can.txt @@ -18,6 +18,8 @@ Optional properties: RAMINIT register, register offset to the RAMINIT register and the CAN instance number (0 offset). +- xceiver-supply: Regulator that powers the CAN transceiver + Note: "ti,hwmods" field is used to fetch the base address and irq resources from TI, omap hwmod data base during device registration. Future plan is to migrate hwmod data base contents into device tree diff --git a/drivers/net/can/c_can/c_can.c b/drivers/net/can/c_can/c_can.c index f91b094..0723aeb 100644 --- a/drivers/net/can/c_can/c_can.c +++ b/drivers/net/can/c_can/c_can.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include @@ -612,6 +613,10 @@ static int c_can_start(struct net_device *dev) else pinctrl_pm_select_default_state(priv->device); + err = regulator_enable(priv->reg_xceiver); + if (err) + return err; + return 0; } @@ -626,6 +631,9 @@ static void c_can_stop(struct net_device *dev) /* deactivate pins */ pinctrl_pm_select_sleep_state(dev->dev.parent); + + regulator_disable(priv->reg_xceiver); + priv->can.state = CAN_STATE_STOPPED; } @@ -1263,6 +1271,10 @@ int register_c_can_dev(struct net_device *dev) */ pinctrl_pm_select_sleep_state(dev->dev.parent); + priv->reg_xceiver = devm_regulator_get(priv->device, "xceiver"); + if (IS_ERR(priv->reg_xceiver)) + return PTR_ERR(priv->reg_xceiver); + c_can_pm_runtime_enable(priv); dev->flags |= IFF_ECHO; /* we support local echo */ diff --git a/drivers/net/can/c_can/c_can.h b/drivers/net/can/c_can/c_can.h index 8acdc7f..59246e3 100644 --- a/drivers/net/can/c_can/c_can.h +++ b/drivers/net/can/c_can/c_can.h @@ -213,6 +213,7 @@ struct c_can_priv { u32 comm_rcv_high; u32 rxmasked; u32 dlc[C_CAN_MSG_OBJ_TX_NUM]; + struct regulator *reg_xceiver; }; struct net_device *alloc_c_can_dev(void); -- 2.7.0.rc3
Re: [PATCH v2] can: c_can: add xceiver enable/disable support
Hi, On Wed, Jan 20, 2016 at 05:19:18PM +0100, Bjørn Mork wrote: > Michael Grzeschik <m.grzesc...@pengutronix.de> writes: > > > @@ -1263,6 +1271,10 @@ int register_c_can_dev(struct net_device *dev) > > */ > > pinctrl_pm_select_sleep_state(dev->dev.parent); > > > > + priv->reg_xceiver = devm_regulator_get(priv->device, "xceiver"); > > + if (IS_ERR(priv->reg_xceiver)) > > + return PTR_ERR(priv->reg_xceiver); > > + > > c_can_pm_runtime_enable(priv); > > > > dev->flags |= IFF_ECHO; /* we support local echo */ > > Do you really want to leave priv->reg_xceiver pointing to an ERR_PTR in > case of error? No, therefore the priv->reg_xceiver will be returned in case of error. This codepath is called once on device registration. Michael -- 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- |
Re: [PATCH 2/5] arcnet: com90xx: add __init attribute
On Mon, Apr 18, 2016 at 04:55:35PM +0200, Julia Lawall wrote: > Add __init attribute on a function that is only called from other __init > functions and that is not inlined, at least with gcc version 4.8.4 on an > x86 machine with allyesconfig. Currently, the function is put in the > .text.unlikely segment. Declaring it as __init will cause it to be put in > the .init.text and to disappear after initialization. > > The result of objdump -x on the function before the change is as follows: > > l F .text.unlikely 00bf check_mirror > > And after the change it is as follows: > > l F .init.text 00ba check_mirror > > Done with the help of Coccinelle. The semantic patch checks for local > static non-init functions that are called from an __init function and are > not called from any other function. > > Signed-off-by: Julia Lawall <julia.law...@lip6.fr> > Acked-by: Michael Grzeschik <m...@pengutronix.de> > --- > drivers/net/arcnet/com90xx.c |2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/net/arcnet/com90xx.c b/drivers/net/arcnet/com90xx.c > index 0d9b45f..81f90c4 100644 > --- a/drivers/net/arcnet/com90xx.c > +++ b/drivers/net/arcnet/com90xx.c > @@ -433,7 +433,7 @@ static void __init com90xx_probe(void) > kfree(iomem); > } > > -static int check_mirror(unsigned long addr, size_t size) > +static int __init check_mirror(unsigned long addr, size_t size) > { > void __iomem *p; > int res = -1; > > -- 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- |
Re: [PATCH v2] regmap: irq: allow different device for irq chip and regmap
On Fri, Jun 23, 2017 at 01:00:43PM +0100, Mark Brown wrote: > On Thu, Jun 22, 2017 at 01:03:20PM +0200, Michael Grzeschik wrote: > > > If the irq chip device is using the regmap of its parent device or > > a syscon regmap that doesn't have an associated device at all, > > allow the driver to provide its own device. That makes it possible > > to reference the irq controller from other devices running on the > > same regmap. > > I would strongly expect that the regmap for a device would be associated > with the physical device, if it's not that seems likely to create > further problems. How is this happening? > > syscon is one potential thing here but it seems odd for the sort of > hardware that syscon handles to be a good fit for regmap-irq. We have the special case that we use the syscon as the basic driver underneath some subdevices that vary in function. We have six arcnet controllers sitting side by side in an 8 byte offset. And after them we have the next small memory windows for an reset controller and one interrupt controller which the other devices reference. For that scenario the interrupt driver sitting under the "devicefree" syscon node, we have to add our own device node with dev_regmap_add_irq_chip. kmae_conf: syscon@0x0900 { compatible = "syscon", "simple-bus"; bits = <32>; reg-io-width = <1>; stride = <1>; reg = <0x0900 0x2>; com20020_1@0x09014000 { compatible = "smsc,com20020"; reg = <0x14000 0x8>; interrupt-parent = <>; interrupts = <0 0x4>; resets = <_reset 0 0>; }; com20020_2@0x09014010 { compatible = "smsc,com20020"; reg = <0x14010 0x8>; interrupt-parent = <>; interrupts = <1 0x4>; resets = <_reset 1 0>; }; com20020_3@0x09014020 { compatible = "smsc,com20020"; reg = <0x14020 0x8>; interrupt-parent = <>; interrupts = <2 0x4>; resets = <_reset 2 0>; }; com20020_4@0x09014030 { compatible = "smsc,com20020"; reg = <0x14030 0x8>; interrupt-parent = <>; interrupts = <3 0x4>; resets = <_reset 3 0>; }; com20020_5@0x09014040 { compatible = "smsc,com20020"; reg = <0x14040 0x8>; interrupt-parent = <>; interrupts = <4 0x4>; resets = <_reset 4 0>; }; com20020_6@0x09014050 { compatible = "smsc,com20020"; reg = <0x14050 0x8>; interrupt-parent = <>; interrupts = <5 0x4>; resets = <_reset 5 0>; }; kmae_reset: kmae_reset@0x09014060 { compatible = "eae,kmae-reset"; reg = <0x14060 0x8>; reset-controller; #reset-cells = <1>; }; kmae_irq: kmae_irq@0x09014060 { compatible = "eae,kmae-irq"; reg = <0x1406c 0x2>; interrupt-controller; #interrupt-cells = <2>; interrupt-parent = <>; interrupts = <31 0x4>; gpmc = <>; }; }; You can imagine this kind of scenarios in various situations where the device structure is loaded into an FPGA. The simplest way to memory map that packed layout pagewise is by using syscon in that case. Regards, Michael -- 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- | signature.asc Description: PGP signature
Re: [PATCH v2] regmap: irq: allow different device for irq chip and regmap
On Tue, Jul 04, 2017 at 11:44:49AM +0100, Mark Brown wrote: > On Fri, Jun 30, 2017 at 03:33:27PM +0200, Michael Grzeschik wrote: > > On Fri, Jun 23, 2017 at 01:00:43PM +0100, Mark Brown wrote: > > > > syscon is one potential thing here but it seems odd for the sort of > > > hardware that syscon handles to be a good fit for regmap-irq. > > > We have the special case that we use the syscon as the basic driver > > underneath some subdevices that vary in function. We have six arcnet > > controllers sitting side by side in an 8 byte offset. And after them we > > have the next small memory windows for an reset controller and one > > interrupt controller which the other devices reference. > > Why is this a syscon and not a MFD? It sounds exactly like a MFD to me, > syscon is more for cases where things are really jumbled together (even > in single registers) but that sounds like a bunch of separate register > ranges for separate devices that happen to be very close together in > address. You are right. I will rewrite it to MFD. Thanks, Michael -- 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- | signature.asc Description: PGP signature
[PATCH] regmap: irq: allow different device for irq chip and regmap
From: Philipp ZabelIf the irq chip device is using the regmap of its parent device or a syscon regmap that doesn't have an associated device at all, allow the driver to provide its own device. That makes it possible to reference the irq controller from other devices running on the same regmap. Signed-off-by: Philipp Zabel --- drivers/base/regmap/regmap-irq.c | 93 +--- include/linux/regmap.h | 4 ++ 2 files changed, 62 insertions(+), 35 deletions(-) diff --git a/drivers/base/regmap/regmap-irq.c b/drivers/base/regmap/regmap-irq.c index cd54189f2b1d4..a2525705c1ad0 100644 --- a/drivers/base/regmap/regmap-irq.c +++ b/drivers/base/regmap/regmap-irq.c @@ -25,6 +25,7 @@ struct regmap_irq_chip_data { struct mutex lock; struct irq_chip irq_chip; + struct device *dev; struct regmap *map; const struct regmap_irq_chip *chip; @@ -63,16 +64,16 @@ static void regmap_irq_lock(struct irq_data *data) static void regmap_irq_sync_unlock(struct irq_data *data) { struct regmap_irq_chip_data *d = irq_data_get_irq_chip_data(data); + struct device *dev = d->dev; struct regmap *map = d->map; int i, ret; u32 reg; u32 unmask_offset; if (d->chip->runtime_pm) { - ret = pm_runtime_get_sync(map->dev); + ret = pm_runtime_get_sync(dev); if (ret < 0) - dev_err(map->dev, "IRQ sync failed to resume: %d\n", - ret); + dev_err(dev, "IRQ sync failed to resume: %d\n", ret); } /* @@ -106,8 +107,7 @@ static void regmap_irq_sync_unlock(struct irq_data *data) d->mask_buf_def[i], d->mask_buf[i]); } if (ret != 0) - dev_err(d->map->dev, "Failed to sync masks in %x\n", - reg); + dev_err(dev, "Failed to sync masks in %x\n", reg); reg = d->chip->wake_base + (i * map->reg_stride * d->irq_reg_stride); @@ -121,8 +121,7 @@ static void regmap_irq_sync_unlock(struct irq_data *data) d->mask_buf_def[i], d->wake_buf[i]); if (ret != 0) - dev_err(d->map->dev, - "Failed to sync wakes in %x: %d\n", + dev_err(dev, "Failed to sync wakes in %x: %d\n", reg, ret); } @@ -142,7 +141,7 @@ static void regmap_irq_sync_unlock(struct irq_data *data) else ret = regmap_write(map, reg, d->mask_buf[i]); if (ret != 0) - dev_err(d->map->dev, "Failed to ack 0x%x: %d\n", + dev_err(dev, "Failed to ack 0x%x: %d\n", reg, ret); } } @@ -164,7 +163,7 @@ static void regmap_irq_sync_unlock(struct irq_data *data) } if (d->chip->runtime_pm) - pm_runtime_put(map->dev); + pm_runtime_put(dev); /* If we've changed our wakeup count propagate it to the parent */ if (d->wake_count < 0) @@ -263,6 +262,7 @@ static irqreturn_t regmap_irq_thread(int irq, void *d) { struct regmap_irq_chip_data *data = d; const struct regmap_irq_chip *chip = data->chip; + struct device *dev = data->dev; struct regmap *map = data->map; int ret, i; bool handled = false; @@ -272,11 +272,10 @@ static irqreturn_t regmap_irq_thread(int irq, void *d) chip->handle_pre_irq(chip->irq_drv_data); if (chip->runtime_pm) { - ret = pm_runtime_get_sync(map->dev); + ret = pm_runtime_get_sync(dev); if (ret < 0) { - dev_err(map->dev, "IRQ thread failed to resume: %d\n", - ret); - pm_runtime_put(map->dev); + dev_err(dev, "IRQ thread failed to resume: %d\n", ret); + pm_runtime_put(dev); goto exit; } } @@ -297,8 +296,7 @@ static irqreturn_t regmap_irq_thread(int irq, void *d) data->status_reg_buf, chip->num_regs); if (ret != 0) { - dev_err(map->dev, "Failed to read IRQ status: %d\n", - ret); + dev_err(dev, "Failed to read IRQ status: %d\n", ret); goto exit; } @@ -327,11 +325,10 @@ static
[PATCH] regmap: irq: add chip option mask_writeonly
Some irq controllers have writeonly/multipurpose register layouts. In those cases we read invalid data back. Here we add the option mask_writeonly as masking option. Signed-off-by: Michael Grzeschik <m.grzesc...@pengutronix.de> --- drivers/base/regmap/regmap-irq.c | 43 ++-- include/linux/regmap.h | 2 ++ 2 files changed, 30 insertions(+), 15 deletions(-) diff --git a/drivers/base/regmap/regmap-irq.c b/drivers/base/regmap/regmap-irq.c index a2525705c1ad0..a599a8ee38647 100644 --- a/drivers/base/regmap/regmap-irq.c +++ b/drivers/base/regmap/regmap-irq.c @@ -61,6 +61,16 @@ static void regmap_irq_lock(struct irq_data *data) mutex_lock(>lock); } +static int regmap_irq_update_bits(struct regmap_irq_chip_data *d, + unsigned int reg, unsigned int mask, + unsigned int val) +{ + if (d->chip->mask_writeonly) + return regmap_write_bits(d->map, reg, mask, val); + else + return regmap_update_bits(d->map, reg, mask, val); +} + static void regmap_irq_sync_unlock(struct irq_data *data) { struct regmap_irq_chip_data *d = irq_data_get_irq_chip_data(data); @@ -85,12 +95,13 @@ static void regmap_irq_sync_unlock(struct irq_data *data) reg = d->chip->mask_base + (i * map->reg_stride * d->irq_reg_stride); if (d->chip->mask_invert) { - ret = regmap_update_bits(d->map, reg, + ret = regmap_irq_update_bits(d, reg, d->mask_buf_def[i], ~d->mask_buf[i]); } else if (d->chip->unmask_base) { /* set mask with mask_base register */ - ret = regmap_update_bits(d->map, reg, + ret = regmap_irq_update_bits(d, reg, d->mask_buf_def[i], ~d->mask_buf[i]); + if (ret < 0) dev_err(d->map->dev, "Failed to sync unmasks in %x\n", @@ -98,13 +109,14 @@ static void regmap_irq_sync_unlock(struct irq_data *data) unmask_offset = d->chip->unmask_base - d->chip->mask_base; /* clear mask with unmask_base register */ - ret = regmap_update_bits(d->map, + ret = regmap_irq_update_bits(d, reg + unmask_offset, d->mask_buf_def[i], d->mask_buf[i]); } else { - ret = regmap_update_bits(d->map, reg, + ret = regmap_irq_update_bits(d, reg, d->mask_buf_def[i], d->mask_buf[i]); + } if (ret != 0) dev_err(dev, "Failed to sync masks in %x\n", reg); @@ -113,11 +125,11 @@ static void regmap_irq_sync_unlock(struct irq_data *data) (i * map->reg_stride * d->irq_reg_stride); if (d->wake_buf) { if (d->chip->wake_invert) - ret = regmap_update_bits(d->map, reg, + ret = regmap_irq_update_bits(d, reg, d->mask_buf_def[i], ~d->wake_buf[i]); else - ret = regmap_update_bits(d->map, reg, + ret = regmap_irq_update_bits(d, reg, d->mask_buf_def[i], d->wake_buf[i]); if (ret != 0) @@ -152,10 +164,10 @@ static void regmap_irq_sync_unlock(struct irq_data *data) reg = d->chip->type_base + (i * map->reg_stride * d->type_reg_stride); if (d->chip->type_invert) - ret = regmap_update_bits(d->map, reg, + ret = regmap_irq_update_bits(d, reg, d->type_buf_def[i], ~d->type_buf[i]); else - ret = regmap_update_bits(d->map, reg, + ret = regmap_irq_update_bits(d, reg, d->type_buf_def[i], d->type_buf[i]); if (ret != 0) dev_err(d->map->dev, "Failed to sync type in %x\n", @@ -519,17 +531,18 @@ int dev_regmap_add_irq_chip(struct device *dev, struct regmap *map,
[PATCH v2] regmap: irq: allow different device for irq chip and regmap
From: Philipp Zabel <p.za...@pengutronix.de> If the irq chip device is using the regmap of its parent device or a syscon regmap that doesn't have an associated device at all, allow the driver to provide its own device. That makes it possible to reference the irq controller from other devices running on the same regmap. Signed-off-by: Philipp Zabel <p.za...@pengutronix.de> Signed-off-by: Michael Grzeschik <m.grzesc...@pengutronix.de> --- v1 -> v2: Added my own missing Signed-off-by. drivers/base/regmap/regmap-irq.c | 93 +--- include/linux/regmap.h | 4 ++ 2 files changed, 62 insertions(+), 35 deletions(-) diff --git a/drivers/base/regmap/regmap-irq.c b/drivers/base/regmap/regmap-irq.c index cd54189f2b1d4..a2525705c1ad0 100644 --- a/drivers/base/regmap/regmap-irq.c +++ b/drivers/base/regmap/regmap-irq.c @@ -25,6 +25,7 @@ struct regmap_irq_chip_data { struct mutex lock; struct irq_chip irq_chip; + struct device *dev; struct regmap *map; const struct regmap_irq_chip *chip; @@ -63,16 +64,16 @@ static void regmap_irq_lock(struct irq_data *data) static void regmap_irq_sync_unlock(struct irq_data *data) { struct regmap_irq_chip_data *d = irq_data_get_irq_chip_data(data); + struct device *dev = d->dev; struct regmap *map = d->map; int i, ret; u32 reg; u32 unmask_offset; if (d->chip->runtime_pm) { - ret = pm_runtime_get_sync(map->dev); + ret = pm_runtime_get_sync(dev); if (ret < 0) - dev_err(map->dev, "IRQ sync failed to resume: %d\n", - ret); + dev_err(dev, "IRQ sync failed to resume: %d\n", ret); } /* @@ -106,8 +107,7 @@ static void regmap_irq_sync_unlock(struct irq_data *data) d->mask_buf_def[i], d->mask_buf[i]); } if (ret != 0) - dev_err(d->map->dev, "Failed to sync masks in %x\n", - reg); + dev_err(dev, "Failed to sync masks in %x\n", reg); reg = d->chip->wake_base + (i * map->reg_stride * d->irq_reg_stride); @@ -121,8 +121,7 @@ static void regmap_irq_sync_unlock(struct irq_data *data) d->mask_buf_def[i], d->wake_buf[i]); if (ret != 0) - dev_err(d->map->dev, - "Failed to sync wakes in %x: %d\n", + dev_err(dev, "Failed to sync wakes in %x: %d\n", reg, ret); } @@ -142,7 +141,7 @@ static void regmap_irq_sync_unlock(struct irq_data *data) else ret = regmap_write(map, reg, d->mask_buf[i]); if (ret != 0) - dev_err(d->map->dev, "Failed to ack 0x%x: %d\n", + dev_err(dev, "Failed to ack 0x%x: %d\n", reg, ret); } } @@ -164,7 +163,7 @@ static void regmap_irq_sync_unlock(struct irq_data *data) } if (d->chip->runtime_pm) - pm_runtime_put(map->dev); + pm_runtime_put(dev); /* If we've changed our wakeup count propagate it to the parent */ if (d->wake_count < 0) @@ -263,6 +262,7 @@ static irqreturn_t regmap_irq_thread(int irq, void *d) { struct regmap_irq_chip_data *data = d; const struct regmap_irq_chip *chip = data->chip; + struct device *dev = data->dev; struct regmap *map = data->map; int ret, i; bool handled = false; @@ -272,11 +272,10 @@ static irqreturn_t regmap_irq_thread(int irq, void *d) chip->handle_pre_irq(chip->irq_drv_data); if (chip->runtime_pm) { - ret = pm_runtime_get_sync(map->dev); + ret = pm_runtime_get_sync(dev); if (ret < 0) { - dev_err(map->dev, "IRQ thread failed to resume: %d\n", - ret); - pm_runtime_put(map->dev); + dev_err(dev, "IRQ thread failed to resume: %d\n", ret); + pm_runtime_put(dev); goto exit; } } @@ -297,8 +296,7 @@ static irqreturn_t regmap_irq_thread(int irq, void *d) data->status_reg_buf,
Re: [PATCH] arcnet: fix spelling mistake "Ackknowledge" -> "Acknowledge"
On Sun, Jun 25, 2017 at 10:15:06PM +0100, Colin King wrote: > From: Colin Ian King> > Trivial fix to spelling mistake in arc_printk message > > Signed-off-by: Colin Ian King > --- > drivers/net/arcnet/capmode.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/net/arcnet/capmode.c b/drivers/net/arcnet/capmode.c > index a80f4eb9262d..b780be6f41ff 100644 > --- a/drivers/net/arcnet/capmode.c > +++ b/drivers/net/arcnet/capmode.c > @@ -212,7 +212,7 @@ static int ack_tx(struct net_device *dev, int acked) > ackpkt->soft.cap.proto = 0; /* using protocol 0 for acknowledge */ > ackpkt->soft.cap.mes.ack = acked; > > - arc_printk(D_PROTO, dev, "Ackknowledge for cap packet %x.\n", > + arc_printk(D_PROTO, dev, "Acknowledge for cap packet %x.\n", > *((int *)>soft.cap.cookie[0])); > > ackskb->protocol = cpu_to_be16(ETH_P_ARCNET); I will take it into my next pull request. -- 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- |
[PATCH v2] regmap: irq: add chip option mask_writeonly
Some irq controllers have writeonly/multipurpose register layouts. In those cases we read invalid data back. Here we add the option mask_writeonly as masking option. Signed-off-by: Michael Grzeschik <m.grzesc...@pengutronix.de> --- v1 -> v2: - rebased on regmap/for-next - removed unneeded extra empty lines from previous patch drivers/base/regmap/regmap-irq.c | 40 +--- include/linux/regmap.h | 2 ++ 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/drivers/base/regmap/regmap-irq.c b/drivers/base/regmap/regmap-irq.c index c4a1eadb093f3..429ca8ed7e518 100644 --- a/drivers/base/regmap/regmap-irq.c +++ b/drivers/base/regmap/regmap-irq.c @@ -60,6 +60,16 @@ static void regmap_irq_lock(struct irq_data *data) mutex_lock(>lock); } +static int regmap_irq_update_bits(struct regmap_irq_chip_data *d, + unsigned int reg, unsigned int mask, + unsigned int val) +{ + if (d->chip->mask_writeonly) + return regmap_write_bits(d->map, reg, mask, val); + else + return regmap_update_bits(d->map, reg, mask, val); +} + static void regmap_irq_sync_unlock(struct irq_data *data) { struct regmap_irq_chip_data *d = irq_data_get_irq_chip_data(data); @@ -84,11 +94,11 @@ static void regmap_irq_sync_unlock(struct irq_data *data) reg = d->chip->mask_base + (i * map->reg_stride * d->irq_reg_stride); if (d->chip->mask_invert) { - ret = regmap_update_bits(d->map, reg, + ret = regmap_irq_update_bits(d, reg, d->mask_buf_def[i], ~d->mask_buf[i]); } else if (d->chip->unmask_base) { /* set mask with mask_base register */ - ret = regmap_update_bits(d->map, reg, + ret = regmap_irq_update_bits(d, reg, d->mask_buf_def[i], ~d->mask_buf[i]); if (ret < 0) dev_err(d->map->dev, @@ -97,12 +107,12 @@ static void regmap_irq_sync_unlock(struct irq_data *data) unmask_offset = d->chip->unmask_base - d->chip->mask_base; /* clear mask with unmask_base register */ - ret = regmap_update_bits(d->map, + ret = regmap_irq_update_bits(d, reg + unmask_offset, d->mask_buf_def[i], d->mask_buf[i]); } else { - ret = regmap_update_bits(d->map, reg, + ret = regmap_irq_update_bits(d, reg, d->mask_buf_def[i], d->mask_buf[i]); } if (ret != 0) @@ -113,11 +123,11 @@ static void regmap_irq_sync_unlock(struct irq_data *data) (i * map->reg_stride * d->irq_reg_stride); if (d->wake_buf) { if (d->chip->wake_invert) - ret = regmap_update_bits(d->map, reg, + ret = regmap_irq_update_bits(d, reg, d->mask_buf_def[i], ~d->wake_buf[i]); else - ret = regmap_update_bits(d->map, reg, + ret = regmap_irq_update_bits(d, reg, d->mask_buf_def[i], d->wake_buf[i]); if (ret != 0) @@ -153,10 +163,10 @@ static void regmap_irq_sync_unlock(struct irq_data *data) reg = d->chip->type_base + (i * map->reg_stride * d->type_reg_stride); if (d->chip->type_invert) - ret = regmap_update_bits(d->map, reg, + ret = regmap_irq_update_bits(d, reg, d->type_buf_def[i], ~d->type_buf[i]); else - ret = regmap_update_bits(d->map, reg, + ret = regmap_irq_update_bits(d, reg, d->type_buf_def[i], d->type_buf[i]); if (ret != 0) dev_err(d->map->dev, "Failed to sync type in %x\n", @@ -519,17 +529,17 @@ int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags, reg = chip->mask_base +
[PATCH v2] usbip: dynamically allocate idev by nports found in sysfs
As the amount of available ports varies by the kernels build configuration. To remove the limitation of the fixed 128 ports we allocate the amount of idevs by using the number we get from the kernel. Signed-off-by: Michael Grzeschik <m.grzesc...@pengutronix.de> --- v1 -> v2: - reworked memory allocation into one calloc call - added error path on allocation failure tools/usb/usbip/libsrc/vhci_driver.c | 14 +- tools/usb/usbip/libsrc/vhci_driver.h | 3 +-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/tools/usb/usbip/libsrc/vhci_driver.c b/tools/usb/usbip/libsrc/vhci_driver.c index c9c81614a66ad..6e2a9edfd1f0d 100644 --- a/tools/usb/usbip/libsrc/vhci_driver.c +++ b/tools/usb/usbip/libsrc/vhci_driver.c @@ -242,13 +242,20 @@ static int read_record(int rhport, char *host, unsigned long host_len, int usbip_vhci_driver_open(void) { + int nports = get_nports(); + udev_context = udev_new(); if (!udev_context) { err("udev_new failed"); return -1; } - vhci_driver = calloc(1, sizeof(struct usbip_vhci_driver)); + vhci_driver = calloc(1, sizeof(struct usbip_vhci_driver) + + nports * sizeof(struct usbip_imported_device)); + if (!vhci_driver) { + err("vhci_driver allocation failed"); + return -1; + } /* will be freed in usbip_driver_close() */ vhci_driver->hc_device = @@ -260,15 +267,12 @@ int usbip_vhci_driver_open(void) goto err; } - vhci_driver->nports = get_nports(); + vhci_driver->nports = nports; dbg("available ports: %d", vhci_driver->nports); if (vhci_driver->nports <= 0) { err("no available ports"); goto err; - } else if (vhci_driver->nports > MAXNPORT) { - err("port number exceeds %d", MAXNPORT); - goto err; } vhci_driver->ncontrollers = get_ncontrollers(); diff --git a/tools/usb/usbip/libsrc/vhci_driver.h b/tools/usb/usbip/libsrc/vhci_driver.h index 418b404d51210..6c9aca2167051 100644 --- a/tools/usb/usbip/libsrc/vhci_driver.h +++ b/tools/usb/usbip/libsrc/vhci_driver.h @@ -13,7 +13,6 @@ #define USBIP_VHCI_BUS_TYPE "platform" #define USBIP_VHCI_DEVICE_NAME "vhci_hcd.0" -#define MAXNPORT 128 enum hub_speed { HUB_SPEED_HIGH = 0, @@ -41,7 +40,7 @@ struct usbip_vhci_driver { int ncontrollers; int nports; - struct usbip_imported_device idev[MAXNPORT]; + struct usbip_imported_device idev[]; }; -- 2.17.0
Re: [PATCH v3] usbip: dynamically allocate idev by nports found in sysfs
On Wed, May 23, 2018 at 10:44:57AM -0600, Shuah Khan wrote: > On 05/23/2018 03:22 AM, Michael Grzeschik wrote: > > As the amount of available ports varies by the kernels build > > configuration. To remove the limitation of the fixed 128 ports > > we allocate the amount of idevs by using the number we get > > from the kernel. > > > > Signed-off-by: Michael Grzeschik <m.grzesc...@pengutronix.de> > > --- > > v1 -> v2: - reworked memory allocation into one calloc call > > - added error path on allocation failure > > v2 -> v3: - moved check for available nports to beginning of function > > > > Hmm. With this patch I see a segfault when I run usbip port command. > I think this patch is incomplete and more changes are needed to the > code that references the idev array. > > I can't take this patch. I will test it again tomorrow. Thanks, Michael -- 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- | signature.asc Description: PGP signature
[PATCH v3] usbip: dynamically allocate idev by nports found in sysfs
As the amount of available ports varies by the kernels build configuration. To remove the limitation of the fixed 128 ports we allocate the amount of idevs by using the number we get from the kernel. Signed-off-by: Michael Grzeschik <m.grzesc...@pengutronix.de> --- v1 -> v2: - reworked memory allocation into one calloc call - added error path on allocation failure v2 -> v3: - moved check for available nports to beginning of function tools/usb/usbip/libsrc/vhci_driver.c | 24 ++-- tools/usb/usbip/libsrc/vhci_driver.h | 3 +-- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/tools/usb/usbip/libsrc/vhci_driver.c b/tools/usb/usbip/libsrc/vhci_driver.c index c9c81614a66ad..c5db1be784bab 100644 --- a/tools/usb/usbip/libsrc/vhci_driver.c +++ b/tools/usb/usbip/libsrc/vhci_driver.c @@ -242,13 +242,25 @@ static int read_record(int rhport, char *host, unsigned long host_len, int usbip_vhci_driver_open(void) { + int nports = get_nports(); + + if (nports <= 0) { + err("no available ports"); + return -1; + } + udev_context = udev_new(); if (!udev_context) { err("udev_new failed"); return -1; } - vhci_driver = calloc(1, sizeof(struct usbip_vhci_driver)); + vhci_driver = calloc(1, sizeof(struct usbip_vhci_driver) + + nports * sizeof(struct usbip_imported_device)); + if (!vhci_driver) { + err("vhci_driver allocation failed"); + return -1; + } /* will be freed in usbip_driver_close() */ vhci_driver->hc_device = @@ -260,17 +272,9 @@ int usbip_vhci_driver_open(void) goto err; } - vhci_driver->nports = get_nports(); + vhci_driver->nports = nports; dbg("available ports: %d", vhci_driver->nports); - if (vhci_driver->nports <= 0) { - err("no available ports"); - goto err; - } else if (vhci_driver->nports > MAXNPORT) { - err("port number exceeds %d", MAXNPORT); - goto err; - } - vhci_driver->ncontrollers = get_ncontrollers(); dbg("available controllers: %d", vhci_driver->ncontrollers); diff --git a/tools/usb/usbip/libsrc/vhci_driver.h b/tools/usb/usbip/libsrc/vhci_driver.h index 418b404d51210..6c9aca2167051 100644 --- a/tools/usb/usbip/libsrc/vhci_driver.h +++ b/tools/usb/usbip/libsrc/vhci_driver.h @@ -13,7 +13,6 @@ #define USBIP_VHCI_BUS_TYPE "platform" #define USBIP_VHCI_DEVICE_NAME "vhci_hcd.0" -#define MAXNPORT 128 enum hub_speed { HUB_SPEED_HIGH = 0, @@ -41,7 +40,7 @@ struct usbip_vhci_driver { int ncontrollers; int nports; - struct usbip_imported_device idev[MAXNPORT]; + struct usbip_imported_device idev[]; }; -- 2.17.0
Re: [PATCH v3] usbip: dynamically allocate idev by nports found in sysfs
On Wed, May 23, 2018 at 10:44:57AM -0600, Shuah Khan wrote: > On 05/23/2018 03:22 AM, Michael Grzeschik wrote: > > As the amount of available ports varies by the kernels build > > configuration. To remove the limitation of the fixed 128 ports > > we allocate the amount of idevs by using the number we get > > from the kernel. > > > > Signed-off-by: Michael Grzeschik <m.grzesc...@pengutronix.de> > > --- > > v1 -> v2: - reworked memory allocation into one calloc call > > - added error path on allocation failure > > v2 -> v3: - moved check for available nports to beginning of function > > > > Hmm. With this patch I see a segfault when I run usbip port command. > I think this patch is incomplete and more changes are needed to the > code that references the idev array. > > I can't take this patch. I missed that get_nports depends on vhci_driver->hc_device which is not initialized that early. I will rework it to get the hc_device by parameter and send v4. Thanks, Michael -- 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- | signature.asc Description: PGP signature
[PATCH v4] usbip: dynamically allocate idev by nports found in sysfs
As the amount of available ports varies by the kernels build configuration. To remove the limitation of the fixed 128 ports we allocate the amount of idevs by using the number we get from the kernel. Signed-off-by: Michael Grzeschik <m.grzesc...@pengutronix.de> --- v1 -> v2: - reworked memory allocation into one calloc call - added error path on allocation failure v2 -> v3: - moved check for available nports to beginning of function v3 -> v4: - changed get_nports to get hc_device via parameter - moved calloc after valid get_nports call tools/usb/usbip/libsrc/vhci_driver.c | 32 +--- tools/usb/usbip/libsrc/vhci_driver.h | 3 +-- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/tools/usb/usbip/libsrc/vhci_driver.c b/tools/usb/usbip/libsrc/vhci_driver.c index c9c81614a66ad..4204359c9feef 100644 --- a/tools/usb/usbip/libsrc/vhci_driver.c +++ b/tools/usb/usbip/libsrc/vhci_driver.c @@ -135,11 +135,11 @@ static int refresh_imported_device_list(void) return 0; } -static int get_nports(void) +static int get_nports(struct udev_device *hc_device) { const char *attr_nports; - attr_nports = udev_device_get_sysattr_value(vhci_driver->hc_device, "nports"); + attr_nports = udev_device_get_sysattr_value(hc_device, "nports"); if (!attr_nports) { err("udev_device_get_sysattr_value nports failed"); return -1; @@ -242,35 +242,41 @@ static int read_record(int rhport, char *host, unsigned long host_len, int usbip_vhci_driver_open(void) { + int nports; + struct udev_device *hc_device; + udev_context = udev_new(); if (!udev_context) { err("udev_new failed"); return -1; } - vhci_driver = calloc(1, sizeof(struct usbip_vhci_driver)); - /* will be freed in usbip_driver_close() */ - vhci_driver->hc_device = + hc_device = udev_device_new_from_subsystem_sysname(udev_context, USBIP_VHCI_BUS_TYPE, USBIP_VHCI_DEVICE_NAME); - if (!vhci_driver->hc_device) { + if (!hc_device) { err("udev_device_new_from_subsystem_sysname failed"); goto err; } - vhci_driver->nports = get_nports(); - dbg("available ports: %d", vhci_driver->nports); - - if (vhci_driver->nports <= 0) { + nports = get_nports(hc_device); + if (nports <= 0) { err("no available ports"); goto err; - } else if (vhci_driver->nports > MAXNPORT) { - err("port number exceeds %d", MAXNPORT); + } + dbg("available ports: %d", nports); + + vhci_driver = calloc(1, sizeof(struct usbip_vhci_driver) + + nports * sizeof(struct usbip_imported_device)); + if (!vhci_driver) { + err("vhci_driver allocation failed"); goto err; } + vhci_driver->nports = nports; + vhci_driver->hc_device = hc_device; vhci_driver->ncontrollers = get_ncontrollers(); dbg("available controllers: %d", vhci_driver->ncontrollers); @@ -285,7 +291,7 @@ int usbip_vhci_driver_open(void) return 0; err: - udev_device_unref(vhci_driver->hc_device); + udev_device_unref(hc_device); if (vhci_driver) free(vhci_driver); diff --git a/tools/usb/usbip/libsrc/vhci_driver.h b/tools/usb/usbip/libsrc/vhci_driver.h index 418b404d51210..6c9aca2167051 100644 --- a/tools/usb/usbip/libsrc/vhci_driver.h +++ b/tools/usb/usbip/libsrc/vhci_driver.h @@ -13,7 +13,6 @@ #define USBIP_VHCI_BUS_TYPE "platform" #define USBIP_VHCI_DEVICE_NAME "vhci_hcd.0" -#define MAXNPORT 128 enum hub_speed { HUB_SPEED_HIGH = 0, @@ -41,7 +40,7 @@ struct usbip_vhci_driver { int ncontrollers; int nports; - struct usbip_imported_device idev[MAXNPORT]; + struct usbip_imported_device idev[]; }; -- 2.17.0
[PATCH] usbip: dynamically allocate idev by nports found in sysfs
As the amount of available ports varies by the kernels build configuration. To remove the limitation of the fixed 128 ports we allocate the amount of idevs by using the number we get from the kernel. Signed-off-by: Michael Grzeschik <m.grzesc...@pengutronix.de> --- tools/usb/usbip/libsrc/vhci_driver.c | 11 --- tools/usb/usbip/libsrc/vhci_driver.h | 3 +-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/tools/usb/usbip/libsrc/vhci_driver.c b/tools/usb/usbip/libsrc/vhci_driver.c index c9c81614a66ad..9a8acfc7697fa 100644 --- a/tools/usb/usbip/libsrc/vhci_driver.c +++ b/tools/usb/usbip/libsrc/vhci_driver.c @@ -266,11 +266,11 @@ int usbip_vhci_driver_open(void) if (vhci_driver->nports <= 0) { err("no available ports"); goto err; - } else if (vhci_driver->nports > MAXNPORT) { - err("port number exceeds %d", MAXNPORT); - goto err; } + vhci_driver->idev = calloc(vhci_driver->nports, + sizeof(struct usbip_imported_device)); + vhci_driver->ncontrollers = get_ncontrollers(); dbg("available controllers: %d", vhci_driver->ncontrollers); @@ -287,6 +287,9 @@ int usbip_vhci_driver_open(void) err: udev_device_unref(vhci_driver->hc_device); + if (vhci_driver->idev) + free(vhci_driver->idev); + if (vhci_driver) free(vhci_driver); @@ -305,6 +308,8 @@ void usbip_vhci_driver_close(void) udev_device_unref(vhci_driver->hc_device); + free(vhci_driver->idev); + free(vhci_driver); vhci_driver = NULL; diff --git a/tools/usb/usbip/libsrc/vhci_driver.h b/tools/usb/usbip/libsrc/vhci_driver.h index 418b404d51210..67dbd1551e159 100644 --- a/tools/usb/usbip/libsrc/vhci_driver.h +++ b/tools/usb/usbip/libsrc/vhci_driver.h @@ -13,7 +13,6 @@ #define USBIP_VHCI_BUS_TYPE "platform" #define USBIP_VHCI_DEVICE_NAME "vhci_hcd.0" -#define MAXNPORT 128 enum hub_speed { HUB_SPEED_HIGH = 0, @@ -41,7 +40,7 @@ struct usbip_vhci_driver { int ncontrollers; int nports; - struct usbip_imported_device idev[MAXNPORT]; + struct usbip_imported_device *idev; }; -- 2.17.0