Re: [PATCH] arm, vt8500, LLVMLlinux: Use mcr instead of mcr% for mach-vt8500
On 24/09/14 21:16, Arnd Bergmann wrote: On Tuesday 23 September 2014 20:44:44 Behan Webster wrote: The ASM below does not compile with clang and is not the way that the mcr command is used in other parts of the kernel. arch/arm/mach-vt8500/vt8500.c:72:11: error: invalid % escape in inline assembly string asm("mcr%? p15, 0, %0, c7, c0, 4" : : "r" (0)); ~^~~~ 1 error generated. There are other forms that are supported on different ARM instruction sets but generally the kernel just uses mcr as it is supported in all ARM instruction sets. Just for confirm: both forms are actually correct and we don't need this backported for stable, right? Signed-off-by: Behan Webster Reviewed-by: Mark Charlebois Acked-by: Will Deacon Acked-by: Arnd Bergmann Tony, would you like to pick this one up and send it in a pull request to arm-soc, or should we apply it to fixes-non-critical directly? Arnd Arnd, You can apply it directly to fixes-non-critical if that's ok. Regards Tony Prisk -- 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] pinctrl: vt8500: Ensure value reg is updated when setting direction
On 30/04/14 07:42, Alexey Charkov wrote: Current code only touches the direction register when setting direction to output, which breaks logic like echo high > /sys/class/gpio/gpio0/direction which is expected to also set the value. This patch also adds a call to update the value register when setting direction to output. Signed-off-by: Alexey Charkov --- drivers/pinctrl/vt8500/pinctrl-wmt.c | 23 --- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/drivers/pinctrl/vt8500/pinctrl-wmt.c b/drivers/pinctrl/vt8500/pinctrl-wmt.c index 9802b67..2c61281 100644 --- a/drivers/pinctrl/vt8500/pinctrl-wmt.c +++ b/drivers/pinctrl/vt8500/pinctrl-wmt.c @@ -523,17 +523,6 @@ static int wmt_gpio_get_direction(struct gpio_chip *chip, unsigned offset) return GPIOF_DIR_IN; } -static int wmt_gpio_direction_input(struct gpio_chip *chip, unsigned offset) -{ - return pinctrl_gpio_direction_input(chip->base + offset); -} - -static int wmt_gpio_direction_output(struct gpio_chip *chip, unsigned offset, -int value) -{ - return pinctrl_gpio_direction_output(chip->base + offset); -} - static int wmt_gpio_get_value(struct gpio_chip *chip, unsigned offset) { struct wmt_pinctrl_data *data = dev_get_drvdata(chip->dev); @@ -568,6 +557,18 @@ static void wmt_gpio_set_value(struct gpio_chip *chip, unsigned offset, wmt_clearbits(data, reg_data_out, BIT(bit)); } +static int wmt_gpio_direction_input(struct gpio_chip *chip, unsigned offset) +{ + return pinctrl_gpio_direction_input(chip->base + offset); +} + +static int wmt_gpio_direction_output(struct gpio_chip *chip, unsigned offset, +int value) +{ + wmt_gpio_set_value(chip, offset, value); + return pinctrl_gpio_direction_output(chip->base + offset); +} + static struct gpio_chip wmt_gpio_chip = { .label = "gpio-wmt", .owner = THIS_MODULE, Acked-by: Tony Prisk Didn't notice that this was an option in the gpio documentation but it makes obvious sense. Regards Tony P -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 4/7] ECHI Platform: Merge ppc-of EHCI driver into the ehci-platform driver
On 22/02/14 00:48, Mark Rutland wrote: [Adding Tony Prisk to Cc] On Fri, Feb 21, 2014 at 06:31:30AM +, Alistair Popple wrote: Currently the ppc-of driver uses the compatibility string "usb-ehci". This means platforms that use device-tree and implement an EHCI compatible interface have to either use the ppc-of driver or add a compatible line to the ehci-platform driver. It would be more appropriate for the platform driver to be compatible with "usb-ehci" as non-powerpc platforms are also beginning to utilise device-tree. This patch merges the device tree property parsing from ehci-ppc-of into the platform driver and adds a "usb-ehci" compatibility string. The existing ehci-ppc-of driver is removed and the 440EPX specific quirks are added to the ehci-platform driver. Signed-off-by: Alistair Popple --- drivers/usb/host/Kconfig |7 +- drivers/usb/host/ehci-hcd.c |5 - drivers/usb/host/ehci-platform.c | 87 +- drivers/usb/host/ehci-ppc-of.c | 238 -- 4 files changed, 89 insertions(+), 248 deletions(-) delete mode 100644 drivers/usb/host/ehci-ppc-of.c Please use of_property_read_bool for these. This driver already handles "via,vt8500-ehci" and "wm,prizm-ehci" which aren't documented to handle these properties, but now gain support for them. It might be worth unifying the binding documents if there's nothing special about those two host controllers. We seem to have two binding documents for "via,vt8500-ehci", so some cleanup is definitely in order. Tony, you seem to have written both documents judging by 95e9fd10f06c and 8ad551d150e3. Do you have any issue with merging both of these into a common usb-ehci document? .. Cheers, Mark. I'm not sure how we ended up with two bindings for the driver anyway. I think this was an error on my part somewhere. None of the in-tree dts files use "wm,prizm-ehci". I have no issue with merging all the documentation into a single usb-ehci binding. Regards Tony Prisk -- 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/3] net: via-rhine: add OF bus binding
On 29/01/14 07:27, Alexey Charkov wrote: 2014/1/27 Rob Herring : On Mon, Jan 27, 2014 at 5:51 AM, Alexey Charkov wrote: This should make the driver usable with VIA/WonderMedia ARM-based Systems-on-Chip integrated Rhine III adapters. Note that these are always in MMIO mode, and don't have any known EEPROM. Signed-off-by: Alexey Charkov Signed-off-by: Roger Luethi --- .../devicetree/bindings/net/via-rhine.txt | 18 ++ drivers/net/ethernet/via/Kconfig | 2 +- drivers/net/ethernet/via/via-rhine.c | 293 + 3 files changed, 200 insertions(+), 113 deletions(-) create mode 100644 Documentation/devicetree/bindings/net/via-rhine.txt diff --git a/Documentation/devicetree/bindings/net/via-rhine.txt b/Documentation/devicetree/bindings/net/via-rhine.txt new file mode 100644 index 000..684dd3a --- /dev/null +++ b/Documentation/devicetree/bindings/net/via-rhine.txt @@ -0,0 +1,18 @@ +* VIA Rhine 10/100 Network Controller + +Required properties: +- compatible : Should be "via,rhine" This should be more specific rather than... +- reg : Address and length of the io space +- interrupts : Should contain the controller interrupt line +- rhine,revision : Rhine core revision, used to inform the + driver of quirks and capabilities to expect from + the device. Mimics the respective PCI attribute. having this property. The OF match table can then have the quirks set based on compatible strings. Sounds fair. Do you think something like the following would fly? Required properties: - compatible : Should be "via,rhine-soc-vt8500" for integrated Rhine cores found in SoC's such as VIA VT8500, WonderMedia WM8950 and possibly others. These are listed as 1106:3106 rev. 0x84 on the virtual PCI bus under vendor-provided kernels. Does it need a special name? I would have assumed they are using their own IP for the VT6105 or VT6106S. Then you can use it to add quirks later on if needed. Regards Tony Prisk -- 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] vt8500: pinctrl: Change devicetree data parsing
On 23/01/14 21:43, Linus Walleij wrote: On Thu, Jan 23, 2014 at 7:31 AM, Tony Prisk wrote: Due to an assumption in the VT8500 pinctrl driver, the value passed from devicetree for 'wm,pull' was not explicitly translated before being passed to pinconf. With changes to 'enum pin_config_param', PIN_CONFIG_BIAS_PULL_(UP/DOWN) no longer map 1-to-1 with the expected values in devicetree. This patch adds a small translation between the devicetree values (0..2) and the enum pin_config_param equivalent values. Signed-off-by: Tony Prisk Isn't this a regression fix for stable? I wasn't sure how to handle this since it's been a problem since 3.10 but no one has mentioned it (or patched it). I assume this is because: a) pinctrl is only used for I2C in mainline - and there is no mainline I2C consumer device drivers for the WonderMedia devices b) most users are using the non-mainline kernel which has more support (as nasty as some of it is). Regards Tony Prisk -- 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 RESEND] vt8500: pinctrl: Change devicetree data parsing
Due to an assumption in the VT8500 pinctrl driver, the value passed from devicetree for 'wm,pull' was not explicitly translated before being passed to pinconf. Since v3.10, changes to 'enum pin_config_param', PIN_CONFIG_BIAS_PULL_(UP/DOWN) no longer map 1-to-1 with the expected values in devicetree. This patch adds a small translation between the devicetree values (0..2) and the enum pin_config_param equivalent values. Signed-off-by: Tony Prisk --- v2: Minor change in commit message to indicate time since problem occurred. Change assigned variable to configs[0] rather than reassigning to pull. Add a default case to the switch to prevent static checker errors. v2 resend: Correct Linus' email address drivers/pinctrl/vt8500/pinctrl-wmt.c | 15 ++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/pinctrl/vt8500/pinctrl-wmt.c b/drivers/pinctrl/vt8500/pinctrl-wmt.c index 39aec08..25ab2ee 100644 --- a/drivers/pinctrl/vt8500/pinctrl-wmt.c +++ b/drivers/pinctrl/vt8500/pinctrl-wmt.c @@ -276,7 +276,20 @@ static int wmt_pctl_dt_node_to_map_pull(struct wmt_pinctrl_data *data, if (!configs) return -ENOMEM; - configs[0] = pull; + switch (pull) { + case 0: + configs[0] = PIN_CONFIG_BIAS_DISABLE; + break; + case 1: + configs[0] = PIN_CONFIG_BIAS_PULL_DOWN; + break; + case 2: + configs[0] = PIN_CONFIG_BIAS_PULL_UP; + break; + default: + configs[0] = PIN_CONFIG_BIAS_DISABLE; + dev_err(data->dev, "invalid pull state %d - disabling\n", pull); + } map->type = PIN_MAP_TYPE_CONFIGS_PIN; map->data.configs.group_or_pin = data->groups[group]; -- 1.7.9.5 -- 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] vt8500: pinctrl: Change devicetree data parsing
Due to an assumption in the VT8500 pinctrl driver, the value passed from devicetree for 'wm,pull' was not explicitly translated before being passed to pinconf. Since v3.10, changes to 'enum pin_config_param', PIN_CONFIG_BIAS_PULL_(UP/DOWN) no longer map 1-to-1 with the expected values in devicetree. This patch adds a small translation between the devicetree values (0..2) and the enum pin_config_param equivalent values. Signed-off-by: Tony Prisk --- v2: Minor change in commit message to indicate time since problem occurred. Change assigned variable to configs[0] rather than reassigning to pull. Add a default case to the switch to prevent static checker errors. drivers/pinctrl/vt8500/pinctrl-wmt.c | 15 ++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/pinctrl/vt8500/pinctrl-wmt.c b/drivers/pinctrl/vt8500/pinctrl-wmt.c index 39aec08..25ab2ee 100644 --- a/drivers/pinctrl/vt8500/pinctrl-wmt.c +++ b/drivers/pinctrl/vt8500/pinctrl-wmt.c @@ -276,7 +276,20 @@ static int wmt_pctl_dt_node_to_map_pull(struct wmt_pinctrl_data *data, if (!configs) return -ENOMEM; - configs[0] = pull; + switch (pull) { + case 0: + configs[0] = PIN_CONFIG_BIAS_DISABLE; + break; + case 1: + configs[0] = PIN_CONFIG_BIAS_PULL_DOWN; + break; + case 2: + configs[0] = PIN_CONFIG_BIAS_PULL_UP; + break; + default: + configs[0] = PIN_CONFIG_BIAS_DISABLE; + dev_err(data->dev, "invalid pull state %d - disabling\n", pull); + } map->type = PIN_MAP_TYPE_CONFIGS_PIN; map->data.configs.group_or_pin = data->groups[group]; -- 1.7.9.5 -- 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: vt8500: Update maintained files for arch/vt8500
Removed maintainership of the ehci-platform.c and uhci-platform.c drivers. These drivers are not solely used by arch-vt8500 anymore, and are captured under Alan Stern's 'USB EHCI DRIVER' and 'USB UHCI DRIVER' wildcards. Add maintainership for the VT8500's clock, irq and pinctrl drivers which were added/migrated quite some time ago. Signed-off-by: Tony Prisk --- MAINTAINERS |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 6a6e4ac..ac26897 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1341,14 +1341,15 @@ M: Tony Prisk L: linux-arm-ker...@lists.infradead.org (moderated for non-subscribers) S: Maintained F: arch/arm/mach-vt8500/ +F: drivers/clk/clk-vt8500.c F: drivers/clocksource/vt8500_timer.c F: drivers/i2c/busses/i2c-wmt.c +F: drivers/irqchip/irq-vt8500.c F: drivers/mmc/host/wmt-sdmmc.c +F: drivers/pinctrl/vt8500/ F: drivers/pwm/pwm-vt8500.c F: drivers/rtc/rtc-vt8500.c F: drivers/tty/serial/vt8500_serial.c -F: drivers/usb/host/ehci-platform.c -F: drivers/usb/host/uhci-platform.c F: drivers/video/vt8500lcdfb.* F: drivers/video/wm8505fb* F: drivers/video/wmt_ge_rops.* -- 1.7.9.5 -- 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] serial: vt8500: Add missing binding document for arch-vt8500 serial driver.
The binding document for the vt8500/wm8xxx SoC UART driver is missing. This patch adds the binding document. Signed-off-by: Tony Prisk --- .../devicetree/bindings/serial/vt8500-uart.txt | 26 1 file changed, 26 insertions(+) create mode 100644 Documentation/devicetree/bindings/serial/vt8500-uart.txt diff --git a/Documentation/devicetree/bindings/serial/vt8500-uart.txt b/Documentation/devicetree/bindings/serial/vt8500-uart.txt new file mode 100644 index 000..795c393 --- /dev/null +++ b/Documentation/devicetree/bindings/serial/vt8500-uart.txt @@ -0,0 +1,26 @@ +* VIA VT8500 and WonderMedia WM8xxx UART Controller + +Required properties: +- compatible: should be "via,vt8500-uart" + +- reg: base physical address of the controller and length of memory mapped + region. + +- interrupts: hardware interrupt number + +- clocks: shall be the input parent clock phandle for the clock. This should + be the 24Mhz reference clock. + +Aliases may be defined to ensure the correct ordering of the uarts. + +Example: + aliases { + serial0 = &uart0; + }; + + uart0: serial@d820 { + compatible = "via,vt8500-uart"; + reg = <0xd820 0x1040>; + interrupts = <32>; + clocks = <&clkuart0>; + }; -- 1.7.9.5 -- 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] vt8500: pinctrl: Change devicetree data parsing
Due to an assumption in the VT8500 pinctrl driver, the value passed from devicetree for 'wm,pull' was not explicitly translated before being passed to pinconf. With changes to 'enum pin_config_param', PIN_CONFIG_BIAS_PULL_(UP/DOWN) no longer map 1-to-1 with the expected values in devicetree. This patch adds a small translation between the devicetree values (0..2) and the enum pin_config_param equivalent values. Signed-off-by: Tony Prisk --- drivers/pinctrl/vt8500/pinctrl-wmt.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/drivers/pinctrl/vt8500/pinctrl-wmt.c b/drivers/pinctrl/vt8500/pinctrl-wmt.c index 39aec08..fa4fdbd 100644 --- a/drivers/pinctrl/vt8500/pinctrl-wmt.c +++ b/drivers/pinctrl/vt8500/pinctrl-wmt.c @@ -276,6 +276,17 @@ static int wmt_pctl_dt_node_to_map_pull(struct wmt_pinctrl_data *data, if (!configs) return -ENOMEM; + switch (pull) { + case 0: + pull = PIN_CONFIG_BIAS_DISABLE; + break; + case 1: + pull = PIN_CONFIG_BIAS_PULL_DOWN; + break; + case 2: + pull = PIN_CONFIG_BIAS_PULL_UP; + break; + } configs[0] = pull; map->type = PIN_MAP_TYPE_CONFIGS_PIN; -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] arm: vt8500: Fix gpio mux setup in vt8500_init()
With the switch to a pinctrl driver, and the dropping of the gpio driver, the code in vt8500_init now always fails, and drops back to LEGACY mode. Update the gpio mux init code, and removing the #ifdef's and the LEGACY mode fallback. Signed-off-by: Tony Prisk --- arch/arm/mach-vt8500/vt8500.c | 91 ++--- 1 file changed, 30 insertions(+), 61 deletions(-) diff --git a/arch/arm/mach-vt8500/vt8500.c b/arch/arm/mach-vt8500/vt8500.c index 4a73464..fe5243e 100644 --- a/arch/arm/mach-vt8500/vt8500.c +++ b/arch/arm/mach-vt8500/vt8500.c @@ -32,9 +32,6 @@ #include #include -#define LEGACY_GPIO_BASE 0xD811 -#define LEGACY_PMC_BASE0xD813 - /* Registers in GPIO Controller */ #define VT8500_GPIO_MUX_REG0x200 @@ -75,89 +72,61 @@ static void vt8500_power_off(void) void __init vt8500_init(void) { struct device_node *np; -#if defined(CONFIG_FB_VT8500) || defined(CONFIG_FB_WM8505) struct device_node *fb; - void __iomem *gpio_base; -#endif + void __iomem *base; -#ifdef CONFIG_FB_VT8500 fb = of_find_compatible_node(NULL, NULL, "via,vt8500-fb"); if (fb) { - np = of_find_compatible_node(NULL, NULL, "via,vt8500-gpio"); - if (np) { - gpio_base = of_iomap(np, 0); - - if (!gpio_base) - pr_err("%s: of_iomap(gpio_mux) failed\n", - __func__); + np = of_find_compatible_node(NULL, NULL, "via,vt8500-pinctrl"); + if (!np) { + pr_err("pinctrl node required for framebuffer\n"); + BUG(); + } - of_node_put(np); + base = of_iomap(np, 0); + if (base) { + writel(readl(base + VT8500_GPIO_MUX_REG) | 1, + base + VT8500_GPIO_MUX_REG); + iounmap(base); } else { - gpio_base = ioremap(LEGACY_GPIO_BASE, 0x1000); - if (!gpio_base) - pr_err("%s: ioremap(legacy_gpio_mux) failed\n", - __func__); + pr_err("%s: of_iomap(gpio_mux) failed\n", __func__); } - if (gpio_base) { - writel(readl(gpio_base + VT8500_GPIO_MUX_REG) | 1, - gpio_base + VT8500_GPIO_MUX_REG); - iounmap(gpio_base); - } else - pr_err("%s: Could not remap GPIO mux\n", __func__); + of_node_put(np); of_node_put(fb); } -#endif -#ifdef CONFIG_FB_WM8505 fb = of_find_compatible_node(NULL, NULL, "wm,wm8505-fb"); if (fb) { - np = of_find_compatible_node(NULL, NULL, "wm,wm8505-gpio"); - if (!np) - np = of_find_compatible_node(NULL, NULL, - "wm,wm8650-gpio"); - if (np) { - gpio_base = of_iomap(np, 0); - - if (!gpio_base) - pr_err("%s: of_iomap(gpio_mux) failed\n", - __func__); - - of_node_put(np); + np = of_find_compatible_node(NULL, NULL, "wm,prizm-pinctrl"); + if (!np) { + pr_err("pinctrl node required for framebuffer\n"); + BUG(); + } + + base = of_iomap(np, 0); + if (base) { + writel(readl(base + VT8500_GPIO_MUX_REG) | + 0x8000, base + VT8500_GPIO_MUX_REG); + iounmap(base); } else { - gpio_base = ioremap(LEGACY_GPIO_BASE, 0x1000); - if (!gpio_base) - pr_err("%s: ioremap(legacy_gpio_mux) failed\n", - __func__); + pr_err("%s: of_iomap(gpio_mux) failed\n", __func__); } - if (gpio_base) { - writel(readl(gpio_base + VT8500_GPIO_MUX_REG) | - 0x8000, gpio_base + VT8500_GPIO_MUX_REG); - iounmap(gpio_base); - } else - pr_err("%s: Could not remap GPIO mux\n", __func__); + of_node_put(np); of_node_put(fb); } -#endif np = of_find_compatible_node(NULL, NU
Re: [PATCH 07/26] clk: vt8500: parse pmc_base from clock driver
On 20/09/13 18:23, Sebastian Hesselbarth wrote: On 09/20/2013 06:51 AM, Tony Prisk wrote: On 20/09/13 07:12, Sebastian Hesselbarth wrote: On 09/19/2013 09:02 PM, Tony Prisk wrote: On 19/09/13 05:53, Sebastian Hesselbarth wrote: Currently, clock providers for vt8500 depend on machine_init providing pmc_base address before calling of_clk_init. With upcoming arch-wide .time_init calling of_clk_init, we should make clock providers independent of mach code. This adds a pmc_base parsing helper to current clock provider that gets called if there is no pmc_base set, yet. Signed-off-by: Sebastian Hesselbarth --- Cc: Olof Johansson Cc: Arnd Bergmann Cc: Tony Prisk Cc: Mike Turquette Cc: linux-arm-ker...@lists.infradead.org Cc: linux-kernel@vger.kernel.org --- drivers/clk/clk-vt8500.c | 21 + 1 file changed, 21 insertions(+) diff --git a/drivers/clk/clk-vt8500.c b/drivers/clk/clk-vt8500.c index 82306f5..a5ee01c 100644 --- a/drivers/clk/clk-vt8500.c +++ b/drivers/clk/clk-vt8500.c @@ -15,11 +15,14 @@ #include #include +#include #include #include #include #include +#define LEGACY_PMC_BASE0xD813 + /* All clocks share the same lock as none can be changed concurrently */ static DEFINE_SPINLOCK(_lock); @@ -626,6 +629,21 @@ const struct clk_ops vtwm_pll_ops = { .recalc_rate = vtwm_pll_recalc_rate, }; +static __init void vtwm_set_pmc_base(void) +{ +struct device_node *np = +of_find_compatible_node(NULL, NULL, "via,vt8500-pmc"); + +if (np) +pmc_base = of_iomap(np, 0); +else +pmc_base = ioremap(LEGACY_PMC_BASE, 0x1000); +of_node_put(np); + +if (!pmc_base) +pr_err("%s:of_iomap(pmc) failed\n", __func__); +} + static __init void vtwm_pll_clk_init(struct device_node *node, int pll_type) { u32 reg; @@ -636,6 +654,9 @@ static __init void vtwm_pll_clk_init(struct device_node *node, int pll_type) struct clk_init_data init; int rc; +if (!pmc_base) +vtwm_set_pmc_base(); + rc = of_property_read_u32(node, "reg", ®); if (WARN_ON(rc)) return; What happens if the first clock registered is a 'device clock' rather than a 'pll'? static __init void vtwm_device_clk_init(struct device_node *node) { u32 en_reg, div_reg; struct clk *clk; struct clk_device *dev_clk; const char *clk_name = node->name; const char *parent_name; struct clk_init_data init; int rc; int clk_init_flags = 0; dev_clk = kzalloc(sizeof(*dev_clk), GFP_KERNEL); if (WARN_ON(!dev_clk)) return; dev_clk->lock = &_lock; rc = of_property_read_u32(node, "enable-reg", &en_reg); if (!rc) { dev_clk->en_reg = pmc_base + en_reg; ... } CLK_OF_DECLARE(vt8500_device, "via,vt8500-device-clock", vtwm_device_clk_init); If a device clock is initialized first, pmc_base will be null and dev_clk->en_reg (+ other register offsets) will be incorrect. Tony, looks like I just missed to add the same check for !pmc_base to vtwm_device_clk_init. If you are ok with the general approach, I send v2 for this patch shortly. Optionally, you can also choose to take care of clk-vt8500 yourself, as mach-vt8500 has its own .init_time callback and will be unaffected by the arch-wide default callback. If so, I will drop vt8500 to not stall this series too much now. Sebastian I have no issue with the concept - just pointing out the missing bit. If you can fix that small issue for v2 then you can also add my: Acked-by: Tony Prisk Just to make sure, does that also count for the other vt8500 patches? Sebastian Sorry, I should have been more specific. For the whole series (vt8500-related): Acked-by: Tony Prisk Regards Tony P -- 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 07/26] clk: vt8500: parse pmc_base from clock driver
On 20/09/13 07:12, Sebastian Hesselbarth wrote: On 09/19/2013 09:02 PM, Tony Prisk wrote: On 19/09/13 05:53, Sebastian Hesselbarth wrote: Currently, clock providers for vt8500 depend on machine_init providing pmc_base address before calling of_clk_init. With upcoming arch-wide .time_init calling of_clk_init, we should make clock providers independent of mach code. This adds a pmc_base parsing helper to current clock provider that gets called if there is no pmc_base set, yet. Signed-off-by: Sebastian Hesselbarth --- Cc: Olof Johansson Cc: Arnd Bergmann Cc: Tony Prisk Cc: Mike Turquette Cc: linux-arm-ker...@lists.infradead.org Cc: linux-kernel@vger.kernel.org --- drivers/clk/clk-vt8500.c | 21 + 1 file changed, 21 insertions(+) diff --git a/drivers/clk/clk-vt8500.c b/drivers/clk/clk-vt8500.c index 82306f5..a5ee01c 100644 --- a/drivers/clk/clk-vt8500.c +++ b/drivers/clk/clk-vt8500.c @@ -15,11 +15,14 @@ #include #include +#include #include #include #include #include +#define LEGACY_PMC_BASE0xD813 + /* All clocks share the same lock as none can be changed concurrently */ static DEFINE_SPINLOCK(_lock); @@ -626,6 +629,21 @@ const struct clk_ops vtwm_pll_ops = { .recalc_rate = vtwm_pll_recalc_rate, }; +static __init void vtwm_set_pmc_base(void) +{ +struct device_node *np = +of_find_compatible_node(NULL, NULL, "via,vt8500-pmc"); + +if (np) +pmc_base = of_iomap(np, 0); +else +pmc_base = ioremap(LEGACY_PMC_BASE, 0x1000); +of_node_put(np); + +if (!pmc_base) +pr_err("%s:of_iomap(pmc) failed\n", __func__); +} + static __init void vtwm_pll_clk_init(struct device_node *node, int pll_type) { u32 reg; @@ -636,6 +654,9 @@ static __init void vtwm_pll_clk_init(struct device_node *node, int pll_type) struct clk_init_data init; int rc; +if (!pmc_base) +vtwm_set_pmc_base(); + rc = of_property_read_u32(node, "reg", ®); if (WARN_ON(rc)) return; What happens if the first clock registered is a 'device clock' rather than a 'pll'? static __init void vtwm_device_clk_init(struct device_node *node) { u32 en_reg, div_reg; struct clk *clk; struct clk_device *dev_clk; const char *clk_name = node->name; const char *parent_name; struct clk_init_data init; int rc; int clk_init_flags = 0; dev_clk = kzalloc(sizeof(*dev_clk), GFP_KERNEL); if (WARN_ON(!dev_clk)) return; dev_clk->lock = &_lock; rc = of_property_read_u32(node, "enable-reg", &en_reg); if (!rc) { dev_clk->en_reg = pmc_base + en_reg; ... } CLK_OF_DECLARE(vt8500_device, "via,vt8500-device-clock", vtwm_device_clk_init); If a device clock is initialized first, pmc_base will be null and dev_clk->en_reg (+ other register offsets) will be incorrect. Tony, looks like I just missed to add the same check for !pmc_base to vtwm_device_clk_init. If you are ok with the general approach, I send v2 for this patch shortly. Optionally, you can also choose to take care of clk-vt8500 yourself, as mach-vt8500 has its own .init_time callback and will be unaffected by the arch-wide default callback. If so, I will drop vt8500 to not stall this series too much now. Sebastian I have no issue with the concept - just pointing out the missing bit. If you can fix that small issue for v2 then you can also add my: Acked-by: Tony Prisk Regards Tony P -- 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 07/26] clk: vt8500: parse pmc_base from clock driver
On 19/09/13 05:53, Sebastian Hesselbarth wrote: Currently, clock providers for vt8500 depend on machine_init providing pmc_base address before calling of_clk_init. With upcoming arch-wide .time_init calling of_clk_init, we should make clock providers independent of mach code. This adds a pmc_base parsing helper to current clock provider that gets called if there is no pmc_base set, yet. Signed-off-by: Sebastian Hesselbarth --- Cc: Olof Johansson Cc: Arnd Bergmann Cc: Tony Prisk Cc: Mike Turquette Cc: linux-arm-ker...@lists.infradead.org Cc: linux-kernel@vger.kernel.org --- drivers/clk/clk-vt8500.c | 21 + 1 file changed, 21 insertions(+) diff --git a/drivers/clk/clk-vt8500.c b/drivers/clk/clk-vt8500.c index 82306f5..a5ee01c 100644 --- a/drivers/clk/clk-vt8500.c +++ b/drivers/clk/clk-vt8500.c @@ -15,11 +15,14 @@ #include #include +#include #include #include #include #include +#define LEGACY_PMC_BASE 0xD813 + /* All clocks share the same lock as none can be changed concurrently */ static DEFINE_SPINLOCK(_lock); @@ -626,6 +629,21 @@ const struct clk_ops vtwm_pll_ops = { .recalc_rate = vtwm_pll_recalc_rate, }; +static __init void vtwm_set_pmc_base(void) +{ + struct device_node *np = + of_find_compatible_node(NULL, NULL, "via,vt8500-pmc"); + + if (np) + pmc_base = of_iomap(np, 0); + else + pmc_base = ioremap(LEGACY_PMC_BASE, 0x1000); + of_node_put(np); + + if (!pmc_base) + pr_err("%s:of_iomap(pmc) failed\n", __func__); +} + static __init void vtwm_pll_clk_init(struct device_node *node, int pll_type) { u32 reg; @@ -636,6 +654,9 @@ static __init void vtwm_pll_clk_init(struct device_node *node, int pll_type) struct clk_init_data init; int rc; + if (!pmc_base) + vtwm_set_pmc_base(); + rc = of_property_read_u32(node, "reg", ®); if (WARN_ON(rc)) return; What happens if the first clock registered is a 'device clock' rather than a 'pll'? static __init void vtwm_device_clk_init(struct device_node *node) { u32 en_reg, div_reg; struct clk *clk; struct clk_device *dev_clk; const char *clk_name = node->name; const char *parent_name; struct clk_init_data init; int rc; int clk_init_flags = 0; dev_clk = kzalloc(sizeof(*dev_clk), GFP_KERNEL); if (WARN_ON(!dev_clk)) return; dev_clk->lock = &_lock; rc = of_property_read_u32(node, "enable-reg", &en_reg); if (!rc) { dev_clk->en_reg = pmc_base + en_reg; ... } CLK_OF_DECLARE(vt8500_device, "via,vt8500-device-clock", vtwm_device_clk_init); If a device clock is initialized first, pmc_base will be null and dev_clk->en_reg (+ other register offsets) will be incorrect. Regards Tony Prisk -- 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] dts: wandboard: Add support for SDIO bcm4329
The wandboard has a Broadcom 4329 WiFi connected via SDIO. This patch sets the required pins to enable the wifi module. Signed-off-by: Tony Prisk --- arch/arm/boot/dts/imx6qdl-wandboard.dtsi | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/arch/arm/boot/dts/imx6qdl-wandboard.dtsi b/arch/arm/boot/dts/imx6qdl-wandboard.dtsi index 7a46f64..2fb0e9b 100644 --- a/arch/arm/boot/dts/imx6qdl-wandboard.dtsi +++ b/arch/arm/boot/dts/imx6qdl-wandboard.dtsi @@ -73,9 +73,14 @@ hog { pinctrl_hog: hoggrp { fsl,pins = < - MX6QDL_PAD_GPIO_0__CCM_CLKO10x130b0 - MX6QDL_PAD_GPIO_2__GPIO1_IO02 0x8000 - MX6QDL_PAD_EIM_DA9__GPIO3_IO09 0x8000 + MX6QDL_PAD_GPIO_0__CCM_CLKO1 0x130b0 + MX6QDL_PAD_GPIO_2__GPIO1_IO020x8000 + MX6QDL_PAD_EIM_DA9__GPIO3_IO09 0x8000 + MX6QDL_PAD_EIM_EB1__GPIO2_IO29 0x8000 /* WL_REF_ON */ + MX6QDL_PAD_EIM_A25__GPIO5_IO02 0x8000 /* WL_RST_N */ + MX6QDL_PAD_ENET_RXD1__GPIO1_IO26 0x8000 /* WL_REG_ON */ + MX6QDL_PAD_ENET_TXD1__GPIO1_IO29 0x8000 /* WL_HOST_WAKE */ + MX6QDL_PAD_ENET_TXD0__GPIO1_IO30 0x8000 /* WL_WAKE */ >; }; }; -- 1.7.9.5 -- 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] irqchip: vt8500: Staticize local symbols
On 04/07/13 18:11, Axel Lin wrote: This driver is converted to use IRQCHIP_DECLARE and irqchip_init. vt8500_handle_irq() and vt8500_irq_init() are only referenced in this file now, make them static. Signed-off-by: Axel Lin --- drivers/irqchip/irq-vt8500.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/irqchip/irq-vt8500.c b/drivers/irqchip/irq-vt8500.c index d970595..1846e7d 100644 --- a/drivers/irqchip/irq-vt8500.c +++ b/drivers/irqchip/irq-vt8500.c @@ -178,7 +178,8 @@ static struct irq_domain_ops vt8500_irq_domain_ops = { .xlate = irq_domain_xlate_onecell, }; -asmlinkage void __exception_irq_entry vt8500_handle_irq(struct pt_regs *regs) +static asmlinkage +void __exception_irq_entry vt8500_handle_irq(struct pt_regs *regs) { u32 stat, i; int irqnr, virq; @@ -203,7 +204,8 @@ asmlinkage void __exception_irq_entry vt8500_handle_irq(struct pt_regs *regs) } } -int __init vt8500_irq_init(struct device_node *node, struct device_node *parent) +static int __init vt8500_irq_init(struct device_node *node, + struct device_node *parent) I prefer that the function variables are lined up, rather than aligning with the (. Can you move the 'struct device_node *parent' across one more space? Otherwise: Acked-by: Tony Prisk { int irq, i; struct device_node *np = node; Regards Tony P -- 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 -next] pinctrl: vt8500: wmt: remove redundant dev_err call in wmt_pinctrl_probe()
On 26/06/13 13:56, Wei Yongjun wrote: From: Wei Yongjun There is a error message within devm_ioremap_resource already, so remove the dev_err call to avoid redundant error message. Signed-off-by: Wei Yongjun --- drivers/pinctrl/vt8500/pinctrl-wmt.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/pinctrl/vt8500/pinctrl-wmt.c b/drivers/pinctrl/vt8500/pinctrl-wmt.c index fb30edf3..0cc4335 100644 --- a/drivers/pinctrl/vt8500/pinctrl-wmt.c +++ b/drivers/pinctrl/vt8500/pinctrl-wmt.c @@ -570,10 +570,8 @@ int wmt_pinctrl_probe(struct platform_device *pdev, res = platform_get_resource(pdev, IORESOURCE_MEM, 0); data->base = devm_ioremap_resource(&pdev->dev, res); - if (IS_ERR(data->base)) { - dev_err(&pdev->dev, "failed to map memory resource\n"); + if (IS_ERR(data->base)) return PTR_ERR(data->base); - } wmt_desc.pins = data->pins; wmt_desc.npins = data->npins; Acked-by: Tony Prisk Regards Tony P -- 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] pinctrl: establish pull-up/pull-down terminology
On 16/06/13 22:45, Linus Walleij wrote: From: Linus Walleij It is counter-intuitive to have "0" mean disable in a boolean manner for electronic properties of pins such as pull-up and pull-down. Therefore, define that a pull-up/pull-down argument of 0 to such a generic option means that the pin is short-circuited to VDD or GROUND. Pull disablement shall be done using PIN_CONFIG_BIAS_DISABLE. Cc: Heiko St�bner Cc: James Hogan Cc: Laurent Pinchart Signed-off-by: Linus Walleij --- include/linux/pinctrl/pinconf-generic.h | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/include/linux/pinctrl/pinconf-generic.h b/include/linux/pinctrl/pinconf-generic.h index d414a77..67780f5 100644 --- a/include/linux/pinctrl/pinconf-generic.h +++ b/include/linux/pinctrl/pinconf-generic.h @@ -36,14 +36,15 @@ *tristate. The argument is ignored. * @PIN_CONFIG_BIAS_PULL_UP: the pin will be pulled up (usually with high *impedance to VDD). If the argument is != 0 pull-up is enabled, - * if it is 0, pull-up is disabled. + * if it is 0, pull-up it total, i.e. the pin is connected to VDD. s/it/is * @PIN_CONFIG_BIAS_PULL_DOWN: the pin will be pulled down (usually with high *impedance to GROUND). If the argument is != 0 pull-down is enabled, - * if it is 0, pull-down is disabled. + * if it is 0, pull-down is total, i.e. the pin is connected to GROUND. * @PIN_CONFIG_BIAS_PULL_PIN_DEFAULT: the pin will be pulled up or down based *on embedded knowledge of the controller, like current mux function. - * If the argument is != 0 pull up/down is enabled, if it is 0, - * the pull is disabled. + * If the argument is != 0 pull up/down is enabled, if it is 0, the + * configuration is ignored. The proper way to disable it is to use + * @PIN_CONFIG_BIAS_DISABLE. * @PIN_CONFIG_DRIVE_PUSH_PULL: the pin will be driven actively high and *low, this is the most typical case and is typically achieved with two *active transistors on the output. Setting this config will enable @@ -72,8 +73,8 @@ *supplies, the argument to this parameter (on a custom format) tells *the driver which alternative power source to use. * @PIN_CONFIG_SLEW_RATE: if the pin can select slew rate, the argument to - * this parameter (on a custom format) tells the driver which alternative - * slew rate to use. + * this parameter (on a custom format) tells the driver which alternative + * slew rate to use. * @PIN_CONFIG_LOW_POWER_MODE: this will configure the pin for low power *operation, if several modes of operation are supported these can be *passed in the argument on a custom form, else just use argument 1 ___ linux-arm-kernel mailing list linux-arm-ker...@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v3] i2c: vt8500: Add support for I2C bus on Wondermedia SoCs
On 15/06/13 23:18, Wolfram Sang wrote: On Sat, Jun 15, 2013 at 09:52:16AM +1200, Tony Prisk wrote: This patch adds support for the I2C bus controllers found on Wondermedia 8xxx-series SoCs. Only master-mode is supported. Signed-off-by: Tony Prisk --- ... +/* REG_TR */ +#define SCL_TIMEOUT(x) (((x) & 0xFF) << 16) I assume this should be << 8 since all regs are 16 bit wide. Fixed it locally and ready to apply. Please confirm or send a proper fix. Rest looks fine. Thanks for the submission! It should be << 8. Please apply your locally corrected version. Regards Tony Prisk -- 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] i2c: vt8500: Add support for I2C bus on Wondermedia SoCs
This patch adds support for the I2C bus controllers found on Wondermedia 8xxx-series SoCs. Only master-mode is supported. Signed-off-by: Tony Prisk --- v3 changes: Included the v2 changes for clarity. Tidy up the I2C_NO_START code properly. Remove the alias handling and allow the core to do it. Change MODULE_LICENSE to "GPL" as per module.h comments. v2 changes: Rewrite wmt_i2c_wait_bus_not_busy() as per Wolfram/Russell. Fix init_completion and INIT_COMPLETION usages. Remove magic value in wmt_i2c_reset_hardware(). Remove test for (!np) in wmt_i2c_probe() as we only support devicetree anyway. Remove reference to ->class = I2C_CLASS_HWMON. .../devicetree/bindings/i2c/i2c-vt8500.txt | 24 + MAINTAINERS|1 + drivers/i2c/busses/Kconfig | 10 + drivers/i2c/busses/Makefile|1 + drivers/i2c/busses/i2c-wmt.c | 479 5 files changed, 515 insertions(+) create mode 100644 Documentation/devicetree/bindings/i2c/i2c-vt8500.txt create mode 100644 drivers/i2c/busses/i2c-wmt.c diff --git a/Documentation/devicetree/bindings/i2c/i2c-vt8500.txt b/Documentation/devicetree/bindings/i2c/i2c-vt8500.txt new file mode 100644 index 000..94a425e --- /dev/null +++ b/Documentation/devicetree/bindings/i2c/i2c-vt8500.txt @@ -0,0 +1,24 @@ +* Wondermedia I2C Controller + +Required properties : + + - compatible : should be "wm,wm8505-i2c" + - reg : Offset and length of the register set for the device + - interrupts : where IRQ is the interrupt number + - clocks : phandle to the I2C clock source + +Optional properties : + + - clock-frequency : desired I2C bus clock frequency in Hz. + Valid values are 10 and 40. + Default to 10 if not specified, or invalid value. + +Example : + + i2c_0: i2c@d828 { + compatible = "wm,wm8505-i2c"; + reg = <0xd828 0x1000>; + interrupts = <19>; + clocks = <&clki2c0>; + clock-frequency = <40>; + }; diff --git a/MAINTAINERS b/MAINTAINERS index 3d7782b..44ea994 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1285,6 +1285,7 @@ S:Maintained F: arch/arm/mach-vt8500/ F: drivers/clocksource/vt8500_timer.c F: drivers/gpio/gpio-vt8500.c +F: drivers/i2c/busses/i2c-wmt.c F: drivers/mmc/host/wmt-sdmmc.c F: drivers/pwm/pwm-vt8500.c F: drivers/rtc/rtc-vt8500.c diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig index 631736e..89e7ec2 100644 --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig @@ -724,6 +724,16 @@ config I2C_VERSATILE This driver can also be built as a module. If so, the module will be called i2c-versatile. +config I2C_WMT + tristate "Wondermedia WM8xxx SoC I2C bus support" + depends on ARCH_VT8500 + help + Say yes if you want to support the I2C bus on Wondermedia 8xxx-series + SoCs. + + This driver can also be built as a module. If so, the module will be + called i2c-wmt. + config I2C_OCTEON tristate "Cavium OCTEON I2C bus support" depends on CPU_CAVIUM_OCTEON diff --git a/drivers/i2c/busses/Makefile b/drivers/i2c/busses/Makefile index 8f4fc23..3ba94a9 100644 --- a/drivers/i2c/busses/Makefile +++ b/drivers/i2c/busses/Makefile @@ -71,6 +71,7 @@ obj-$(CONFIG_I2C_SIRF)+= i2c-sirf.o obj-$(CONFIG_I2C_STU300) += i2c-stu300.o obj-$(CONFIG_I2C_TEGRA)+= i2c-tegra.o obj-$(CONFIG_I2C_VERSATILE)+= i2c-versatile.o +obj-$(CONFIG_I2C_WMT) += i2c-wmt.o obj-$(CONFIG_I2C_OCTEON) += i2c-octeon.o obj-$(CONFIG_I2C_XILINX) += i2c-xiic.o obj-$(CONFIG_I2C_XLR) += i2c-xlr.o diff --git a/drivers/i2c/busses/i2c-wmt.c b/drivers/i2c/busses/i2c-wmt.c new file mode 100644 index 000..19f6f35 --- /dev/null +++ b/drivers/i2c/busses/i2c-wmt.c @@ -0,0 +1,479 @@ +/* + * Wondermedia I2C Master Mode Driver + * + * Copyright (C) 2012 Tony Prisk + * + * Derived from GPLv2+ licensed source: + * - Copyright (C) 2008 WonderMedia Technologies, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, or + * (at your option) any later version. as published by the Free Software + * Foundation + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define REG_CR 0x00 +#define REG_TCR0x02 +#define REG_CSR0x04 +#define REG_ISR0x06 +#define REG_IMR0x08 +#define REG_CDR0x0A +#define REG_TR 0x0C +#define REG_MCR0x0E +#define REG_SLAVE_CR 0x10 +#define REG_SLAVE_SR 0x1
[PATCH v2] i2c: vt8500: Add support for I2C bus on Wondermedia SoCs
This patch adds support for the I2C bus controllers found on Wondermedia 8xxx-series SoCs. Only master-mode is supported. Signed-off-by: Tony Prisk --- .../devicetree/bindings/i2c/i2c-vt8500.txt | 24 + MAINTAINERS|1 + drivers/i2c/busses/Kconfig | 10 + drivers/i2c/busses/Makefile|1 + drivers/i2c/busses/i2c-wmt.c | 483 5 files changed, 519 insertions(+) create mode 100644 Documentation/devicetree/bindings/i2c/i2c-vt8500.txt create mode 100644 drivers/i2c/busses/i2c-wmt.c diff --git a/Documentation/devicetree/bindings/i2c/i2c-vt8500.txt b/Documentation/devicetree/bindings/i2c/i2c-vt8500.txt new file mode 100644 index 000..94a425e --- /dev/null +++ b/Documentation/devicetree/bindings/i2c/i2c-vt8500.txt @@ -0,0 +1,24 @@ +* Wondermedia I2C Controller + +Required properties : + + - compatible : should be "wm,wm8505-i2c" + - reg : Offset and length of the register set for the device + - interrupts : where IRQ is the interrupt number + - clocks : phandle to the I2C clock source + +Optional properties : + + - clock-frequency : desired I2C bus clock frequency in Hz. + Valid values are 10 and 40. + Default to 10 if not specified, or invalid value. + +Example : + + i2c_0: i2c@d828 { + compatible = "wm,wm8505-i2c"; + reg = <0xd828 0x1000>; + interrupts = <19>; + clocks = <&clki2c0>; + clock-frequency = <40>; + }; diff --git a/MAINTAINERS b/MAINTAINERS index 3d7782b..44ea994 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1285,6 +1285,7 @@ S:Maintained F: arch/arm/mach-vt8500/ F: drivers/clocksource/vt8500_timer.c F: drivers/gpio/gpio-vt8500.c +F: drivers/i2c/busses/i2c-wmt.c F: drivers/mmc/host/wmt-sdmmc.c F: drivers/pwm/pwm-vt8500.c F: drivers/rtc/rtc-vt8500.c diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig index 631736e..89e7ec2 100644 --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig @@ -724,6 +724,16 @@ config I2C_VERSATILE This driver can also be built as a module. If so, the module will be called i2c-versatile. +config I2C_WMT + tristate "Wondermedia WM8xxx SoC I2C bus support" + depends on ARCH_VT8500 + help + Say yes if you want to support the I2C bus on Wondermedia 8xxx-series + SoCs. + + This driver can also be built as a module. If so, the module will be + called i2c-wmt. + config I2C_OCTEON tristate "Cavium OCTEON I2C bus support" depends on CPU_CAVIUM_OCTEON diff --git a/drivers/i2c/busses/Makefile b/drivers/i2c/busses/Makefile index 8f4fc23..3ba94a9 100644 --- a/drivers/i2c/busses/Makefile +++ b/drivers/i2c/busses/Makefile @@ -71,6 +71,7 @@ obj-$(CONFIG_I2C_SIRF)+= i2c-sirf.o obj-$(CONFIG_I2C_STU300) += i2c-stu300.o obj-$(CONFIG_I2C_TEGRA)+= i2c-tegra.o obj-$(CONFIG_I2C_VERSATILE)+= i2c-versatile.o +obj-$(CONFIG_I2C_WMT) += i2c-wmt.o obj-$(CONFIG_I2C_OCTEON) += i2c-octeon.o obj-$(CONFIG_I2C_XILINX) += i2c-xiic.o obj-$(CONFIG_I2C_XLR) += i2c-xlr.o diff --git a/drivers/i2c/busses/i2c-wmt.c b/drivers/i2c/busses/i2c-wmt.c new file mode 100644 index 000..2bbac9b --- /dev/null +++ b/drivers/i2c/busses/i2c-wmt.c @@ -0,0 +1,483 @@ +/* + * Wondermedia I2C Master Mode Driver + * + * Copyright (C) 2012 Tony Prisk + * + * Derived from GPLv2+ licensed source: + * - Copyright (C) 2008 WonderMedia Technologies, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, or + * (at your option) any later version. as published by the Free Software + * Foundation + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define REG_CR 0x00 +#define REG_TCR0x02 +#define REG_CSR0x04 +#define REG_ISR0x06 +#define REG_IMR0x08 +#define REG_CDR0x0A +#define REG_TR 0x0C +#define REG_MCR0x0E +#define REG_SLAVE_CR 0x10 +#define REG_SLAVE_SR 0x12 +#define REG_SLAVE_ISR 0x14 +#define REG_SLAVE_IMR 0x16 +#define REG_SLAVE_DR 0x18 +#define REG_SLAVE_TR 0x1A + +/* REG_CR Bit fields */ +#define CR_TX_NEXT_ACK 0x +#define CR_ENABLE 0x0001 +#define CR_TX_NEXT_NO_ACK 0x0002 +#define CR_TX_END 0x0004 +#define CR_CPU_RDY 0x0008 +#define SLAV_MODE_SEL 0x8000 + +/* REG_TCR Bit fields */ +#define TCR_STANDARD_MODE 0x +#define TCR_MASTER_WRITE 0x +#define TCR_HS_MODE
Re: [PATCH 4/4] MAINTAINERS: vt8500: Add clk-vt8500.c to MAINTAINERS file
On 30/05/13 11:16, Mike Turquette wrote: Quoting Tony Prisk (2013-05-18 01:30:21) On 18/05/13 18:40, Alexey Charkov wrote: On 18 May 2013 01:18, "Tony Prisk" wrote: This file has missed being added under ARM/VT8500 ARM ARCHITECTURE, and is maintained along with the rest of the vt8500 arch code. Signed-off-by: Tony Prisk --- MAINTAINERS |1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index 3d7782b..5ab8ccb 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1283,6 +1283,7 @@ M: Tony Prisk L: linux-arm-ker...@lists.infradead.org (moderated for non-subscribers) S: Maintained F: arch/arm/mach-vt8500/ +F: drivers/clk/vt8500-vt8500.c This looks like a typo (clk vs. vt8500). Best, Alexey eeek - oops. Mike, Disregard this patch - I will send a more complete one through arm-soc as there are other files missing as well. Hi Tony, I've taken patch #1 into clk-fixes. I took patches #2 & #3 into clk-next from your previous series posted on May 13, which appear identical to the ones in this series. In the future could you put a "v2" in the patch subject since those patches were re-posted? It would have helped me catch it. I have not taken patch #4. Does this all sound correct to you? Thanks, Mike Regards Tony P Perfect - Thanks Mike Regards Tony P -- 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] i2c: vt8500: Add support for I2C bus on Wondermedia SoCs
On 12/05/13 21:23, Tony Prisk wrote: This patch adds support for the I2C bus controllers found on Wondermedia 8xxx-series SoCs. Only master-mode is supported. Signed-off-by: Tony Prisk --- .../devicetree/bindings/i2c/i2c-vt8500.txt | 24 + MAINTAINERS|1 + drivers/i2c/busses/Kconfig | 10 + drivers/i2c/busses/Makefile|1 + drivers/i2c/busses/i2c-wmt.c | 488 5 files changed, 524 insertions(+) create mode 100644 Documentation/devicetree/bindings/i2c/i2c-vt8500.txt create mode 100644 drivers/i2c/busses/i2c-wmt.c This patch seems to have stalled. Any news? Regards Tony Prisk -- 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/4] FB updates for 3.11
On 18/05/13 21:15, Tony Prisk wrote: Patch #1 - Move register defines inside the driver and drop the header. Patch #2 - Convert the register defines to use the vendor preferred names. Patch #3 - Add a device clock to wm8505fb. Without it, only the uboot initialized resolution is supported. Patch #4 - Add support for the VGA output found on the APC8750 board. Tony Prisk (4): fb: vt8500: Move register defines inside driver fb: vt8500: Convert to use vendor register names fb: vt8500: Require a device clock for wm8505fb driver fb: vt8500: Add VGA output support to wm8505fb driver. .../devicetree/bindings/video/wm,wm8505-fb.txt |9 +- drivers/video/wm8505fb.c | 195 -- drivers/video/wm8505fb_regs.h | 76 -- drivers/video/wmt_ge_rops.c| 280 +++- 4 files changed, 394 insertions(+), 166 deletions(-) delete mode 100644 drivers/video/wm8505fb_regs.h Florian/Tomi, Please ignore these patches. This driver needs a bit more work, so I will do a more thorough series and resubmit. Regards Tony Prisk -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/2] pinctrl: Don't override the error code in probe error handling
On 19/05/13 17:58, Axel Lin wrote: Otherwise, we return 0 in probe error paths when gpiochip_remove() returns 0. Also show error message if gpiochip_remove() fails. Signed-off-by: Axel Lin Cc: Linus Walleij Cc: Maxime Ripard Cc: Tony Prisk --- drivers/pinctrl/pinctrl-coh901.c | 3 ++- drivers/pinctrl/pinctrl-sunxi.c | 3 ++- drivers/pinctrl/vt8500/pinctrl-wmt.c | 3 +-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/pinctrl/pinctrl-coh901.c b/drivers/pinctrl/pinctrl-coh901.c index 20da215..ea98df9 100644 --- a/drivers/pinctrl/pinctrl-coh901.c +++ b/drivers/pinctrl/pinctrl-coh901.c @@ -830,7 +830,8 @@ static int __init u300_gpio_probe(struct platform_device *pdev) return 0; err_no_range: - err = gpiochip_remove(&gpio->chip); + if (gpiochip_remove(&gpio->chip)) + dev_err(&pdev->dev, "failed to remove gpio chip\n"); err_no_chip: err_no_domain: err_no_port: diff --git a/drivers/pinctrl/pinctrl-sunxi.c b/drivers/pinctrl/pinctrl-sunxi.c index c52fc2c..c058529 100644 --- a/drivers/pinctrl/pinctrl-sunxi.c +++ b/drivers/pinctrl/pinctrl-sunxi.c @@ -2000,7 +2000,8 @@ static int sunxi_pinctrl_probe(struct platform_device *pdev) return 0; gpiochip_error: - ret = gpiochip_remove(pctl->chip); + if (gpiochip_remove(pctl->chip)) + dev_err(&pdev->dev, "failed to remove gpio chip\n"); pinctrl_error: pinctrl_unregister(pctl->pctl_dev); return ret; diff --git a/drivers/pinctrl/vt8500/pinctrl-wmt.c b/drivers/pinctrl/vt8500/pinctrl-wmt.c index e877082..fb30edf3 100644 --- a/drivers/pinctrl/vt8500/pinctrl-wmt.c +++ b/drivers/pinctrl/vt8500/pinctrl-wmt.c @@ -609,8 +609,7 @@ int wmt_pinctrl_probe(struct platform_device *pdev, return 0; fail_range: - err = gpiochip_remove(&data->gpio_chip); - if (err) + if (gpiochip_remove(&data->gpio_chip)) dev_err(&pdev->dev, "failed to remove gpio chip\n"); fail_gpio: pinctrl_unregister(data->pctl_dev); Good catch. for pinctrl-wmt Acked-by: Tony Prisk Regards Tony P -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 4/4] fb: vt8500: Add VGA output support to wm8505fb driver.
On 19/05/13 01:28, Alexey Charkov wrote: 2013/5/18 Tony Prisk : The APC8750 does not support an LCD panel, but provides a VGA connector. This patch adds support for the VGA interface, and defines an optional devicetree property to specify the output interface. The default if not specified is LCD for backward compatibility. Signed-off-by: Tony Prisk --- .../devicetree/bindings/video/wm,wm8505-fb.txt |5 drivers/video/wm8505fb.c | 31 ++-- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/video/wm,wm8505-fb.txt b/Documentation/devicetree/bindings/video/wm,wm8505-fb.txt index 601416c..9f1d648 100644 --- a/Documentation/devicetree/bindings/video/wm,wm8505-fb.txt +++ b/Documentation/devicetree/bindings/video/wm,wm8505-fb.txt @@ -7,6 +7,10 @@ Required properties: - bits-per-pixel : bit depth of framebuffer (16 or 32) - clocks : phandle to DVO clock +Optional properties: +- output-interface : the interface the fb should output on. Valid values are + "lcd" or "vga". If not specified, the default is "lcd". + Required subnodes: - display-timings: see display-timing.txt for information @@ -17,6 +21,7 @@ Example: reg = <0xd8051700 0x200>; bits-per-pixel = <16>; clocks = <&clkdvo>; + output-interface = "vga"; display-timings { native-mode = <&timing0>; diff --git a/drivers/video/wm8505fb.c b/drivers/video/wm8505fb.c index f8bffc2..d1f7f33 100644 --- a/drivers/video/wm8505fb.c +++ b/drivers/video/wm8505fb.c @@ -130,12 +130,17 @@ #define to_wm8505fb_info(__info) container_of(__info, \ struct wm8505fb_info, fb) + +#define INTERFACE_LCD 1 +#define INTERFACE_VGA 2 + struct wm8505fb_info { struct fb_info fb; void __iomem *regbase; unsigned int contrast; struct device *dev; struct clk *clk_dvo; + int interface; }; @@ -158,7 +163,11 @@ static int wm8505fb_init_hw(struct fb_info *info) * 0x31C sets the correct color mode (RGB565) for WM8650 * Bit 8+9 (0x300) are ignored on WM8505 as reserved */ - writel(0x31c, fbi->regbase + REG_GOVRH_YUVRGB); + if (fbi->interface == INTERFACE_VGA) + writel(0x338, fbi->regbase + REG_GOVRH_YUVRGB); + else + writel(0x31c, fbi->regbase + REG_GOVRH_YUVRGB); + writel(1, fbi->regbase + REG_GOVRH_DVO_PIX); Tony, Would it be possible to also define known bit offsets for those registers, while you are at this? It would probably reduce the black magic quite a bit :) On my list of things to do :) /* Virtual buffer size */ @@ -167,7 +176,12 @@ static int wm8505fb_init_hw(struct fb_info *info) /* black magic ;) */ writel(0xf,fbi->regbase + REG_GOVRH_FHI); - writel(4, fbi->regbase + REG_GOVRH_DVO_SET); + + if (fbi->interface == INTERFACE_VGA) + writel(0xe, fbi->regbase + REG_GOVRH_DVO_SET); + else + writel(4, fbi->regbase + REG_GOVRH_DVO_SET); I don't remember if HDMI is yet another option for this register or not... If it is, it would probably warrant defining fbi->interface as an enum and changing this if-else into a switch statement to let the compiler add its checks/warnings. This register defines the h/v syncpolarity and enable/disable for DVO. writel(1, fbi->regbase + REG_GOVRH_MIF); writel(1, fbi->regbase + REG_GOVRH_REG_STS); @@ -194,11 +208,15 @@ static int wm8505fb_set_timing(struct fb_info *info) writel(h_end, fbi->regbase + REG_GOVRH_ACTPX_END); writel(h_all, fbi->regbase + REG_GOVRH_H_ALLPXL); writel(h_sync, fbi->regbase + REG_GOVRH_HDMI_HSYNW); + if (fbi->interface == INTERFACE_VGA) + writel(h_sync, fbi->regbase + REG_GOVRH_VGA_HSYNW); Will it misbehave on LCD if you write to the VGA register unconditionally? Don't know - wouldn't imagine so. I will test it and see. writel(v_start, fbi->regbase + REG_GOVRH_ACTLN_BG); writel(v_end, fbi->regbase + REG_GOVRH_ACTLN_END); writel(v_all, fbi->regbase + REG_GOVRH_V_ALLLN); writel(v_sync, fbi->regbase + REG_GOVRH_HDMI_VBISW); + if (fbi->interface == INTERFACE_VGA) + writel(info->var.pixclock, fbi->regbase + REG_GOVRH_VGA_VSYNW); Same here. I would assume that setting the pixclock should not hurt LCD, which would then simplify the code a little. Thanks, Alexey Regards Tony Prisk -- To unsubscribe from this list: send the line &
[PATCHv9 3/3] net: velocity: Add platform device support to VIA velocity driver
Add support for the VIA Velocity network driver to be bound to a OF created platform device. Signed-off-by: Tony Prisk --- .../devicetree/bindings/net/via-velocity.txt | 20 + drivers/net/ethernet/via/Kconfig |3 +- drivers/net/ethernet/via/via-velocity.c| 408 ++-- drivers/net/ethernet/via/via-velocity.h|3 +- 4 files changed, 305 insertions(+), 129 deletions(-) create mode 100644 Documentation/devicetree/bindings/net/via-velocity.txt diff --git a/Documentation/devicetree/bindings/net/via-velocity.txt b/Documentation/devicetree/bindings/net/via-velocity.txt new file mode 100644 index 000..b3db469 --- /dev/null +++ b/Documentation/devicetree/bindings/net/via-velocity.txt @@ -0,0 +1,20 @@ +* VIA Velocity 10/100/1000 Network Controller + +Required properties: +- compatible : Should be "via,velocity-vt6110" +- reg : Address and length of the io space +- interrupts : Should contain the controller interrupt line + +Optional properties: +- no-eeprom : PCI network cards use an external EEPROM to store data. Embedded + devices quite often set this data in uboot and do not provide an eeprom. + Specify this option if you have no external eeprom. + +Examples: + +eth0@d8004000 { + compatible = "via,velocity-vt6110"; + reg = <0xd8004000 0x400>; + interrupts = <10>; + no-eeprom; +}; diff --git a/drivers/net/ethernet/via/Kconfig b/drivers/net/ethernet/via/Kconfig index 68a9ba6..6a87097 100644 --- a/drivers/net/ethernet/via/Kconfig +++ b/drivers/net/ethernet/via/Kconfig @@ -5,7 +5,6 @@ config NET_VENDOR_VIA bool "VIA devices" default y - depends on PCI ---help--- If you have a network (Ethernet) card belonging to this class, say Y and read the Ethernet-HOWTO, available from @@ -45,7 +44,7 @@ config VIA_RHINE_MMIO config VIA_VELOCITY tristate "VIA Velocity support" - depends on PCI + depends on (PCI || USE_OF) select CRC32 select CRC_CCITT select NET_CORE diff --git a/drivers/net/ethernet/via/via-velocity.c b/drivers/net/ethernet/via/via-velocity.c index 5996cee..7691994 100644 --- a/drivers/net/ethernet/via/via-velocity.c +++ b/drivers/net/ethernet/via/via-velocity.c @@ -65,7 +65,11 @@ #include #include #include +#include +#include +#include #include +#include #include #include #include @@ -80,10 +84,24 @@ #include "via-velocity.h" +enum velocity_bus_type { + BUS_PCI, + BUS_PLATFORM, +}; static int velocity_nics; static int msglevel = MSG_LEVEL_INFO; +static void velocity_set_power_state(struct velocity_info *vptr, char state) +{ + void *addr = vptr->mac_regs; + + if (vptr->pdev) + pci_set_power_state(vptr->pdev, state); + else + writeb(state, addr + 0x154); +} + /** * mac_get_cam_mask- Read a CAM mask * @regs: register block for this velocity @@ -362,12 +380,23 @@ static struct velocity_info_tbl chip_info_table[] = { * Describe the PCI device identifiers that we support in this * device driver. Used for hotplug autoloading. */ -static DEFINE_PCI_DEVICE_TABLE(velocity_id_table) = { + +static DEFINE_PCI_DEVICE_TABLE(velocity_pci_id_table) = { { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_612X) }, { } }; -MODULE_DEVICE_TABLE(pci, velocity_id_table); +MODULE_DEVICE_TABLE(pci, velocity_pci_id_table); + +/** + * Describe the OF device identifiers that we support in this + * device driver. Used for devicetree nodes. + */ +static struct of_device_id velocity_of_ids[] = { + { .compatible = "via,velocity-vt6110", .data = &chip_info_table[0] }, + { /* Sentinel */ }, +}; +MODULE_DEVICE_TABLE(of, velocity_of_ids); /** * get_chip_name - identifier to name @@ -386,29 +415,6 @@ static const char *get_chip_name(enum chip_type chip_id) } /** - * velocity_remove1- device unplug - * @pdev: PCI device being removed - * - * Device unload callback. Called on an unplug or on module - * unload for each active device that is present. Disconnects - * the device from the network layer and frees all the resources - */ -static void velocity_remove1(struct pci_dev *pdev) -{ - struct net_device *dev = pci_get_drvdata(pdev); - struct velocity_info *vptr = netdev_priv(dev); - - unregister_netdev(dev); - iounmap(vptr->mac_regs); - pci_release_regions(pdev); - pci_disable_device(pdev); - pci_set_drvdata(pdev, NULL); - free_netdev(dev); - - velocity_nics--; -} - -/** * velocity_set_int_opt- parser for integer options * @opt: pointer to option value * @val: value the user requested (or -1 for default) @@ -1181,6 +1187,17 @@ static void
[PATCHv9 1/3] net: velocity: Rename vptr->dev to vptr->netdev
Improve the clarity of the code in preparation for converting the dma functions to generic versions, which require a struct device *. This makes it possible to store a 'struct device *dev' in the velocity_info structure. Signed-off-by: Tony Prisk --- drivers/net/ethernet/via/via-velocity.c | 66 +++ drivers/net/ethernet/via/via-velocity.h |4 +- 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/drivers/net/ethernet/via/via-velocity.c b/drivers/net/ethernet/via/via-velocity.c index fb62489..187eef3 100644 --- a/drivers/net/ethernet/via/via-velocity.c +++ b/drivers/net/ethernet/via/via-velocity.c @@ -998,9 +998,9 @@ static void velocity_print_link_status(struct velocity_info *vptr) { if (vptr->mii_status & VELOCITY_LINK_FAIL) { - VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: failed to detect cable link\n", vptr->dev->name); + VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: failed to detect cable link\n", vptr->netdev->name); } else if (vptr->options.spd_dpx == SPD_DPX_AUTO) { - VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: Link auto-negotiation", vptr->dev->name); + VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: Link auto-negotiation", vptr->netdev->name); if (vptr->mii_status & VELOCITY_SPEED_1000) VELOCITY_PRT(MSG_LEVEL_INFO, " speed 1000M bps"); @@ -1014,7 +1014,7 @@ static void velocity_print_link_status(struct velocity_info *vptr) else VELOCITY_PRT(MSG_LEVEL_INFO, " half duplex\n"); } else { - VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: Link forced", vptr->dev->name); + VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: Link forced", vptr->netdev->name); switch (vptr->options.spd_dpx) { case SPD_DPX_1000_FULL: VELOCITY_PRT(MSG_LEVEL_INFO, " speed 1000M bps full duplex\n"); @@ -1319,7 +1319,7 @@ static void velocity_init_registers(struct velocity_info *vptr, case VELOCITY_INIT_RESET: case VELOCITY_INIT_WOL: - netif_stop_queue(vptr->dev); + netif_stop_queue(vptr->netdev); /* * Reset RX to prevent RX pointer not on the 4X location @@ -1332,7 +1332,7 @@ static void velocity_init_registers(struct velocity_info *vptr, if (velocity_set_media_mode(vptr, mii_status) != VELOCITY_LINK_CHANGE) { velocity_print_link_status(vptr); if (!(vptr->mii_status & VELOCITY_LINK_FAIL)) - netif_wake_queue(vptr->dev); + netif_wake_queue(vptr->netdev); } enable_flow_control_ability(vptr); @@ -1354,7 +1354,7 @@ static void velocity_init_registers(struct velocity_info *vptr, mac_eeprom_reload(regs); for (i = 0; i < 6; i++) - writeb(vptr->dev->dev_addr[i], &(regs->PAR[i])); + writeb(vptr->netdev->dev_addr[i], &(regs->PAR[i])); /* * clear Pre_ACPI bit. @@ -1377,7 +1377,7 @@ static void velocity_init_registers(struct velocity_info *vptr, /* * Set packet filter: Receive directed and broadcast address */ - velocity_set_multi(vptr->dev); + velocity_set_multi(vptr->netdev); /* * Enable MII auto-polling @@ -1404,14 +1404,14 @@ static void velocity_init_registers(struct velocity_info *vptr, writel((CR0_DPOLL | CR0_TXON | CR0_RXON | CR0_STRT), ®s->CR0Set); mii_status = velocity_get_opt_media_mode(vptr); - netif_stop_queue(vptr->dev); + netif_stop_queue(vptr->netdev); mii_init(vptr, mii_status); if (velocity_set_media_mode(vptr, mii_status) != VELOCITY_LINK_CHANGE) { velocity_print_link_status(vptr); if (!(vptr->mii_status & VELOCITY_LINK_FAIL)) - netif_wake_queue(vptr->dev); + netif_wake_queue(vptr->netdev); } enable_flow_control_ability(vptr); @@ -1474,7 +1474,7 @@ static int velocity_init_dma_rings(struct velocity_info *vptr) rx_ring_size, &pool_dma); if (!pool) { dev_err(&pdev->dev, "%s : DMA memory allocation failed.\n", - vptr->dev->name); + vptr->netd
[PATCHv9 2/3] net: velocity: Convert to generic dma functions
Remove the pci_* dma functions and replace with the more generic versions. In preparation of adding platform support, a new struct device *dev is added to struct velocity_info which can be used by both the pci and platform code. Signed-off-by: Tony Prisk --- drivers/net/ethernet/via/via-velocity.c | 51 +++ drivers/net/ethernet/via/via-velocity.h |1 + 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/drivers/net/ethernet/via/via-velocity.c b/drivers/net/ethernet/via/via-velocity.c index 187eef3..5996cee 100644 --- a/drivers/net/ethernet/via/via-velocity.c +++ b/drivers/net/ethernet/via/via-velocity.c @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include @@ -1459,7 +1460,6 @@ static int velocity_init_dma_rings(struct velocity_info *vptr) struct velocity_opt *opt = &vptr->options; const unsigned int rx_ring_size = opt->numrx * sizeof(struct rx_desc); const unsigned int tx_ring_size = opt->numtx * sizeof(struct tx_desc); - struct pci_dev *pdev = vptr->pdev; dma_addr_t pool_dma; void *pool; unsigned int i; @@ -1467,13 +1467,13 @@ static int velocity_init_dma_rings(struct velocity_info *vptr) /* * Allocate all RD/TD rings a single pool. * -* pci_alloc_consistent() fulfills the requirement for 64 bytes +* dma_alloc_coherent() fulfills the requirement for 64 bytes * alignment */ - pool = pci_alloc_consistent(pdev, tx_ring_size * vptr->tx.numq + - rx_ring_size, &pool_dma); + pool = dma_alloc_coherent(vptr->dev, tx_ring_size * vptr->tx.numq + + rx_ring_size, &pool_dma, GFP_ATOMIC); if (!pool) { - dev_err(&pdev->dev, "%s : DMA memory allocation failed.\n", + dev_err(vptr->dev, "%s : DMA memory allocation failed.\n", vptr->netdev->name); return -ENOMEM; } @@ -1524,8 +1524,8 @@ static int velocity_alloc_rx_buf(struct velocity_info *vptr, int idx) */ skb_reserve(rd_info->skb, 64 - ((unsigned long) rd_info->skb->data & 63)); - rd_info->skb_dma = pci_map_single(vptr->pdev, rd_info->skb->data, - vptr->rx.buf_sz, PCI_DMA_FROMDEVICE); + rd_info->skb_dma = dma_map_single(vptr->dev, rd_info->skb->data, + vptr->rx.buf_sz, DMA_FROM_DEVICE); /* * Fill in the descriptor to match @@ -1588,8 +1588,8 @@ static void velocity_free_rd_ring(struct velocity_info *vptr) if (!rd_info->skb) continue; - pci_unmap_single(vptr->pdev, rd_info->skb_dma, vptr->rx.buf_sz, -PCI_DMA_FROMDEVICE); + dma_unmap_single(vptr->dev, rd_info->skb_dma, vptr->rx.buf_sz, +DMA_FROM_DEVICE); rd_info->skb_dma = 0; dev_kfree_skb(rd_info->skb); @@ -1670,7 +1670,7 @@ static void velocity_free_dma_rings(struct velocity_info *vptr) const int size = vptr->options.numrx * sizeof(struct rx_desc) + vptr->options.numtx * sizeof(struct tx_desc) * vptr->tx.numq; - pci_free_consistent(vptr->pdev, size, vptr->rx.ring, vptr->rx.pool_dma); + dma_free_coherent(vptr->dev, size, vptr->rx.ring, vptr->rx.pool_dma); } static int velocity_init_rings(struct velocity_info *vptr, int mtu) @@ -1727,8 +1727,8 @@ static void velocity_free_tx_buf(struct velocity_info *vptr, pktlen = max_t(size_t, pktlen, td->td_buf[i].size & ~TD_QUEUE); - pci_unmap_single(vptr->pdev, tdinfo->skb_dma[i], - le16_to_cpu(pktlen), PCI_DMA_TODEVICE); + dma_unmap_single(vptr->dev, tdinfo->skb_dma[i], + le16_to_cpu(pktlen), DMA_TO_DEVICE); } } dev_kfree_skb_irq(skb); @@ -1750,8 +1750,8 @@ static void velocity_free_td_ring_entry(struct velocity_info *vptr, if (td_info->skb) { for (i = 0; i < td_info->nskb_dma; i++) { if (td_info->skb_dma[i]) { - pci_unmap_single(vptr->pdev, td_info->skb_dma[i], - td_info->skb->len, PCI_DMA_TODEVICE); + dma_unmap_single(vptr->dev, td_info->skb_dma[i], + td_info->skb->len, DMA_TO_DEVICE); td_in
[PATCHv9 0/3] Add support for velocity network driver on platform devices
v9 changes: Code tidyup as requested by Francois Romieu. v8 changes: Remove velocity_choose_state from via-velocity.h: unused function. v7 changes: Forgot to merge a patch to fix an error with the pm ops changes. Apologies Dave. v6 changes: Remove more bus specific code from velocity_probe() Make velocity_(suspend/resume) accept a struct device * Simplify PM code to use velocity_(suspend/resume) - remove the individual pci and platform functions. Add a struct pci_dev variable to velocity_get_pci_info() to reduce churn v5 changes: Remove velocity_info union. Change velocity_info->pdev back to struct pci_dev. Remove more 'if (pci)' sections. Remove 'void *pdev' function parameters. Pass correct variable to velocity_choose_state() v4 changes: Code tidyup as requested by Francois Romieu Removed '#ifdef PCI' around PCI code. Compile tested on (!)PCI and (!)PM. v3 changes: Rebased against net-next. Fix errors in pm code. v2 changes: Drop patch #1 as requested by David Miller. Correct the PHYID_ICPLUS_IP101A MII bits - should be ON, rather than OFF. Read the platform rev_id from the correct register [regs->rev_id]. It's possible this would work for the PCI version as well and would remove the need for the 'if (pci)' test to set vptr->rev_id. v1: The first three patches are general tidyup. [DROPPED] Patch ## just alphabetizes the #includes to make it easier to read. Patch #1 replaces vptr->dev with vptr->netdev, in preparation of adding a struct device *dev in Patch #2 Patch #2 replaces the pci dma functions with the generic versions. I have build tested these patches but don't have a PCI velocity to run-test it. I can't see that they should introduce any problems as it is all renames and function swapping. Patch #3 adds support for the velocity driver on devicetree platform devices. Binding document included. This patch is compile-tested for PCI, and boot tested on a VIA APC8750. I think it would be pertinent to get some tested-by's for PCI users. Regards Tony Prisk Tony Prisk (3): net: velocity: Rename vptr->dev to vptr->netdev net: velocity: Convert to generic dma functions net: velocity: Add platform device support to VIA velocity driver .../devicetree/bindings/net/via-velocity.txt | 20 + drivers/net/ethernet/via/Kconfig |3 +- drivers/net/ethernet/via/via-velocity.c| 507 +--- drivers/net/ethernet/via/via-velocity.h|8 +- 4 files changed, 357 insertions(+), 181 deletions(-) create mode 100644 Documentation/devicetree/bindings/net/via-velocity.txt -- 1.7.9.5 -- 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/4] fb: vt8500: Move register defines inside driver
The #defines in wm8505fb_regs.h are only used in the wm8505fb driver, and don't need to be visible outside. Move the defines into the driver and remove the header. Signed-off-by: Tony Prisk --- drivers/video/wm8505fb.c | 25 +- drivers/video/wm8505fb_regs.h | 76 - 2 files changed, 24 insertions(+), 77 deletions(-) delete mode 100644 drivers/video/wm8505fb_regs.h diff --git a/drivers/video/wm8505fb.c b/drivers/video/wm8505fb.c index 01f9ace..f824af8 100644 --- a/drivers/video/wm8505fb.c +++ b/drivers/video/wm8505fb.c @@ -34,11 +34,34 @@ #include #include -#include "wm8505fb_regs.h" #include "wmt_ge_rops.h" #define DRIVER_NAME "wm8505-fb" +#define WMT_GOVR_COLORSPACE1 0x030 +#define WMT_GOVR_MIF_ENABLE0x080 +#define WMT_GOVR_FBADDR0x090 +#define WMT_GOVR_FBADDR1 0x094 +#define WMT_GOVR_XRES 0x098 +#define WMT_GOVR_XRES_VIRTUAL 0x09c +#define WMT_GOVR_YPAN 0x0a0 +#define WMT_GOVR_XPAN 0x0a4 +#define WMT_GOVR_FHI 0x0a8 +#define WMT_GOVR_REG_UPDATE0x0e4 +#define WMT_GOVR_TG0x100 +#define WMT_GOVR_TIMING_H_ALL 0x108 +#define WMT_GOVR_TIMING_V_ALL 0x10c +#define WMT_GOVR_TIMING_V_START0x110 +#define WMT_GOVR_TIMING_V_END 0x114 +#define WMT_GOVR_TIMING_H_START0x118 +#define WMT_GOVR_TIMING_H_END 0x11c +#define WMT_GOVR_TIMING_V_SYNC 0x128 +#define WMT_GOVR_TIMING_H_SYNC 0x12c +#define WMT_GOVR_DVO_SET 0x148 +#define WMT_GOVR_CONTRAST 0x1b8 +#define WMT_GOVR_BRGHTNESS 0x1bc +#define WMT_GOVR_COLORSPACE0x1e4 + #define to_wm8505fb_info(__info) container_of(__info, \ struct wm8505fb_info, fb) struct wm8505fb_info { diff --git a/drivers/video/wm8505fb_regs.h b/drivers/video/wm8505fb_regs.h deleted file mode 100644 index 4dd4166..000 --- a/drivers/video/wm8505fb_regs.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * GOVR registers list for WM8505 chips - * - * Copyright (C) 2010 Ed Spiridonov - * Based on VIA/WonderMedia wm8510-govrh-reg.h - * http://github.com/projectgus/kernel_wm8505/blob/wm8505_2.6.29/ - * drivers/video/wmt/register/wm8510/wm8510-govrh-reg.h - * - * This software is licensed under the terms of the GNU General Public - * License version 2, as published by the Free Software Foundation, and - * may be copied, distributed, and modified under those terms. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#ifndef _WM8505FB_REGS_H -#define _WM8505FB_REGS_H - -/* - * Color space select register, default value 0x1c - * BIT0 GOVRH_DVO_YUV2RGB_ENABLE - * BIT1 GOVRH_VGA_YUV2RGB_ENABLE - * BIT2 GOVRH_RGB_MODE - * BIT3 GOVRH_DAC_CLKINV - * BIT4 GOVRH_BLANK_ZERO - */ -#define WMT_GOVR_COLORSPACE0x1e4 -/* - * Another colorspace select register, default value 1 - * BIT0 GOVRH_DVO_RGB - * BIT1 GOVRH_DVO_YUV422 - */ -#define WMT_GOVR_COLORSPACE10x30 - -#define WMT_GOVR_CONTRAST 0x1b8 -#define WMT_GOVR_BRGHTNESS 0x1bc /* incompatible with RGB? */ - -/* Framubeffer address */ -#define WMT_GOVR_FBADDR 0x90 -#define WMT_GOVR_FBADDR10x94 /* UV offset in YUV mode */ - -/* Offset of visible window */ -#define WMT_GOVR_XPAN 0xa4 -#define WMT_GOVR_YPAN 0xa0 - -#define WMT_GOVR_XRES 0x98 -#define WMT_GOVR_XRES_VIRTUAL 0x9c - -#define WMT_GOVR_MIF_ENABLE 0x80 -#define WMT_GOVR_FHI0xa8 -#define WMT_GOVR_REG_UPDATE 0xe4 - -/* - * BIT0 GOVRH_DVO_OUTWIDTH - * BIT1 GOVRH_DVO_SYNC_POLAR - * BIT2 GOVRH_DVO_ENABLE - */ -#define WMT_GOVR_DVO_SET 0x148 - -/* Timing generator? */ -#define WMT_GOVR_TG0x100 - -/* Timings */ -#define WMT_GOVR_TIMING_H_ALL 0x108 -#define WMT_GOVR_TIMING_V_ALL 0x10c -#define WMT_GOVR_TIMING_V_START0x110 -#define WMT_GOVR_TIMING_V_END 0x114 -#define WMT_GOVR_TIMING_H_START0x118 -#define WMT_GOVR_TIMING_H_END 0x11c -#define WMT_GOVR_TIMING_V_SYNC 0x128 -#define WMT_GOVR_TIMING_H_SYNC 0x12c - -#endif /* _WM8505FB_REGS_H */ -- 1.7.9.5 -- 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/4] fb: vt8500: Require a device clock for wm8505fb driver
The wm8505fb driver requires a clock to work properly. Without a clock, the driver can only initialize the display resolution that was set in uboot. This patch updates the driver to get and use a clock, and updates the devicetree documentation to indicate the requirement for a clock. Signed-off-by: Tony Prisk --- .../devicetree/bindings/video/wm,wm8505-fb.txt |4 ++- drivers/video/wm8505fb.c | 30 +--- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/Documentation/devicetree/bindings/video/wm,wm8505-fb.txt b/Documentation/devicetree/bindings/video/wm,wm8505-fb.txt index 0bcadb2..601416c 100644 --- a/Documentation/devicetree/bindings/video/wm,wm8505-fb.txt +++ b/Documentation/devicetree/bindings/video/wm,wm8505-fb.txt @@ -5,6 +5,7 @@ Required properties: - compatible : "wm,wm8505-fb" - reg : Should contain 1 register ranges(address and length) - bits-per-pixel : bit depth of framebuffer (16 or 32) +- clocks : phandle to DVO clock Required subnodes: - display-timings: see display-timing.txt for information @@ -15,11 +16,12 @@ Example: compatible = "wm,wm8505-fb"; reg = <0xd8051700 0x200>; bits-per-pixel = <16>; + clocks = <&clkdvo>; display-timings { native-mode = <&timing0>; timing0: 800x480 { - clock-frequency = <0>; /* unused but required */ + clock-frequency = <3000>; hactive = <800>; vactive = <480>; hfront-porch = <40>; diff --git a/drivers/video/wm8505fb.c b/drivers/video/wm8505fb.c index 167a9e2..f8bffc2 100644 --- a/drivers/video/wm8505fb.c +++ b/drivers/video/wm8505fb.c @@ -14,6 +14,7 @@ * GNU General Public License for more details. */ +#include #include #include #include @@ -130,9 +131,11 @@ #define to_wm8505fb_info(__info) container_of(__info, \ struct wm8505fb_info, fb) struct wm8505fb_info { - struct fb_info fb; - void __iomem*regbase; - unsigned intcontrast; + struct fb_info fb; + void __iomem *regbase; + unsigned int contrast; + struct device *dev; + struct clk *clk_dvo; }; @@ -210,6 +213,13 @@ static int wm8505fb_set_par(struct fb_info *info) if (!fbi) return -EINVAL; + if (info->var.pixclock == 0) { + dev_err(fbi->dev, "requested pixclock = 0\n"); + return -EINVAL; + } + + clk_set_rate(fbi->clk_dvo, PICOS2KHZ(info->var.pixclock)*1000); + if (info->var.bits_per_pixel == 32) { info->var.red.offset = 16; info->var.red.length = 8; @@ -369,6 +379,8 @@ static int wm8505fb_probe(struct platform_device *pdev) return -ENOMEM; } + fbi->dev = &pdev->dev; + strcpy(fbi->fb.fix.id, DRIVER_NAME); fbi->fb.fix.type= FB_TYPE_PACKED_PIXELS; @@ -408,6 +420,14 @@ static int wm8505fb_probe(struct platform_device *pdev) if (ret) return ret; + fbi->clk_dvo = of_clk_get(pdev->dev.of_node, 0); + if (IS_ERR(fbi->clk_dvo)) { + dev_err(&pdev->dev, "Error retrieving clock\n"); + return PTR_ERR(fbi->clk_dvo); + } + + clk_prepare_enable(fbi->clk_dvo); + fb_videomode_to_var(&fbi->fb.var, &mode); fbi->fb.var.nonstd = 0; @@ -421,7 +441,7 @@ static int wm8505fb_probe(struct platform_device *pdev) fb_mem_virt = dmam_alloc_coherent(&pdev->dev, fb_mem_len, &fb_mem_phys, GFP_KERNEL); if (!fb_mem_virt) { - pr_err("%s: Failed to allocate framebuffer\n", __func__); + dev_err(&pdev->dev, "Failed to allocate framebuffer\n"); return -ENOMEM; } @@ -480,6 +500,8 @@ static int wm8505fb_remove(struct platform_device *pdev) unregister_framebuffer(&fbi->fb); + clk_disable_unprepare(fbi->clk_dvo); + writel(0, fbi->regbase); if (fbi->fb.cmap.len) -- 1.7.9.5 -- 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/4] fb: vt8500: Convert to use vendor register names
Change all the #defines to match the vendor defined names, and change the references in wm8505fb.c and wmt_ge_rops.c. Add all the missing register offsets as well to prevent churn in the future. Signed-off-by: Tony Prisk --- drivers/video/wm8505fb.c| 159 drivers/video/wmt_ge_rops.c | 280 +-- 2 files changed, 332 insertions(+), 107 deletions(-) diff --git a/drivers/video/wm8505fb.c b/drivers/video/wm8505fb.c index f824af8..167a9e2 100644 --- a/drivers/video/wm8505fb.c +++ b/drivers/video/wm8505fb.c @@ -38,29 +38,94 @@ #define DRIVER_NAME "wm8505-fb" -#define WMT_GOVR_COLORSPACE1 0x030 -#define WMT_GOVR_MIF_ENABLE0x080 -#define WMT_GOVR_FBADDR0x090 -#define WMT_GOVR_FBADDR1 0x094 -#define WMT_GOVR_XRES 0x098 -#define WMT_GOVR_XRES_VIRTUAL 0x09c -#define WMT_GOVR_YPAN 0x0a0 -#define WMT_GOVR_XPAN 0x0a4 -#define WMT_GOVR_FHI 0x0a8 -#define WMT_GOVR_REG_UPDATE0x0e4 -#define WMT_GOVR_TG0x100 -#define WMT_GOVR_TIMING_H_ALL 0x108 -#define WMT_GOVR_TIMING_V_ALL 0x10c -#define WMT_GOVR_TIMING_V_START0x110 -#define WMT_GOVR_TIMING_V_END 0x114 -#define WMT_GOVR_TIMING_H_START0x118 -#define WMT_GOVR_TIMING_H_END 0x11c -#define WMT_GOVR_TIMING_V_SYNC 0x128 -#define WMT_GOVR_TIMING_H_SYNC 0x12c -#define WMT_GOVR_DVO_SET 0x148 -#define WMT_GOVR_CONTRAST 0x1b8 -#define WMT_GOVR_BRGHTNESS 0x1bc -#define WMT_GOVR_COLORSPACE0x1e4 +#define REG_GOVRH_CUR_ADDR 0x +#define REG_GOVRH_CUR_WIDTH0x0004 +#define REG_GOVRH_CUR_FB_WIDTH 0x0008 +#define REG_GOVRH_CUR_VCROP0x000C +#define REG_GOVRH_CUR_HCROP0x0010 +#define REG_GOVRH_CUR_HCOORD 0x0014 +#define REG_GOVRH_CUR_VCOORD 0x0018 +#define REG_GOVRH_CUR_STATUS 0x001C +#define REG_GOVRH_CUR_COLOR_KEY0x0020 +#define REG_GOVRH_DVO_PIX 0x0030 +#define REG_GOVRH_DVO_DLY_SEL 0x0034 +#define REG_GOVRH_INT 0x0038 +#define REG_GOVRH_DVO_BLANK_DATA 0x003C +#define REG_GOVRH_DIRPATH 0x0040 /* WM8750+ */ +#define REG_GOVRH_MIF 0x0080 +#define REG_GOVRH_COLFMT 0x0084 +#define REG_GOVRH_SRCFMT 0x0088 +#define REG_GOVRH_DSTFMT 0x008C +#define REG_GOVRH_YSA 0x0090 +#define REG_GOVRH_CSA 0x0094 +#define REG_GOVRH_PIXWID 0x0098 +#define REG_GOVRH_BUFWID 0x009C +#define REG_GOVRH_VCROP0x00A0 +#define REG_GOVRH_HCROP0x00A4 +#define REG_GOVRH_FHI 0x00A8 +#define REG_GOVRH_COLFMT2 0x00AC +#define REG_GOVRH_YSA2 0x00B0 /* WM8950 */ +#define REG_GOVRH_CSA2 0x00B4 /* WM8950 */ +#define REG_GOVRH_MIF_FRAME_MODE 0x00B8 /* WM8950 */ +#define REG_GOVRH_REG_STS 0x00E4 +#define REG_GOVRH_SWFLD0x00E8 +#define REG_GOVRH_TG_ENABLE0x0100 +#define REG_GOVRH_READ_CYC 0x0104 +#define REG_GOVRH_H_ALLPXL 0x0108 +#define REG_GOVRH_V_ALLLN 0x010C +#define REG_GOVRH_ACTLN_BG 0x0110 +#define REG_GOVRH_ACTLN_END0x0114 +#define REG_GOVRH_ACTPX_BG 0x0118 +#define REG_GOVRH_ACTPX_END0x011C +#define REG_GOVRH_VBIE_LINE0x0120 +#define REG_GOVRH_PVBI_LINE0x0124 +#define REG_GOVRH_HDMI_VBISW 0x0128 +#define REG_GOVRH_HDMI_HSYNW 0x012C +#define REG_GOVRH_VSYNC_OFFSET 0x0130 +#define REG_GOVRH_FIELD_STATUS 0x0134 +#define REG_GOVRH_HDMI_3D 0x013C /* WM8950 */ +#define REG_GOVRH_DVO_SET 0x0148 +#define REG_GOVRH_CB_ENABLE0x0150 +#define REG_GOVRH_H_ALLPXL20x0158 +#define REG_GOVRH_V_ALLLN2 0x015C +#define REG_GOVRH_ACTLN_BG20x0160 +#define REG_GOVRH_ACTLN_END2 0x0164 +#define REG_GOVRH_ACTPX_BG20x0168 +#define REG_GOVRH_ACTPX_END2 0x016C +#define REG_GOVRH_VBIE_LINE2 0x0170 +#define REG_GOVRH_PVBI_LINE2 0x0174 +#define REG_GOVRH_HDMI_VBISW2 0x0178 +#define REG_GOVRH_HDMI_HSYNW2 0x017C +#define REG_GOVRH_LVDS_CTRL0x0180 /* WM8750+ */ +#define REG_GOVRH_LVDS_CTRL2 0x0184 /* WM8750+ */ +#define REG_GOVRH_DAC_LP_SENSE_VAL 0x0188 /* WM8750 */ +#define REG_GOVRH_DAC_TEST_MODE0x018C /* WM8750 */ +#define REG_GOVRH_VGA_HSYNW0x0190 /* WM8750 */ +#define REG_GOVRH_VGA_VSYNW0x0194 /* WM8750 */ +#define REG_GOVRH_VGA_SYNPOLAR 0x0198 /* WM8750 */ +#define REG_GOVRH_DAC_MOD 0x019C /* WM8750 */ +#define REG_GOVRH_DAC_VAL 0x01A0 /* WM8750 */ +#define REG_GOVRH_DAC_CON 0x01A4 /* WM8750 *
[PATCH 4/4] fb: vt8500: Add VGA output support to wm8505fb driver.
The APC8750 does not support an LCD panel, but provides a VGA connector. This patch adds support for the VGA interface, and defines an optional devicetree property to specify the output interface. The default if not specified is LCD for backward compatibility. Signed-off-by: Tony Prisk --- .../devicetree/bindings/video/wm,wm8505-fb.txt |5 drivers/video/wm8505fb.c | 31 ++-- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/video/wm,wm8505-fb.txt b/Documentation/devicetree/bindings/video/wm,wm8505-fb.txt index 601416c..9f1d648 100644 --- a/Documentation/devicetree/bindings/video/wm,wm8505-fb.txt +++ b/Documentation/devicetree/bindings/video/wm,wm8505-fb.txt @@ -7,6 +7,10 @@ Required properties: - bits-per-pixel : bit depth of framebuffer (16 or 32) - clocks : phandle to DVO clock +Optional properties: +- output-interface : the interface the fb should output on. Valid values are + "lcd" or "vga". If not specified, the default is "lcd". + Required subnodes: - display-timings: see display-timing.txt for information @@ -17,6 +21,7 @@ Example: reg = <0xd8051700 0x200>; bits-per-pixel = <16>; clocks = <&clkdvo>; + output-interface = "vga"; display-timings { native-mode = <&timing0>; diff --git a/drivers/video/wm8505fb.c b/drivers/video/wm8505fb.c index f8bffc2..d1f7f33 100644 --- a/drivers/video/wm8505fb.c +++ b/drivers/video/wm8505fb.c @@ -130,12 +130,17 @@ #define to_wm8505fb_info(__info) container_of(__info, \ struct wm8505fb_info, fb) + +#define INTERFACE_LCD 1 +#define INTERFACE_VGA 2 + struct wm8505fb_info { struct fb_info fb; void __iomem *regbase; unsigned int contrast; struct device *dev; struct clk *clk_dvo; + int interface; }; @@ -158,7 +163,11 @@ static int wm8505fb_init_hw(struct fb_info *info) * 0x31C sets the correct color mode (RGB565) for WM8650 * Bit 8+9 (0x300) are ignored on WM8505 as reserved */ - writel(0x31c, fbi->regbase + REG_GOVRH_YUVRGB); + if (fbi->interface == INTERFACE_VGA) + writel(0x338, fbi->regbase + REG_GOVRH_YUVRGB); + else + writel(0x31c, fbi->regbase + REG_GOVRH_YUVRGB); + writel(1, fbi->regbase + REG_GOVRH_DVO_PIX); /* Virtual buffer size */ @@ -167,7 +176,12 @@ static int wm8505fb_init_hw(struct fb_info *info) /* black magic ;) */ writel(0xf,fbi->regbase + REG_GOVRH_FHI); - writel(4, fbi->regbase + REG_GOVRH_DVO_SET); + + if (fbi->interface == INTERFACE_VGA) + writel(0xe, fbi->regbase + REG_GOVRH_DVO_SET); + else + writel(4, fbi->regbase + REG_GOVRH_DVO_SET); + writel(1, fbi->regbase + REG_GOVRH_MIF); writel(1, fbi->regbase + REG_GOVRH_REG_STS); @@ -194,11 +208,15 @@ static int wm8505fb_set_timing(struct fb_info *info) writel(h_end, fbi->regbase + REG_GOVRH_ACTPX_END); writel(h_all, fbi->regbase + REG_GOVRH_H_ALLPXL); writel(h_sync, fbi->regbase + REG_GOVRH_HDMI_HSYNW); + if (fbi->interface == INTERFACE_VGA) + writel(h_sync, fbi->regbase + REG_GOVRH_VGA_HSYNW); writel(v_start, fbi->regbase + REG_GOVRH_ACTLN_BG); writel(v_end, fbi->regbase + REG_GOVRH_ACTLN_END); writel(v_all, fbi->regbase + REG_GOVRH_V_ALLLN); writel(v_sync, fbi->regbase + REG_GOVRH_HDMI_VBISW); + if (fbi->interface == INTERFACE_VGA) + writel(info->var.pixclock, fbi->regbase + REG_GOVRH_VGA_VSYNW); writel(1, fbi->regbase + REG_GOVRH_TG_ENABLE); @@ -371,6 +389,7 @@ static int wm8505fb_probe(struct platform_device *pdev) dma_addr_t fb_mem_phys; unsigned long fb_mem_len; void *fb_mem_virt; + const char *intf; fbi = devm_kzalloc(&pdev->dev, sizeof(struct wm8505fb_info) + sizeof(u32) * 16, GFP_KERNEL); @@ -428,6 +447,14 @@ static int wm8505fb_probe(struct platform_device *pdev) clk_prepare_enable(fbi->clk_dvo); + fbi->interface = INTERFACE_LCD; + ret = of_property_read_string(pdev->dev.of_node, "output-interface", + &intf); + if (!ret) { + if (!strcmp(intf, "vga")) + fbi->interface = INTERFACE_VGA; + } + fb_videomode_to_var(&fbi->fb.var, &mode); fbi->fb.var.nonstd = 0; --
[PATCH 0/4] FB updates for 3.11
Patch #1 - Move register defines inside the driver and drop the header. Patch #2 - Convert the register defines to use the vendor preferred names. Patch #3 - Add a device clock to wm8505fb. Without it, only the uboot initialized resolution is supported. Patch #4 - Add support for the VGA output found on the APC8750 board. Tony Prisk (4): fb: vt8500: Move register defines inside driver fb: vt8500: Convert to use vendor register names fb: vt8500: Require a device clock for wm8505fb driver fb: vt8500: Add VGA output support to wm8505fb driver. .../devicetree/bindings/video/wm,wm8505-fb.txt |9 +- drivers/video/wm8505fb.c | 195 -- drivers/video/wm8505fb_regs.h | 76 -- drivers/video/wmt_ge_rops.c| 280 +++- 4 files changed, 394 insertions(+), 166 deletions(-) delete mode 100644 drivers/video/wm8505fb_regs.h -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 4/4] MAINTAINERS: vt8500: Add clk-vt8500.c to MAINTAINERS file
On 18/05/13 18:40, Alexey Charkov wrote: On 18 May 2013 01:18, "Tony Prisk" wrote: This file has missed being added under ARM/VT8500 ARM ARCHITECTURE, and is maintained along with the rest of the vt8500 arch code. Signed-off-by: Tony Prisk --- MAINTAINERS |1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index 3d7782b..5ab8ccb 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1283,6 +1283,7 @@ M: Tony Prisk L: linux-arm-ker...@lists.infradead.org (moderated for non-subscribers) S: Maintained F: arch/arm/mach-vt8500/ +F: drivers/clk/vt8500-vt8500.c This looks like a typo (clk vs. vt8500). Best, Alexey eeek - oops. Mike, Disregard this patch - I will send a more complete one through arm-soc as there are other files missing as well. Regards Tony P -- 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/
[PATCHv8 2/3] net: velocity: Convert to generic dma functions
Remove the pci_* dma functions and replace with the more generic versions. In preparation of adding platform support, a new struct device *dev is added to struct velocity_info which can be used by both the pci and platform code. Signed-off-by: Tony Prisk --- drivers/net/ethernet/via/via-velocity.c | 51 +++ drivers/net/ethernet/via/via-velocity.h |1 + 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/drivers/net/ethernet/via/via-velocity.c b/drivers/net/ethernet/via/via-velocity.c index 187eef3..5996cee 100644 --- a/drivers/net/ethernet/via/via-velocity.c +++ b/drivers/net/ethernet/via/via-velocity.c @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include @@ -1459,7 +1460,6 @@ static int velocity_init_dma_rings(struct velocity_info *vptr) struct velocity_opt *opt = &vptr->options; const unsigned int rx_ring_size = opt->numrx * sizeof(struct rx_desc); const unsigned int tx_ring_size = opt->numtx * sizeof(struct tx_desc); - struct pci_dev *pdev = vptr->pdev; dma_addr_t pool_dma; void *pool; unsigned int i; @@ -1467,13 +1467,13 @@ static int velocity_init_dma_rings(struct velocity_info *vptr) /* * Allocate all RD/TD rings a single pool. * -* pci_alloc_consistent() fulfills the requirement for 64 bytes +* dma_alloc_coherent() fulfills the requirement for 64 bytes * alignment */ - pool = pci_alloc_consistent(pdev, tx_ring_size * vptr->tx.numq + - rx_ring_size, &pool_dma); + pool = dma_alloc_coherent(vptr->dev, tx_ring_size * vptr->tx.numq + + rx_ring_size, &pool_dma, GFP_ATOMIC); if (!pool) { - dev_err(&pdev->dev, "%s : DMA memory allocation failed.\n", + dev_err(vptr->dev, "%s : DMA memory allocation failed.\n", vptr->netdev->name); return -ENOMEM; } @@ -1524,8 +1524,8 @@ static int velocity_alloc_rx_buf(struct velocity_info *vptr, int idx) */ skb_reserve(rd_info->skb, 64 - ((unsigned long) rd_info->skb->data & 63)); - rd_info->skb_dma = pci_map_single(vptr->pdev, rd_info->skb->data, - vptr->rx.buf_sz, PCI_DMA_FROMDEVICE); + rd_info->skb_dma = dma_map_single(vptr->dev, rd_info->skb->data, + vptr->rx.buf_sz, DMA_FROM_DEVICE); /* * Fill in the descriptor to match @@ -1588,8 +1588,8 @@ static void velocity_free_rd_ring(struct velocity_info *vptr) if (!rd_info->skb) continue; - pci_unmap_single(vptr->pdev, rd_info->skb_dma, vptr->rx.buf_sz, -PCI_DMA_FROMDEVICE); + dma_unmap_single(vptr->dev, rd_info->skb_dma, vptr->rx.buf_sz, +DMA_FROM_DEVICE); rd_info->skb_dma = 0; dev_kfree_skb(rd_info->skb); @@ -1670,7 +1670,7 @@ static void velocity_free_dma_rings(struct velocity_info *vptr) const int size = vptr->options.numrx * sizeof(struct rx_desc) + vptr->options.numtx * sizeof(struct tx_desc) * vptr->tx.numq; - pci_free_consistent(vptr->pdev, size, vptr->rx.ring, vptr->rx.pool_dma); + dma_free_coherent(vptr->dev, size, vptr->rx.ring, vptr->rx.pool_dma); } static int velocity_init_rings(struct velocity_info *vptr, int mtu) @@ -1727,8 +1727,8 @@ static void velocity_free_tx_buf(struct velocity_info *vptr, pktlen = max_t(size_t, pktlen, td->td_buf[i].size & ~TD_QUEUE); - pci_unmap_single(vptr->pdev, tdinfo->skb_dma[i], - le16_to_cpu(pktlen), PCI_DMA_TODEVICE); + dma_unmap_single(vptr->dev, tdinfo->skb_dma[i], + le16_to_cpu(pktlen), DMA_TO_DEVICE); } } dev_kfree_skb_irq(skb); @@ -1750,8 +1750,8 @@ static void velocity_free_td_ring_entry(struct velocity_info *vptr, if (td_info->skb) { for (i = 0; i < td_info->nskb_dma; i++) { if (td_info->skb_dma[i]) { - pci_unmap_single(vptr->pdev, td_info->skb_dma[i], - td_info->skb->len, PCI_DMA_TODEVICE); + dma_unmap_single(vptr->dev, td_info->skb_dma[i], + td_info->skb->len, DMA_TO_DEVICE); td_in
[PATCHv8 1/3] net: velocity: Rename vptr->dev to vptr->netdev
Improve the clarity of the code in preparation for converting the dma functions to generic versions, which require a struct device *. This makes it possible to store a 'struct device *dev' in the velocity_info structure. Signed-off-by: Tony Prisk --- drivers/net/ethernet/via/via-velocity.c | 66 +++ drivers/net/ethernet/via/via-velocity.h |4 +- 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/drivers/net/ethernet/via/via-velocity.c b/drivers/net/ethernet/via/via-velocity.c index fb62489..187eef3 100644 --- a/drivers/net/ethernet/via/via-velocity.c +++ b/drivers/net/ethernet/via/via-velocity.c @@ -998,9 +998,9 @@ static void velocity_print_link_status(struct velocity_info *vptr) { if (vptr->mii_status & VELOCITY_LINK_FAIL) { - VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: failed to detect cable link\n", vptr->dev->name); + VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: failed to detect cable link\n", vptr->netdev->name); } else if (vptr->options.spd_dpx == SPD_DPX_AUTO) { - VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: Link auto-negotiation", vptr->dev->name); + VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: Link auto-negotiation", vptr->netdev->name); if (vptr->mii_status & VELOCITY_SPEED_1000) VELOCITY_PRT(MSG_LEVEL_INFO, " speed 1000M bps"); @@ -1014,7 +1014,7 @@ static void velocity_print_link_status(struct velocity_info *vptr) else VELOCITY_PRT(MSG_LEVEL_INFO, " half duplex\n"); } else { - VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: Link forced", vptr->dev->name); + VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: Link forced", vptr->netdev->name); switch (vptr->options.spd_dpx) { case SPD_DPX_1000_FULL: VELOCITY_PRT(MSG_LEVEL_INFO, " speed 1000M bps full duplex\n"); @@ -1319,7 +1319,7 @@ static void velocity_init_registers(struct velocity_info *vptr, case VELOCITY_INIT_RESET: case VELOCITY_INIT_WOL: - netif_stop_queue(vptr->dev); + netif_stop_queue(vptr->netdev); /* * Reset RX to prevent RX pointer not on the 4X location @@ -1332,7 +1332,7 @@ static void velocity_init_registers(struct velocity_info *vptr, if (velocity_set_media_mode(vptr, mii_status) != VELOCITY_LINK_CHANGE) { velocity_print_link_status(vptr); if (!(vptr->mii_status & VELOCITY_LINK_FAIL)) - netif_wake_queue(vptr->dev); + netif_wake_queue(vptr->netdev); } enable_flow_control_ability(vptr); @@ -1354,7 +1354,7 @@ static void velocity_init_registers(struct velocity_info *vptr, mac_eeprom_reload(regs); for (i = 0; i < 6; i++) - writeb(vptr->dev->dev_addr[i], &(regs->PAR[i])); + writeb(vptr->netdev->dev_addr[i], &(regs->PAR[i])); /* * clear Pre_ACPI bit. @@ -1377,7 +1377,7 @@ static void velocity_init_registers(struct velocity_info *vptr, /* * Set packet filter: Receive directed and broadcast address */ - velocity_set_multi(vptr->dev); + velocity_set_multi(vptr->netdev); /* * Enable MII auto-polling @@ -1404,14 +1404,14 @@ static void velocity_init_registers(struct velocity_info *vptr, writel((CR0_DPOLL | CR0_TXON | CR0_RXON | CR0_STRT), ®s->CR0Set); mii_status = velocity_get_opt_media_mode(vptr); - netif_stop_queue(vptr->dev); + netif_stop_queue(vptr->netdev); mii_init(vptr, mii_status); if (velocity_set_media_mode(vptr, mii_status) != VELOCITY_LINK_CHANGE) { velocity_print_link_status(vptr); if (!(vptr->mii_status & VELOCITY_LINK_FAIL)) - netif_wake_queue(vptr->dev); + netif_wake_queue(vptr->netdev); } enable_flow_control_ability(vptr); @@ -1474,7 +1474,7 @@ static int velocity_init_dma_rings(struct velocity_info *vptr) rx_ring_size, &pool_dma); if (!pool) { dev_err(&pdev->dev, "%s : DMA memory allocation failed.\n", - vptr->dev->name); + vptr->netd
[PATCHv8 0/3] Add support for velocity network driver on platform devices
v8 changes: Remove velocity_choose_state from via-velocity.h: unused function. v7 changes: Forgot to merge a patch to fix an error with the pm ops changes. Apologies Dave. v6 changes: Remove more bus specific code from velocity_probe() Make velocity_(suspend/resume) accept a struct device * Simplify PM code to use velocity_(suspend/resume) - remove the individual pci and platform functions. Add a struct pci_dev variable to velocity_get_pci_info() to reduce churn v5 changes: Remove velocity_info union. Change velocity_info->pdev back to struct pci_dev. Remove more 'if (pci)' sections. Remove 'void *pdev' function parameters. Pass correct variable to velocity_choose_state() v4 changes: Code tidyup as requested by Francois Romieu Removed '#ifdef PCI' around PCI code. Compile tested on (!)PCI and (!)PM. v3 changes: Rebased against net-next. Fix errors in pm code. v2 changes: Drop patch #1 as requested by David Miller. Correct the PHYID_ICPLUS_IP101A MII bits - should be ON, rather than OFF. Read the platform rev_id from the correct register [regs->rev_id]. It's possible this would work for the PCI version as well and would remove the need for the 'if (pci)' test to set vptr->rev_id. v1: The first three patches are general tidyup. [DROPPED] Patch ## just alphabetizes the #includes to make it easier to read. Patch #1 replaces vptr->dev with vptr->netdev, in preparation of adding a struct device *dev in Patch #2 Patch #2 replaces the pci dma functions with the generic versions. I have build tested these patches but don't have a PCI velocity to run-test it. I can't see that they should introduce any problems as it is all renames and function swapping. Patch #3 adds support for the velocity driver on devicetree platform devices. Binding document included. This patch is compile-tested for PCI, and boot tested on a VIA APC8750. I think it would be pertinent to get some tested-by's for PCI users. Regards Tony Prisk Tony Prisk (3): net: velocity: Rename vptr->dev to vptr->netdev net: velocity: Convert to generic dma functions net: velocity: Add platform device support to VIA velocity driver .../devicetree/bindings/net/via-velocity.txt | 20 + drivers/net/ethernet/via/Kconfig |3 +- drivers/net/ethernet/via/via-velocity.c| 496 +--- drivers/net/ethernet/via/via-velocity.h| 14 +- 4 files changed, 355 insertions(+), 178 deletions(-) create mode 100644 Documentation/devicetree/bindings/net/via-velocity.txt -- 1.7.9.5 -- 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/
[PATCHv8 3/3] net: velocity: Add platform device support to VIA velocity driver
Add support for the VIA Velocity network driver to be bound to a OF created platform device. Signed-off-by: Tony Prisk --- .../devicetree/bindings/net/via-velocity.txt | 20 + drivers/net/ethernet/via/Kconfig |3 +- drivers/net/ethernet/via/via-velocity.c| 387 ++-- drivers/net/ethernet/via/via-velocity.h| 11 +- 4 files changed, 299 insertions(+), 122 deletions(-) create mode 100644 Documentation/devicetree/bindings/net/via-velocity.txt diff --git a/Documentation/devicetree/bindings/net/via-velocity.txt b/Documentation/devicetree/bindings/net/via-velocity.txt new file mode 100644 index 000..b3db469 --- /dev/null +++ b/Documentation/devicetree/bindings/net/via-velocity.txt @@ -0,0 +1,20 @@ +* VIA Velocity 10/100/1000 Network Controller + +Required properties: +- compatible : Should be "via,velocity-vt6110" +- reg : Address and length of the io space +- interrupts : Should contain the controller interrupt line + +Optional properties: +- no-eeprom : PCI network cards use an external EEPROM to store data. Embedded + devices quite often set this data in uboot and do not provide an eeprom. + Specify this option if you have no external eeprom. + +Examples: + +eth0@d8004000 { + compatible = "via,velocity-vt6110"; + reg = <0xd8004000 0x400>; + interrupts = <10>; + no-eeprom; +}; diff --git a/drivers/net/ethernet/via/Kconfig b/drivers/net/ethernet/via/Kconfig index 68a9ba6..6a87097 100644 --- a/drivers/net/ethernet/via/Kconfig +++ b/drivers/net/ethernet/via/Kconfig @@ -5,7 +5,6 @@ config NET_VENDOR_VIA bool "VIA devices" default y - depends on PCI ---help--- If you have a network (Ethernet) card belonging to this class, say Y and read the Ethernet-HOWTO, available from @@ -45,7 +44,7 @@ config VIA_RHINE_MMIO config VIA_VELOCITY tristate "VIA Velocity support" - depends on PCI + depends on (PCI || USE_OF) select CRC32 select CRC_CCITT select NET_CORE diff --git a/drivers/net/ethernet/via/via-velocity.c b/drivers/net/ethernet/via/via-velocity.c index 5996cee..d8d5bc5 100644 --- a/drivers/net/ethernet/via/via-velocity.c +++ b/drivers/net/ethernet/via/via-velocity.c @@ -65,7 +65,11 @@ #include #include #include +#include +#include +#include #include +#include #include #include #include @@ -84,6 +88,16 @@ static int velocity_nics; static int msglevel = MSG_LEVEL_INFO; +static void velocity_set_power_state(struct velocity_info *vptr, char state) +{ + void *addr = vptr->mac_regs; + + if (vptr->bustype == BUS_PCI) + pci_set_power_state(vptr->pdev, state); + else + writeb(state, addr + 0x154); +} + /** * mac_get_cam_mask- Read a CAM mask * @regs: register block for this velocity @@ -362,12 +376,23 @@ static struct velocity_info_tbl chip_info_table[] = { * Describe the PCI device identifiers that we support in this * device driver. Used for hotplug autoloading. */ -static DEFINE_PCI_DEVICE_TABLE(velocity_id_table) = { + +static DEFINE_PCI_DEVICE_TABLE(velocity_pci_id_table) = { { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_612X) }, { } }; -MODULE_DEVICE_TABLE(pci, velocity_id_table); +MODULE_DEVICE_TABLE(pci, velocity_pci_id_table); + +/** + * Describe the OF device identifiers that we support in this + * device driver. Used for devicetree nodes. + */ +static struct of_device_id velocity_of_ids[] = { + { .compatible = "via,velocity-vt6110", .data = &chip_info_table[0] }, + { /* Sentinel */ }, +}; +MODULE_DEVICE_TABLE(of, velocity_of_ids); /** * get_chip_name - identifier to name @@ -386,29 +411,6 @@ static const char *get_chip_name(enum chip_type chip_id) } /** - * velocity_remove1- device unplug - * @pdev: PCI device being removed - * - * Device unload callback. Called on an unplug or on module - * unload for each active device that is present. Disconnects - * the device from the network layer and frees all the resources - */ -static void velocity_remove1(struct pci_dev *pdev) -{ - struct net_device *dev = pci_get_drvdata(pdev); - struct velocity_info *vptr = netdev_priv(dev); - - unregister_netdev(dev); - iounmap(vptr->mac_regs); - pci_release_regions(pdev); - pci_disable_device(pdev); - pci_set_drvdata(pdev, NULL); - free_netdev(dev); - - velocity_nics--; -} - -/** * velocity_set_int_opt- parser for integer options * @opt: pointer to option value * @val: value the user requested (or -1 for default) @@ -1181,6 +1183,17 @@ static void mii_init(struct velocity_info *vptr, u32 mii_status) u16 BMCR; switch (PHYID_GET_PHY_ID(vptr
Re: [PATCHv7 0/3] Add support for velocity network driver on platform devices
On 18/05/13 14:23, Tony Prisk wrote: v7 changes: Forgot to merge a patch to fix an error with the pm ops changes. Apologies Dave. v6 changes: Remove more bus specific code from velocity_probe() Make velocity_(suspend/resume) accept a struct device * Simplify PM code to use velocity_(suspend/resume) - remove the individual pci and platform functions. Add a struct pci_dev variable to velocity_get_pci_info() to reduce churn v5 changes: Remove velocity_info union. Change velocity_info->pdev back to struct pci_dev. Remove more 'if (pci)' sections. Remove 'void *pdev' function parameters. Pass correct variable to velocity_choose_state() v4 changes: Code tidyup as requested by Francois Romieu Removed '#ifdef PCI' around PCI code. Compile tested on (!)PCI and (!)PM. v3 changes: Rebased against net-next. Fix errors in pm code. v2 changes: Drop patch #1 as requested by David Miller. Correct the PHYID_ICPLUS_IP101A MII bits - should be ON, rather than OFF. Read the platform rev_id from the correct register [regs->rev_id]. It's possible this would work for the PCI version as well and would remove the need for the 'if (pci)' test to set vptr->rev_id. v1: The first three patches are general tidyup. [DROPPED] Patch ## just alphabetizes the #includes to make it easier to read. Patch #1 replaces vptr->dev with vptr->netdev, in preparation of adding a struct device *dev in Patch #2 Patch #2 replaces the pci dma functions with the generic versions. I have build tested these patches but don't have a PCI velocity to run-test it. I can't see that they should introduce any problems as it is all renames and function swapping. Patch #3 adds support for the velocity driver on devicetree platform devices. Binding document included. This patch is compile-tested for PCI, and boot tested on a VIA APC8750. I think it would be pertinent to get some tested-by's for PCI users. Regards Tony Prisk Tony Prisk (3): net: velocity: Rename vptr->dev to vptr->netdev net: velocity: Convert to generic dma functions net: velocity: Add platform device support to VIA velocity driver .../devicetree/bindings/net/via-velocity.txt | 20 + drivers/net/ethernet/via/Kconfig |3 +- drivers/net/ethernet/via/via-velocity.c| 496 +--- drivers/net/ethernet/via/via-velocity.h| 35 +- 4 files changed, 376 insertions(+), 178 deletions(-) create mode 100644 Documentation/devicetree/bindings/net/via-velocity.txt Please don't apply this version either Dave. I noticed that velocity_choose_state is defined in via-velocity.h but is never used. Will resend v8. -- 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/
[PATCHv7 3/3] net: velocity: Add platform device support to VIA velocity driver
Add support for the VIA Velocity network driver to be bound to a OF created platform device. Signed-off-by: Tony Prisk --- .../devicetree/bindings/net/via-velocity.txt | 20 + drivers/net/ethernet/via/Kconfig |3 +- drivers/net/ethernet/via/via-velocity.c| 387 ++-- drivers/net/ethernet/via/via-velocity.h| 32 +- 4 files changed, 320 insertions(+), 122 deletions(-) create mode 100644 Documentation/devicetree/bindings/net/via-velocity.txt diff --git a/Documentation/devicetree/bindings/net/via-velocity.txt b/Documentation/devicetree/bindings/net/via-velocity.txt new file mode 100644 index 000..b3db469 --- /dev/null +++ b/Documentation/devicetree/bindings/net/via-velocity.txt @@ -0,0 +1,20 @@ +* VIA Velocity 10/100/1000 Network Controller + +Required properties: +- compatible : Should be "via,velocity-vt6110" +- reg : Address and length of the io space +- interrupts : Should contain the controller interrupt line + +Optional properties: +- no-eeprom : PCI network cards use an external EEPROM to store data. Embedded + devices quite often set this data in uboot and do not provide an eeprom. + Specify this option if you have no external eeprom. + +Examples: + +eth0@d8004000 { + compatible = "via,velocity-vt6110"; + reg = <0xd8004000 0x400>; + interrupts = <10>; + no-eeprom; +}; diff --git a/drivers/net/ethernet/via/Kconfig b/drivers/net/ethernet/via/Kconfig index 68a9ba6..6a87097 100644 --- a/drivers/net/ethernet/via/Kconfig +++ b/drivers/net/ethernet/via/Kconfig @@ -5,7 +5,6 @@ config NET_VENDOR_VIA bool "VIA devices" default y - depends on PCI ---help--- If you have a network (Ethernet) card belonging to this class, say Y and read the Ethernet-HOWTO, available from @@ -45,7 +44,7 @@ config VIA_RHINE_MMIO config VIA_VELOCITY tristate "VIA Velocity support" - depends on PCI + depends on (PCI || USE_OF) select CRC32 select CRC_CCITT select NET_CORE diff --git a/drivers/net/ethernet/via/via-velocity.c b/drivers/net/ethernet/via/via-velocity.c index 5996cee..d8d5bc5 100644 --- a/drivers/net/ethernet/via/via-velocity.c +++ b/drivers/net/ethernet/via/via-velocity.c @@ -65,7 +65,11 @@ #include #include #include +#include +#include +#include #include +#include #include #include #include @@ -84,6 +88,16 @@ static int velocity_nics; static int msglevel = MSG_LEVEL_INFO; +static void velocity_set_power_state(struct velocity_info *vptr, char state) +{ + void *addr = vptr->mac_regs; + + if (vptr->bustype == BUS_PCI) + pci_set_power_state(vptr->pdev, state); + else + writeb(state, addr + 0x154); +} + /** * mac_get_cam_mask- Read a CAM mask * @regs: register block for this velocity @@ -362,12 +376,23 @@ static struct velocity_info_tbl chip_info_table[] = { * Describe the PCI device identifiers that we support in this * device driver. Used for hotplug autoloading. */ -static DEFINE_PCI_DEVICE_TABLE(velocity_id_table) = { + +static DEFINE_PCI_DEVICE_TABLE(velocity_pci_id_table) = { { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_612X) }, { } }; -MODULE_DEVICE_TABLE(pci, velocity_id_table); +MODULE_DEVICE_TABLE(pci, velocity_pci_id_table); + +/** + * Describe the OF device identifiers that we support in this + * device driver. Used for devicetree nodes. + */ +static struct of_device_id velocity_of_ids[] = { + { .compatible = "via,velocity-vt6110", .data = &chip_info_table[0] }, + { /* Sentinel */ }, +}; +MODULE_DEVICE_TABLE(of, velocity_of_ids); /** * get_chip_name - identifier to name @@ -386,29 +411,6 @@ static const char *get_chip_name(enum chip_type chip_id) } /** - * velocity_remove1- device unplug - * @pdev: PCI device being removed - * - * Device unload callback. Called on an unplug or on module - * unload for each active device that is present. Disconnects - * the device from the network layer and frees all the resources - */ -static void velocity_remove1(struct pci_dev *pdev) -{ - struct net_device *dev = pci_get_drvdata(pdev); - struct velocity_info *vptr = netdev_priv(dev); - - unregister_netdev(dev); - iounmap(vptr->mac_regs); - pci_release_regions(pdev); - pci_disable_device(pdev); - pci_set_drvdata(pdev, NULL); - free_netdev(dev); - - velocity_nics--; -} - -/** * velocity_set_int_opt- parser for integer options * @opt: pointer to option value * @val: value the user requested (or -1 for default) @@ -1181,6 +1183,17 @@ static void mii_init(struct velocity_info *vptr, u32 mii_status) u16 BMCR; switch (PHYID_GET_PHY_ID(vptr
[PATCHv7 2/3] net: velocity: Convert to generic dma functions
Remove the pci_* dma functions and replace with the more generic versions. In preparation of adding platform support, a new struct device *dev is added to struct velocity_info which can be used by both the pci and platform code. Signed-off-by: Tony Prisk --- drivers/net/ethernet/via/via-velocity.c | 51 +++ drivers/net/ethernet/via/via-velocity.h |1 + 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/drivers/net/ethernet/via/via-velocity.c b/drivers/net/ethernet/via/via-velocity.c index 187eef3..5996cee 100644 --- a/drivers/net/ethernet/via/via-velocity.c +++ b/drivers/net/ethernet/via/via-velocity.c @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include @@ -1459,7 +1460,6 @@ static int velocity_init_dma_rings(struct velocity_info *vptr) struct velocity_opt *opt = &vptr->options; const unsigned int rx_ring_size = opt->numrx * sizeof(struct rx_desc); const unsigned int tx_ring_size = opt->numtx * sizeof(struct tx_desc); - struct pci_dev *pdev = vptr->pdev; dma_addr_t pool_dma; void *pool; unsigned int i; @@ -1467,13 +1467,13 @@ static int velocity_init_dma_rings(struct velocity_info *vptr) /* * Allocate all RD/TD rings a single pool. * -* pci_alloc_consistent() fulfills the requirement for 64 bytes +* dma_alloc_coherent() fulfills the requirement for 64 bytes * alignment */ - pool = pci_alloc_consistent(pdev, tx_ring_size * vptr->tx.numq + - rx_ring_size, &pool_dma); + pool = dma_alloc_coherent(vptr->dev, tx_ring_size * vptr->tx.numq + + rx_ring_size, &pool_dma, GFP_ATOMIC); if (!pool) { - dev_err(&pdev->dev, "%s : DMA memory allocation failed.\n", + dev_err(vptr->dev, "%s : DMA memory allocation failed.\n", vptr->netdev->name); return -ENOMEM; } @@ -1524,8 +1524,8 @@ static int velocity_alloc_rx_buf(struct velocity_info *vptr, int idx) */ skb_reserve(rd_info->skb, 64 - ((unsigned long) rd_info->skb->data & 63)); - rd_info->skb_dma = pci_map_single(vptr->pdev, rd_info->skb->data, - vptr->rx.buf_sz, PCI_DMA_FROMDEVICE); + rd_info->skb_dma = dma_map_single(vptr->dev, rd_info->skb->data, + vptr->rx.buf_sz, DMA_FROM_DEVICE); /* * Fill in the descriptor to match @@ -1588,8 +1588,8 @@ static void velocity_free_rd_ring(struct velocity_info *vptr) if (!rd_info->skb) continue; - pci_unmap_single(vptr->pdev, rd_info->skb_dma, vptr->rx.buf_sz, -PCI_DMA_FROMDEVICE); + dma_unmap_single(vptr->dev, rd_info->skb_dma, vptr->rx.buf_sz, +DMA_FROM_DEVICE); rd_info->skb_dma = 0; dev_kfree_skb(rd_info->skb); @@ -1670,7 +1670,7 @@ static void velocity_free_dma_rings(struct velocity_info *vptr) const int size = vptr->options.numrx * sizeof(struct rx_desc) + vptr->options.numtx * sizeof(struct tx_desc) * vptr->tx.numq; - pci_free_consistent(vptr->pdev, size, vptr->rx.ring, vptr->rx.pool_dma); + dma_free_coherent(vptr->dev, size, vptr->rx.ring, vptr->rx.pool_dma); } static int velocity_init_rings(struct velocity_info *vptr, int mtu) @@ -1727,8 +1727,8 @@ static void velocity_free_tx_buf(struct velocity_info *vptr, pktlen = max_t(size_t, pktlen, td->td_buf[i].size & ~TD_QUEUE); - pci_unmap_single(vptr->pdev, tdinfo->skb_dma[i], - le16_to_cpu(pktlen), PCI_DMA_TODEVICE); + dma_unmap_single(vptr->dev, tdinfo->skb_dma[i], + le16_to_cpu(pktlen), DMA_TO_DEVICE); } } dev_kfree_skb_irq(skb); @@ -1750,8 +1750,8 @@ static void velocity_free_td_ring_entry(struct velocity_info *vptr, if (td_info->skb) { for (i = 0; i < td_info->nskb_dma; i++) { if (td_info->skb_dma[i]) { - pci_unmap_single(vptr->pdev, td_info->skb_dma[i], - td_info->skb->len, PCI_DMA_TODEVICE); + dma_unmap_single(vptr->dev, td_info->skb_dma[i], + td_info->skb->len, DMA_TO_DEVICE); td_in
[PATCHv7 0/3] Add support for velocity network driver on platform devices
v7 changes: Forgot to merge a patch to fix an error with the pm ops changes. Apologies Dave. v6 changes: Remove more bus specific code from velocity_probe() Make velocity_(suspend/resume) accept a struct device * Simplify PM code to use velocity_(suspend/resume) - remove the individual pci and platform functions. Add a struct pci_dev variable to velocity_get_pci_info() to reduce churn v5 changes: Remove velocity_info union. Change velocity_info->pdev back to struct pci_dev. Remove more 'if (pci)' sections. Remove 'void *pdev' function parameters. Pass correct variable to velocity_choose_state() v4 changes: Code tidyup as requested by Francois Romieu Removed '#ifdef PCI' around PCI code. Compile tested on (!)PCI and (!)PM. v3 changes: Rebased against net-next. Fix errors in pm code. v2 changes: Drop patch #1 as requested by David Miller. Correct the PHYID_ICPLUS_IP101A MII bits - should be ON, rather than OFF. Read the platform rev_id from the correct register [regs->rev_id]. It's possible this would work for the PCI version as well and would remove the need for the 'if (pci)' test to set vptr->rev_id. v1: The first three patches are general tidyup. [DROPPED] Patch ## just alphabetizes the #includes to make it easier to read. Patch #1 replaces vptr->dev with vptr->netdev, in preparation of adding a struct device *dev in Patch #2 Patch #2 replaces the pci dma functions with the generic versions. I have build tested these patches but don't have a PCI velocity to run-test it. I can't see that they should introduce any problems as it is all renames and function swapping. Patch #3 adds support for the velocity driver on devicetree platform devices. Binding document included. This patch is compile-tested for PCI, and boot tested on a VIA APC8750. I think it would be pertinent to get some tested-by's for PCI users. Regards Tony Prisk Tony Prisk (3): net: velocity: Rename vptr->dev to vptr->netdev net: velocity: Convert to generic dma functions net: velocity: Add platform device support to VIA velocity driver .../devicetree/bindings/net/via-velocity.txt | 20 + drivers/net/ethernet/via/Kconfig |3 +- drivers/net/ethernet/via/via-velocity.c| 496 +--- drivers/net/ethernet/via/via-velocity.h| 35 +- 4 files changed, 376 insertions(+), 178 deletions(-) create mode 100644 Documentation/devicetree/bindings/net/via-velocity.txt -- 1.7.9.5 -- 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/
[PATCHv7 1/3] net: velocity: Rename vptr->dev to vptr->netdev
Improve the clarity of the code in preparation for converting the dma functions to generic versions, which require a struct device *. This makes it possible to store a 'struct device *dev' in the velocity_info structure. Signed-off-by: Tony Prisk --- drivers/net/ethernet/via/via-velocity.c | 66 +++ drivers/net/ethernet/via/via-velocity.h |4 +- 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/drivers/net/ethernet/via/via-velocity.c b/drivers/net/ethernet/via/via-velocity.c index fb62489..187eef3 100644 --- a/drivers/net/ethernet/via/via-velocity.c +++ b/drivers/net/ethernet/via/via-velocity.c @@ -998,9 +998,9 @@ static void velocity_print_link_status(struct velocity_info *vptr) { if (vptr->mii_status & VELOCITY_LINK_FAIL) { - VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: failed to detect cable link\n", vptr->dev->name); + VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: failed to detect cable link\n", vptr->netdev->name); } else if (vptr->options.spd_dpx == SPD_DPX_AUTO) { - VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: Link auto-negotiation", vptr->dev->name); + VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: Link auto-negotiation", vptr->netdev->name); if (vptr->mii_status & VELOCITY_SPEED_1000) VELOCITY_PRT(MSG_LEVEL_INFO, " speed 1000M bps"); @@ -1014,7 +1014,7 @@ static void velocity_print_link_status(struct velocity_info *vptr) else VELOCITY_PRT(MSG_LEVEL_INFO, " half duplex\n"); } else { - VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: Link forced", vptr->dev->name); + VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: Link forced", vptr->netdev->name); switch (vptr->options.spd_dpx) { case SPD_DPX_1000_FULL: VELOCITY_PRT(MSG_LEVEL_INFO, " speed 1000M bps full duplex\n"); @@ -1319,7 +1319,7 @@ static void velocity_init_registers(struct velocity_info *vptr, case VELOCITY_INIT_RESET: case VELOCITY_INIT_WOL: - netif_stop_queue(vptr->dev); + netif_stop_queue(vptr->netdev); /* * Reset RX to prevent RX pointer not on the 4X location @@ -1332,7 +1332,7 @@ static void velocity_init_registers(struct velocity_info *vptr, if (velocity_set_media_mode(vptr, mii_status) != VELOCITY_LINK_CHANGE) { velocity_print_link_status(vptr); if (!(vptr->mii_status & VELOCITY_LINK_FAIL)) - netif_wake_queue(vptr->dev); + netif_wake_queue(vptr->netdev); } enable_flow_control_ability(vptr); @@ -1354,7 +1354,7 @@ static void velocity_init_registers(struct velocity_info *vptr, mac_eeprom_reload(regs); for (i = 0; i < 6; i++) - writeb(vptr->dev->dev_addr[i], &(regs->PAR[i])); + writeb(vptr->netdev->dev_addr[i], &(regs->PAR[i])); /* * clear Pre_ACPI bit. @@ -1377,7 +1377,7 @@ static void velocity_init_registers(struct velocity_info *vptr, /* * Set packet filter: Receive directed and broadcast address */ - velocity_set_multi(vptr->dev); + velocity_set_multi(vptr->netdev); /* * Enable MII auto-polling @@ -1404,14 +1404,14 @@ static void velocity_init_registers(struct velocity_info *vptr, writel((CR0_DPOLL | CR0_TXON | CR0_RXON | CR0_STRT), ®s->CR0Set); mii_status = velocity_get_opt_media_mode(vptr); - netif_stop_queue(vptr->dev); + netif_stop_queue(vptr->netdev); mii_init(vptr, mii_status); if (velocity_set_media_mode(vptr, mii_status) != VELOCITY_LINK_CHANGE) { velocity_print_link_status(vptr); if (!(vptr->mii_status & VELOCITY_LINK_FAIL)) - netif_wake_queue(vptr->dev); + netif_wake_queue(vptr->netdev); } enable_flow_control_ability(vptr); @@ -1474,7 +1474,7 @@ static int velocity_init_dma_rings(struct velocity_info *vptr) rx_ring_size, &pool_dma); if (!pool) { dev_err(&pdev->dev, "%s : DMA memory allocation failed.\n", - vptr->dev->name); + vptr->netd
Re: [PATCHv6 0/3] Add support for velocity network driver on platform devices
On 18/05/13 12:36, David Miller wrote: From: David Miller Date: Fri, 17 May 2013 14:19:38 -0700 (PDT) Series applied, thanks. I'm reverting this, you're not using the correct types for the PM functions you're hooking up. drivers/net/ethernet/via/via-velocity.c:3238:8: warning: initialization from incompatible pointer type [enabled by default] drivers/net/ethernet/via/via-velocity.c:3238:8: warning: (near initialization for ‘velocity_pm_ops.suspend’) [enabled by default] drivers/net/ethernet/via/via-velocity.c:3238:8: warning: initialization from incompatible pointer type [enabled by default] drivers/net/ethernet/via/via-velocity.c:3238:8: warning: (near initialization for ‘velocity_pm_ops.freeze’) [enabled by default] drivers/net/ethernet/via/via-velocity.c:3238:8: warning: initialization from incompatible pointer type [enabled by default] drivers/net/ethernet/via/via-velocity.c:3238:8: warning: (near initialization for ‘velocity_pm_ops.poweroff’) [enabled by default] Argh.. sorry Dave. I forgot to merge the fixup for this before sending. Fixed version to follow. Regards Tony P -- 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/4] VT8500 clock for 3.10/3.11
Hi Mike, Patch #1 is a fix for 3.10 please - Due to an unbalanced spinlock in vt8500_dclk_set_rate() we get kernel dumps on bootup. Patch #2 adds support for the PLL clocks on WM8850 - originally it was thought these were the same as WM8750, but with the release of vendor source it's now confirmed to be different. Patch #3 removes a check (which is also done in vt8500_dclk_round_rate) to ensure the divisor is correct. Due to rounding errors, this usually results in a lower than requested clock rate. Because round_rate is always called on all our clocks, this test is actually redundant so I have dropped it. Patch #4 is to add clk-vt8500.c to MAINTAINERS Regards Tony Prisk Tony Prisk (4): clk: vt8500: Fix unbalanced spinlock in vt8500_dclk_set_rate() clk: vt8500: Add support for clocks on the WM8850 SoCs clk: vt8500: Remove unnecessary divisor adjustment in vtwm_dclk_set_rate() MAINTAINERS: vt8500: Add clk-vt8500.c to MAINTAINERS file Documentation/devicetree/bindings/clock/vt8500.txt |2 + MAINTAINERS|1 + drivers/clk/clk-vt8500.c | 77 ++-- 3 files changed, 75 insertions(+), 5 deletions(-) -- 1.7.9.5 -- 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/4] clk: vt8500: Add support for clocks on the WM8850 SoCs
The WM8850 has a different PLL clock to the previous versions. This patch adds support for the WM8850-style PLL clocks. Signed-off-by: Tony Prisk --- Documentation/devicetree/bindings/clock/vt8500.txt |2 + drivers/clk/clk-vt8500.c | 71 2 files changed, 73 insertions(+) diff --git a/Documentation/devicetree/bindings/clock/vt8500.txt b/Documentation/devicetree/bindings/clock/vt8500.txt index a880c70..91d71cc 100644 --- a/Documentation/devicetree/bindings/clock/vt8500.txt +++ b/Documentation/devicetree/bindings/clock/vt8500.txt @@ -8,6 +8,8 @@ Required properties: - compatible : shall be one of the following: "via,vt8500-pll-clock" - for a VT8500/WM8505 PLL clock "wm,wm8650-pll-clock" - for a WM8650 PLL clock + "wm,wm8750-pll-clock" - for a WM8750 PLL clock + "wm,wm8850-pll-clock" - for a WM8850 PLL clock "via,vt8500-device-clock" - for a VT/WM device clock Required properties for PLL clocks: diff --git a/drivers/clk/clk-vt8500.c b/drivers/clk/clk-vt8500.c index 553ac35..ce401cf 100644 --- a/drivers/clk/clk-vt8500.c +++ b/drivers/clk/clk-vt8500.c @@ -42,6 +42,7 @@ struct clk_device { #define PLL_TYPE_VT85000 #define PLL_TYPE_WM86501 #define PLL_TYPE_WM87502 +#define PLL_TYPE_WM88503 struct clk_pll { struct clk_hw hw; @@ -327,6 +328,15 @@ CLK_OF_DECLARE(vt8500_device, "via,vt8500-device-clock", vtwm_device_clk_init); #define WM8750_BITS_TO_VAL(f, m, d1, d2) \ ((f << 24) | ((m - 1) << 16) | ((d1 - 1) << 8) | d2) +/* Helper macros for PLL_WM8850 */ +#define WM8850_PLL_MUL(x) x >> 16) & 0x7F) + 1) * 2) +#define WM8850_PLL_DIV(x) x >> 8) & 1) + 1) * (1 << (x & 3))) + +#define WM8850_BITS_TO_FREQ(r, m, d1, d2) \ + (r * ((m + 1) * 2) / ((d1+1) * (1 << d2))) + +#define WM8850_BITS_TO_VAL(m, d1, d2) \ + m / 2) - 1) << 16) | ((d1 - 1) << 8) | d2) static void vt8500_find_pll_bits(unsigned long rate, unsigned long parent_rate, u32 *multiplier, u32 *prediv) @@ -466,6 +476,49 @@ static void wm8750_find_pll_bits(unsigned long rate, unsigned long parent_rate, *divisor2 = best_div2; } +static void wm8850_find_pll_bits(unsigned long rate, unsigned long parent_rate, + u32 *multiplier, u32 *divisor1, u32 *divisor2) +{ + u32 mul, div1, div2; + u32 best_mul, best_div1, best_div2; + unsigned long tclk, rate_err, best_err; + + best_err = (unsigned long)-1; + + /* Find the closest match (lower or equal to requested) */ + for (div1 = 1; div1 >= 0; div1--) + for (div2 = 3; div2 >= 0; div2--) + for (mul = 0; mul <= 127; mul++) { + tclk = parent_rate * ((mul + 1) * 2) / + ((div1 + 1) * (1 << div2)); + if (tclk > rate) + continue; + /* error will always be +ve */ + rate_err = rate - tclk; + if (rate_err == 0) { + *multiplier = mul; + *divisor1 = div1; + *divisor2 = div2; + return; + } + + if (rate_err < best_err) { + best_err = rate_err; + best_mul = mul; + best_div1 = div1; + best_div2 = div2; + } + } + + /* if we got here, it wasn't an exact match */ + pr_warn("%s: requested rate %lu, found rate %lu\n", __func__, rate, + rate - best_err); + + *multiplier = best_mul; + *divisor1 = best_div1; + *divisor2 = best_div2; +} + static int vtwm_pll_set_rate(struct clk_hw *hw, unsigned long rate, unsigned long parent_rate) { @@ -489,6 +542,10 @@ static int vtwm_pll_set_rate(struct clk_hw *hw, unsigned long rate, wm8750_find_pll_bits(rate, parent_rate, &filter, &mul, &div1, &div2); pll_val = WM8750_BITS_TO_VAL(filter, mul, div1, div2); break; + case PLL_TYPE_WM8850: + wm8850_find_pll_bits(rate, parent_rate, &mul, &div1, &div2); +
[PATCH 3/4] clk: vt8500: Remove unnecessary divisor adjustment in vtwm_dclk_set_rate()
The divisor adjustment code to ensure that a divisor is not rounded down, thereby giving a rate higher than requested, is unnecessary and in some instances results in the actual rate being much lower than requested due to rounding errors. The test is already performed in vtwm_dclk_round_rate(), which is always called when clk_set_rate is called. Due to rounding errors in the line: divisor = parent_rate / rate (clk-vt8500.c:160) we will sometimes end up adjusting the divisor twice - first in round_rate and then again in set_rate. This patch removes the test/adjustment in vtwm_dclk_set_rate. Signed-off-by: Tony Prisk --- drivers/clk/clk-vt8500.c |4 1 file changed, 4 deletions(-) diff --git a/drivers/clk/clk-vt8500.c b/drivers/clk/clk-vt8500.c index ce401cf..82306f5 100644 --- a/drivers/clk/clk-vt8500.c +++ b/drivers/clk/clk-vt8500.c @@ -157,10 +157,6 @@ static int vt8500_dclk_set_rate(struct clk_hw *hw, unsigned long rate, divisor = parent_rate / rate; - /* If prate / rate would be decimal, incr the divisor */ - if (rate * divisor < parent_rate) - divisor++; - if (divisor == cdev->div_mask + 1) divisor = 0; -- 1.7.9.5 -- 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/4] clk: vt8500: Fix unbalanced spinlock in vt8500_dclk_set_rate()
With the addition of a DVO clock, a bug is now evident in the vt8500 clock code: [0.29] WARNING: at init/main.c:698 do_one_initcall+0x158/0x18c() [0.30] initcall wm8505fb_driver_init+0x0/0xc returned with disabled int This is caused by an unbalanced spinlock in vt8500_dclk_set_rate(). Replace the second call to spin_lock_irqsave() with spin_unlock_irqrestore(). Signed-off-by: Tony Prisk --- drivers/clk/clk-vt8500.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/clk-vt8500.c b/drivers/clk/clk-vt8500.c index debf688..553ac35 100644 --- a/drivers/clk/clk-vt8500.c +++ b/drivers/clk/clk-vt8500.c @@ -183,7 +183,7 @@ static int vt8500_dclk_set_rate(struct clk_hw *hw, unsigned long rate, writel(divisor, cdev->div_reg); vt8500_pmc_wait_busy(); - spin_lock_irqsave(cdev->lock, flags); + spin_unlock_irqrestore(cdev->lock, flags); return 0; } -- 1.7.9.5 -- 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/4] MAINTAINERS: vt8500: Add clk-vt8500.c to MAINTAINERS file
This file has missed being added under ARM/VT8500 ARM ARCHITECTURE, and is maintained along with the rest of the vt8500 arch code. Signed-off-by: Tony Prisk --- MAINTAINERS |1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index 3d7782b..5ab8ccb 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1283,6 +1283,7 @@ M:Tony Prisk L: linux-arm-ker...@lists.infradead.org (moderated for non-subscribers) S: Maintained F: arch/arm/mach-vt8500/ +F: drivers/clk/vt8500-vt8500.c F: drivers/clocksource/vt8500_timer.c F: drivers/gpio/gpio-vt8500.c F: drivers/mmc/host/wmt-sdmmc.c -- 1.7.9.5 -- 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] ARM: vt8500: Add missing NULL terminator in dt_compat
On 17/05/13 19:44, Srinivas KANDAGATLA wrote: From: Srinivas Kandagatla When I tried booting a stih415 Dual core A9 with multi_v7_defconfig, it failed to boot. The issues seems to be changing by enabling or disabling VT8550 platform. Having a quick look at dt_compat list, it seems to miss a NULL terminator, which means of_flat_dt_match will compat check will cross the boundary of dt_compat and fault at some point , which is what was happening in my case. Without this patch if we try to boot multi_v7_defconfig you might notice that some of the platforms might fault if they fall after vt8500 in machine-desc list. Other platforms which fall before vt8500 in mdesc list will not fault. Signed-off-by: Srinivas Kandagatla --- arch/arm/mach-vt8500/vt8500.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-vt8500/vt8500.c b/arch/arm/mach-vt8500/vt8500.c index 1dd281e..f5c33df 100644 --- a/arch/arm/mach-vt8500/vt8500.c +++ b/arch/arm/mach-vt8500/vt8500.c @@ -173,6 +173,7 @@ static const char * const vt8500_dt_compat[] = { "wm,wm8505", "wm,wm8750", "wm,wm8850", + NULL }; DT_MACHINE_START(WMT_DT, "VIA/Wondermedia SoC (Device Tree Support)") My bad. Thanks for the fix. Acked-by: Tony Prisk Arnd, Olof: Can you apply this directly please. Regards Tony Prisk -- 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/
[PATCHv6 2/3] net: velocity: Convert to generic dma functions
Remove the pci_* dma functions and replace with the more generic versions. In preparation of adding platform support, a new struct device *dev is added to struct velocity_info which can be used by both the pci and platform code. Signed-off-by: Tony Prisk --- drivers/net/ethernet/via/via-velocity.c | 51 +++ drivers/net/ethernet/via/via-velocity.h |1 + 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/drivers/net/ethernet/via/via-velocity.c b/drivers/net/ethernet/via/via-velocity.c index 187eef3..5996cee 100644 --- a/drivers/net/ethernet/via/via-velocity.c +++ b/drivers/net/ethernet/via/via-velocity.c @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include @@ -1459,7 +1460,6 @@ static int velocity_init_dma_rings(struct velocity_info *vptr) struct velocity_opt *opt = &vptr->options; const unsigned int rx_ring_size = opt->numrx * sizeof(struct rx_desc); const unsigned int tx_ring_size = opt->numtx * sizeof(struct tx_desc); - struct pci_dev *pdev = vptr->pdev; dma_addr_t pool_dma; void *pool; unsigned int i; @@ -1467,13 +1467,13 @@ static int velocity_init_dma_rings(struct velocity_info *vptr) /* * Allocate all RD/TD rings a single pool. * -* pci_alloc_consistent() fulfills the requirement for 64 bytes +* dma_alloc_coherent() fulfills the requirement for 64 bytes * alignment */ - pool = pci_alloc_consistent(pdev, tx_ring_size * vptr->tx.numq + - rx_ring_size, &pool_dma); + pool = dma_alloc_coherent(vptr->dev, tx_ring_size * vptr->tx.numq + + rx_ring_size, &pool_dma, GFP_ATOMIC); if (!pool) { - dev_err(&pdev->dev, "%s : DMA memory allocation failed.\n", + dev_err(vptr->dev, "%s : DMA memory allocation failed.\n", vptr->netdev->name); return -ENOMEM; } @@ -1524,8 +1524,8 @@ static int velocity_alloc_rx_buf(struct velocity_info *vptr, int idx) */ skb_reserve(rd_info->skb, 64 - ((unsigned long) rd_info->skb->data & 63)); - rd_info->skb_dma = pci_map_single(vptr->pdev, rd_info->skb->data, - vptr->rx.buf_sz, PCI_DMA_FROMDEVICE); + rd_info->skb_dma = dma_map_single(vptr->dev, rd_info->skb->data, + vptr->rx.buf_sz, DMA_FROM_DEVICE); /* * Fill in the descriptor to match @@ -1588,8 +1588,8 @@ static void velocity_free_rd_ring(struct velocity_info *vptr) if (!rd_info->skb) continue; - pci_unmap_single(vptr->pdev, rd_info->skb_dma, vptr->rx.buf_sz, -PCI_DMA_FROMDEVICE); + dma_unmap_single(vptr->dev, rd_info->skb_dma, vptr->rx.buf_sz, +DMA_FROM_DEVICE); rd_info->skb_dma = 0; dev_kfree_skb(rd_info->skb); @@ -1670,7 +1670,7 @@ static void velocity_free_dma_rings(struct velocity_info *vptr) const int size = vptr->options.numrx * sizeof(struct rx_desc) + vptr->options.numtx * sizeof(struct tx_desc) * vptr->tx.numq; - pci_free_consistent(vptr->pdev, size, vptr->rx.ring, vptr->rx.pool_dma); + dma_free_coherent(vptr->dev, size, vptr->rx.ring, vptr->rx.pool_dma); } static int velocity_init_rings(struct velocity_info *vptr, int mtu) @@ -1727,8 +1727,8 @@ static void velocity_free_tx_buf(struct velocity_info *vptr, pktlen = max_t(size_t, pktlen, td->td_buf[i].size & ~TD_QUEUE); - pci_unmap_single(vptr->pdev, tdinfo->skb_dma[i], - le16_to_cpu(pktlen), PCI_DMA_TODEVICE); + dma_unmap_single(vptr->dev, tdinfo->skb_dma[i], + le16_to_cpu(pktlen), DMA_TO_DEVICE); } } dev_kfree_skb_irq(skb); @@ -1750,8 +1750,8 @@ static void velocity_free_td_ring_entry(struct velocity_info *vptr, if (td_info->skb) { for (i = 0; i < td_info->nskb_dma; i++) { if (td_info->skb_dma[i]) { - pci_unmap_single(vptr->pdev, td_info->skb_dma[i], - td_info->skb->len, PCI_DMA_TODEVICE); + dma_unmap_single(vptr->dev, td_info->skb_dma[i], + td_info->skb->len, DMA_TO_DEVICE); td_in
[PATCHv6 3/3] net: velocity: Add platform device support to VIA velocity driver
Add support for the VIA Velocity network driver to be bound to a OF created platform device. Signed-off-by: Tony Prisk --- .../devicetree/bindings/net/via-velocity.txt | 20 + drivers/net/ethernet/via/Kconfig |3 +- drivers/net/ethernet/via/via-velocity.c| 388 ++-- drivers/net/ethernet/via/via-velocity.h| 32 +- 4 files changed, 321 insertions(+), 122 deletions(-) create mode 100644 Documentation/devicetree/bindings/net/via-velocity.txt diff --git a/Documentation/devicetree/bindings/net/via-velocity.txt b/Documentation/devicetree/bindings/net/via-velocity.txt new file mode 100644 index 000..b3db469 --- /dev/null +++ b/Documentation/devicetree/bindings/net/via-velocity.txt @@ -0,0 +1,20 @@ +* VIA Velocity 10/100/1000 Network Controller + +Required properties: +- compatible : Should be "via,velocity-vt6110" +- reg : Address and length of the io space +- interrupts : Should contain the controller interrupt line + +Optional properties: +- no-eeprom : PCI network cards use an external EEPROM to store data. Embedded + devices quite often set this data in uboot and do not provide an eeprom. + Specify this option if you have no external eeprom. + +Examples: + +eth0@d8004000 { + compatible = "via,velocity-vt6110"; + reg = <0xd8004000 0x400>; + interrupts = <10>; + no-eeprom; +}; diff --git a/drivers/net/ethernet/via/Kconfig b/drivers/net/ethernet/via/Kconfig index 68a9ba6..6a87097 100644 --- a/drivers/net/ethernet/via/Kconfig +++ b/drivers/net/ethernet/via/Kconfig @@ -5,7 +5,6 @@ config NET_VENDOR_VIA bool "VIA devices" default y - depends on PCI ---help--- If you have a network (Ethernet) card belonging to this class, say Y and read the Ethernet-HOWTO, available from @@ -45,7 +44,7 @@ config VIA_RHINE_MMIO config VIA_VELOCITY tristate "VIA Velocity support" - depends on PCI + depends on (PCI || USE_OF) select CRC32 select CRC_CCITT select NET_CORE diff --git a/drivers/net/ethernet/via/via-velocity.c b/drivers/net/ethernet/via/via-velocity.c index 5996cee..b30ab62 100644 --- a/drivers/net/ethernet/via/via-velocity.c +++ b/drivers/net/ethernet/via/via-velocity.c @@ -65,7 +65,11 @@ #include #include #include +#include +#include +#include #include +#include #include #include #include @@ -84,6 +88,16 @@ static int velocity_nics; static int msglevel = MSG_LEVEL_INFO; +static void velocity_set_power_state(struct velocity_info *vptr, char state) +{ + void *addr = vptr->mac_regs; + + if (vptr->bustype == BUS_PCI) + pci_set_power_state(vptr->pdev, state); + else + writeb(state, addr + 0x154); +} + /** * mac_get_cam_mask- Read a CAM mask * @regs: register block for this velocity @@ -362,12 +376,23 @@ static struct velocity_info_tbl chip_info_table[] = { * Describe the PCI device identifiers that we support in this * device driver. Used for hotplug autoloading. */ -static DEFINE_PCI_DEVICE_TABLE(velocity_id_table) = { + +static DEFINE_PCI_DEVICE_TABLE(velocity_pci_id_table) = { { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_612X) }, { } }; -MODULE_DEVICE_TABLE(pci, velocity_id_table); +MODULE_DEVICE_TABLE(pci, velocity_pci_id_table); + +/** + * Describe the OF device identifiers that we support in this + * device driver. Used for devicetree nodes. + */ +static struct of_device_id velocity_of_ids[] = { + { .compatible = "via,velocity-vt6110", .data = &chip_info_table[0] }, + { /* Sentinel */ }, +}; +MODULE_DEVICE_TABLE(of, velocity_of_ids); /** * get_chip_name - identifier to name @@ -386,29 +411,6 @@ static const char *get_chip_name(enum chip_type chip_id) } /** - * velocity_remove1- device unplug - * @pdev: PCI device being removed - * - * Device unload callback. Called on an unplug or on module - * unload for each active device that is present. Disconnects - * the device from the network layer and frees all the resources - */ -static void velocity_remove1(struct pci_dev *pdev) -{ - struct net_device *dev = pci_get_drvdata(pdev); - struct velocity_info *vptr = netdev_priv(dev); - - unregister_netdev(dev); - iounmap(vptr->mac_regs); - pci_release_regions(pdev); - pci_disable_device(pdev); - pci_set_drvdata(pdev, NULL); - free_netdev(dev); - - velocity_nics--; -} - -/** * velocity_set_int_opt- parser for integer options * @opt: pointer to option value * @val: value the user requested (or -1 for default) @@ -1181,6 +1183,17 @@ static void mii_init(struct velocity_info *vptr, u32 mii_status) u16 BMCR; switch (PHYID_GET_PHY_ID(vptr
[PATCHv6 1/3] net: velocity: Rename vptr->dev to vptr->netdev
Improve the clarity of the code in preparation for converting the dma functions to generic versions, which require a struct device *. This makes it possible to store a 'struct device *dev' in the velocity_info structure. Signed-off-by: Tony Prisk --- drivers/net/ethernet/via/via-velocity.c | 66 +++ drivers/net/ethernet/via/via-velocity.h |4 +- 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/drivers/net/ethernet/via/via-velocity.c b/drivers/net/ethernet/via/via-velocity.c index fb62489..187eef3 100644 --- a/drivers/net/ethernet/via/via-velocity.c +++ b/drivers/net/ethernet/via/via-velocity.c @@ -998,9 +998,9 @@ static void velocity_print_link_status(struct velocity_info *vptr) { if (vptr->mii_status & VELOCITY_LINK_FAIL) { - VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: failed to detect cable link\n", vptr->dev->name); + VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: failed to detect cable link\n", vptr->netdev->name); } else if (vptr->options.spd_dpx == SPD_DPX_AUTO) { - VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: Link auto-negotiation", vptr->dev->name); + VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: Link auto-negotiation", vptr->netdev->name); if (vptr->mii_status & VELOCITY_SPEED_1000) VELOCITY_PRT(MSG_LEVEL_INFO, " speed 1000M bps"); @@ -1014,7 +1014,7 @@ static void velocity_print_link_status(struct velocity_info *vptr) else VELOCITY_PRT(MSG_LEVEL_INFO, " half duplex\n"); } else { - VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: Link forced", vptr->dev->name); + VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: Link forced", vptr->netdev->name); switch (vptr->options.spd_dpx) { case SPD_DPX_1000_FULL: VELOCITY_PRT(MSG_LEVEL_INFO, " speed 1000M bps full duplex\n"); @@ -1319,7 +1319,7 @@ static void velocity_init_registers(struct velocity_info *vptr, case VELOCITY_INIT_RESET: case VELOCITY_INIT_WOL: - netif_stop_queue(vptr->dev); + netif_stop_queue(vptr->netdev); /* * Reset RX to prevent RX pointer not on the 4X location @@ -1332,7 +1332,7 @@ static void velocity_init_registers(struct velocity_info *vptr, if (velocity_set_media_mode(vptr, mii_status) != VELOCITY_LINK_CHANGE) { velocity_print_link_status(vptr); if (!(vptr->mii_status & VELOCITY_LINK_FAIL)) - netif_wake_queue(vptr->dev); + netif_wake_queue(vptr->netdev); } enable_flow_control_ability(vptr); @@ -1354,7 +1354,7 @@ static void velocity_init_registers(struct velocity_info *vptr, mac_eeprom_reload(regs); for (i = 0; i < 6; i++) - writeb(vptr->dev->dev_addr[i], &(regs->PAR[i])); + writeb(vptr->netdev->dev_addr[i], &(regs->PAR[i])); /* * clear Pre_ACPI bit. @@ -1377,7 +1377,7 @@ static void velocity_init_registers(struct velocity_info *vptr, /* * Set packet filter: Receive directed and broadcast address */ - velocity_set_multi(vptr->dev); + velocity_set_multi(vptr->netdev); /* * Enable MII auto-polling @@ -1404,14 +1404,14 @@ static void velocity_init_registers(struct velocity_info *vptr, writel((CR0_DPOLL | CR0_TXON | CR0_RXON | CR0_STRT), ®s->CR0Set); mii_status = velocity_get_opt_media_mode(vptr); - netif_stop_queue(vptr->dev); + netif_stop_queue(vptr->netdev); mii_init(vptr, mii_status); if (velocity_set_media_mode(vptr, mii_status) != VELOCITY_LINK_CHANGE) { velocity_print_link_status(vptr); if (!(vptr->mii_status & VELOCITY_LINK_FAIL)) - netif_wake_queue(vptr->dev); + netif_wake_queue(vptr->netdev); } enable_flow_control_ability(vptr); @@ -1474,7 +1474,7 @@ static int velocity_init_dma_rings(struct velocity_info *vptr) rx_ring_size, &pool_dma); if (!pool) { dev_err(&pdev->dev, "%s : DMA memory allocation failed.\n", - vptr->dev->name); + vptr->netd
[PATCHv6 0/3] Add support for velocity network driver on platform devices
v6 changes: Remove more bus specific code from velocity_probe() Make velocity_(suspend/resume) accept a struct device * Simplify PM code to use velocity_(suspend/resume) - remove the individual pci and platform functions. Add a struct pci_dev variable to velocity_get_pci_info() to reduce churn v5 changes: Remove velocity_info union. Change velocity_info->pdev back to struct pci_dev. Remove more 'if (pci)' sections. Remove 'void *pdev' function parameters. Pass correct variable to velocity_choose_state() v4 changes: Code tidyup as requested by Francois Romieu Removed '#ifdef PCI' around PCI code. Compile tested on (!)PCI and (!)PM. v3 changes: Rebased against net-next. Fix errors in pm code. v2 changes: Drop patch #1 as requested by David Miller. Correct the PHYID_ICPLUS_IP101A MII bits - should be ON, rather than OFF. Read the platform rev_id from the correct register [regs->rev_id]. It's possible this would work for the PCI version as well and would remove the need for the 'if (pci)' test to set vptr->rev_id. v1: The first three patches are general tidyup. [DROPPED] Patch ## just alphabetizes the #includes to make it easier to read. Patch #1 replaces vptr->dev with vptr->netdev, in preparation of adding a struct device *dev in Patch #2 Patch #2 replaces the pci dma functions with the generic versions. I have build tested these patches but don't have a PCI velocity to run-test it. I can't see that they should introduce any problems as it is all renames and function swapping. Patch #3 adds support for the velocity driver on devicetree platform devices. Binding document included. This patch is compile-tested for PCI, and boot tested on a VIA APC8750. I think it would be pertinent to get some tested-by's for PCI users. Regards Tony Prisk Tony Prisk (3): net: velocity: Rename vptr->dev to vptr->netdev net: velocity: Convert to generic dma functions net: velocity: Add platform device support to VIA velocity driver .../devicetree/bindings/net/via-velocity.txt | 20 + drivers/net/ethernet/via/Kconfig |3 +- drivers/net/ethernet/via/via-velocity.c| 497 +--- drivers/net/ethernet/via/via-velocity.h| 35 +- 4 files changed, 377 insertions(+), 178 deletions(-) create mode 100644 Documentation/devicetree/bindings/net/via-velocity.txt -- 1.7.9.5 -- 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 20/20] ARM: vt8500: Remove init_irq declaration in machine description
On 15/05/13 03:38, Maxime Ripard wrote: Commit ebafed7a ("ARM: irq: Call irqchip_init if no init_irq function is specified") removed the need to explictly setup the init_irq field in the machine description when using only irqchip_init. Remove that declaration for vt8500 as well. Signed-off-by: Maxime Ripard --- arch/arm/mach-vt8500/vt8500.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/arm/mach-vt8500/vt8500.c b/arch/arm/mach-vt8500/vt8500.c index 1dd281e..70a5ac9 100644 --- a/arch/arm/mach-vt8500/vt8500.c +++ b/arch/arm/mach-vt8500/vt8500.c @@ -20,7 +20,6 @@ #include #include -#include #include #include @@ -178,7 +177,6 @@ static const char * const vt8500_dt_compat[] = { DT_MACHINE_START(WMT_DT, "VIA/Wondermedia SoC (Device Tree Support)") .dt_compat = vt8500_dt_compat, .map_io = vt8500_map_io, - .init_irq = irqchip_init, .init_machine = vt8500_init, .init_time = clocksource_of_init, .restart= vt8500_restart, I don't have any plans to touch this driver, so please send direct to arm-soc as Arnd requested. Acked-by: Tony Prisk Regards Tony Prisk -- 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] drivers: pinctrl: vt8500: use devm_ioremap_resource()
On 15/05/13 00:52, Linus Walleij wrote: On Sun, May 12, 2013 at 4:59 PM, Laurent Navet wrote: Replace a call to deprecated devm_request_and_ioremap by devm_ioremap_resource. Oh is that deprecated? I had no clue :-/ Can you point to some rationale about this so I'm not totally misguided in my world..? Found with coccicheck and this semantic patch: scripts/coccinelle/api/devm_ioremap_resource.cocci Signed-off-by: Laurent Navet Seems OK if the deprecation is ongoing. Tony can I have your ACK? Acked-by: Tony Prisk -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/2] clk: vt8500: Remove unnecessary divisor adjustment in vtwm_dclk_set_rate()
The divisor adjustment code to ensure that a divisor is not rounded down, thereby giving a rate higher than requested, is unnecessary and in some instances results in the actual rate being much lower than requested due to rounding errors. The test is already performed in vtwm_dclk_round_rate(), which is always called when clk_set_rate is called. Due to rounding errors in the line: divisor = parent_rate / rate (clk-vt8500.c:160) we will sometimes end up adjusting the divisor twice - first in round_rate and then again in set_rate. This patch removes the test/adjustment in vtwm_dclk_set_rate. Signed-off-by: Tony Prisk --- drivers/clk/clk-vt8500.c |4 1 file changed, 4 deletions(-) diff --git a/drivers/clk/clk-vt8500.c b/drivers/clk/clk-vt8500.c index 6d5b6e9..d8fd085 100644 --- a/drivers/clk/clk-vt8500.c +++ b/drivers/clk/clk-vt8500.c @@ -157,10 +157,6 @@ static int vt8500_dclk_set_rate(struct clk_hw *hw, unsigned long rate, divisor = parent_rate / rate; - /* If prate / rate would be decimal, incr the divisor */ - if (rate * divisor < parent_rate) - divisor++; - if (divisor == cdev->div_mask + 1) divisor = 0; -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/2] clk: vt8500: Add support for clocks on the WM8850 SoCs
The WM8850 has a different PLL clock to the previous versions. This patch adds support for the WM8850-style PLL clocks. Signed-off-by: Tony Prisk --- Documentation/devicetree/bindings/clock/vt8500.txt |2 + drivers/clk/clk-vt8500.c | 71 2 files changed, 73 insertions(+) diff --git a/Documentation/devicetree/bindings/clock/vt8500.txt b/Documentation/devicetree/bindings/clock/vt8500.txt index a880c70..91d71cc 100644 --- a/Documentation/devicetree/bindings/clock/vt8500.txt +++ b/Documentation/devicetree/bindings/clock/vt8500.txt @@ -8,6 +8,8 @@ Required properties: - compatible : shall be one of the following: "via,vt8500-pll-clock" - for a VT8500/WM8505 PLL clock "wm,wm8650-pll-clock" - for a WM8650 PLL clock + "wm,wm8750-pll-clock" - for a WM8750 PLL clock + "wm,wm8850-pll-clock" - for a WM8850 PLL clock "via,vt8500-device-clock" - for a VT/WM device clock Required properties for PLL clocks: diff --git a/drivers/clk/clk-vt8500.c b/drivers/clk/clk-vt8500.c index debf688..6d5b6e9 100644 --- a/drivers/clk/clk-vt8500.c +++ b/drivers/clk/clk-vt8500.c @@ -42,6 +42,7 @@ struct clk_device { #define PLL_TYPE_VT85000 #define PLL_TYPE_WM86501 #define PLL_TYPE_WM87502 +#define PLL_TYPE_WM88503 struct clk_pll { struct clk_hw hw; @@ -327,6 +328,15 @@ CLK_OF_DECLARE(vt8500_device, "via,vt8500-device-clock", vtwm_device_clk_init); #define WM8750_BITS_TO_VAL(f, m, d1, d2) \ ((f << 24) | ((m - 1) << 16) | ((d1 - 1) << 8) | d2) +/* Helper macros for PLL_WM8850 */ +#define WM8850_PLL_MUL(x) x >> 16) & 0x7F) + 1) * 2) +#define WM8850_PLL_DIV(x) x >> 8) & 1) + 1) * (1 << (x & 3))) + +#define WM8850_BITS_TO_FREQ(r, m, d1, d2) \ + (r * ((m + 1) * 2) / ((d1+1) * (1 << d2))) + +#define WM8850_BITS_TO_VAL(m, d1, d2) \ + m / 2) - 1) << 16) | ((d1 - 1) << 8) | d2) static void vt8500_find_pll_bits(unsigned long rate, unsigned long parent_rate, u32 *multiplier, u32 *prediv) @@ -466,6 +476,49 @@ static void wm8750_find_pll_bits(unsigned long rate, unsigned long parent_rate, *divisor2 = best_div2; } +static void wm8850_find_pll_bits(unsigned long rate, unsigned long parent_rate, + u32 *multiplier, u32 *divisor1, u32 *divisor2) +{ + u32 mul, div1, div2; + u32 best_mul, best_div1, best_div2; + unsigned long tclk, rate_err, best_err; + + best_err = (unsigned long)-1; + + /* Find the closest match (lower or equal to requested) */ + for (div1 = 1; div1 >= 0; div1--) + for (div2 = 3; div2 >= 0; div2--) + for (mul = 0; mul <= 127; mul++) { + tclk = parent_rate * ((mul + 1) * 2) / + ((div1 + 1) * (1 << div2)); + if (tclk > rate) + continue; + /* error will always be +ve */ + rate_err = rate - tclk; + if (rate_err == 0) { + *multiplier = mul; + *divisor1 = div1; + *divisor2 = div2; + return; + } + + if (rate_err < best_err) { + best_err = rate_err; + best_mul = mul; + best_div1 = div1; + best_div2 = div2; + } + } + + /* if we got here, it wasn't an exact match */ + pr_warn("%s: requested rate %lu, found rate %lu\n", __func__, rate, + rate - best_err); + + *multiplier = best_mul; + *divisor1 = best_div1; + *divisor2 = best_div2; +} + static int vtwm_pll_set_rate(struct clk_hw *hw, unsigned long rate, unsigned long parent_rate) { @@ -489,6 +542,10 @@ static int vtwm_pll_set_rate(struct clk_hw *hw, unsigned long rate, wm8750_find_pll_bits(rate, parent_rate, &filter, &mul, &div1, &div2); pll_val = WM8750_BITS_TO_VAL(filter, mul, div1, div2); break; + case PLL_TYPE_WM8850: + wm8850_find_pll_bits(rate, parent_rate, &mul, &div1, &div2); +
[PATCH 0/2] clk: vt8500: updates for 3.11
Hi Mike, Two updates for the arch-vt8500 clock code: #1: Add support for the WM8850 PLL. #2: Remove a second divisor check in vt8500_dclk_set_rate() which causes the divisor to be round-down too low. Regards Tony Prisk Tony Prisk (2): clk: vt8500: Add support for clocks on the WM8850 SoCs clk: vt8500: Remove unnecessary divisor adjustment in vtwm_dclk_set_rate() Documentation/devicetree/bindings/clock/vt8500.txt |2 + drivers/clk/clk-vt8500.c | 75 ++-- 2 files changed, 73 insertions(+), 4 deletions(-) -- 1.7.9.5 -- 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/
[PATCHv6 2/3] net: velocity: Convert to generic dma functions
Remove the pci_* dma functions and replace with the more generic versions. In preparation of adding platform support, a new struct device *dev is added to struct velocity_info which can be used by both the pci and platform code. Signed-off-by: Tony Prisk --- drivers/net/ethernet/via/via-velocity.c | 51 +++ drivers/net/ethernet/via/via-velocity.h |1 + 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/drivers/net/ethernet/via/via-velocity.c b/drivers/net/ethernet/via/via-velocity.c index 187eef3..5996cee 100644 --- a/drivers/net/ethernet/via/via-velocity.c +++ b/drivers/net/ethernet/via/via-velocity.c @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include @@ -1459,7 +1460,6 @@ static int velocity_init_dma_rings(struct velocity_info *vptr) struct velocity_opt *opt = &vptr->options; const unsigned int rx_ring_size = opt->numrx * sizeof(struct rx_desc); const unsigned int tx_ring_size = opt->numtx * sizeof(struct tx_desc); - struct pci_dev *pdev = vptr->pdev; dma_addr_t pool_dma; void *pool; unsigned int i; @@ -1467,13 +1467,13 @@ static int velocity_init_dma_rings(struct velocity_info *vptr) /* * Allocate all RD/TD rings a single pool. * -* pci_alloc_consistent() fulfills the requirement for 64 bytes +* dma_alloc_coherent() fulfills the requirement for 64 bytes * alignment */ - pool = pci_alloc_consistent(pdev, tx_ring_size * vptr->tx.numq + - rx_ring_size, &pool_dma); + pool = dma_alloc_coherent(vptr->dev, tx_ring_size * vptr->tx.numq + + rx_ring_size, &pool_dma, GFP_ATOMIC); if (!pool) { - dev_err(&pdev->dev, "%s : DMA memory allocation failed.\n", + dev_err(vptr->dev, "%s : DMA memory allocation failed.\n", vptr->netdev->name); return -ENOMEM; } @@ -1524,8 +1524,8 @@ static int velocity_alloc_rx_buf(struct velocity_info *vptr, int idx) */ skb_reserve(rd_info->skb, 64 - ((unsigned long) rd_info->skb->data & 63)); - rd_info->skb_dma = pci_map_single(vptr->pdev, rd_info->skb->data, - vptr->rx.buf_sz, PCI_DMA_FROMDEVICE); + rd_info->skb_dma = dma_map_single(vptr->dev, rd_info->skb->data, + vptr->rx.buf_sz, DMA_FROM_DEVICE); /* * Fill in the descriptor to match @@ -1588,8 +1588,8 @@ static void velocity_free_rd_ring(struct velocity_info *vptr) if (!rd_info->skb) continue; - pci_unmap_single(vptr->pdev, rd_info->skb_dma, vptr->rx.buf_sz, -PCI_DMA_FROMDEVICE); + dma_unmap_single(vptr->dev, rd_info->skb_dma, vptr->rx.buf_sz, +DMA_FROM_DEVICE); rd_info->skb_dma = 0; dev_kfree_skb(rd_info->skb); @@ -1670,7 +1670,7 @@ static void velocity_free_dma_rings(struct velocity_info *vptr) const int size = vptr->options.numrx * sizeof(struct rx_desc) + vptr->options.numtx * sizeof(struct tx_desc) * vptr->tx.numq; - pci_free_consistent(vptr->pdev, size, vptr->rx.ring, vptr->rx.pool_dma); + dma_free_coherent(vptr->dev, size, vptr->rx.ring, vptr->rx.pool_dma); } static int velocity_init_rings(struct velocity_info *vptr, int mtu) @@ -1727,8 +1727,8 @@ static void velocity_free_tx_buf(struct velocity_info *vptr, pktlen = max_t(size_t, pktlen, td->td_buf[i].size & ~TD_QUEUE); - pci_unmap_single(vptr->pdev, tdinfo->skb_dma[i], - le16_to_cpu(pktlen), PCI_DMA_TODEVICE); + dma_unmap_single(vptr->dev, tdinfo->skb_dma[i], + le16_to_cpu(pktlen), DMA_TO_DEVICE); } } dev_kfree_skb_irq(skb); @@ -1750,8 +1750,8 @@ static void velocity_free_td_ring_entry(struct velocity_info *vptr, if (td_info->skb) { for (i = 0; i < td_info->nskb_dma; i++) { if (td_info->skb_dma[i]) { - pci_unmap_single(vptr->pdev, td_info->skb_dma[i], - td_info->skb->len, PCI_DMA_TODEVICE); + dma_unmap_single(vptr->dev, td_info->skb_dma[i], + td_info->skb->len, DMA_TO_DEVICE); td_in
[PATCHv6 1/3] net: velocity: Rename vptr->dev to vptr->netdev
Improve the clarity of the code in preparation for converting the dma functions to generic versions, which require a struct device *. This makes it possible to store a 'struct device *dev' in the velocity_info structure. Signed-off-by: Tony Prisk --- drivers/net/ethernet/via/via-velocity.c | 66 +++ drivers/net/ethernet/via/via-velocity.h |4 +- 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/drivers/net/ethernet/via/via-velocity.c b/drivers/net/ethernet/via/via-velocity.c index fb62489..187eef3 100644 --- a/drivers/net/ethernet/via/via-velocity.c +++ b/drivers/net/ethernet/via/via-velocity.c @@ -998,9 +998,9 @@ static void velocity_print_link_status(struct velocity_info *vptr) { if (vptr->mii_status & VELOCITY_LINK_FAIL) { - VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: failed to detect cable link\n", vptr->dev->name); + VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: failed to detect cable link\n", vptr->netdev->name); } else if (vptr->options.spd_dpx == SPD_DPX_AUTO) { - VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: Link auto-negotiation", vptr->dev->name); + VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: Link auto-negotiation", vptr->netdev->name); if (vptr->mii_status & VELOCITY_SPEED_1000) VELOCITY_PRT(MSG_LEVEL_INFO, " speed 1000M bps"); @@ -1014,7 +1014,7 @@ static void velocity_print_link_status(struct velocity_info *vptr) else VELOCITY_PRT(MSG_LEVEL_INFO, " half duplex\n"); } else { - VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: Link forced", vptr->dev->name); + VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: Link forced", vptr->netdev->name); switch (vptr->options.spd_dpx) { case SPD_DPX_1000_FULL: VELOCITY_PRT(MSG_LEVEL_INFO, " speed 1000M bps full duplex\n"); @@ -1319,7 +1319,7 @@ static void velocity_init_registers(struct velocity_info *vptr, case VELOCITY_INIT_RESET: case VELOCITY_INIT_WOL: - netif_stop_queue(vptr->dev); + netif_stop_queue(vptr->netdev); /* * Reset RX to prevent RX pointer not on the 4X location @@ -1332,7 +1332,7 @@ static void velocity_init_registers(struct velocity_info *vptr, if (velocity_set_media_mode(vptr, mii_status) != VELOCITY_LINK_CHANGE) { velocity_print_link_status(vptr); if (!(vptr->mii_status & VELOCITY_LINK_FAIL)) - netif_wake_queue(vptr->dev); + netif_wake_queue(vptr->netdev); } enable_flow_control_ability(vptr); @@ -1354,7 +1354,7 @@ static void velocity_init_registers(struct velocity_info *vptr, mac_eeprom_reload(regs); for (i = 0; i < 6; i++) - writeb(vptr->dev->dev_addr[i], &(regs->PAR[i])); + writeb(vptr->netdev->dev_addr[i], &(regs->PAR[i])); /* * clear Pre_ACPI bit. @@ -1377,7 +1377,7 @@ static void velocity_init_registers(struct velocity_info *vptr, /* * Set packet filter: Receive directed and broadcast address */ - velocity_set_multi(vptr->dev); + velocity_set_multi(vptr->netdev); /* * Enable MII auto-polling @@ -1404,14 +1404,14 @@ static void velocity_init_registers(struct velocity_info *vptr, writel((CR0_DPOLL | CR0_TXON | CR0_RXON | CR0_STRT), ®s->CR0Set); mii_status = velocity_get_opt_media_mode(vptr); - netif_stop_queue(vptr->dev); + netif_stop_queue(vptr->netdev); mii_init(vptr, mii_status); if (velocity_set_media_mode(vptr, mii_status) != VELOCITY_LINK_CHANGE) { velocity_print_link_status(vptr); if (!(vptr->mii_status & VELOCITY_LINK_FAIL)) - netif_wake_queue(vptr->dev); + netif_wake_queue(vptr->netdev); } enable_flow_control_ability(vptr); @@ -1474,7 +1474,7 @@ static int velocity_init_dma_rings(struct velocity_info *vptr) rx_ring_size, &pool_dma); if (!pool) { dev_err(&pdev->dev, "%s : DMA memory allocation failed.\n", - vptr->dev->name); + vptr->netd
[PATCHv6 3/3] net: velocity: Add platform device support to VIA velocity driver
Add support for the VIA Velocity network driver to be bound to a OF created platform device. Signed-off-by: Tony Prisk --- .../devicetree/bindings/net/via-velocity.txt | 20 + drivers/net/ethernet/via/Kconfig |3 +- drivers/net/ethernet/via/via-velocity.c| 388 ++-- drivers/net/ethernet/via/via-velocity.h| 32 +- 4 files changed, 321 insertions(+), 122 deletions(-) create mode 100644 Documentation/devicetree/bindings/net/via-velocity.txt diff --git a/Documentation/devicetree/bindings/net/via-velocity.txt b/Documentation/devicetree/bindings/net/via-velocity.txt new file mode 100644 index 000..b3db469 --- /dev/null +++ b/Documentation/devicetree/bindings/net/via-velocity.txt @@ -0,0 +1,20 @@ +* VIA Velocity 10/100/1000 Network Controller + +Required properties: +- compatible : Should be "via,velocity-vt6110" +- reg : Address and length of the io space +- interrupts : Should contain the controller interrupt line + +Optional properties: +- no-eeprom : PCI network cards use an external EEPROM to store data. Embedded + devices quite often set this data in uboot and do not provide an eeprom. + Specify this option if you have no external eeprom. + +Examples: + +eth0@d8004000 { + compatible = "via,velocity-vt6110"; + reg = <0xd8004000 0x400>; + interrupts = <10>; + no-eeprom; +}; diff --git a/drivers/net/ethernet/via/Kconfig b/drivers/net/ethernet/via/Kconfig index 68a9ba6..6a87097 100644 --- a/drivers/net/ethernet/via/Kconfig +++ b/drivers/net/ethernet/via/Kconfig @@ -5,7 +5,6 @@ config NET_VENDOR_VIA bool "VIA devices" default y - depends on PCI ---help--- If you have a network (Ethernet) card belonging to this class, say Y and read the Ethernet-HOWTO, available from @@ -45,7 +44,7 @@ config VIA_RHINE_MMIO config VIA_VELOCITY tristate "VIA Velocity support" - depends on PCI + depends on (PCI || USE_OF) select CRC32 select CRC_CCITT select NET_CORE diff --git a/drivers/net/ethernet/via/via-velocity.c b/drivers/net/ethernet/via/via-velocity.c index 5996cee..b30ab62 100644 --- a/drivers/net/ethernet/via/via-velocity.c +++ b/drivers/net/ethernet/via/via-velocity.c @@ -65,7 +65,11 @@ #include #include #include +#include +#include +#include #include +#include #include #include #include @@ -84,6 +88,16 @@ static int velocity_nics; static int msglevel = MSG_LEVEL_INFO; +static void velocity_set_power_state(struct velocity_info *vptr, char state) +{ + void *addr = vptr->mac_regs; + + if (vptr->bustype == BUS_PCI) + pci_set_power_state(vptr->pdev, state); + else + writeb(state, addr + 0x154); +} + /** * mac_get_cam_mask- Read a CAM mask * @regs: register block for this velocity @@ -362,12 +376,23 @@ static struct velocity_info_tbl chip_info_table[] = { * Describe the PCI device identifiers that we support in this * device driver. Used for hotplug autoloading. */ -static DEFINE_PCI_DEVICE_TABLE(velocity_id_table) = { + +static DEFINE_PCI_DEVICE_TABLE(velocity_pci_id_table) = { { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_612X) }, { } }; -MODULE_DEVICE_TABLE(pci, velocity_id_table); +MODULE_DEVICE_TABLE(pci, velocity_pci_id_table); + +/** + * Describe the OF device identifiers that we support in this + * device driver. Used for devicetree nodes. + */ +static struct of_device_id velocity_of_ids[] = { + { .compatible = "via,velocity-vt6110", .data = &chip_info_table[0] }, + { /* Sentinel */ }, +}; +MODULE_DEVICE_TABLE(of, velocity_of_ids); /** * get_chip_name - identifier to name @@ -386,29 +411,6 @@ static const char *get_chip_name(enum chip_type chip_id) } /** - * velocity_remove1- device unplug - * @pdev: PCI device being removed - * - * Device unload callback. Called on an unplug or on module - * unload for each active device that is present. Disconnects - * the device from the network layer and frees all the resources - */ -static void velocity_remove1(struct pci_dev *pdev) -{ - struct net_device *dev = pci_get_drvdata(pdev); - struct velocity_info *vptr = netdev_priv(dev); - - unregister_netdev(dev); - iounmap(vptr->mac_regs); - pci_release_regions(pdev); - pci_disable_device(pdev); - pci_set_drvdata(pdev, NULL); - free_netdev(dev); - - velocity_nics--; -} - -/** * velocity_set_int_opt- parser for integer options * @opt: pointer to option value * @val: value the user requested (or -1 for default) @@ -1181,6 +1183,17 @@ static void mii_init(struct velocity_info *vptr, u32 mii_status) u16 BMCR; switch (PHYID_GET_PHY_ID(vptr
[PATCHv6 0/3] Add support for velocity network driver on platform devices
v6 changes: Remove more bus specific code from velocity_probe() Make velocity_(suspend/resume) accept a struct device * Simplify PM code to use velocity_(suspend/resume) - remove the individual pci and platform functions. Add a struct pci_dev variable to velocity_get_pci_info() to reduce churn v5 changes: Remove velocity_info union. Change velocity_info->pdev back to struct pci_dev. Remove more 'if (pci)' sections. Remove 'void *pdev' function parameters. Pass correct variable to velocity_choose_state() v4 changes: Code tidyup as requested by Francois Romieu Removed '#ifdef PCI' around PCI code. Compile tested on (!)PCI and (!)PM. v3 changes: Rebased against net-next. Fix errors in pm code. v2 changes: Drop patch #1 as requested by David Miller. Correct the PHYID_ICPLUS_IP101A MII bits - should be ON, rather than OFF. Read the platform rev_id from the correct register [regs->rev_id]. It's possible this would work for the PCI version as well and would remove the need for the 'if (pci)' test to set vptr->rev_id. v1: The first three patches are general tidyup. [DROPPED] Patch ## just alphabetizes the #includes to make it easier to read. Patch #1 replaces vptr->dev with vptr->netdev, in preparation of adding a struct device *dev in Patch #3 Patch #2 replaces the pci dma functions with the generic versions. I have build tested these patches but don't have a PCI velocity to run-test it. I can't see that they should introduce any problems as it is all renames and function swapping. Patch #3 adds support for the velocity driver on devicetree platform devices. Binding document included. This patch is compile-tested for PCI, and boot tested on a VIA APC8750. I think it would be pertinent to get some tested-by's for PCI users. Regards Tony Prisk Tony Prisk (3): net: velocity: Rename vptr->dev to vptr->netdev net: velocity: Convert to generic dma functions net: velocity: Add platform device support to VIA velocity driver .../devicetree/bindings/net/via-velocity.txt | 20 + drivers/net/ethernet/via/Kconfig |3 +- drivers/net/ethernet/via/via-velocity.c| 497 +--- drivers/net/ethernet/via/via-velocity.h| 35 +- 4 files changed, 377 insertions(+), 178 deletions(-) create mode 100644 Documentation/devicetree/bindings/net/via-velocity.txt -- 1.7.9.5 -- 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] i2c: vt8500: Add support for I2C bus on Wondermedia SoCs
This patch adds support for the I2C bus controllers found on Wondermedia 8xxx-series SoCs. Only master-mode is supported. Signed-off-by: Tony Prisk --- .../devicetree/bindings/i2c/i2c-vt8500.txt | 24 + MAINTAINERS|1 + drivers/i2c/busses/Kconfig | 10 + drivers/i2c/busses/Makefile|1 + drivers/i2c/busses/i2c-wmt.c | 488 5 files changed, 524 insertions(+) create mode 100644 Documentation/devicetree/bindings/i2c/i2c-vt8500.txt create mode 100644 drivers/i2c/busses/i2c-wmt.c diff --git a/Documentation/devicetree/bindings/i2c/i2c-vt8500.txt b/Documentation/devicetree/bindings/i2c/i2c-vt8500.txt new file mode 100644 index 000..94a425e --- /dev/null +++ b/Documentation/devicetree/bindings/i2c/i2c-vt8500.txt @@ -0,0 +1,24 @@ +* Wondermedia I2C Controller + +Required properties : + + - compatible : should be "wm,wm8505-i2c" + - reg : Offset and length of the register set for the device + - interrupts : where IRQ is the interrupt number + - clocks : phandle to the I2C clock source + +Optional properties : + + - clock-frequency : desired I2C bus clock frequency in Hz. + Valid values are 10 and 40. + Default to 10 if not specified, or invalid value. + +Example : + + i2c_0: i2c@d828 { + compatible = "wm,wm8505-i2c"; + reg = <0xd828 0x1000>; + interrupts = <19>; + clocks = <&clki2c0>; + clock-frequency = <40>; + }; diff --git a/MAINTAINERS b/MAINTAINERS index 3d7782b..44ea994 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1285,6 +1285,7 @@ S:Maintained F: arch/arm/mach-vt8500/ F: drivers/clocksource/vt8500_timer.c F: drivers/gpio/gpio-vt8500.c +F: drivers/i2c/busses/i2c-wmt.c F: drivers/mmc/host/wmt-sdmmc.c F: drivers/pwm/pwm-vt8500.c F: drivers/rtc/rtc-vt8500.c diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig index 631736e..89e7ec2 100644 --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig @@ -724,6 +724,16 @@ config I2C_VERSATILE This driver can also be built as a module. If so, the module will be called i2c-versatile. +config I2C_WMT + tristate "Wondermedia WM8xxx SoC I2C bus support" + depends on ARCH_VT8500 + help + Say yes if you want to support the I2C bus on Wondermedia 8xxx-series + SoCs. + + This driver can also be built as a module. If so, the module will be + called i2c-wmt. + config I2C_OCTEON tristate "Cavium OCTEON I2C bus support" depends on CPU_CAVIUM_OCTEON diff --git a/drivers/i2c/busses/Makefile b/drivers/i2c/busses/Makefile index 8f4fc23..3ba94a9 100644 --- a/drivers/i2c/busses/Makefile +++ b/drivers/i2c/busses/Makefile @@ -71,6 +71,7 @@ obj-$(CONFIG_I2C_SIRF)+= i2c-sirf.o obj-$(CONFIG_I2C_STU300) += i2c-stu300.o obj-$(CONFIG_I2C_TEGRA)+= i2c-tegra.o obj-$(CONFIG_I2C_VERSATILE)+= i2c-versatile.o +obj-$(CONFIG_I2C_WMT) += i2c-wmt.o obj-$(CONFIG_I2C_OCTEON) += i2c-octeon.o obj-$(CONFIG_I2C_XILINX) += i2c-xiic.o obj-$(CONFIG_I2C_XLR) += i2c-xlr.o diff --git a/drivers/i2c/busses/i2c-wmt.c b/drivers/i2c/busses/i2c-wmt.c new file mode 100644 index 000..5cebb29 --- /dev/null +++ b/drivers/i2c/busses/i2c-wmt.c @@ -0,0 +1,488 @@ +/* + * Wondermedia I2C Master Mode Driver + * + * Copyright (C) 2012 Tony Prisk + * + * Derived from GPLv2+ licensed source: + * - Copyright (C) 2008 WonderMedia Technologies, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, or + * (at your option) any later version. as published by the Free Software + * Foundation + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define REG_CR 0x00 +#define REG_TCR0x02 +#define REG_CSR0x04 +#define REG_ISR0x06 +#define REG_IMR0x08 +#define REG_CDR0x0A +#define REG_TR 0x0C +#define REG_MCR0x0E +#define REG_SLAVE_CR 0x10 +#define REG_SLAVE_SR 0x12 +#define REG_SLAVE_ISR 0x14 +#define REG_SLAVE_IMR 0x16 +#define REG_SLAVE_DR 0x18 +#define REG_SLAVE_TR 0x1A + +/* REG_CR Bit fields */ +#define CR_TX_NEXT_ACK 0x +#define CR_ENABLE 0x0001 +#define CR_TX_NEXT_NO_ACK 0x0002 +#define CR_TX_END 0x0004 +#define CR_CPU_RDY 0x0008 +#define SLAV_MODE_SEL 0x8000 + +/* REG_TCR Bit fields */ +#define TCR_STANDARD_MODE 0x +#define TCR_MASTER_WRITE 0x +#define TCR_HS_MODE
[PATCH] pinctrl: vt8500: Fix incorrect data in WM8750 pinctrl table
WMT_PIN_WAKEUP1 should be declared as WMT_PIN(0, 17) rather than WMT_PIN(0, 16). This currently generates a runtime warning because WMT_PIN_WAKEUP0 is already defined as WMT_PIN(0, 16). Signed-off-by: Tony Prisk --- drivers/pinctrl/vt8500/pinctrl-wm8750.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pinctrl/vt8500/pinctrl-wm8750.c b/drivers/pinctrl/vt8500/pinctrl-wm8750.c index b964cc5..de43262 100644 --- a/drivers/pinctrl/vt8500/pinctrl-wm8750.c +++ b/drivers/pinctrl/vt8500/pinctrl-wm8750.c @@ -53,7 +53,7 @@ static const struct wmt_pinctrl_bank_registers wm8750_banks[] = { #define WMT_PIN_EXTGPIO6 WMT_PIN(0, 6) #define WMT_PIN_EXTGPIO7 WMT_PIN(0, 7) #define WMT_PIN_WAKEUP0WMT_PIN(0, 16) -#define WMT_PIN_WAKEUP1WMT_PIN(0, 16) +#define WMT_PIN_WAKEUP1WMT_PIN(0, 17) #define WMT_PIN_SD0CD WMT_PIN(0, 28) #define WMT_PIN_VDOUT0 WMT_PIN(1, 0) #define WMT_PIN_VDOUT1 WMT_PIN(1, 1) -- 1.7.9.5 -- 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 38/42] rtc: rtc-vt8500: remove unnecessary platform_set_drvdata()
On 03/05/13 18:38, Jingoo Han wrote: The driver core clears the driver data to NULL after device_release or on probe failure, since commit 0998d0631001288a5974afc0b2a5f568bcdecb4d (device-core: Ensure drvdata = NULL when no driver is bound). Thus, it is not needed to manually clear the device driver data to NULL. Signed-off-by: Jingoo Han --- drivers/rtc/rtc-vt8500.c |2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/drivers/rtc/rtc-vt8500.c b/drivers/rtc/rtc-vt8500.c index d89efee..c2d6331 100644 --- a/drivers/rtc/rtc-vt8500.c +++ b/drivers/rtc/rtc-vt8500.c @@ -282,8 +282,6 @@ static int vt8500_rtc_remove(struct platform_device *pdev) /* Disable alarm matching */ writel(0, vt8500_rtc->regbase + VT8500_RTC_IS); - platform_set_drvdata(pdev, NULL); - return 0; } Acked-by: Tony Prisk -- 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/
[PATCHv5 1/3] net: velocity: Rename vptr->dev to vptr->netdev
Improve the clarity of the code in preparation for converting the dma functions to generic versions, which require a struct device *. This makes it possible to store a 'struct device *dev' in the velocity_info structure. Signed-off-by: Tony Prisk --- drivers/net/ethernet/via/via-velocity.c | 66 +++ drivers/net/ethernet/via/via-velocity.h |4 +- 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/drivers/net/ethernet/via/via-velocity.c b/drivers/net/ethernet/via/via-velocity.c index fb62489..187eef3 100644 --- a/drivers/net/ethernet/via/via-velocity.c +++ b/drivers/net/ethernet/via/via-velocity.c @@ -998,9 +998,9 @@ static void velocity_print_link_status(struct velocity_info *vptr) { if (vptr->mii_status & VELOCITY_LINK_FAIL) { - VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: failed to detect cable link\n", vptr->dev->name); + VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: failed to detect cable link\n", vptr->netdev->name); } else if (vptr->options.spd_dpx == SPD_DPX_AUTO) { - VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: Link auto-negotiation", vptr->dev->name); + VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: Link auto-negotiation", vptr->netdev->name); if (vptr->mii_status & VELOCITY_SPEED_1000) VELOCITY_PRT(MSG_LEVEL_INFO, " speed 1000M bps"); @@ -1014,7 +1014,7 @@ static void velocity_print_link_status(struct velocity_info *vptr) else VELOCITY_PRT(MSG_LEVEL_INFO, " half duplex\n"); } else { - VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: Link forced", vptr->dev->name); + VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: Link forced", vptr->netdev->name); switch (vptr->options.spd_dpx) { case SPD_DPX_1000_FULL: VELOCITY_PRT(MSG_LEVEL_INFO, " speed 1000M bps full duplex\n"); @@ -1319,7 +1319,7 @@ static void velocity_init_registers(struct velocity_info *vptr, case VELOCITY_INIT_RESET: case VELOCITY_INIT_WOL: - netif_stop_queue(vptr->dev); + netif_stop_queue(vptr->netdev); /* * Reset RX to prevent RX pointer not on the 4X location @@ -1332,7 +1332,7 @@ static void velocity_init_registers(struct velocity_info *vptr, if (velocity_set_media_mode(vptr, mii_status) != VELOCITY_LINK_CHANGE) { velocity_print_link_status(vptr); if (!(vptr->mii_status & VELOCITY_LINK_FAIL)) - netif_wake_queue(vptr->dev); + netif_wake_queue(vptr->netdev); } enable_flow_control_ability(vptr); @@ -1354,7 +1354,7 @@ static void velocity_init_registers(struct velocity_info *vptr, mac_eeprom_reload(regs); for (i = 0; i < 6; i++) - writeb(vptr->dev->dev_addr[i], &(regs->PAR[i])); + writeb(vptr->netdev->dev_addr[i], &(regs->PAR[i])); /* * clear Pre_ACPI bit. @@ -1377,7 +1377,7 @@ static void velocity_init_registers(struct velocity_info *vptr, /* * Set packet filter: Receive directed and broadcast address */ - velocity_set_multi(vptr->dev); + velocity_set_multi(vptr->netdev); /* * Enable MII auto-polling @@ -1404,14 +1404,14 @@ static void velocity_init_registers(struct velocity_info *vptr, writel((CR0_DPOLL | CR0_TXON | CR0_RXON | CR0_STRT), ®s->CR0Set); mii_status = velocity_get_opt_media_mode(vptr); - netif_stop_queue(vptr->dev); + netif_stop_queue(vptr->netdev); mii_init(vptr, mii_status); if (velocity_set_media_mode(vptr, mii_status) != VELOCITY_LINK_CHANGE) { velocity_print_link_status(vptr); if (!(vptr->mii_status & VELOCITY_LINK_FAIL)) - netif_wake_queue(vptr->dev); + netif_wake_queue(vptr->netdev); } enable_flow_control_ability(vptr); @@ -1474,7 +1474,7 @@ static int velocity_init_dma_rings(struct velocity_info *vptr) rx_ring_size, &pool_dma); if (!pool) { dev_err(&pdev->dev, "%s : DMA memory allocation failed.\n", - vptr->dev->name); + vptr->netd
[PATCHv5 3/3] net: velocity: Add platform device support to VIA velocity driver
Add support for the VIA Velocity network driver to be bound to a OF created platform device. Signed-off-by: Tony Prisk --- .../devicetree/bindings/net/via-velocity.txt | 20 + drivers/net/ethernet/via/Kconfig |3 +- drivers/net/ethernet/via/via-velocity.c| 432 ++-- drivers/net/ethernet/via/via-velocity.h| 32 +- 4 files changed, 362 insertions(+), 125 deletions(-) create mode 100644 Documentation/devicetree/bindings/net/via-velocity.txt diff --git a/Documentation/devicetree/bindings/net/via-velocity.txt b/Documentation/devicetree/bindings/net/via-velocity.txt new file mode 100644 index 000..b3db469 --- /dev/null +++ b/Documentation/devicetree/bindings/net/via-velocity.txt @@ -0,0 +1,20 @@ +* VIA Velocity 10/100/1000 Network Controller + +Required properties: +- compatible : Should be "via,velocity-vt6110" +- reg : Address and length of the io space +- interrupts : Should contain the controller interrupt line + +Optional properties: +- no-eeprom : PCI network cards use an external EEPROM to store data. Embedded + devices quite often set this data in uboot and do not provide an eeprom. + Specify this option if you have no external eeprom. + +Examples: + +eth0@d8004000 { + compatible = "via,velocity-vt6110"; + reg = <0xd8004000 0x400>; + interrupts = <10>; + no-eeprom; +}; diff --git a/drivers/net/ethernet/via/Kconfig b/drivers/net/ethernet/via/Kconfig index 68a9ba6..6a87097 100644 --- a/drivers/net/ethernet/via/Kconfig +++ b/drivers/net/ethernet/via/Kconfig @@ -5,7 +5,6 @@ config NET_VENDOR_VIA bool "VIA devices" default y - depends on PCI ---help--- If you have a network (Ethernet) card belonging to this class, say Y and read the Ethernet-HOWTO, available from @@ -45,7 +44,7 @@ config VIA_RHINE_MMIO config VIA_VELOCITY tristate "VIA Velocity support" - depends on PCI + depends on (PCI || USE_OF) select CRC32 select CRC_CCITT select NET_CORE diff --git a/drivers/net/ethernet/via/via-velocity.c b/drivers/net/ethernet/via/via-velocity.c index 5996cee..cd4bf87 100644 --- a/drivers/net/ethernet/via/via-velocity.c +++ b/drivers/net/ethernet/via/via-velocity.c @@ -65,7 +65,11 @@ #include #include #include +#include +#include +#include #include +#include #include #include #include @@ -84,6 +88,16 @@ static int velocity_nics; static int msglevel = MSG_LEVEL_INFO; +static void velocity_set_power_state(struct velocity_info *vptr, char state) +{ + void *addr = vptr->mac_regs; + + if (vptr->bustype == BUS_PCI) + pci_set_power_state(vptr->pdev, state); + else + writeb(state, addr + 0x154); +} + /** * mac_get_cam_mask- Read a CAM mask * @regs: register block for this velocity @@ -362,12 +376,23 @@ static struct velocity_info_tbl chip_info_table[] = { * Describe the PCI device identifiers that we support in this * device driver. Used for hotplug autoloading. */ -static DEFINE_PCI_DEVICE_TABLE(velocity_id_table) = { + +static DEFINE_PCI_DEVICE_TABLE(velocity_pci_id_table) = { { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_612X) }, { } }; -MODULE_DEVICE_TABLE(pci, velocity_id_table); +MODULE_DEVICE_TABLE(pci, velocity_pci_id_table); + +/** + * Describe the OF device identifiers that we support in this + * device driver. Used for devicetree nodes. + */ +static struct of_device_id velocity_of_ids[] = { + { .compatible = "via,velocity-vt6110", .data = &chip_info_table[0] }, + { /* Sentinel */ }, +}; +MODULE_DEVICE_TABLE(of, velocity_of_ids); /** * get_chip_name - identifier to name @@ -386,29 +411,6 @@ static const char *get_chip_name(enum chip_type chip_id) } /** - * velocity_remove1- device unplug - * @pdev: PCI device being removed - * - * Device unload callback. Called on an unplug or on module - * unload for each active device that is present. Disconnects - * the device from the network layer and frees all the resources - */ -static void velocity_remove1(struct pci_dev *pdev) -{ - struct net_device *dev = pci_get_drvdata(pdev); - struct velocity_info *vptr = netdev_priv(dev); - - unregister_netdev(dev); - iounmap(vptr->mac_regs); - pci_release_regions(pdev); - pci_disable_device(pdev); - pci_set_drvdata(pdev, NULL); - free_netdev(dev); - - velocity_nics--; -} - -/** * velocity_set_int_opt- parser for integer options * @opt: pointer to option value * @val: value the user requested (or -1 for default) @@ -1181,6 +1183,17 @@ static void mii_init(struct velocity_info *vptr, u32 mii_status) u16 BMCR; switch (PHYID_GET_PHY_ID(vptr
[PATCHv5 0/3] Add support for velocity network driver on platform devices
v5 changes: Remove velocity_info union. Change velocity_info->pdev back to struct pci_dev. Remove more 'if (pci)' sections. Remove 'void *pdev' function parameters. Pass correct variable to velocity_choose_state() v4 changes: Code tidyup as requested by Francois Romieu Removed '#ifdef PCI' around PCI code. Compile tested on (!)PCI and (!)PM. v3 changes: Rebased against net-next. Fix errors in pm code. v2 changes: Drop patch #1 as requested by David Miller. Correct the PHYID_ICPLUS_IP101A MII bits - should be ON, rather than OFF. Read the platform rev_id from the correct register [regs->rev_id]. It's possible this would work for the PCI version as well and would remove the need for the 'if (pci)' test to set vptr->rev_id. v1: The first three patches are general tidyup. [DROPPED] Patch ## just alphabetizes the #includes to make it easier to read. Patch #1 replaces vptr->dev with vptr->netdev, in preparation of adding a struct device *dev in Patch #3 Patch #2 replaces the pci dma functions with the generic versions. I have build tested these patches but don't have a PCI velocity to run-test it. I can't see that they should introduce any problems as it is all renames and function swapping. Patch #3 adds support for the velocity driver on devicetree platform devices. Binding document included. This patch is compile-tested for PCI, and boot tested on a VIA APC8750. I think it would be pertinent to get some tested-by's for PCI users. Regards Tony Prisk Tony Prisk (3): net: velocity: Rename vptr->dev to vptr->netdev net: velocity: Convert to generic dma functions net: velocity: Add platform device support to VIA velocity driver .../devicetree/bindings/net/via-velocity.txt | 20 + drivers/net/ethernet/via/Kconfig |3 +- drivers/net/ethernet/via/via-velocity.c| 543 +--- drivers/net/ethernet/via/via-velocity.h| 35 +- 4 files changed, 419 insertions(+), 182 deletions(-) create mode 100644 Documentation/devicetree/bindings/net/via-velocity.txt -- 1.7.9.5 -- 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/
[PATCHv5 2/3] net: velocity: Convert to generic dma functions
Remove the pci_* dma functions and replace with the more generic versions. In preparation of adding platform support, a new struct device *dev is added to struct velocity_info which can be used by both the pci and platform code. Signed-off-by: Tony Prisk --- drivers/net/ethernet/via/via-velocity.c | 51 +++ drivers/net/ethernet/via/via-velocity.h |1 + 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/drivers/net/ethernet/via/via-velocity.c b/drivers/net/ethernet/via/via-velocity.c index 187eef3..5996cee 100644 --- a/drivers/net/ethernet/via/via-velocity.c +++ b/drivers/net/ethernet/via/via-velocity.c @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include @@ -1459,7 +1460,6 @@ static int velocity_init_dma_rings(struct velocity_info *vptr) struct velocity_opt *opt = &vptr->options; const unsigned int rx_ring_size = opt->numrx * sizeof(struct rx_desc); const unsigned int tx_ring_size = opt->numtx * sizeof(struct tx_desc); - struct pci_dev *pdev = vptr->pdev; dma_addr_t pool_dma; void *pool; unsigned int i; @@ -1467,13 +1467,13 @@ static int velocity_init_dma_rings(struct velocity_info *vptr) /* * Allocate all RD/TD rings a single pool. * -* pci_alloc_consistent() fulfills the requirement for 64 bytes +* dma_alloc_coherent() fulfills the requirement for 64 bytes * alignment */ - pool = pci_alloc_consistent(pdev, tx_ring_size * vptr->tx.numq + - rx_ring_size, &pool_dma); + pool = dma_alloc_coherent(vptr->dev, tx_ring_size * vptr->tx.numq + + rx_ring_size, &pool_dma, GFP_ATOMIC); if (!pool) { - dev_err(&pdev->dev, "%s : DMA memory allocation failed.\n", + dev_err(vptr->dev, "%s : DMA memory allocation failed.\n", vptr->netdev->name); return -ENOMEM; } @@ -1524,8 +1524,8 @@ static int velocity_alloc_rx_buf(struct velocity_info *vptr, int idx) */ skb_reserve(rd_info->skb, 64 - ((unsigned long) rd_info->skb->data & 63)); - rd_info->skb_dma = pci_map_single(vptr->pdev, rd_info->skb->data, - vptr->rx.buf_sz, PCI_DMA_FROMDEVICE); + rd_info->skb_dma = dma_map_single(vptr->dev, rd_info->skb->data, + vptr->rx.buf_sz, DMA_FROM_DEVICE); /* * Fill in the descriptor to match @@ -1588,8 +1588,8 @@ static void velocity_free_rd_ring(struct velocity_info *vptr) if (!rd_info->skb) continue; - pci_unmap_single(vptr->pdev, rd_info->skb_dma, vptr->rx.buf_sz, -PCI_DMA_FROMDEVICE); + dma_unmap_single(vptr->dev, rd_info->skb_dma, vptr->rx.buf_sz, +DMA_FROM_DEVICE); rd_info->skb_dma = 0; dev_kfree_skb(rd_info->skb); @@ -1670,7 +1670,7 @@ static void velocity_free_dma_rings(struct velocity_info *vptr) const int size = vptr->options.numrx * sizeof(struct rx_desc) + vptr->options.numtx * sizeof(struct tx_desc) * vptr->tx.numq; - pci_free_consistent(vptr->pdev, size, vptr->rx.ring, vptr->rx.pool_dma); + dma_free_coherent(vptr->dev, size, vptr->rx.ring, vptr->rx.pool_dma); } static int velocity_init_rings(struct velocity_info *vptr, int mtu) @@ -1727,8 +1727,8 @@ static void velocity_free_tx_buf(struct velocity_info *vptr, pktlen = max_t(size_t, pktlen, td->td_buf[i].size & ~TD_QUEUE); - pci_unmap_single(vptr->pdev, tdinfo->skb_dma[i], - le16_to_cpu(pktlen), PCI_DMA_TODEVICE); + dma_unmap_single(vptr->dev, tdinfo->skb_dma[i], + le16_to_cpu(pktlen), DMA_TO_DEVICE); } } dev_kfree_skb_irq(skb); @@ -1750,8 +1750,8 @@ static void velocity_free_td_ring_entry(struct velocity_info *vptr, if (td_info->skb) { for (i = 0; i < td_info->nskb_dma; i++) { if (td_info->skb_dma[i]) { - pci_unmap_single(vptr->pdev, td_info->skb_dma[i], - td_info->skb->len, PCI_DMA_TODEVICE); + dma_unmap_single(vptr->dev, td_info->skb_dma[i], + td_info->skb->len, DMA_TO_DEVICE); td_in
[PATCH 29/30] rtc: rtc-vt8500: use devm_rtc_device_register()
I realise this is a rather trivial series but it would be nice if the listed maintainers for the drivers had been notified as well. Regards Tony Prisk -- 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: [PATCHv4 0/3] Add support for velocity network driver on platform devices
On 02/05/13 06:52, David Miller wrote: From: Tony Prisk Date: Tue, 30 Apr 2013 18:16:57 +1200 I think it would be pertinent to get some tested-by's for PCI users. Tony, this came in a bit late, and there hasn't been any PCI test reports so I have to defer this to the next merge window, sorry. No problems - I didn't honestly expect it to go in for 3.10 any way. I was trying to get in nice and earlier for 3.11 to give people plenty of time to test. Regards Tony P -- 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/
[PATCHv4 3/3] net: velocity: Add platform device support to VIA velocity driver
Add support for the VIA Velocity network driver to be bound to a OF created platform device. Signed-off-by: Tony Prisk --- .../devicetree/bindings/net/via-velocity.txt | 20 + drivers/net/ethernet/via/Kconfig |3 +- drivers/net/ethernet/via/via-velocity.c| 435 +++- drivers/net/ethernet/via/via-velocity.h| 35 +- 4 files changed, 380 insertions(+), 113 deletions(-) create mode 100644 Documentation/devicetree/bindings/net/via-velocity.txt diff --git a/Documentation/devicetree/bindings/net/via-velocity.txt b/Documentation/devicetree/bindings/net/via-velocity.txt new file mode 100644 index 000..b3db469 --- /dev/null +++ b/Documentation/devicetree/bindings/net/via-velocity.txt @@ -0,0 +1,20 @@ +* VIA Velocity 10/100/1000 Network Controller + +Required properties: +- compatible : Should be "via,velocity-vt6110" +- reg : Address and length of the io space +- interrupts : Should contain the controller interrupt line + +Optional properties: +- no-eeprom : PCI network cards use an external EEPROM to store data. Embedded + devices quite often set this data in uboot and do not provide an eeprom. + Specify this option if you have no external eeprom. + +Examples: + +eth0@d8004000 { + compatible = "via,velocity-vt6110"; + reg = <0xd8004000 0x400>; + interrupts = <10>; + no-eeprom; +}; diff --git a/drivers/net/ethernet/via/Kconfig b/drivers/net/ethernet/via/Kconfig index 68a9ba6..6a87097 100644 --- a/drivers/net/ethernet/via/Kconfig +++ b/drivers/net/ethernet/via/Kconfig @@ -5,7 +5,6 @@ config NET_VENDOR_VIA bool "VIA devices" default y - depends on PCI ---help--- If you have a network (Ethernet) card belonging to this class, say Y and read the Ethernet-HOWTO, available from @@ -45,7 +44,7 @@ config VIA_RHINE_MMIO config VIA_VELOCITY tristate "VIA Velocity support" - depends on PCI + depends on (PCI || USE_OF) select CRC32 select CRC_CCITT select NET_CORE diff --git a/drivers/net/ethernet/via/via-velocity.c b/drivers/net/ethernet/via/via-velocity.c index 5996cee..aa0789f 100644 --- a/drivers/net/ethernet/via/via-velocity.c +++ b/drivers/net/ethernet/via/via-velocity.c @@ -65,7 +65,11 @@ #include #include #include +#include +#include +#include #include +#include #include #include #include @@ -84,6 +88,16 @@ static int velocity_nics; static int msglevel = MSG_LEVEL_INFO; +static void velocity_set_power_state(struct velocity_info *vptr, char state) +{ + void *addr = vptr->mac_regs; + + if (vptr->bustype == BUS_PCI) + pci_set_power_state(vptr->pdev.pcidev, state); + else + writeb(state, addr + 0x154); +} + /** * mac_get_cam_mask- Read a CAM mask * @regs: register block for this velocity @@ -362,12 +376,23 @@ static struct velocity_info_tbl chip_info_table[] = { * Describe the PCI device identifiers that we support in this * device driver. Used for hotplug autoloading. */ -static DEFINE_PCI_DEVICE_TABLE(velocity_id_table) = { + +static DEFINE_PCI_DEVICE_TABLE(velocity_pci_id_table) = { { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_612X) }, { } }; -MODULE_DEVICE_TABLE(pci, velocity_id_table); +MODULE_DEVICE_TABLE(pci, velocity_pci_id_table); + +/** + * Describe the OF device identifiers that we support in this + * device driver. Used for devicetree nodes. + */ +static struct of_device_id velocity_of_ids[] = { + { .compatible = "via,velocity-vt6110", .data = &chip_info_table[0] }, + { /* Sentinel */ }, +}; +MODULE_DEVICE_TABLE(of, velocity_of_ids); /** * get_chip_name - identifier to name @@ -386,29 +411,6 @@ static const char *get_chip_name(enum chip_type chip_id) } /** - * velocity_remove1- device unplug - * @pdev: PCI device being removed - * - * Device unload callback. Called on an unplug or on module - * unload for each active device that is present. Disconnects - * the device from the network layer and frees all the resources - */ -static void velocity_remove1(struct pci_dev *pdev) -{ - struct net_device *dev = pci_get_drvdata(pdev); - struct velocity_info *vptr = netdev_priv(dev); - - unregister_netdev(dev); - iounmap(vptr->mac_regs); - pci_release_regions(pdev); - pci_disable_device(pdev); - pci_set_drvdata(pdev, NULL); - free_netdev(dev); - - velocity_nics--; -} - -/** * velocity_set_int_opt- parser for integer options * @opt: pointer to option value * @val: value the user requested (or -1 for default) @@ -1181,6 +1183,17 @@ static void mii_init(struct velocity_info *vptr, u32 mii_status) u16 BMCR;
[PATCHv4 1/3] net: velocity: Rename vptr->dev to vptr->netdev
Improve the clarity of the code in preparation for converting the dma functions to generic versions, which require a struct device *. This makes it possible to store a 'struct device *dev' in the velocity_info structure. Signed-off-by: Tony Prisk --- drivers/net/ethernet/via/via-velocity.c | 66 +++ drivers/net/ethernet/via/via-velocity.h |4 +- 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/drivers/net/ethernet/via/via-velocity.c b/drivers/net/ethernet/via/via-velocity.c index fb62489..187eef3 100644 --- a/drivers/net/ethernet/via/via-velocity.c +++ b/drivers/net/ethernet/via/via-velocity.c @@ -998,9 +998,9 @@ static void velocity_print_link_status(struct velocity_info *vptr) { if (vptr->mii_status & VELOCITY_LINK_FAIL) { - VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: failed to detect cable link\n", vptr->dev->name); + VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: failed to detect cable link\n", vptr->netdev->name); } else if (vptr->options.spd_dpx == SPD_DPX_AUTO) { - VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: Link auto-negotiation", vptr->dev->name); + VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: Link auto-negotiation", vptr->netdev->name); if (vptr->mii_status & VELOCITY_SPEED_1000) VELOCITY_PRT(MSG_LEVEL_INFO, " speed 1000M bps"); @@ -1014,7 +1014,7 @@ static void velocity_print_link_status(struct velocity_info *vptr) else VELOCITY_PRT(MSG_LEVEL_INFO, " half duplex\n"); } else { - VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: Link forced", vptr->dev->name); + VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: Link forced", vptr->netdev->name); switch (vptr->options.spd_dpx) { case SPD_DPX_1000_FULL: VELOCITY_PRT(MSG_LEVEL_INFO, " speed 1000M bps full duplex\n"); @@ -1319,7 +1319,7 @@ static void velocity_init_registers(struct velocity_info *vptr, case VELOCITY_INIT_RESET: case VELOCITY_INIT_WOL: - netif_stop_queue(vptr->dev); + netif_stop_queue(vptr->netdev); /* * Reset RX to prevent RX pointer not on the 4X location @@ -1332,7 +1332,7 @@ static void velocity_init_registers(struct velocity_info *vptr, if (velocity_set_media_mode(vptr, mii_status) != VELOCITY_LINK_CHANGE) { velocity_print_link_status(vptr); if (!(vptr->mii_status & VELOCITY_LINK_FAIL)) - netif_wake_queue(vptr->dev); + netif_wake_queue(vptr->netdev); } enable_flow_control_ability(vptr); @@ -1354,7 +1354,7 @@ static void velocity_init_registers(struct velocity_info *vptr, mac_eeprom_reload(regs); for (i = 0; i < 6; i++) - writeb(vptr->dev->dev_addr[i], &(regs->PAR[i])); + writeb(vptr->netdev->dev_addr[i], &(regs->PAR[i])); /* * clear Pre_ACPI bit. @@ -1377,7 +1377,7 @@ static void velocity_init_registers(struct velocity_info *vptr, /* * Set packet filter: Receive directed and broadcast address */ - velocity_set_multi(vptr->dev); + velocity_set_multi(vptr->netdev); /* * Enable MII auto-polling @@ -1404,14 +1404,14 @@ static void velocity_init_registers(struct velocity_info *vptr, writel((CR0_DPOLL | CR0_TXON | CR0_RXON | CR0_STRT), ®s->CR0Set); mii_status = velocity_get_opt_media_mode(vptr); - netif_stop_queue(vptr->dev); + netif_stop_queue(vptr->netdev); mii_init(vptr, mii_status); if (velocity_set_media_mode(vptr, mii_status) != VELOCITY_LINK_CHANGE) { velocity_print_link_status(vptr); if (!(vptr->mii_status & VELOCITY_LINK_FAIL)) - netif_wake_queue(vptr->dev); + netif_wake_queue(vptr->netdev); } enable_flow_control_ability(vptr); @@ -1474,7 +1474,7 @@ static int velocity_init_dma_rings(struct velocity_info *vptr) rx_ring_size, &pool_dma); if (!pool) { dev_err(&pdev->dev, "%s : DMA memory allocation failed.\n", - vptr->dev->name); + vptr->netd
[PATCHv4 2/3] net: velocity: Convert to generic dma functions
Remove the pci_* dma functions and replace with the more generic versions. In preparation of adding platform support, a new struct device *dev is added to struct velocity_info which can be used by both the pci and platform code. Signed-off-by: Tony Prisk --- drivers/net/ethernet/via/via-velocity.c | 51 +++ drivers/net/ethernet/via/via-velocity.h |1 + 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/drivers/net/ethernet/via/via-velocity.c b/drivers/net/ethernet/via/via-velocity.c index 187eef3..5996cee 100644 --- a/drivers/net/ethernet/via/via-velocity.c +++ b/drivers/net/ethernet/via/via-velocity.c @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include @@ -1459,7 +1460,6 @@ static int velocity_init_dma_rings(struct velocity_info *vptr) struct velocity_opt *opt = &vptr->options; const unsigned int rx_ring_size = opt->numrx * sizeof(struct rx_desc); const unsigned int tx_ring_size = opt->numtx * sizeof(struct tx_desc); - struct pci_dev *pdev = vptr->pdev; dma_addr_t pool_dma; void *pool; unsigned int i; @@ -1467,13 +1467,13 @@ static int velocity_init_dma_rings(struct velocity_info *vptr) /* * Allocate all RD/TD rings a single pool. * -* pci_alloc_consistent() fulfills the requirement for 64 bytes +* dma_alloc_coherent() fulfills the requirement for 64 bytes * alignment */ - pool = pci_alloc_consistent(pdev, tx_ring_size * vptr->tx.numq + - rx_ring_size, &pool_dma); + pool = dma_alloc_coherent(vptr->dev, tx_ring_size * vptr->tx.numq + + rx_ring_size, &pool_dma, GFP_ATOMIC); if (!pool) { - dev_err(&pdev->dev, "%s : DMA memory allocation failed.\n", + dev_err(vptr->dev, "%s : DMA memory allocation failed.\n", vptr->netdev->name); return -ENOMEM; } @@ -1524,8 +1524,8 @@ static int velocity_alloc_rx_buf(struct velocity_info *vptr, int idx) */ skb_reserve(rd_info->skb, 64 - ((unsigned long) rd_info->skb->data & 63)); - rd_info->skb_dma = pci_map_single(vptr->pdev, rd_info->skb->data, - vptr->rx.buf_sz, PCI_DMA_FROMDEVICE); + rd_info->skb_dma = dma_map_single(vptr->dev, rd_info->skb->data, + vptr->rx.buf_sz, DMA_FROM_DEVICE); /* * Fill in the descriptor to match @@ -1588,8 +1588,8 @@ static void velocity_free_rd_ring(struct velocity_info *vptr) if (!rd_info->skb) continue; - pci_unmap_single(vptr->pdev, rd_info->skb_dma, vptr->rx.buf_sz, -PCI_DMA_FROMDEVICE); + dma_unmap_single(vptr->dev, rd_info->skb_dma, vptr->rx.buf_sz, +DMA_FROM_DEVICE); rd_info->skb_dma = 0; dev_kfree_skb(rd_info->skb); @@ -1670,7 +1670,7 @@ static void velocity_free_dma_rings(struct velocity_info *vptr) const int size = vptr->options.numrx * sizeof(struct rx_desc) + vptr->options.numtx * sizeof(struct tx_desc) * vptr->tx.numq; - pci_free_consistent(vptr->pdev, size, vptr->rx.ring, vptr->rx.pool_dma); + dma_free_coherent(vptr->dev, size, vptr->rx.ring, vptr->rx.pool_dma); } static int velocity_init_rings(struct velocity_info *vptr, int mtu) @@ -1727,8 +1727,8 @@ static void velocity_free_tx_buf(struct velocity_info *vptr, pktlen = max_t(size_t, pktlen, td->td_buf[i].size & ~TD_QUEUE); - pci_unmap_single(vptr->pdev, tdinfo->skb_dma[i], - le16_to_cpu(pktlen), PCI_DMA_TODEVICE); + dma_unmap_single(vptr->dev, tdinfo->skb_dma[i], + le16_to_cpu(pktlen), DMA_TO_DEVICE); } } dev_kfree_skb_irq(skb); @@ -1750,8 +1750,8 @@ static void velocity_free_td_ring_entry(struct velocity_info *vptr, if (td_info->skb) { for (i = 0; i < td_info->nskb_dma; i++) { if (td_info->skb_dma[i]) { - pci_unmap_single(vptr->pdev, td_info->skb_dma[i], - td_info->skb->len, PCI_DMA_TODEVICE); + dma_unmap_single(vptr->dev, td_info->skb_dma[i], + td_info->skb->len, DMA_TO_DEVICE); td_in
[PATCHv4 0/3] Add support for velocity network driver on platform devices
v4 changes: Code tidyup as requested by Francois Romieu Removed '#ifdef PCI' around PCI code. Compile tested on (!)PCI and (!)PM. v3 changes: Rebased against net-next. Fix errors in pm code. v2 changes: Drop patch #1 as requested by David Miller. Correct the PHYID_ICPLUS_IP101A MII bits - should be ON, rather than OFF. Read the platform rev_id from the correct register [regs->rev_id]. It's possible this would work for the PCI version as well and would remove the need for the 'if (pci)' test to set vptr->rev_id. v1: The first three patches are general tidyup. [DROPPED] Patch ## just alphabetizes the #includes to make it easier to read. Patch #1 replaces vptr->dev with vptr->netdev, in preparation of adding a struct device *dev in Patch #3 Patch #2 replaces the pci dma functions with the generic versions. I have build tested these patches but don't have a PCI velocity to run-test it. I can't see that they should introduce any problems as it is all renames and function swapping. Patch #3 adds support for the velocity driver on devicetree platform devices. Binding document included. This patch is compile-tested for PCI, and boot tested on a VIA APC8750. I think it would be pertinent to get some tested-by's for PCI users. Regards Tony Prisk Tony Prisk (3): net: velocity: Rename vptr->dev to vptr->netdev net: velocity: Convert to generic dma functions net: velocity: Add platform device support to VIA velocity driver .../devicetree/bindings/net/via-velocity.txt | 20 + drivers/net/ethernet/via/Kconfig |3 +- drivers/net/ethernet/via/via-velocity.c| 546 ++-- drivers/net/ethernet/via/via-velocity.h| 40 +- 4 files changed, 438 insertions(+), 171 deletions(-) create mode 100644 Documentation/devicetree/bindings/net/via-velocity.txt -- 1.7.9.5 -- 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/
[PATCHv3 0/3] Add support for velocity network driver on platform devices
v3 changes: Rebased against net-next. Fix errors in pm code. v2 changes: Drop patch #1 as requested by David Miller. Correct the PHYID_ICPLUS_IP101A MII bits - should be ON, rather than OFF. Read the platform rev_id from the correct register [regs->rev_id]. It's possible this would work for the PCI version as well and would remove the need for the 'if (pci)' test to set vptr->rev_id. v1: The first three patches are general tidyup. [DROPPED] Patch ## just alphabetizes the #includes to make it easier to read. Patch #1 replaces vptr->dev with vptr->netdev, in preparation of adding a struct device *dev in Patch #3 Patch #2 replaces the pci dma functions with the generic versions. I have build tested these patches but don't have a PCI velocity to run-test it. I can't see that they should introduce any problems as it is all renames and function swapping. Patch #3 adds support for the velocity driver on devicetree platform devices. Binding document included. This patch is compile-tested for PCI, and boot tested on a VIA APC8750. I think it would be pertinent to get some tested-by's for PCI users. Regards Tony Prisk Tony Prisk (3): net: velocity: Rename vptr->dev to vptr->netdev net: velocity: Convert to generic dma functions net: velocity: Add platform device support to VIA velocity driver .../devicetree/bindings/net/via-velocity.txt | 20 + drivers/net/ethernet/via/Kconfig |3 +- drivers/net/ethernet/via/via-velocity.c| 563 ++-- drivers/net/ethernet/via/via-velocity.h| 35 +- 4 files changed, 454 insertions(+), 167 deletions(-) create mode 100644 Documentation/devicetree/bindings/net/via-velocity.txt -- 1.7.9.5 -- 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/
[PATCHv3 2/3] net: velocity: Convert to generic dma functions
Remove the pci_* dma functions and replace with the more generic versions. In preparation of adding platform support, a new struct device *dev is added to struct velocity_info which can be used by both the pci and platform code. Signed-off-by: Tony Prisk --- drivers/net/ethernet/via/via-velocity.c | 51 +++ drivers/net/ethernet/via/via-velocity.h |1 + 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/drivers/net/ethernet/via/via-velocity.c b/drivers/net/ethernet/via/via-velocity.c index 187eef3..5996cee 100644 --- a/drivers/net/ethernet/via/via-velocity.c +++ b/drivers/net/ethernet/via/via-velocity.c @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include @@ -1459,7 +1460,6 @@ static int velocity_init_dma_rings(struct velocity_info *vptr) struct velocity_opt *opt = &vptr->options; const unsigned int rx_ring_size = opt->numrx * sizeof(struct rx_desc); const unsigned int tx_ring_size = opt->numtx * sizeof(struct tx_desc); - struct pci_dev *pdev = vptr->pdev; dma_addr_t pool_dma; void *pool; unsigned int i; @@ -1467,13 +1467,13 @@ static int velocity_init_dma_rings(struct velocity_info *vptr) /* * Allocate all RD/TD rings a single pool. * -* pci_alloc_consistent() fulfills the requirement for 64 bytes +* dma_alloc_coherent() fulfills the requirement for 64 bytes * alignment */ - pool = pci_alloc_consistent(pdev, tx_ring_size * vptr->tx.numq + - rx_ring_size, &pool_dma); + pool = dma_alloc_coherent(vptr->dev, tx_ring_size * vptr->tx.numq + + rx_ring_size, &pool_dma, GFP_ATOMIC); if (!pool) { - dev_err(&pdev->dev, "%s : DMA memory allocation failed.\n", + dev_err(vptr->dev, "%s : DMA memory allocation failed.\n", vptr->netdev->name); return -ENOMEM; } @@ -1524,8 +1524,8 @@ static int velocity_alloc_rx_buf(struct velocity_info *vptr, int idx) */ skb_reserve(rd_info->skb, 64 - ((unsigned long) rd_info->skb->data & 63)); - rd_info->skb_dma = pci_map_single(vptr->pdev, rd_info->skb->data, - vptr->rx.buf_sz, PCI_DMA_FROMDEVICE); + rd_info->skb_dma = dma_map_single(vptr->dev, rd_info->skb->data, + vptr->rx.buf_sz, DMA_FROM_DEVICE); /* * Fill in the descriptor to match @@ -1588,8 +1588,8 @@ static void velocity_free_rd_ring(struct velocity_info *vptr) if (!rd_info->skb) continue; - pci_unmap_single(vptr->pdev, rd_info->skb_dma, vptr->rx.buf_sz, -PCI_DMA_FROMDEVICE); + dma_unmap_single(vptr->dev, rd_info->skb_dma, vptr->rx.buf_sz, +DMA_FROM_DEVICE); rd_info->skb_dma = 0; dev_kfree_skb(rd_info->skb); @@ -1670,7 +1670,7 @@ static void velocity_free_dma_rings(struct velocity_info *vptr) const int size = vptr->options.numrx * sizeof(struct rx_desc) + vptr->options.numtx * sizeof(struct tx_desc) * vptr->tx.numq; - pci_free_consistent(vptr->pdev, size, vptr->rx.ring, vptr->rx.pool_dma); + dma_free_coherent(vptr->dev, size, vptr->rx.ring, vptr->rx.pool_dma); } static int velocity_init_rings(struct velocity_info *vptr, int mtu) @@ -1727,8 +1727,8 @@ static void velocity_free_tx_buf(struct velocity_info *vptr, pktlen = max_t(size_t, pktlen, td->td_buf[i].size & ~TD_QUEUE); - pci_unmap_single(vptr->pdev, tdinfo->skb_dma[i], - le16_to_cpu(pktlen), PCI_DMA_TODEVICE); + dma_unmap_single(vptr->dev, tdinfo->skb_dma[i], + le16_to_cpu(pktlen), DMA_TO_DEVICE); } } dev_kfree_skb_irq(skb); @@ -1750,8 +1750,8 @@ static void velocity_free_td_ring_entry(struct velocity_info *vptr, if (td_info->skb) { for (i = 0; i < td_info->nskb_dma; i++) { if (td_info->skb_dma[i]) { - pci_unmap_single(vptr->pdev, td_info->skb_dma[i], - td_info->skb->len, PCI_DMA_TODEVICE); + dma_unmap_single(vptr->dev, td_info->skb_dma[i], + td_info->skb->len, DMA_TO_DEVICE); td_in
[PATCHv3 1/3] net: velocity: Rename vptr->dev to vptr->netdev
Improve the clarity of the code in preparation for converting the dma functions to generic versions, which require a struct device *. This makes it possible to store a 'struct device *dev' in the velocity_info structure. Signed-off-by: Tony Prisk --- drivers/net/ethernet/via/via-velocity.c | 66 +++ drivers/net/ethernet/via/via-velocity.h |4 +- 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/drivers/net/ethernet/via/via-velocity.c b/drivers/net/ethernet/via/via-velocity.c index fb62489..187eef3 100644 --- a/drivers/net/ethernet/via/via-velocity.c +++ b/drivers/net/ethernet/via/via-velocity.c @@ -998,9 +998,9 @@ static void velocity_print_link_status(struct velocity_info *vptr) { if (vptr->mii_status & VELOCITY_LINK_FAIL) { - VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: failed to detect cable link\n", vptr->dev->name); + VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: failed to detect cable link\n", vptr->netdev->name); } else if (vptr->options.spd_dpx == SPD_DPX_AUTO) { - VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: Link auto-negotiation", vptr->dev->name); + VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: Link auto-negotiation", vptr->netdev->name); if (vptr->mii_status & VELOCITY_SPEED_1000) VELOCITY_PRT(MSG_LEVEL_INFO, " speed 1000M bps"); @@ -1014,7 +1014,7 @@ static void velocity_print_link_status(struct velocity_info *vptr) else VELOCITY_PRT(MSG_LEVEL_INFO, " half duplex\n"); } else { - VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: Link forced", vptr->dev->name); + VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: Link forced", vptr->netdev->name); switch (vptr->options.spd_dpx) { case SPD_DPX_1000_FULL: VELOCITY_PRT(MSG_LEVEL_INFO, " speed 1000M bps full duplex\n"); @@ -1319,7 +1319,7 @@ static void velocity_init_registers(struct velocity_info *vptr, case VELOCITY_INIT_RESET: case VELOCITY_INIT_WOL: - netif_stop_queue(vptr->dev); + netif_stop_queue(vptr->netdev); /* * Reset RX to prevent RX pointer not on the 4X location @@ -1332,7 +1332,7 @@ static void velocity_init_registers(struct velocity_info *vptr, if (velocity_set_media_mode(vptr, mii_status) != VELOCITY_LINK_CHANGE) { velocity_print_link_status(vptr); if (!(vptr->mii_status & VELOCITY_LINK_FAIL)) - netif_wake_queue(vptr->dev); + netif_wake_queue(vptr->netdev); } enable_flow_control_ability(vptr); @@ -1354,7 +1354,7 @@ static void velocity_init_registers(struct velocity_info *vptr, mac_eeprom_reload(regs); for (i = 0; i < 6; i++) - writeb(vptr->dev->dev_addr[i], &(regs->PAR[i])); + writeb(vptr->netdev->dev_addr[i], &(regs->PAR[i])); /* * clear Pre_ACPI bit. @@ -1377,7 +1377,7 @@ static void velocity_init_registers(struct velocity_info *vptr, /* * Set packet filter: Receive directed and broadcast address */ - velocity_set_multi(vptr->dev); + velocity_set_multi(vptr->netdev); /* * Enable MII auto-polling @@ -1404,14 +1404,14 @@ static void velocity_init_registers(struct velocity_info *vptr, writel((CR0_DPOLL | CR0_TXON | CR0_RXON | CR0_STRT), ®s->CR0Set); mii_status = velocity_get_opt_media_mode(vptr); - netif_stop_queue(vptr->dev); + netif_stop_queue(vptr->netdev); mii_init(vptr, mii_status); if (velocity_set_media_mode(vptr, mii_status) != VELOCITY_LINK_CHANGE) { velocity_print_link_status(vptr); if (!(vptr->mii_status & VELOCITY_LINK_FAIL)) - netif_wake_queue(vptr->dev); + netif_wake_queue(vptr->netdev); } enable_flow_control_ability(vptr); @@ -1474,7 +1474,7 @@ static int velocity_init_dma_rings(struct velocity_info *vptr) rx_ring_size, &pool_dma); if (!pool) { dev_err(&pdev->dev, "%s : DMA memory allocation failed.\n", - vptr->dev->name); + vptr->netd
[PATCHv3 3/3] net: velocity: Add platform device support to VIA velocity driver
Add support for the VIA Velocity network driver to be bound to a OF created platform device. Signed-off-by: Tony Prisk --- .../devicetree/bindings/net/via-velocity.txt | 20 + drivers/net/ethernet/via/Kconfig |3 +- drivers/net/ethernet/via/via-velocity.c| 452 +++- drivers/net/ethernet/via/via-velocity.h| 30 +- 4 files changed, 396 insertions(+), 109 deletions(-) create mode 100644 Documentation/devicetree/bindings/net/via-velocity.txt diff --git a/Documentation/devicetree/bindings/net/via-velocity.txt b/Documentation/devicetree/bindings/net/via-velocity.txt new file mode 100644 index 000..b3db469 --- /dev/null +++ b/Documentation/devicetree/bindings/net/via-velocity.txt @@ -0,0 +1,20 @@ +* VIA Velocity 10/100/1000 Network Controller + +Required properties: +- compatible : Should be "via,velocity-vt6110" +- reg : Address and length of the io space +- interrupts : Should contain the controller interrupt line + +Optional properties: +- no-eeprom : PCI network cards use an external EEPROM to store data. Embedded + devices quite often set this data in uboot and do not provide an eeprom. + Specify this option if you have no external eeprom. + +Examples: + +eth0@d8004000 { + compatible = "via,velocity-vt6110"; + reg = <0xd8004000 0x400>; + interrupts = <10>; + no-eeprom; +}; diff --git a/drivers/net/ethernet/via/Kconfig b/drivers/net/ethernet/via/Kconfig index 68a9ba6..6a87097 100644 --- a/drivers/net/ethernet/via/Kconfig +++ b/drivers/net/ethernet/via/Kconfig @@ -5,7 +5,6 @@ config NET_VENDOR_VIA bool "VIA devices" default y - depends on PCI ---help--- If you have a network (Ethernet) card belonging to this class, say Y and read the Ethernet-HOWTO, available from @@ -45,7 +44,7 @@ config VIA_RHINE_MMIO config VIA_VELOCITY tristate "VIA Velocity support" - depends on PCI + depends on (PCI || USE_OF) select CRC32 select CRC_CCITT select NET_CORE diff --git a/drivers/net/ethernet/via/via-velocity.c b/drivers/net/ethernet/via/via-velocity.c index 5996cee..3a87f13 100644 --- a/drivers/net/ethernet/via/via-velocity.c +++ b/drivers/net/ethernet/via/via-velocity.c @@ -65,7 +65,11 @@ #include #include #include +#include +#include +#include #include +#include #include #include #include @@ -84,6 +88,16 @@ static int velocity_nics; static int msglevel = MSG_LEVEL_INFO; +static void velocity_set_power_state(struct velocity_info *vptr, char state) +{ + void *addr = vptr->mac_regs; + + if (vptr->bustype == BUS_PCI) + pci_set_power_state(vptr->pdev, state); + else + writeb(state, addr + 0x154); +} + /** * mac_get_cam_mask- Read a CAM mask * @regs: register block for this velocity @@ -362,12 +376,24 @@ static struct velocity_info_tbl chip_info_table[] = { * Describe the PCI device identifiers that we support in this * device driver. Used for hotplug autoloading. */ -static DEFINE_PCI_DEVICE_TABLE(velocity_id_table) = { +#ifdef CONFIG_PCI +static DEFINE_PCI_DEVICE_TABLE(velocity_pci_id_table) = { { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_612X) }, { } }; -MODULE_DEVICE_TABLE(pci, velocity_id_table); +MODULE_DEVICE_TABLE(pci, velocity_pci_id_table); +#endif + +/** + * Describe the OF device identifiers that we support in this + * device driver. Used for devicetree nodes. + */ +static struct of_device_id velocity_of_ids[] = { + { .compatible = "via,velocity-vt6110", .data = &chip_info_table[0] }, + { /* Sentinel */ }, +}; +MODULE_DEVICE_TABLE(of, velocity_of_ids); /** * get_chip_name - identifier to name @@ -386,29 +412,6 @@ static const char *get_chip_name(enum chip_type chip_id) } /** - * velocity_remove1- device unplug - * @pdev: PCI device being removed - * - * Device unload callback. Called on an unplug or on module - * unload for each active device that is present. Disconnects - * the device from the network layer and frees all the resources - */ -static void velocity_remove1(struct pci_dev *pdev) -{ - struct net_device *dev = pci_get_drvdata(pdev); - struct velocity_info *vptr = netdev_priv(dev); - - unregister_netdev(dev); - iounmap(vptr->mac_regs); - pci_release_regions(pdev); - pci_disable_device(pdev); - pci_set_drvdata(pdev, NULL); - free_netdev(dev); - - velocity_nics--; -} - -/** * velocity_set_int_opt- parser for integer options * @opt: pointer to option value * @val: value the user requested (or -1 for default) @@ -1181,6 +1184,14 @@ static void mii_init(struct velocity_info *vptr, u32 mii_status) u16 BMCR;
Re: [PATCHv2 0/3] Add support for velocity network driver on platform devices
On 30/04/13 07:15, David Miller wrote: You prepared these patches against a net-next tree which is at least a week old, I know this because that's when the NETIF_F_* flags for VLAN offloading changed their names which causes your third patch to fail to apply. Do not do this, net-next changes every day and rapidly, don't take the chance that the driver you're touching is unpopular and thus hasn't had changes to it recently. Tree-wide interface changes happen all the time. Apologies - I didn't realise. These patches are based against 3.8-rc8. I will rebase against net-next and resend. Regards Tony P -- 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/
[PATCHv2 3/3] net: velocity: Add platform device support to VIA velocity driver
Add support for the VIA Velocity network driver to be bound to a OF created platform device. Signed-off-by: Tony Prisk --- .../devicetree/bindings/net/via-velocity.txt | 20 + drivers/net/ethernet/via/Kconfig |3 +- drivers/net/ethernet/via/via-velocity.c| 453 +++- drivers/net/ethernet/via/via-velocity.h| 30 +- 4 files changed, 398 insertions(+), 108 deletions(-) create mode 100644 Documentation/devicetree/bindings/net/via-velocity.txt diff --git a/Documentation/devicetree/bindings/net/via-velocity.txt b/Documentation/devicetree/bindings/net/via-velocity.txt new file mode 100644 index 000..b3db469 --- /dev/null +++ b/Documentation/devicetree/bindings/net/via-velocity.txt @@ -0,0 +1,20 @@ +* VIA Velocity 10/100/1000 Network Controller + +Required properties: +- compatible : Should be "via,velocity-vt6110" +- reg : Address and length of the io space +- interrupts : Should contain the controller interrupt line + +Optional properties: +- no-eeprom : PCI network cards use an external EEPROM to store data. Embedded + devices quite often set this data in uboot and do not provide an eeprom. + Specify this option if you have no external eeprom. + +Examples: + +eth0@d8004000 { + compatible = "via,velocity-vt6110"; + reg = <0xd8004000 0x400>; + interrupts = <10>; + no-eeprom; +}; diff --git a/drivers/net/ethernet/via/Kconfig b/drivers/net/ethernet/via/Kconfig index 68a9ba6..6a87097 100644 --- a/drivers/net/ethernet/via/Kconfig +++ b/drivers/net/ethernet/via/Kconfig @@ -5,7 +5,6 @@ config NET_VENDOR_VIA bool "VIA devices" default y - depends on PCI ---help--- If you have a network (Ethernet) card belonging to this class, say Y and read the Ethernet-HOWTO, available from @@ -45,7 +44,7 @@ config VIA_RHINE_MMIO config VIA_VELOCITY tristate "VIA Velocity support" - depends on PCI + depends on (PCI || USE_OF) select CRC32 select CRC_CCITT select NET_CORE diff --git a/drivers/net/ethernet/via/via-velocity.c b/drivers/net/ethernet/via/via-velocity.c index e2c4887..03cc3ed 100644 --- a/drivers/net/ethernet/via/via-velocity.c +++ b/drivers/net/ethernet/via/via-velocity.c @@ -65,7 +65,11 @@ #include #include #include +#include +#include +#include #include +#include #include #include #include @@ -84,6 +88,16 @@ static int velocity_nics; static int msglevel = MSG_LEVEL_INFO; +static void velocity_set_power_state(struct velocity_info *vptr, char state) +{ + void *addr = vptr->mac_regs; + + if (vptr->bustype == BUS_PCI) + pci_set_power_state(vptr->pdev, state); + else + writeb(state, addr + 0x154); +} + /** * mac_get_cam_mask- Read a CAM mask * @regs: register block for this velocity @@ -362,12 +376,24 @@ static struct velocity_info_tbl chip_info_table[] = { * Describe the PCI device identifiers that we support in this * device driver. Used for hotplug autoloading. */ -static DEFINE_PCI_DEVICE_TABLE(velocity_id_table) = { +#ifdef CONFIG_PCI +static DEFINE_PCI_DEVICE_TABLE(velocity_pci_id_table) = { { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_612X) }, { } }; -MODULE_DEVICE_TABLE(pci, velocity_id_table); +MODULE_DEVICE_TABLE(pci, velocity_pci_id_table); +#endif + +/** + * Describe the OF device identifiers that we support in this + * device driver. Used for devicetree nodes. + */ +static struct of_device_id velocity_of_ids[] = { + { .compatible = "via,velocity-vt6110", .data = &chip_info_table[0] }, + { /* Sentinel */ }, +}; +MODULE_DEVICE_TABLE(of, velocity_of_ids); /** * get_chip_name - identifier to name @@ -386,29 +412,6 @@ static const char *get_chip_name(enum chip_type chip_id) } /** - * velocity_remove1- device unplug - * @pdev: PCI device being removed - * - * Device unload callback. Called on an unplug or on module - * unload for each active device that is present. Disconnects - * the device from the network layer and frees all the resources - */ -static void velocity_remove1(struct pci_dev *pdev) -{ - struct net_device *dev = pci_get_drvdata(pdev); - struct velocity_info *vptr = netdev_priv(dev); - - unregister_netdev(dev); - iounmap(vptr->mac_regs); - pci_release_regions(pdev); - pci_disable_device(pdev); - pci_set_drvdata(pdev, NULL); - free_netdev(dev); - - velocity_nics--; -} - -/** * velocity_set_int_opt- parser for integer options * @opt: pointer to option value * @val: value the user requested (or -1 for default) @@ -1179,6 +1182,14 @@ static void mii_init(struct velocity_info *vptr, u32 mii_status) u16 BMCR;
[PATCHv2 1/3] net: velocity: Rename vptr->dev to vptr->netdev
Improve the clarity of the code in preparation for converting the dma functions to generic versions, which require a struct device *. This makes it possible to store a 'struct device *dev' in the velocity_info structure. Signed-off-by: Tony Prisk --- drivers/net/ethernet/via/via-velocity.c | 66 +++ drivers/net/ethernet/via/via-velocity.h |4 +- 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/drivers/net/ethernet/via/via-velocity.c b/drivers/net/ethernet/via/via-velocity.c index 1bc7f9fd..9a408b1 100644 --- a/drivers/net/ethernet/via/via-velocity.c +++ b/drivers/net/ethernet/via/via-velocity.c @@ -996,9 +996,9 @@ static void velocity_print_link_status(struct velocity_info *vptr) { if (vptr->mii_status & VELOCITY_LINK_FAIL) { - VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: failed to detect cable link\n", vptr->dev->name); + VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: failed to detect cable link\n", vptr->netdev->name); } else if (vptr->options.spd_dpx == SPD_DPX_AUTO) { - VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: Link auto-negotiation", vptr->dev->name); + VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: Link auto-negotiation", vptr->netdev->name); if (vptr->mii_status & VELOCITY_SPEED_1000) VELOCITY_PRT(MSG_LEVEL_INFO, " speed 1000M bps"); @@ -1012,7 +1012,7 @@ static void velocity_print_link_status(struct velocity_info *vptr) else VELOCITY_PRT(MSG_LEVEL_INFO, " half duplex\n"); } else { - VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: Link forced", vptr->dev->name); + VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: Link forced", vptr->netdev->name); switch (vptr->options.spd_dpx) { case SPD_DPX_1000_FULL: VELOCITY_PRT(MSG_LEVEL_INFO, " speed 1000M bps full duplex\n"); @@ -1317,7 +1317,7 @@ static void velocity_init_registers(struct velocity_info *vptr, case VELOCITY_INIT_RESET: case VELOCITY_INIT_WOL: - netif_stop_queue(vptr->dev); + netif_stop_queue(vptr->netdev); /* * Reset RX to prevent RX pointer not on the 4X location @@ -1330,7 +1330,7 @@ static void velocity_init_registers(struct velocity_info *vptr, if (velocity_set_media_mode(vptr, mii_status) != VELOCITY_LINK_CHANGE) { velocity_print_link_status(vptr); if (!(vptr->mii_status & VELOCITY_LINK_FAIL)) - netif_wake_queue(vptr->dev); + netif_wake_queue(vptr->netdev); } enable_flow_control_ability(vptr); @@ -1352,7 +1352,7 @@ static void velocity_init_registers(struct velocity_info *vptr, mac_eeprom_reload(regs); for (i = 0; i < 6; i++) - writeb(vptr->dev->dev_addr[i], &(regs->PAR[i])); + writeb(vptr->netdev->dev_addr[i], &(regs->PAR[i])); /* * clear Pre_ACPI bit. @@ -1375,7 +1375,7 @@ static void velocity_init_registers(struct velocity_info *vptr, /* * Set packet filter: Receive directed and broadcast address */ - velocity_set_multi(vptr->dev); + velocity_set_multi(vptr->netdev); /* * Enable MII auto-polling @@ -1402,14 +1402,14 @@ static void velocity_init_registers(struct velocity_info *vptr, writel((CR0_DPOLL | CR0_TXON | CR0_RXON | CR0_STRT), ®s->CR0Set); mii_status = velocity_get_opt_media_mode(vptr); - netif_stop_queue(vptr->dev); + netif_stop_queue(vptr->netdev); mii_init(vptr, mii_status); if (velocity_set_media_mode(vptr, mii_status) != VELOCITY_LINK_CHANGE) { velocity_print_link_status(vptr); if (!(vptr->mii_status & VELOCITY_LINK_FAIL)) - netif_wake_queue(vptr->dev); + netif_wake_queue(vptr->netdev); } enable_flow_control_ability(vptr); @@ -1472,7 +1472,7 @@ static int velocity_init_dma_rings(struct velocity_info *vptr) rx_ring_size, &pool_dma); if (!pool) { dev_err(&pdev->dev, "%s : DMA memory allocation failed.\n", - vptr->dev->name); + vptr->netd
[PATCHv2 0/3] Add support for velocity network driver on platform devices
v2 changes: Drop patch #1 as requested by David Miller. Correct the PHYID_ICPLUS_IP101A MII bits - should be ON, rather than OFF. Read the platform rev_id from the correct register [regs->rev_id]. It's possible this would work for the PCI version as well and would remove the need for the 'if (pci)' test to set vptr->rev_id. v1: The first three patches are general tidyup. [DROPPED] Patch ## just alphabetizes the #includes to make it easier to read. Patch #1 replaces vptr->dev with vptr->netdev, in preparation of adding a struct device *dev in Patch #3 Patch #2 replaces the pci dma functions with the generic versions. I have build tested these patches but don't have a PCI velocity to run-test it. I can't see that they should introduce any problems as it is all renames and function swapping. Patch #3 adds support for the velocity driver on devicetree platform devices. Binding document included. This patch is compile-tested for PCI, and boot tested on a VIA APC8750. I think it would be pertinent to get some tested-by's for PCI users. Regards Tony Prisk Tony Prisk (3): net: velocity: Rename vptr->dev to vptr->netdev net: velocity: Convert to generic dma functions net: velocity: Add platform device support to VIA velocity driver .../devicetree/bindings/net/via-velocity.txt | 20 + drivers/net/ethernet/via/Kconfig |3 +- drivers/net/ethernet/via/via-velocity.c| 564 ++-- drivers/net/ethernet/via/via-velocity.h| 35 +- 4 files changed, 456 insertions(+), 166 deletions(-) create mode 100644 Documentation/devicetree/bindings/net/via-velocity.txt -- 1.7.9.5 -- 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/
[PATCHv2 2/3] net: velocity: Convert to generic dma functions
Remove the pci_* dma functions and replace with the more generic versions. In preparation of adding platform support, a new struct device *dev is added to struct velocity_info which can be used by both the pci and platform code. Signed-off-by: Tony Prisk --- drivers/net/ethernet/via/via-velocity.c | 51 +++ drivers/net/ethernet/via/via-velocity.h |1 + 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/drivers/net/ethernet/via/via-velocity.c b/drivers/net/ethernet/via/via-velocity.c index 9a408b1..e2c4887 100644 --- a/drivers/net/ethernet/via/via-velocity.c +++ b/drivers/net/ethernet/via/via-velocity.c @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include @@ -1457,7 +1458,6 @@ static int velocity_init_dma_rings(struct velocity_info *vptr) struct velocity_opt *opt = &vptr->options; const unsigned int rx_ring_size = opt->numrx * sizeof(struct rx_desc); const unsigned int tx_ring_size = opt->numtx * sizeof(struct tx_desc); - struct pci_dev *pdev = vptr->pdev; dma_addr_t pool_dma; void *pool; unsigned int i; @@ -1465,13 +1465,13 @@ static int velocity_init_dma_rings(struct velocity_info *vptr) /* * Allocate all RD/TD rings a single pool. * -* pci_alloc_consistent() fulfills the requirement for 64 bytes +* dma_alloc_coherent() fulfills the requirement for 64 bytes * alignment */ - pool = pci_alloc_consistent(pdev, tx_ring_size * vptr->tx.numq + - rx_ring_size, &pool_dma); + pool = dma_alloc_coherent(vptr->dev, tx_ring_size * vptr->tx.numq + + rx_ring_size, &pool_dma, GFP_ATOMIC); if (!pool) { - dev_err(&pdev->dev, "%s : DMA memory allocation failed.\n", + dev_err(vptr->dev, "%s : DMA memory allocation failed.\n", vptr->netdev->name); return -ENOMEM; } @@ -1522,8 +1522,8 @@ static int velocity_alloc_rx_buf(struct velocity_info *vptr, int idx) */ skb_reserve(rd_info->skb, 64 - ((unsigned long) rd_info->skb->data & 63)); - rd_info->skb_dma = pci_map_single(vptr->pdev, rd_info->skb->data, - vptr->rx.buf_sz, PCI_DMA_FROMDEVICE); + rd_info->skb_dma = dma_map_single(vptr->dev, rd_info->skb->data, + vptr->rx.buf_sz, DMA_FROM_DEVICE); /* * Fill in the descriptor to match @@ -1586,8 +1586,8 @@ static void velocity_free_rd_ring(struct velocity_info *vptr) if (!rd_info->skb) continue; - pci_unmap_single(vptr->pdev, rd_info->skb_dma, vptr->rx.buf_sz, -PCI_DMA_FROMDEVICE); + dma_unmap_single(vptr->dev, rd_info->skb_dma, vptr->rx.buf_sz, +DMA_FROM_DEVICE); rd_info->skb_dma = 0; dev_kfree_skb(rd_info->skb); @@ -1668,7 +1668,7 @@ static void velocity_free_dma_rings(struct velocity_info *vptr) const int size = vptr->options.numrx * sizeof(struct rx_desc) + vptr->options.numtx * sizeof(struct tx_desc) * vptr->tx.numq; - pci_free_consistent(vptr->pdev, size, vptr->rx.ring, vptr->rx.pool_dma); + dma_free_coherent(vptr->dev, size, vptr->rx.ring, vptr->rx.pool_dma); } static int velocity_init_rings(struct velocity_info *vptr, int mtu) @@ -1725,8 +1725,8 @@ static void velocity_free_tx_buf(struct velocity_info *vptr, pktlen = max_t(size_t, pktlen, td->td_buf[i].size & ~TD_QUEUE); - pci_unmap_single(vptr->pdev, tdinfo->skb_dma[i], - le16_to_cpu(pktlen), PCI_DMA_TODEVICE); + dma_unmap_single(vptr->dev, tdinfo->skb_dma[i], + le16_to_cpu(pktlen), DMA_TO_DEVICE); } } dev_kfree_skb_irq(skb); @@ -1748,8 +1748,8 @@ static void velocity_free_td_ring_entry(struct velocity_info *vptr, if (td_info->skb) { for (i = 0; i < td_info->nskb_dma; i++) { if (td_info->skb_dma[i]) { - pci_unmap_single(vptr->pdev, td_info->skb_dma[i], - td_info->skb->len, PCI_DMA_TODEVICE); + dma_unmap_single(vptr->dev, td_info->skb_dma[i], + td_info->skb->len, DMA_TO_DEVICE); td_in
Re: [PATCH 1/4] net: velocity: Alphabetize #includes
On 28/04/13 17:21, David Miller wrote: From: Tony Prisk Date: Sun, 28 Apr 2013 15:16:43 +1200 Due to number of #includes, alphabetize them to help avoid duplicates. Signed-off-by: Tony Prisk Needless churn, I refuse to apply this. No problem - I'll drop it. Tony Prisk -- 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] net: velocity: Convert to generic dma functions
On 28/04/13 15:16, Tony Prisk wrote: Remove the pci_* dma functions and replace with the more generic versions. In preparation of adding platform support, a new struct device *dev is added to struct velocity_info which can be used by both the pci and platform code. Signed-off-by: Tony Prisk --- drivers/net/ethernet/via/via-velocity.c | 51 +++ drivers/net/ethernet/via/via-velocity.h |1 + 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/drivers/net/ethernet/via/via-velocity.c b/drivers/net/ethernet/via/via-velocity.c index 1168666..a5fe892 100644 --- a/drivers/net/ethernet/via/via-velocity.c +++ b/drivers/net/ethernet/via/via-velocity.c @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include @@ -1457,7 +1458,6 @@ static int velocity_init_dma_rings(struct velocity_info *vptr) struct velocity_opt *opt = &vptr->options; const unsigned int rx_ring_size = opt->numrx * sizeof(struct rx_desc); const unsigned int tx_ring_size = opt->numtx * sizeof(struct tx_desc); - struct pci_dev *pdev = vptr->pdev; dma_addr_t pool_dma; void *pool; unsigned int i; @@ -1465,13 +1465,13 @@ static int velocity_init_dma_rings(struct velocity_info *vptr) /* * Allocate all RD/TD rings a single pool. * -* pci_alloc_consistent() fulfills the requirement for 64 bytes +* dma_alloc_coherent() fulfills the requirement for 64 bytes * alignment */ - pool = pci_alloc_consistent(pdev, tx_ring_size * vptr->tx.numq + - rx_ring_size, &pool_dma); + pool = dma_alloc_coherent(vptr->dev, tx_ring_size * vptr->tx.numq + + rx_ring_size, &pool_dma, GFP_ATOMIC); if (!pool) { - dev_err(&pdev->dev, "%s : DMA memory allocation failed.\n", + dev_err(vptr->dev, "%s : DMA memory allocation failed.\n", vptr->netdev->name); return -ENOMEM; } @@ -1522,8 +1522,8 @@ static int velocity_alloc_rx_buf(struct velocity_info *vptr, int idx) */ skb_reserve(rd_info->skb, 64 - ((unsigned long) rd_info->skb->data & 63)); - rd_info->skb_dma = pci_map_single(vptr->pdev, rd_info->skb->data, - vptr->rx.buf_sz, PCI_DMA_FROMDEVICE); + rd_info->skb_dma = dma_map_single(vptr->dev, rd_info->skb->data, + vptr->rx.buf_sz, DMA_FROM_DEVICE); /* * Fill in the descriptor to match @@ -1586,8 +1586,8 @@ static void velocity_free_rd_ring(struct velocity_info *vptr) if (!rd_info->skb) continue; - pci_unmap_single(vptr->pdev, rd_info->skb_dma, vptr->rx.buf_sz, -PCI_DMA_FROMDEVICE); + dma_unmap_single(vptr->dev, rd_info->skb_dma, vptr->rx.buf_sz, +DMA_FROM_DEVICE); rd_info->skb_dma = 0; dev_kfree_skb(rd_info->skb); @@ -1668,7 +1668,7 @@ static void velocity_free_dma_rings(struct velocity_info *vptr) const int size = vptr->options.numrx * sizeof(struct rx_desc) + vptr->options.numtx * sizeof(struct tx_desc) * vptr->tx.numq; - pci_free_consistent(vptr->pdev, size, vptr->rx.ring, vptr->rx.pool_dma); + dma_free_coherent(vptr->dev, size, vptr->rx.ring, vptr->rx.pool_dma); } static int velocity_init_rings(struct velocity_info *vptr, int mtu) @@ -1725,8 +1725,8 @@ static void velocity_free_tx_buf(struct velocity_info *vptr, pktlen = max_t(size_t, pktlen, td->td_buf[i].size & ~TD_QUEUE); - pci_unmap_single(vptr->pdev, tdinfo->skb_dma[i], - le16_to_cpu(pktlen), PCI_DMA_TODEVICE); + dma_unmap_single(vptr->dev, tdinfo->skb_dma[i], + le16_to_cpu(pktlen), DMA_TO_DEVICE); } } dev_kfree_skb_irq(skb); @@ -1748,8 +1748,8 @@ static void velocity_free_td_ring_entry(struct velocity_info *vptr, if (td_info->skb) { for (i = 0; i < td_info->nskb_dma; i++) { if (td_info->skb_dma[i]) { - pci_unmap_single(vptr->pdev, td_info->skb_dma[i], - td_info->skb->len, PCI_DMA_TODEVICE); + dma_unmap_single(vptr->dev, td_info->skb_dma[i], + td_info->skb->len, DMA_TO_DEVICE); t
[PATCH 3/4] net: velocity: Convert to generic dma functions
Remove the pci_* dma functions and replace with the more generic versions. In preparation of adding platform support, a new struct device *dev is added to struct velocity_info which can be used by both the pci and platform code. Signed-off-by: Tony Prisk --- drivers/net/ethernet/via/via-velocity.c | 51 +++ drivers/net/ethernet/via/via-velocity.h |1 + 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/drivers/net/ethernet/via/via-velocity.c b/drivers/net/ethernet/via/via-velocity.c index 1168666..a5fe892 100644 --- a/drivers/net/ethernet/via/via-velocity.c +++ b/drivers/net/ethernet/via/via-velocity.c @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include @@ -1457,7 +1458,6 @@ static int velocity_init_dma_rings(struct velocity_info *vptr) struct velocity_opt *opt = &vptr->options; const unsigned int rx_ring_size = opt->numrx * sizeof(struct rx_desc); const unsigned int tx_ring_size = opt->numtx * sizeof(struct tx_desc); - struct pci_dev *pdev = vptr->pdev; dma_addr_t pool_dma; void *pool; unsigned int i; @@ -1465,13 +1465,13 @@ static int velocity_init_dma_rings(struct velocity_info *vptr) /* * Allocate all RD/TD rings a single pool. * -* pci_alloc_consistent() fulfills the requirement for 64 bytes +* dma_alloc_coherent() fulfills the requirement for 64 bytes * alignment */ - pool = pci_alloc_consistent(pdev, tx_ring_size * vptr->tx.numq + - rx_ring_size, &pool_dma); + pool = dma_alloc_coherent(vptr->dev, tx_ring_size * vptr->tx.numq + + rx_ring_size, &pool_dma, GFP_ATOMIC); if (!pool) { - dev_err(&pdev->dev, "%s : DMA memory allocation failed.\n", + dev_err(vptr->dev, "%s : DMA memory allocation failed.\n", vptr->netdev->name); return -ENOMEM; } @@ -1522,8 +1522,8 @@ static int velocity_alloc_rx_buf(struct velocity_info *vptr, int idx) */ skb_reserve(rd_info->skb, 64 - ((unsigned long) rd_info->skb->data & 63)); - rd_info->skb_dma = pci_map_single(vptr->pdev, rd_info->skb->data, - vptr->rx.buf_sz, PCI_DMA_FROMDEVICE); + rd_info->skb_dma = dma_map_single(vptr->dev, rd_info->skb->data, + vptr->rx.buf_sz, DMA_FROM_DEVICE); /* * Fill in the descriptor to match @@ -1586,8 +1586,8 @@ static void velocity_free_rd_ring(struct velocity_info *vptr) if (!rd_info->skb) continue; - pci_unmap_single(vptr->pdev, rd_info->skb_dma, vptr->rx.buf_sz, -PCI_DMA_FROMDEVICE); + dma_unmap_single(vptr->dev, rd_info->skb_dma, vptr->rx.buf_sz, +DMA_FROM_DEVICE); rd_info->skb_dma = 0; dev_kfree_skb(rd_info->skb); @@ -1668,7 +1668,7 @@ static void velocity_free_dma_rings(struct velocity_info *vptr) const int size = vptr->options.numrx * sizeof(struct rx_desc) + vptr->options.numtx * sizeof(struct tx_desc) * vptr->tx.numq; - pci_free_consistent(vptr->pdev, size, vptr->rx.ring, vptr->rx.pool_dma); + dma_free_coherent(vptr->dev, size, vptr->rx.ring, vptr->rx.pool_dma); } static int velocity_init_rings(struct velocity_info *vptr, int mtu) @@ -1725,8 +1725,8 @@ static void velocity_free_tx_buf(struct velocity_info *vptr, pktlen = max_t(size_t, pktlen, td->td_buf[i].size & ~TD_QUEUE); - pci_unmap_single(vptr->pdev, tdinfo->skb_dma[i], - le16_to_cpu(pktlen), PCI_DMA_TODEVICE); + dma_unmap_single(vptr->dev, tdinfo->skb_dma[i], + le16_to_cpu(pktlen), DMA_TO_DEVICE); } } dev_kfree_skb_irq(skb); @@ -1748,8 +1748,8 @@ static void velocity_free_td_ring_entry(struct velocity_info *vptr, if (td_info->skb) { for (i = 0; i < td_info->nskb_dma; i++) { if (td_info->skb_dma[i]) { - pci_unmap_single(vptr->pdev, td_info->skb_dma[i], - td_info->skb->len, PCI_DMA_TODEVICE); + dma_unmap_single(vptr->dev, td_info->skb_dma[i], + td_info->skb->len, DMA_TO_DEVICE); td_in
[PATCH 0/4] Add support for velocity network driver on platform devices
The first three patches are general tidyup. Patch #1 just alphabetizes the #includes to make it easier to read. Patch #2 replaces vptr->dev with vptr->netdev, again for clarity in the code. Patch #3 replaces the pci dma functions with the generic versions. I have build tested these patches but don't have a PCI velocity to run-test it. I can't see that they should introduce any problems as it is all renames and function swapping. Patch #4 adds support for the velocity driver on devicetree platform devices. Binding document included. This patch is compile-tested for PCI, and boot tested on a VIA APC8750. I think it would be pertinent to get some tested-by's for PCI users. Regards Tony Prisk Tony Prisk (4): net: velocity: Alphabetize #includes net: velocity: Rename vptr->dev to vptr->netdev net: velocity: Convert to generic dma functions net: velocity: Add platform device support to VIA velocity driver .../devicetree/bindings/net/via-velocity.txt | 20 + drivers/net/ethernet/via/Kconfig |3 +- drivers/net/ethernet/via/via-velocity.c| 612 ++-- drivers/net/ethernet/via/via-velocity.h| 35 +- 4 files changed, 480 insertions(+), 190 deletions(-) create mode 100644 Documentation/devicetree/bindings/net/via-velocity.txt -- 1.7.9.5 -- 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/4] net: velocity: Add platform device support to VIA velocity driver
Add support for the VIA Velocity network driver to be bound to a OF created platform device. Signed-off-by: Tony Prisk --- .../devicetree/bindings/net/via-velocity.txt | 20 + drivers/net/ethernet/via/Kconfig |3 +- drivers/net/ethernet/via/via-velocity.c| 453 +++- drivers/net/ethernet/via/via-velocity.h| 30 +- 4 files changed, 398 insertions(+), 108 deletions(-) create mode 100644 Documentation/devicetree/bindings/net/via-velocity.txt diff --git a/Documentation/devicetree/bindings/net/via-velocity.txt b/Documentation/devicetree/bindings/net/via-velocity.txt new file mode 100644 index 000..b3db469 --- /dev/null +++ b/Documentation/devicetree/bindings/net/via-velocity.txt @@ -0,0 +1,20 @@ +* VIA Velocity 10/100/1000 Network Controller + +Required properties: +- compatible : Should be "via,velocity-vt6110" +- reg : Address and length of the io space +- interrupts : Should contain the controller interrupt line + +Optional properties: +- no-eeprom : PCI network cards use an external EEPROM to store data. Embedded + devices quite often set this data in uboot and do not provide an eeprom. + Specify this option if you have no external eeprom. + +Examples: + +eth0@d8004000 { + compatible = "via,velocity-vt6110"; + reg = <0xd8004000 0x400>; + interrupts = <10>; + no-eeprom; +}; diff --git a/drivers/net/ethernet/via/Kconfig b/drivers/net/ethernet/via/Kconfig index 68a9ba6..6a87097 100644 --- a/drivers/net/ethernet/via/Kconfig +++ b/drivers/net/ethernet/via/Kconfig @@ -5,7 +5,6 @@ config NET_VENDOR_VIA bool "VIA devices" default y - depends on PCI ---help--- If you have a network (Ethernet) card belonging to this class, say Y and read the Ethernet-HOWTO, available from @@ -45,7 +44,7 @@ config VIA_RHINE_MMIO config VIA_VELOCITY tristate "VIA Velocity support" - depends on PCI + depends on (PCI || USE_OF) select CRC32 select CRC_CCITT select NET_CORE diff --git a/drivers/net/ethernet/via/via-velocity.c b/drivers/net/ethernet/via/via-velocity.c index a5fe892..f4b5ff1 100644 --- a/drivers/net/ethernet/via/via-velocity.c +++ b/drivers/net/ethernet/via/via-velocity.c @@ -65,7 +65,11 @@ #include #include #include +#include +#include +#include #include +#include #include #include #include @@ -84,6 +88,16 @@ static int velocity_nics; static int msglevel = MSG_LEVEL_INFO; +static void velocity_set_power_state(struct velocity_info *vptr, char state) +{ + void *addr = vptr->mac_regs; + + if (vptr->bustype == BUS_PCI) + pci_set_power_state(vptr->pdev, state); + else + writeb(state, addr + 0x154); +} + /** * mac_get_cam_mask- Read a CAM mask * @regs: register block for this velocity @@ -362,12 +376,24 @@ static struct velocity_info_tbl chip_info_table[] = { * Describe the PCI device identifiers that we support in this * device driver. Used for hotplug autoloading. */ -static DEFINE_PCI_DEVICE_TABLE(velocity_id_table) = { +#ifdef CONFIG_PCI +static DEFINE_PCI_DEVICE_TABLE(velocity_pci_id_table) = { { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_612X) }, { } }; -MODULE_DEVICE_TABLE(pci, velocity_id_table); +MODULE_DEVICE_TABLE(pci, velocity_pci_id_table); +#endif + +/** + * Describe the OF device identifiers that we support in this + * device driver. Used for devicetree nodes. + */ +static struct of_device_id velocity_of_ids[] = { + { .compatible = "via,velocity-vt6110", .data = &chip_info_table[0] }, + { /* Sentinel */ }, +}; +MODULE_DEVICE_TABLE(of, velocity_of_ids); /** * get_chip_name - identifier to name @@ -386,29 +412,6 @@ static const char *get_chip_name(enum chip_type chip_id) } /** - * velocity_remove1- device unplug - * @pdev: PCI device being removed - * - * Device unload callback. Called on an unplug or on module - * unload for each active device that is present. Disconnects - * the device from the network layer and frees all the resources - */ -static void velocity_remove1(struct pci_dev *pdev) -{ - struct net_device *dev = pci_get_drvdata(pdev); - struct velocity_info *vptr = netdev_priv(dev); - - unregister_netdev(dev); - iounmap(vptr->mac_regs); - pci_release_regions(pdev); - pci_disable_device(pdev); - pci_set_drvdata(pdev, NULL); - free_netdev(dev); - - velocity_nics--; -} - -/** * velocity_set_int_opt- parser for integer options * @opt: pointer to option value * @val: value the user requested (or -1 for default) @@ -1179,6 +1182,14 @@ static void mii_init(struct velocity_info *vptr, u32 mii_status) u16 BMCR;
[PATCH 2/4] net: velocity: Rename vptr->dev to vptr->netdev
Improve the clarity of the code in preparation for converting the dma functions to generic versions, which require a struct device *. This makes it possible to store a 'struct device *dev' in the velocity_info structure. Signed-off-by: Tony Prisk --- drivers/net/ethernet/via/via-velocity.c | 66 +++ drivers/net/ethernet/via/via-velocity.h |4 +- 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/drivers/net/ethernet/via/via-velocity.c b/drivers/net/ethernet/via/via-velocity.c index eb2a023..1168666 100644 --- a/drivers/net/ethernet/via/via-velocity.c +++ b/drivers/net/ethernet/via/via-velocity.c @@ -996,9 +996,9 @@ static void velocity_print_link_status(struct velocity_info *vptr) { if (vptr->mii_status & VELOCITY_LINK_FAIL) { - VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: failed to detect cable link\n", vptr->dev->name); + VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: failed to detect cable link\n", vptr->netdev->name); } else if (vptr->options.spd_dpx == SPD_DPX_AUTO) { - VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: Link auto-negotiation", vptr->dev->name); + VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: Link auto-negotiation", vptr->netdev->name); if (vptr->mii_status & VELOCITY_SPEED_1000) VELOCITY_PRT(MSG_LEVEL_INFO, " speed 1000M bps"); @@ -1012,7 +1012,7 @@ static void velocity_print_link_status(struct velocity_info *vptr) else VELOCITY_PRT(MSG_LEVEL_INFO, " half duplex\n"); } else { - VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: Link forced", vptr->dev->name); + VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: Link forced", vptr->netdev->name); switch (vptr->options.spd_dpx) { case SPD_DPX_1000_FULL: VELOCITY_PRT(MSG_LEVEL_INFO, " speed 1000M bps full duplex\n"); @@ -1317,7 +1317,7 @@ static void velocity_init_registers(struct velocity_info *vptr, case VELOCITY_INIT_RESET: case VELOCITY_INIT_WOL: - netif_stop_queue(vptr->dev); + netif_stop_queue(vptr->netdev); /* * Reset RX to prevent RX pointer not on the 4X location @@ -1330,7 +1330,7 @@ static void velocity_init_registers(struct velocity_info *vptr, if (velocity_set_media_mode(vptr, mii_status) != VELOCITY_LINK_CHANGE) { velocity_print_link_status(vptr); if (!(vptr->mii_status & VELOCITY_LINK_FAIL)) - netif_wake_queue(vptr->dev); + netif_wake_queue(vptr->netdev); } enable_flow_control_ability(vptr); @@ -1352,7 +1352,7 @@ static void velocity_init_registers(struct velocity_info *vptr, mac_eeprom_reload(regs); for (i = 0; i < 6; i++) - writeb(vptr->dev->dev_addr[i], &(regs->PAR[i])); + writeb(vptr->netdev->dev_addr[i], &(regs->PAR[i])); /* * clear Pre_ACPI bit. @@ -1375,7 +1375,7 @@ static void velocity_init_registers(struct velocity_info *vptr, /* * Set packet filter: Receive directed and broadcast address */ - velocity_set_multi(vptr->dev); + velocity_set_multi(vptr->netdev); /* * Enable MII auto-polling @@ -1402,14 +1402,14 @@ static void velocity_init_registers(struct velocity_info *vptr, writel((CR0_DPOLL | CR0_TXON | CR0_RXON | CR0_STRT), ®s->CR0Set); mii_status = velocity_get_opt_media_mode(vptr); - netif_stop_queue(vptr->dev); + netif_stop_queue(vptr->netdev); mii_init(vptr, mii_status); if (velocity_set_media_mode(vptr, mii_status) != VELOCITY_LINK_CHANGE) { velocity_print_link_status(vptr); if (!(vptr->mii_status & VELOCITY_LINK_FAIL)) - netif_wake_queue(vptr->dev); + netif_wake_queue(vptr->netdev); } enable_flow_control_ability(vptr); @@ -1472,7 +1472,7 @@ static int velocity_init_dma_rings(struct velocity_info *vptr) rx_ring_size, &pool_dma); if (!pool) { dev_err(&pdev->dev, "%s : DMA memory allocation failed.\n", - vptr->dev->name); + vptr->netd
[PATCH 1/4] net: velocity: Alphabetize #includes
Due to number of #includes, alphabetize them to help avoid duplicates. Signed-off-by: Tony Prisk --- drivers/net/ethernet/via/via-velocity.c | 48 +++ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/drivers/net/ethernet/via/via-velocity.c b/drivers/net/ethernet/via/via-velocity.c index 1bc7f9fd..eb2a023 100644 --- a/drivers/net/ethernet/via/via-velocity.c +++ b/drivers/net/ethernet/via/via-velocity.c @@ -42,40 +42,40 @@ * */ -#include -#include #include -#include -#include +#include +#include +#include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include -#include +#include #include +#include +#include +#include #include -#include +#include +#include +#include #include -#include -#include #include -#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include +#include +#include +#include #include -#include -#include +#include #include "via-velocity.h" -- 1.7.9.5 -- 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/
VIA velocity network driver
I would like to add support to this driver for platform devices as found on VIA's APC8750 board. At the moment, I have a standalone platform version that works fine, but wanted to ask a few questions before sending a patch to merge this code into one driver. The current driver is for PCI network cards, and uses pci dma functions. Most of the pci dma functions are wrappers around other functions which is what I have used for the platform version. For example: rd_info->skb_dma = pci_map_single(vptr->pdev, rd_info->skb->data, vptr->rx.buf_sz, PCI_DMA_FROMDEVICE); is replaced with: rd_info->skb_dma = dma_map_single(&vptr->plat_dev->dev, rd_info->skb->data, vptr->rx.buf_sz, DMA_FROM_DEVICE); Is it ok to use the non-pci versions (which are basically just the unwrapped pci versions) and pass the struct device *, or will I need to use the correct function for the correct instance. Other than adding some new probe/remove functions, this is all that is needed to add platform driver support. One bug/problem that arose is to do with the EEPROM code in velocity_init_registers(), in the case for VELOCITY_INIT_COLD: mac_eeprom_reload(regs); for (i = 0; i < 6; i++) writeb(vptr->dev->dev_addr[i], &(regs->PAR[i])); I assume this is loading something from an EEPROM, but there is no EEPROM on the APC8750. Removing this code, the driver seems to work fine on the APC8750. Could it be avoided with a vptr->has_no_eeprom that defaults to 0 to avoid breaking existing support? Regards Tony Prisk -- 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] clk: vt8500: Missing breaks in vtwm_pll_round_rate/_set_rate.
The case of PLL_TYPE_WM8750 in both these functions is missing a break statement causing a fall-through to the default: case. Insert the missing break statements. Signed-off-by: Tony Prisk --- Mike, Any chance this can still go in as a fix for 3.9 The fault makes it impossible to set the PLL clocks on WM8750 and later SoCs. Regards Tony P drivers/clk/clk-vt8500.c |2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/clk/clk-vt8500.c b/drivers/clk/clk-vt8500.c index 09c6331..debf688 100644 --- a/drivers/clk/clk-vt8500.c +++ b/drivers/clk/clk-vt8500.c @@ -488,6 +488,7 @@ static int vtwm_pll_set_rate(struct clk_hw *hw, unsigned long rate, case PLL_TYPE_WM8750: wm8750_find_pll_bits(rate, parent_rate, &filter, &mul, &div1, &div2); pll_val = WM8750_BITS_TO_VAL(filter, mul, div1, div2); + break; default: pr_err("%s: invalid pll type\n", __func__); return 0; @@ -523,6 +524,7 @@ static long vtwm_pll_round_rate(struct clk_hw *hw, unsigned long rate, case PLL_TYPE_WM8750: wm8750_find_pll_bits(rate, *prate, &filter, &mul, &div1, &div2); round_rate = WM8750_BITS_TO_FREQ(*prate, mul, div1, div2); + break; default: round_rate = 0; } -- 1.7.9.5 -- 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/
[v3] Support Elan Touchscreen eKTF product.
Hi Scott, Not sure what is happening with the patch - seems to have been sitting for quite a while. Is it still being worked on? I integrated it into our arm/arch-vt8500 testing tree (based on 3.9-rc6) as we have tablets with eKTF2127 controllers and noticed a few problems. 1) __dev attributes cause unused function warnings because they are deprecated. 2) elants_get_power_state() is only called from elants_resume() which is contained within a #ifdef CONFIG_PM_SLEEP. You should also move the elants_get_power_state() inside the #ifdef to remove the unused_function warning when compiled without CONFIG_PM. Regards Tony Prisk -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] arm: vt8500: Add SDHC support to WM8505 DT
This patch adds the required node for the SDHC controller on WM8505 SoCs. Signed-off-by: Tony Prisk --- Arnd, Any chance you can apply this for 3.10 Regards Ton yP arch/arm/boot/dts/wm8505.dtsi | 31 +++ 1 file changed, 31 insertions(+) diff --git a/arch/arm/boot/dts/wm8505.dtsi b/arch/arm/boot/dts/wm8505.dtsi index e74a1c0..388f26d 100644 --- a/arch/arm/boot/dts/wm8505.dtsi +++ b/arch/arm/boot/dts/wm8505.dtsi @@ -60,6 +60,19 @@ clock-frequency = <2400>; }; + ref25: ref25M { + #clock-cells = <0>; + compatible = "fixed-clock"; + clock-frequency = <2500>; + }; + + pllb: pllb { + #clock-cells = <0>; + compatible = "via,vt8500-pll-clock"; + clocks = <&ref25>; + reg = <0x204>; + }; + clkuart0: uart0 { #clock-cells = <0>; compatible = "via,vt8500-device-clock"; @@ -107,6 +120,16 @@ enable-reg = <0x250>; enable-bit = <23>; }; + + clksdhc: sdhc { + #clock-cells = <0>; + compatible = "via,vt8500-device-clock"; + clocks = <&pllb>; + divisor-reg = <0x328>; + divisor-mask = <0x3f>; + enable-reg = <0x254>; + enable-bit = <18>; + }; }; }; @@ -187,5 +210,13 @@ reg = <0xd810 0x1>; interrupts = <48>; }; + + sdhc@d800a000 { + compatible = "wm,wm8505-sdhc"; + reg = <0xd800a000 0x1000>; + interrupts = <20 21>; + clocks = <&clksdhc>; + bus-width = <4>; + }; }; }; -- 1.7.9.5 -- 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] pinctrl: vt8500: wmt: Fix checking return value of pinctrl_register()
On 10/04/13 03:59, Axel Lin wrote: pinctrl_register() returns NULL on error. Signed-off-by: Axel Lin --- drivers/pinctrl/vt8500/pinctrl-wmt.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pinctrl/vt8500/pinctrl-wmt.c b/drivers/pinctrl/vt8500/pinctrl-wmt.c index 14400a7..ab63104e 100644 --- a/drivers/pinctrl/vt8500/pinctrl-wmt.c +++ b/drivers/pinctrl/vt8500/pinctrl-wmt.c @@ -588,7 +588,7 @@ int wmt_pinctrl_probe(struct platform_device *pdev, data->dev = &pdev->dev; data->pctl_dev = pinctrl_register(&wmt_desc, &pdev->dev, data); - if (IS_ERR(data->pctl_dev)) { + if (!data->pctl_dev) { dev_err(&pdev->dev, "Failed to register pinctrl\n"); return -EINVAL; } Not sure why I missed this... Linus, If you're happy with this patch, I'll forward it on to arm-soc to go in with the rest. Regards Tony P -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: linux-next: manual merge of the arm-soc tree with the gpio-lw tree
On 09/04/13 19:47, Stephen Rothwell wrote: Hi all, Today's linux-next merge of the arm-soc tree got a conflict in drivers/gpio/gpio-vt8500.c between commit 808c513ee64b ("gpio/vt8500: Convert to devm_ioremap_resource()") from the gpio-lw tree and commit dc1010860b03 ("gpio: vt8500: Remove arch-vt8500 gpio driver") from the arm-soc tree. The latter removed the file, so I did that and can carry the fix as necessary (no action is required). That's the correct solution Regards Tony P -- 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/