From: Greg Kroah-Hartman Date: Mon, 3 Dec 2012 23:02:06 +0000 (-0800) Subject: 3.4: Armadillo 800 and Marzen patches added X-Git-Tag: v3.4.25-ltsi~25 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=12e057530821c9839d0d0272cdda555fb36869d1;p=platform%2Fkernel%2Flinux-stable.git 3.4: Armadillo 800 and Marzen patches added --- diff --git a/patches.armadillo800/0001-ARM-shmobile-add-common-DMAEngine-definitions.patch b/patches.armadillo800/0001-ARM-shmobile-add-common-DMAEngine-definitions.patch new file mode 100644 index 000000000000..5316285a382f --- /dev/null +++ b/patches.armadillo800/0001-ARM-shmobile-add-common-DMAEngine-definitions.patch @@ -0,0 +1,115 @@ +From 4d3626f914a2b4023a3edf428640e578527ac0c8 Mon Sep 17 00:00:00 2001 +From: Kuninori Morimoto +Date: Mon, 25 Jun 2012 03:43:00 -0700 +Subject: ARM: shmobile: add common DMAEngine definitions + +Current shmobile have DMAEngine specific settings on each CPU code, +but SH-ARM DMAC use same value. + +This patch adds new dma-register.h header to share definitions +and reduce a waste of code on SH-ARM architecture. + +Signed-off-by: Kuninori Morimoto +Acked-by: Magnus Damm +Signed-off-by: Rafael J. Wysocki +(cherry picked from commit 5ca1d44f6a99b29ab164a06f4ec71950d6939fb5) + +Signed-off-by: Simon Horman +--- + arch/arm/mach-shmobile/include/mach/dma-register.h | 84 ++++++++++++++++++++++ + 1 file changed, 84 insertions(+) + create mode 100644 arch/arm/mach-shmobile/include/mach/dma-register.h + +diff --git a/arch/arm/mach-shmobile/include/mach/dma-register.h b/arch/arm/mach-shmobile/include/mach/dma-register.h +new file mode 100644 +index 0000000..97c40bd +--- /dev/null ++++ b/arch/arm/mach-shmobile/include/mach/dma-register.h +@@ -0,0 +1,84 @@ ++/* ++ * SH-ARM CPU-specific DMA definitions, used by both DMA drivers ++ * ++ * Copyright (C) 2012 Renesas Solutions Corp ++ * ++ * Kuninori Morimoto ++ * ++ * Based on arch/sh/include/cpu-sh4/cpu/dma-register.h ++ * Copyright (C) 2010 Guennadi Liakhovetski ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ */ ++ ++#ifndef DMA_REGISTER_H ++#define DMA_REGISTER_H ++ ++/* ++ * Direct Memory Access Controller ++ */ ++ ++/* Transmit sizes and respective CHCR register values */ ++enum { ++ XMIT_SZ_8BIT = 0, ++ XMIT_SZ_16BIT = 1, ++ XMIT_SZ_32BIT = 2, ++ XMIT_SZ_64BIT = 7, ++ XMIT_SZ_128BIT = 3, ++ XMIT_SZ_256BIT = 4, ++ XMIT_SZ_512BIT = 5, ++}; ++ ++/* log2(size / 8) - used to calculate number of transfers */ ++static const unsigned int dma_ts_shift[] = { ++ [XMIT_SZ_8BIT] = 0, ++ [XMIT_SZ_16BIT] = 1, ++ [XMIT_SZ_32BIT] = 2, ++ [XMIT_SZ_64BIT] = 3, ++ [XMIT_SZ_128BIT] = 4, ++ [XMIT_SZ_256BIT] = 5, ++ [XMIT_SZ_512BIT] = 6, ++}; ++ ++#define TS_LOW_BIT 0x3 /* --xx */ ++#define TS_HI_BIT 0xc /* xx-- */ ++ ++#define TS_LOW_SHIFT (3) ++#define TS_HI_SHIFT (20 - 2) /* 2 bits for shifted low TS */ ++ ++#define TS_INDEX2VAL(i) \ ++ ((((i) & TS_LOW_BIT) << TS_LOW_SHIFT) |\ ++ (((i) & TS_HI_BIT) << TS_HI_SHIFT)) ++ ++#define CHCR_TX(xmit_sz) (DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL((xmit_sz))) ++#define CHCR_RX(xmit_sz) (DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL((xmit_sz))) ++ ++ ++/* ++ * USB High-Speed DMAC ++ */ ++/* Transmit sizes and respective CHCR register values */ ++enum { ++ USBTS_XMIT_SZ_8BYTE = 0, ++ USBTS_XMIT_SZ_16BYTE = 1, ++ USBTS_XMIT_SZ_32BYTE = 2, ++}; ++ ++/* log2(size / 8) - used to calculate number of transfers */ ++static const unsigned int dma_usbts_shift[] = { ++ [USBTS_XMIT_SZ_8BYTE] = 3, ++ [USBTS_XMIT_SZ_16BYTE] = 4, ++ [USBTS_XMIT_SZ_32BYTE] = 5, ++}; ++ ++#define USBTS_LOW_BIT 0x3 /* --xx */ ++#define USBTS_HI_BIT 0x0 /* ---- */ ++ ++#define USBTS_LOW_SHIFT 6 ++#define USBTS_HI_SHIFT 0 ++ ++#define USBTS_INDEX2VAL(i) (((i) & 3) << 6) ++ ++#endif /* DMA_REGISTER_H */ +-- +1.8.0.197.g5a90748 + diff --git a/patches.armadillo800/0002-ARM-shmobile-soc-core-add-R-mobile-PM-domain-common-.patch b/patches.armadillo800/0002-ARM-shmobile-soc-core-add-R-mobile-PM-domain-common-.patch new file mode 100644 index 000000000000..2acaf3de704c --- /dev/null +++ b/patches.armadillo800/0002-ARM-shmobile-soc-core-add-R-mobile-PM-domain-common-.patch @@ -0,0 +1,260 @@ +From c13b4e8e39cad46f37b794ba12b8a97569767e25 Mon Sep 17 00:00:00 2001 +From: Kuninori Morimoto +Date: Thu, 5 Jul 2012 01:24:46 -0700 +Subject: ARM: shmobile: soc-core: add R-mobile PM domain common APIs + +This patch adds Renesas R-mobile series common PM domain APIs. +R-mobile CPU can use/switch this API + +Signed-off-by: Kuninori Morimoto +Acked-by: Magnus Damm +Signed-off-by: Rafael J. Wysocki +(cherry picked from commit 8f45b112fc66ef6869ccca4c3966976982f496a9) + +Signed-off-by: Simon Horman +--- + arch/arm/mach-shmobile/Makefile | 1 + + arch/arm/mach-shmobile/include/mach/pm-rmobile.h | 44 ++++++ + arch/arm/mach-shmobile/pm-rmobile.c | 167 +++++++++++++++++++++++ + 3 files changed, 212 insertions(+) + create mode 100644 arch/arm/mach-shmobile/include/mach/pm-rmobile.h + create mode 100644 arch/arm/mach-shmobile/pm-rmobile.c + +diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile +index e7c2590..53846a1e 100644 +--- a/arch/arm/mach-shmobile/Makefile ++++ b/arch/arm/mach-shmobile/Makefile +@@ -37,6 +37,7 @@ obj-$(CONFIG_ARCH_R8A7740) += entry-intc.o + # PM objects + obj-$(CONFIG_SUSPEND) += suspend.o + obj-$(CONFIG_CPU_IDLE) += cpuidle.o ++obj-$(CONFIG_ARCH_SHMOBILE) += pm-rmobile.o + obj-$(CONFIG_ARCH_SH7372) += pm-sh7372.o sleep-sh7372.o + obj-$(CONFIG_ARCH_R8A7779) += pm-r8a7779.o + +diff --git a/arch/arm/mach-shmobile/include/mach/pm-rmobile.h b/arch/arm/mach-shmobile/include/mach/pm-rmobile.h +new file mode 100644 +index 0000000..5a40284 +--- /dev/null ++++ b/arch/arm/mach-shmobile/include/mach/pm-rmobile.h +@@ -0,0 +1,44 @@ ++/* ++ * Copyright (C) 2012 Renesas Solutions Corp. ++ * ++ * Kuninori Morimoto ++ * ++ * This file is subject to the terms and conditions of the GNU General Public ++ * License. See the file "COPYING" in the main directory of this archive ++ * for more details. ++ */ ++#ifndef PM_RMOBILE_H ++#define PM_RMOBILE_H ++ ++#include ++ ++struct platform_device; ++ ++struct rmobile_pm_domain { ++ struct generic_pm_domain genpd; ++ struct dev_power_governor *gov; ++ int (*suspend)(void); ++ void (*resume)(void); ++ unsigned int bit_shift; ++ bool no_debug; ++}; ++ ++static inline ++struct rmobile_pm_domain *to_rmobile_pd(struct generic_pm_domain *d) ++{ ++ return container_of(d, struct rmobile_pm_domain, genpd); ++} ++ ++#ifdef CONFIG_PM ++extern void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd); ++extern void rmobile_add_device_to_domain(struct rmobile_pm_domain *rmobile_pd, ++ struct platform_device *pdev); ++extern void rmobile_pm_add_subdomain(struct rmobile_pm_domain *rmobile_pd, ++ struct rmobile_pm_domain *rmobile_sd); ++#else ++#define rmobile_init_pm_domain(pd) do { } while (0) ++#define rmobile_add_device_to_domain(pd, pdev) do { } while (0) ++#define rmobile_pm_add_subdomain(pd, sd) do { } while (0) ++#endif /* CONFIG_PM */ ++ ++#endif /* PM_RMOBILE_H */ +diff --git a/arch/arm/mach-shmobile/pm-rmobile.c b/arch/arm/mach-shmobile/pm-rmobile.c +new file mode 100644 +index 0000000..a856254 +--- /dev/null ++++ b/arch/arm/mach-shmobile/pm-rmobile.c +@@ -0,0 +1,167 @@ ++/* ++ * rmobile power management support ++ * ++ * Copyright (C) 2012 Renesas Solutions Corp. ++ * Copyright (C) 2012 Kuninori Morimoto ++ * ++ * based on pm-sh7372.c ++ * Copyright (C) 2011 Magnus Damm ++ * ++ * This file is subject to the terms and conditions of the GNU General Public ++ * License. See the file "COPYING" in the main directory of this archive ++ * for more details. ++ */ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++/* SYSC */ ++#define SPDCR 0xe6180008 ++#define SWUCR 0xe6180014 ++#define PSTR 0xe6180080 ++ ++#define PSTR_RETRIES 100 ++#define PSTR_DELAY_US 10 ++ ++#ifdef CONFIG_PM ++static int rmobile_pd_power_down(struct generic_pm_domain *genpd) ++{ ++ struct rmobile_pm_domain *rmobile_pd = to_rmobile_pd(genpd); ++ unsigned int mask = 1 << rmobile_pd->bit_shift; ++ ++ if (rmobile_pd->suspend) { ++ int ret = rmobile_pd->suspend(); ++ ++ if (ret) ++ return ret; ++ } ++ ++ if (__raw_readl(PSTR) & mask) { ++ unsigned int retry_count; ++ __raw_writel(mask, SPDCR); ++ ++ for (retry_count = PSTR_RETRIES; retry_count; retry_count--) { ++ if (!(__raw_readl(SPDCR) & mask)) ++ break; ++ cpu_relax(); ++ } ++ } ++ ++ if (!rmobile_pd->no_debug) ++ pr_debug("%s: Power off, 0x%08x -> PSTR = 0x%08x\n", ++ genpd->name, mask, __raw_readl(PSTR)); ++ ++ return 0; ++} ++ ++static int __rmobile_pd_power_up(struct rmobile_pm_domain *rmobile_pd, ++ bool do_resume) ++{ ++ unsigned int mask = 1 << rmobile_pd->bit_shift; ++ unsigned int retry_count; ++ int ret = 0; ++ ++ if (__raw_readl(PSTR) & mask) ++ goto out; ++ ++ __raw_writel(mask, SWUCR); ++ ++ for (retry_count = 2 * PSTR_RETRIES; retry_count; retry_count--) { ++ if (!(__raw_readl(SWUCR) & mask)) ++ break; ++ if (retry_count > PSTR_RETRIES) ++ udelay(PSTR_DELAY_US); ++ else ++ cpu_relax(); ++ } ++ if (!retry_count) ++ ret = -EIO; ++ ++ if (!rmobile_pd->no_debug) ++ pr_debug("%s: Power on, 0x%08x -> PSTR = 0x%08x\n", ++ rmobile_pd->genpd.name, mask, __raw_readl(PSTR)); ++ ++out: ++ if (ret == 0 && rmobile_pd->resume && do_resume) ++ rmobile_pd->resume(); ++ ++ return ret; ++} ++ ++static int rmobile_pd_power_up(struct generic_pm_domain *genpd) ++{ ++ return __rmobile_pd_power_up(to_rmobile_pd(genpd), true); ++} ++ ++static bool rmobile_pd_active_wakeup(struct device *dev) ++{ ++ bool (*active_wakeup)(struct device *dev); ++ ++ active_wakeup = dev_gpd_data(dev)->ops.active_wakeup; ++ return active_wakeup ? active_wakeup(dev) : true; ++} ++ ++static int rmobile_pd_stop_dev(struct device *dev) ++{ ++ int (*stop)(struct device *dev); ++ ++ stop = dev_gpd_data(dev)->ops.stop; ++ if (stop) { ++ int ret = stop(dev); ++ if (ret) ++ return ret; ++ } ++ return pm_clk_suspend(dev); ++} ++ ++static int rmobile_pd_start_dev(struct device *dev) ++{ ++ int (*start)(struct device *dev); ++ int ret; ++ ++ ret = pm_clk_resume(dev); ++ if (ret) ++ return ret; ++ ++ start = dev_gpd_data(dev)->ops.start; ++ if (start) ++ ret = start(dev); ++ ++ return ret; ++} ++ ++void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd) ++{ ++ struct generic_pm_domain *genpd = &rmobile_pd->genpd; ++ struct dev_power_governor *gov = rmobile_pd->gov; ++ ++ pm_genpd_init(genpd, gov ? : &simple_qos_governor, false); ++ genpd->dev_ops.stop = rmobile_pd_stop_dev; ++ genpd->dev_ops.start = rmobile_pd_start_dev; ++ genpd->dev_ops.active_wakeup = rmobile_pd_active_wakeup; ++ genpd->dev_irq_safe = true; ++ genpd->power_off = rmobile_pd_power_down; ++ genpd->power_on = rmobile_pd_power_up; ++ __rmobile_pd_power_up(rmobile_pd, false); ++} ++ ++void rmobile_add_device_to_domain(struct rmobile_pm_domain *rmobile_pd, ++ struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ ++ pm_genpd_add_device(&rmobile_pd->genpd, dev); ++ if (pm_clk_no_clocks(dev)) ++ pm_clk_add(dev, NULL); ++} ++ ++void rmobile_pm_add_subdomain(struct rmobile_pm_domain *rmobile_pd, ++ struct rmobile_pm_domain *rmobile_sd) ++{ ++ pm_genpd_add_subdomain(&rmobile_pd->genpd, &rmobile_sd->genpd); ++} ++#endif /* CONFIG_PM */ +-- +1.8.0.197.g5a90748 + diff --git a/patches.armadillo800/0003-media-V4L2-sh_mobile_ceu-manage-lower-8bit-bus.patch b/patches.armadillo800/0003-media-V4L2-sh_mobile_ceu-manage-lower-8bit-bus.patch new file mode 100644 index 000000000000..e133ecf33aa8 --- /dev/null +++ b/patches.armadillo800/0003-media-V4L2-sh_mobile_ceu-manage-lower-8bit-bus.patch @@ -0,0 +1,55 @@ +From 657ed37c21c4b58b2ce736343d1c653a842f7299 Mon Sep 17 00:00:00 2001 +From: Kuninori Morimoto +Date: Tue, 8 May 2012 00:00:07 -0300 +Subject: [media] V4L2: sh_mobile_ceu: manage lower 8bit bus + +CAMCR::DTIF feild controls camera bus as upper8bit/16bit/lower8bit. +This patch manages unmanaged lower 8bit bus + +Signed-off-by: Kuninori Morimoto +Signed-off-by: Guennadi Liakhovetski +Signed-off-by: Mauro Carvalho Chehab +(cherry picked from commit 2564f67bc8d56e5c7fc2970f80f41f2d38db3e21) + +Signed-off-by: Simon Horman +--- + drivers/media/video/sh_mobile_ceu_camera.c | 8 +++++--- + include/media/sh_mobile_ceu.h | 1 + + 2 files changed, 6 insertions(+), 3 deletions(-) + +diff --git a/drivers/media/video/sh_mobile_ceu_camera.c b/drivers/media/video/sh_mobile_ceu_camera.c +index 424dfac..4e0b654 100644 +--- a/drivers/media/video/sh_mobile_ceu_camera.c ++++ b/drivers/media/video/sh_mobile_ceu_camera.c +@@ -881,11 +881,13 @@ static int sh_mobile_ceu_set_bus_param(struct soc_camera_device *icd) + + value |= common_flags & V4L2_MBUS_VSYNC_ACTIVE_LOW ? 1 << 1 : 0; + value |= common_flags & V4L2_MBUS_HSYNC_ACTIVE_LOW ? 1 << 0 : 0; +- value |= pcdev->is_16bit ? 1 << 12 : 0; + +- /* CSI2 mode */ +- if (pcdev->pdata->csi2) ++ if (pcdev->pdata->csi2) /* CSI2 mode */ + value |= 3 << 12; ++ else if (pcdev->is_16bit) ++ value |= 1 << 12; ++ else if (pcdev->pdata->flags & SH_CEU_FLAG_LOWER_8BIT) ++ value |= 2 << 12; + + ceu_write(pcdev, CAMCR, value); + +diff --git a/include/media/sh_mobile_ceu.h b/include/media/sh_mobile_ceu.h +index a90a765..6fdb6ad 100644 +--- a/include/media/sh_mobile_ceu.h ++++ b/include/media/sh_mobile_ceu.h +@@ -5,6 +5,7 @@ + #define SH_CEU_FLAG_USE_16BIT_BUS (1 << 1) /* use 16bit bus width */ + #define SH_CEU_FLAG_HSYNC_LOW (1 << 2) /* default High if possible */ + #define SH_CEU_FLAG_VSYNC_LOW (1 << 3) /* default High if possible */ ++#define SH_CEU_FLAG_LOWER_8BIT (1 << 4) /* default upper 8bit */ + + struct device; + struct resource; +-- +1.8.0.197.g5a90748 + diff --git a/patches.armadillo800/0004-regulator-support-multiple-dummy-fixed-regulators.patch b/patches.armadillo800/0004-regulator-support-multiple-dummy-fixed-regulators.patch new file mode 100644 index 000000000000..fb5e5111c483 --- /dev/null +++ b/patches.armadillo800/0004-regulator-support-multiple-dummy-fixed-regulators.patch @@ -0,0 +1,96 @@ +From 5d792a5a2daa8e2d397c0b5f45ac76c9e0d175ff Mon Sep 17 00:00:00 2001 +From: Guennadi Liakhovetski +Date: Tue, 19 Jun 2012 17:43:56 +0200 +Subject: regulator: support multiple dummy fixed regulators + +Currently regulator_register_fixed() uses a constant name to register a +fixed dummy regulator. This is sufficient in principle, since there is no +reason to register multiple such regulators. The user can simply supply all +consumers in one array and use it to initialise such a regulator. However, +in some cases it can be convenient to register multiple such regulators. +This is also a prerequisite for the upcoming patch, that will add a voltage +parameter to this function. The original function is provided as a wrapper +macro. + +Signed-off-by: Guennadi Liakhovetski +Signed-off-by: Mark Brown +(cherry picked from commit dfad84aeab5f71b33a12e6803a809f698bdef5a2) + +Signed-off-by: Simon Horman +--- + drivers/regulator/fixed-helper.c | 14 +++++++++++--- + include/linux/regulator/fixed.h | 7 +++++-- + 2 files changed, 16 insertions(+), 5 deletions(-) + +diff --git a/drivers/regulator/fixed-helper.c b/drivers/regulator/fixed-helper.c +index cacd33c..3aa268d 100644 +--- a/drivers/regulator/fixed-helper.c ++++ b/drivers/regulator/fixed-helper.c +@@ -1,4 +1,5 @@ + #include ++#include + #include + #include + #include +@@ -13,16 +14,18 @@ static void regulator_fixed_release(struct device *dev) + { + struct fixed_regulator_data *data = container_of(dev, + struct fixed_regulator_data, pdev.dev); ++ kfree(data->cfg.supply_name); + kfree(data); + } + + /** +- * regulator_register_fixed - register a no-op fixed regulator ++ * regulator_register_fixed_name - register a no-op fixed regulator + * @id: platform device id ++ * @name: name to be used for the regulator + * @supplies: consumers for this regulator + * @num_supplies: number of consumers + */ +-struct platform_device *regulator_register_fixed(int id, ++struct platform_device *regulator_register_always_on(int id, const char *name, + struct regulator_consumer_supply *supplies, int num_supplies) + { + struct fixed_regulator_data *data; +@@ -31,7 +34,12 @@ struct platform_device *regulator_register_fixed(int id, + if (!data) + return NULL; + +- data->cfg.supply_name = "fixed-dummy"; ++ data->cfg.supply_name = kstrdup(name, GFP_KERNEL); ++ if (!data->cfg.supply_name) { ++ kfree(data); ++ return NULL; ++ } ++ + data->cfg.microvolts = 0; + data->cfg.gpio = -EINVAL; + data->cfg.enabled_at_boot = 1; +diff --git a/include/linux/regulator/fixed.h b/include/linux/regulator/fixed.h +index 936a7d8..7bb456c 100644 +--- a/include/linux/regulator/fixed.h ++++ b/include/linux/regulator/fixed.h +@@ -51,14 +51,17 @@ struct fixed_voltage_config { + struct regulator_consumer_supply; + + #if IS_ENABLED(CONFIG_REGULATOR) +-struct platform_device *regulator_register_fixed(int id, ++struct platform_device *regulator_register_always_on(int id, const char *name, + struct regulator_consumer_supply *supplies, int num_supplies); + #else +-static inline struct platform_device *regulator_register_fixed(int id, ++static inline struct platform_device *regulator_register_always_on(int id, const char *name, + struct regulator_consumer_supply *supplies, int num_supplies) + { + return NULL; + } + #endif + ++#define regulator_register_fixed(id, s, ns) regulator_register_always_on(id, \ ++ "fixed-dummy", s, ns) ++ + #endif +-- +1.8.0.197.g5a90748 + diff --git a/patches.armadillo800/0005-regulator-extend-the-fixed-dummy-voltage-regulator-t.patch b/patches.armadillo800/0005-regulator-extend-the-fixed-dummy-voltage-regulator-t.patch new file mode 100644 index 000000000000..dccde558658f --- /dev/null +++ b/patches.armadillo800/0005-regulator-extend-the-fixed-dummy-voltage-regulator-t.patch @@ -0,0 +1,70 @@ +From c5249f06fd57ea88ef47b750dc11a6f683bd5e5d Mon Sep 17 00:00:00 2001 +From: Guennadi Liakhovetski +Date: Tue, 19 Jun 2012 17:44:39 +0200 +Subject: regulator: extend the fixed dummy voltage regulator to accept voltage + +Trivially extend the regulator_register_always_on() helper function to be +even more useful by adding a voltage parameter to it. + +Signed-off-by: Guennadi Liakhovetski +Signed-off-by: Mark Brown +(cherry picked from commit 15719ccc274981b19ad8fe9ac20c94249de8a257) + +Signed-off-by: Simon Horman +--- + drivers/regulator/fixed-helper.c | 5 +++-- + include/linux/regulator/fixed.h | 6 +++--- + 2 files changed, 6 insertions(+), 5 deletions(-) + +diff --git a/drivers/regulator/fixed-helper.c b/drivers/regulator/fixed-helper.c +index 3aa268d..f9d0279 100644 +--- a/drivers/regulator/fixed-helper.c ++++ b/drivers/regulator/fixed-helper.c +@@ -24,9 +24,10 @@ static void regulator_fixed_release(struct device *dev) + * @name: name to be used for the regulator + * @supplies: consumers for this regulator + * @num_supplies: number of consumers ++ * @uv: voltage in microvolts + */ + struct platform_device *regulator_register_always_on(int id, const char *name, +- struct regulator_consumer_supply *supplies, int num_supplies) ++ struct regulator_consumer_supply *supplies, int num_supplies, int uv) + { + struct fixed_regulator_data *data; + +@@ -40,7 +41,7 @@ struct platform_device *regulator_register_always_on(int id, const char *name, + return NULL; + } + +- data->cfg.microvolts = 0; ++ data->cfg.microvolts = uv; + data->cfg.gpio = -EINVAL; + data->cfg.enabled_at_boot = 1; + data->cfg.init_data = &data->init_data; +diff --git a/include/linux/regulator/fixed.h b/include/linux/regulator/fixed.h +index 7bb456c..f6372ee 100644 +--- a/include/linux/regulator/fixed.h ++++ b/include/linux/regulator/fixed.h +@@ -52,16 +52,16 @@ struct regulator_consumer_supply; + + #if IS_ENABLED(CONFIG_REGULATOR) + struct platform_device *regulator_register_always_on(int id, const char *name, +- struct regulator_consumer_supply *supplies, int num_supplies); ++ struct regulator_consumer_supply *supplies, int num_supplies, int uv); + #else + static inline struct platform_device *regulator_register_always_on(int id, const char *name, +- struct regulator_consumer_supply *supplies, int num_supplies) ++ struct regulator_consumer_supply *supplies, int num_supplies, int uv) + { + return NULL; + } + #endif + + #define regulator_register_fixed(id, s, ns) regulator_register_always_on(id, \ +- "fixed-dummy", s, ns) ++ "fixed-dummy", s, ns, 0) + + #endif +-- +1.8.0.197.g5a90748 + diff --git a/patches.armadillo800/0006-Input-gpio_keys-remove-useless-reinitialization-of-p.patch b/patches.armadillo800/0006-Input-gpio_keys-remove-useless-reinitialization-of-p.patch new file mode 100644 index 000000000000..0f2761ddaffb --- /dev/null +++ b/patches.armadillo800/0006-Input-gpio_keys-remove-useless-reinitialization-of-p.patch @@ -0,0 +1,32 @@ +From 5f0a6815e3a7c5e73486b7b0a7ffffcf78b81cee Mon Sep 17 00:00:00 2001 +From: Tobias Klauser +Date: Mon, 11 Jun 2012 23:55:32 -0700 +Subject: Input: gpio_keys - remove useless reinitialization of pdata->nbuttons + +pdata is zeroed using memset just a few lines before, so there is no +need to set the nbuttons member to 0 again. + +Signed-off-by: Tobias Klauser +Signed-off-by: Dmitry Torokhov +(cherry picked from commit 4eceb14f669cb9e9d189019e8fcbf73577fe77a7) + +Signed-off-by: Simon Horman +--- + drivers/input/keyboard/gpio_keys.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c +index 62bfce4..cbb1add 100644 +--- a/drivers/input/keyboard/gpio_keys.c ++++ b/drivers/input/keyboard/gpio_keys.c +@@ -559,7 +559,6 @@ static int gpio_keys_get_devtree_pdata(struct device *dev, + pdata->rep = !!of_get_property(node, "autorepeat", NULL); + + /* First count the subnodes */ +- pdata->nbuttons = 0; + pp = NULL; + while ((pp = of_get_next_child(node, pp))) + pdata->nbuttons++; +-- +1.8.0.197.g5a90748 + diff --git a/patches.armadillo800/0007-Input-st1232-add-device-tree-support.patch b/patches.armadillo800/0007-Input-st1232-add-device-tree-support.patch new file mode 100644 index 000000000000..d0a9ee2bf961 --- /dev/null +++ b/patches.armadillo800/0007-Input-st1232-add-device-tree-support.patch @@ -0,0 +1,49 @@ +From ccbea8cbb6f976a4ed42dfba5648bfb543f520d1 Mon Sep 17 00:00:00 2001 +From: Magnus Damm +Date: Tue, 3 Apr 2012 11:30:28 -0700 +Subject: Input: st1232 - add device tree support + +This patch enables DT support for the st1232 driver +which is primarily used on the sh7372 Mackerel board. + +[dtor@mail.ru: chnaged to use CONFIG_OF and of_match_ptr] +Signed-off-by: Magnus Damm +Acked-by: Arnd Bergmann +Signed-off-by: Dmitry Torokhov +(cherry picked from commit e6293d2f8a6cd427a1ef4ddecb16b1d5ae1929cd) + +Signed-off-by: Simon Horman +--- + drivers/input/touchscreen/st1232.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/drivers/input/touchscreen/st1232.c b/drivers/input/touchscreen/st1232.c +index cbbf71b..216fabb 100644 +--- a/drivers/input/touchscreen/st1232.c ++++ b/drivers/input/touchscreen/st1232.c +@@ -255,6 +255,14 @@ static const struct i2c_device_id st1232_ts_id[] = { + }; + MODULE_DEVICE_TABLE(i2c, st1232_ts_id); + ++#ifdef CONFIG_OF ++static const struct of_device_id st1232_ts_dt_ids[] __devinitconst = { ++ { .compatible = "sitronix,st1232", }, ++ { } ++}; ++MODULE_DEVICE_TABLE(of, st1232_ts_dt_ids); ++#endif ++ + static struct i2c_driver st1232_ts_driver = { + .probe = st1232_ts_probe, + .remove = __devexit_p(st1232_ts_remove), +@@ -262,6 +270,7 @@ static struct i2c_driver st1232_ts_driver = { + .driver = { + .name = ST1232_TS_NAME, + .owner = THIS_MODULE, ++ .of_match_table = of_match_ptr(st1232_ts_dt_ids), + #ifdef CONFIG_PM + .pm = &st1232_ts_pm_ops, + #endif +-- +1.8.0.197.g5a90748 + diff --git a/patches.armadillo800/0008-Input-st1232-switch-to-using-SIMPLE_DEV_PM_OPS.patch b/patches.armadillo800/0008-Input-st1232-switch-to-using-SIMPLE_DEV_PM_OPS.patch new file mode 100644 index 000000000000..95252d1ed1bb --- /dev/null +++ b/patches.armadillo800/0008-Input-st1232-switch-to-using-SIMPLE_DEV_PM_OPS.patch @@ -0,0 +1,57 @@ +From 456b9180124a8edec6c90cbd4d2b3f7c8a09a6f7 Mon Sep 17 00:00:00 2001 +From: Dmitry Torokhov +Date: Tue, 3 Apr 2012 11:30:28 -0700 +Subject: Input: st1232 - switch to using SIMPLE_DEV_PM_OPS + +Acked-by: Rafael J. Wysocki +Reviewed-by: Simon Horman +Signed-off-by: Dmitry Torokhov +(cherry picked from commit b3571400395e318306165eabbfbe05a4c3e4366c) + +Signed-off-by: Simon Horman +--- + drivers/input/touchscreen/st1232.c | 11 ++++------- + 1 file changed, 4 insertions(+), 7 deletions(-) + +diff --git a/drivers/input/touchscreen/st1232.c b/drivers/input/touchscreen/st1232.c +index 216fabb..6cb68a1 100644 +--- a/drivers/input/touchscreen/st1232.c ++++ b/drivers/input/touchscreen/st1232.c +@@ -218,7 +218,7 @@ static int __devexit st1232_ts_remove(struct i2c_client *client) + return 0; + } + +-#ifdef CONFIG_PM ++#ifdef CONFIG_PM_SLEEP + static int st1232_ts_suspend(struct device *dev) + { + struct i2c_client *client = to_i2c_client(dev); +@@ -243,12 +243,11 @@ static int st1232_ts_resume(struct device *dev) + return 0; + } + +-static const struct dev_pm_ops st1232_ts_pm_ops = { +- .suspend = st1232_ts_suspend, +- .resume = st1232_ts_resume, +-}; + #endif + ++static SIMPLE_DEV_PM_OPS(st1232_ts_pm_ops, ++ st1232_ts_suspend, st1232_ts_resume); ++ + static const struct i2c_device_id st1232_ts_id[] = { + { ST1232_TS_NAME, 0 }, + { } +@@ -271,9 +270,7 @@ static struct i2c_driver st1232_ts_driver = { + .name = ST1232_TS_NAME, + .owner = THIS_MODULE, + .of_match_table = of_match_ptr(st1232_ts_dt_ids), +-#ifdef CONFIG_PM + .pm = &st1232_ts_pm_ops, +-#endif + }, + }; + +-- +1.8.0.197.g5a90748 + diff --git a/patches.armadillo800/0009-net-sh_eth-add-support-R8A7740.patch b/patches.armadillo800/0009-net-sh_eth-add-support-R8A7740.patch new file mode 100644 index 000000000000..24501ce745b1 --- /dev/null +++ b/patches.armadillo800/0009-net-sh_eth-add-support-R8A7740.patch @@ -0,0 +1,209 @@ +From 38480ba305384441ebefad2684028756f7eab8b2 Mon Sep 17 00:00:00 2001 +From: Yoshihiro Shimoda +Date: Wed, 4 Apr 2012 18:37:10 +0000 +Subject: net: sh_eth: add support R8A7740 + +The R8A7740 has a Gigabit Ethernet MAC. This patch supports it. + +Signed-off-by: Yoshihiro Shimoda +Tested-by: Kuninori Morimoto +Signed-off-by: David S. Miller +(cherry picked from commit 73a0d907301ece200d32b4e8ba2da2ca296b507f) + +Signed-off-by: Simon Horman +--- + drivers/net/ethernet/renesas/Kconfig | 7 ++- + drivers/net/ethernet/renesas/sh_eth.c | 114 +++++++++++++++++++++++++++++++++- + drivers/net/ethernet/renesas/sh_eth.h | 5 +- + 3 files changed, 120 insertions(+), 6 deletions(-) + +diff --git a/drivers/net/ethernet/renesas/Kconfig b/drivers/net/ethernet/renesas/Kconfig +index 3fb2355..46df3a0 100644 +--- a/drivers/net/ethernet/renesas/Kconfig ++++ b/drivers/net/ethernet/renesas/Kconfig +@@ -4,11 +4,11 @@ + + config SH_ETH + tristate "Renesas SuperH Ethernet support" +- depends on SUPERH && \ ++ depends on (SUPERH || ARCH_SHMOBILE) && \ + (CPU_SUBTYPE_SH7710 || CPU_SUBTYPE_SH7712 || \ + CPU_SUBTYPE_SH7763 || CPU_SUBTYPE_SH7619 || \ + CPU_SUBTYPE_SH7724 || CPU_SUBTYPE_SH7734 || \ +- CPU_SUBTYPE_SH7757) ++ CPU_SUBTYPE_SH7757 || ARCH_R8A7740) + select CRC32 + select NET_CORE + select MII +@@ -17,4 +17,5 @@ config SH_ETH + ---help--- + Renesas SuperH Ethernet device driver. + This driver supporting CPUs are: +- - SH7619, SH7710, SH7712, SH7724, SH7734, SH7763 and SH7757. ++ - SH7619, SH7710, SH7712, SH7724, SH7734, SH7763, SH7757, ++ and R8A7740. +diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c +index d63e09b..be3c221 100644 +--- a/drivers/net/ethernet/renesas/sh_eth.c ++++ b/drivers/net/ethernet/renesas/sh_eth.c +@@ -386,6 +386,114 @@ static void sh_eth_reset_hw_crc(struct net_device *ndev) + sh_eth_write(ndev, 0x0, CSMR); + } + ++#elif defined(CONFIG_ARCH_R8A7740) ++#define SH_ETH_HAS_TSU 1 ++static void sh_eth_chip_reset(struct net_device *ndev) ++{ ++ struct sh_eth_private *mdp = netdev_priv(ndev); ++ unsigned long mii; ++ ++ /* reset device */ ++ sh_eth_tsu_write(mdp, ARSTR_ARSTR, ARSTR); ++ mdelay(1); ++ ++ switch (mdp->phy_interface) { ++ case PHY_INTERFACE_MODE_GMII: ++ mii = 2; ++ break; ++ case PHY_INTERFACE_MODE_MII: ++ mii = 1; ++ break; ++ case PHY_INTERFACE_MODE_RMII: ++ default: ++ mii = 0; ++ break; ++ } ++ sh_eth_write(ndev, mii, RMII_MII); ++} ++ ++static void sh_eth_reset(struct net_device *ndev) ++{ ++ int cnt = 100; ++ ++ sh_eth_write(ndev, EDSR_ENALL, EDSR); ++ sh_eth_write(ndev, sh_eth_read(ndev, EDMR) | EDMR_SRST_GETHER, EDMR); ++ while (cnt > 0) { ++ if (!(sh_eth_read(ndev, EDMR) & 0x3)) ++ break; ++ mdelay(1); ++ cnt--; ++ } ++ if (cnt == 0) ++ printk(KERN_ERR "Device reset fail\n"); ++ ++ /* Table Init */ ++ sh_eth_write(ndev, 0x0, TDLAR); ++ sh_eth_write(ndev, 0x0, TDFAR); ++ sh_eth_write(ndev, 0x0, TDFXR); ++ sh_eth_write(ndev, 0x0, TDFFR); ++ sh_eth_write(ndev, 0x0, RDLAR); ++ sh_eth_write(ndev, 0x0, RDFAR); ++ sh_eth_write(ndev, 0x0, RDFXR); ++ sh_eth_write(ndev, 0x0, RDFFR); ++} ++ ++static void sh_eth_set_duplex(struct net_device *ndev) ++{ ++ struct sh_eth_private *mdp = netdev_priv(ndev); ++ ++ if (mdp->duplex) /* Full */ ++ sh_eth_write(ndev, sh_eth_read(ndev, ECMR) | ECMR_DM, ECMR); ++ else /* Half */ ++ sh_eth_write(ndev, sh_eth_read(ndev, ECMR) & ~ECMR_DM, ECMR); ++} ++ ++static void sh_eth_set_rate(struct net_device *ndev) ++{ ++ struct sh_eth_private *mdp = netdev_priv(ndev); ++ ++ switch (mdp->speed) { ++ case 10: /* 10BASE */ ++ sh_eth_write(ndev, GECMR_10, GECMR); ++ break; ++ case 100:/* 100BASE */ ++ sh_eth_write(ndev, GECMR_100, GECMR); ++ break; ++ case 1000: /* 1000BASE */ ++ sh_eth_write(ndev, GECMR_1000, GECMR); ++ break; ++ default: ++ break; ++ } ++} ++ ++/* R8A7740 */ ++static struct sh_eth_cpu_data sh_eth_my_cpu_data = { ++ .chip_reset = sh_eth_chip_reset, ++ .set_duplex = sh_eth_set_duplex, ++ .set_rate = sh_eth_set_rate, ++ ++ .ecsr_value = ECSR_ICD | ECSR_MPD, ++ .ecsipr_value = ECSIPR_LCHNGIP | ECSIPR_ICDIP | ECSIPR_MPDIP, ++ .eesipr_value = DMAC_M_RFRMER | DMAC_M_ECI | 0x003fffff, ++ ++ .tx_check = EESR_TC1 | EESR_FTC, ++ .eesr_err_check = EESR_TWB1 | EESR_TWB | EESR_TABT | EESR_RABT | \ ++ EESR_RDE | EESR_RFRMER | EESR_TFE | EESR_TDE | \ ++ EESR_ECI, ++ .tx_error_check = EESR_TWB1 | EESR_TWB | EESR_TABT | EESR_TDE | \ ++ EESR_TFE, ++ ++ .apr = 1, ++ .mpr = 1, ++ .tpauser = 1, ++ .bculr = 1, ++ .hw_swap = 1, ++ .no_trimd = 1, ++ .no_ade = 1, ++ .tsu = 1, ++}; ++ + #elif defined(CONFIG_CPU_SUBTYPE_SH7619) + #define SH_ETH_RESET_DEFAULT 1 + static struct sh_eth_cpu_data sh_eth_my_cpu_data = { +@@ -443,7 +551,7 @@ static void sh_eth_reset(struct net_device *ndev) + } + #endif + +-#if defined(CONFIG_CPU_SH4) ++#if defined(CONFIG_CPU_SH4) || defined(CONFIG_ARCH_SHMOBILE) + static void sh_eth_set_receive_align(struct sk_buff *skb) + { + int reserve; +@@ -919,6 +1027,10 @@ static int sh_eth_rx(struct net_device *ndev) + desc_status = edmac_to_cpu(mdp, rxdesc->status); + pkt_len = rxdesc->frame_length; + ++#if defined(CONFIG_ARCH_R8A7740) ++ desc_status >>= 16; ++#endif ++ + if (--boguscnt < 0) + break; + +diff --git a/drivers/net/ethernet/renesas/sh_eth.h b/drivers/net/ethernet/renesas/sh_eth.h +index 0fa14afc..57b8e1f 100644 +--- a/drivers/net/ethernet/renesas/sh_eth.h ++++ b/drivers/net/ethernet/renesas/sh_eth.h +@@ -372,7 +372,7 @@ static const u16 sh_eth_offset_fast_sh3_sh2[SH_ETH_MAX_REGISTER_OFFSET] = { + }; + + /* Driver's parameters */ +-#if defined(CONFIG_CPU_SH4) ++#if defined(CONFIG_CPU_SH4) || defined(CONFIG_ARCH_SHMOBILE) + #define SH4_SKB_RX_ALIGN 32 + #else + #define SH2_SH3_SKB_RX_ALIGN 2 +@@ -381,7 +381,8 @@ static const u16 sh_eth_offset_fast_sh3_sh2[SH_ETH_MAX_REGISTER_OFFSET] = { + /* + * Register's bits + */ +-#if defined(CONFIG_CPU_SUBTYPE_SH7734) || defined(CONFIG_CPU_SUBTYPE_SH7763) ++#if defined(CONFIG_CPU_SUBTYPE_SH7734) || defined(CONFIG_CPU_SUBTYPE_SH7763) ||\ ++ defined(CONFIG_ARCH_R8A7740) + /* EDSR */ + enum EDSR_BIT { + EDSR_ENT = 0x01, EDSR_ENR = 0x02, +-- +1.8.0.197.g5a90748 + diff --git a/patches.armadillo800/0010-net-sh_eth-fix-the-rxdesc-pointer-when-rx-descriptor.patch b/patches.armadillo800/0010-net-sh_eth-fix-the-rxdesc-pointer-when-rx-descriptor.patch new file mode 100644 index 000000000000..f06a9706150d --- /dev/null +++ b/patches.armadillo800/0010-net-sh_eth-fix-the-rxdesc-pointer-when-rx-descriptor.patch @@ -0,0 +1,48 @@ +From 02098572c84a88121b0baeb2b96cea47f17f2e3e Mon Sep 17 00:00:00 2001 +From: Yoshihiro Shimoda +Date: Mon, 28 May 2012 23:07:55 +0000 +Subject: net: sh_eth: fix the rxdesc pointer when rx descriptor empty happens + +When Receive Descriptor Empty happens, rxdesc pointer of the driver +and actual next descriptor of the controller may be mismatch. +This patch fixes it. + +Signed-off-by: Yoshihiro Shimoda +Signed-off-by: David S. Miller +(cherry picked from commit 79fba9f51755c704c0a7d7b7f0df10874dc0a744) + +Signed-off-by: Simon Horman +--- + drivers/net/ethernet/renesas/sh_eth.c | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c +index be3c221..667169b 100644 +--- a/drivers/net/ethernet/renesas/sh_eth.c ++++ b/drivers/net/ethernet/renesas/sh_eth.c +@@ -1101,8 +1101,12 @@ static int sh_eth_rx(struct net_device *ndev) + + /* Restart Rx engine if stopped. */ + /* If we don't need to check status, don't. -KDU */ +- if (!(sh_eth_read(ndev, EDRRR) & EDRRR_R)) ++ if (!(sh_eth_read(ndev, EDRRR) & EDRRR_R)) { ++ /* fix the values for the next receiving */ ++ mdp->cur_rx = mdp->dirty_rx = (sh_eth_read(ndev, RDFAR) - ++ sh_eth_read(ndev, RDLAR)) >> 4; + sh_eth_write(ndev, EDRRR_R, EDRRR); ++ } + + return 0; + } +@@ -1199,8 +1203,6 @@ static void sh_eth_error(struct net_device *ndev, int intr_status) + /* Receive Descriptor Empty int */ + ndev->stats.rx_over_errors++; + +- if (sh_eth_read(ndev, EDRRR) ^ EDRRR_R) +- sh_eth_write(ndev, EDRRR_R, EDRRR); + if (netif_msg_rx_err(mdp)) + dev_err(&ndev->dev, "Receive Descriptor Empty\n"); + } +-- +1.8.0.197.g5a90748 + diff --git a/patches.armadillo800/0011-net-sh_eth-fix-the-condition-to-fix-the-cur_tx-dirty.patch b/patches.armadillo800/0011-net-sh_eth-fix-the-condition-to-fix-the-cur_tx-dirty.patch new file mode 100644 index 000000000000..9d3e463e2e06 --- /dev/null +++ b/patches.armadillo800/0011-net-sh_eth-fix-the-condition-to-fix-the-cur_tx-dirty.patch @@ -0,0 +1,65 @@ +From 1c70638e065f5a6bba99f0e27a3b4a4931c77681 Mon Sep 17 00:00:00 2001 +From: Yoshihiro Shimoda +Date: Wed, 20 Jun 2012 15:26:34 +0000 +Subject: net: sh_eth: fix the condition to fix the cur_tx/dirty_rx + +The following commit couldn't work if the RMCR is not set to 1. + +"net: sh_eth: fix the rxdesc pointer when rx descriptor empty happens" +commit id 79fba9f51755c704c0a7d7b7f0df10874dc0a744 + +If RMCR is not set, the controller will clear the EDRRR after it received +a frame. In this case, the driver doesn't need to fix the value of +cur_rx/dirty_rx. The driver only needs it when the controll detects +receive descriptors are empty. + +Signed-off-by: Yoshihiro Shimoda +Tested-by: Guennadi Liakhovetski +Signed-off-by: David S. Miller +(cherry picked from commit a18e08bdcf845efb7344cea146e683df746bbfb4) + +Signed-off-by: Simon Horman +--- + drivers/net/ethernet/renesas/sh_eth.c | 12 +++++++----- + 1 file changed, 7 insertions(+), 5 deletions(-) + +diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c +index 667169b..79bf09b 100644 +--- a/drivers/net/ethernet/renesas/sh_eth.c ++++ b/drivers/net/ethernet/renesas/sh_eth.c +@@ -1011,7 +1011,7 @@ static int sh_eth_txfree(struct net_device *ndev) + } + + /* Packet receive function */ +-static int sh_eth_rx(struct net_device *ndev) ++static int sh_eth_rx(struct net_device *ndev, u32 intr_status) + { + struct sh_eth_private *mdp = netdev_priv(ndev); + struct sh_eth_rxdesc *rxdesc; +@@ -1102,9 +1102,11 @@ static int sh_eth_rx(struct net_device *ndev) + /* Restart Rx engine if stopped. */ + /* If we don't need to check status, don't. -KDU */ + if (!(sh_eth_read(ndev, EDRRR) & EDRRR_R)) { +- /* fix the values for the next receiving */ +- mdp->cur_rx = mdp->dirty_rx = (sh_eth_read(ndev, RDFAR) - +- sh_eth_read(ndev, RDLAR)) >> 4; ++ /* fix the values for the next receiving if RDE is set */ ++ if (intr_status & EESR_RDE) ++ mdp->cur_rx = mdp->dirty_rx = ++ (sh_eth_read(ndev, RDFAR) - ++ sh_eth_read(ndev, RDLAR)) >> 4; + sh_eth_write(ndev, EDRRR_R, EDRRR); + } + +@@ -1273,7 +1275,7 @@ static irqreturn_t sh_eth_interrupt(int irq, void *netdev) + EESR_RTSF | /* short frame recv */ + EESR_PRE | /* PHY-LSI recv error */ + EESR_CERF)){ /* recv frame CRC error */ +- sh_eth_rx(ndev); ++ sh_eth_rx(ndev, intr_status); + } + + /* Tx Check */ +-- +1.8.0.197.g5a90748 + diff --git a/patches.armadillo800/0012-net-sh-eth-Add-support-selecting-MII-function-for-SH.patch b/patches.armadillo800/0012-net-sh-eth-Add-support-selecting-MII-function-for-SH.patch new file mode 100644 index 000000000000..66b1134781ac --- /dev/null +++ b/patches.armadillo800/0012-net-sh-eth-Add-support-selecting-MII-function-for-SH.patch @@ -0,0 +1,196 @@ +From a9d45f3559e2b48428446114ae6817f8a4883de8 Mon Sep 17 00:00:00 2001 +From: Nobuhiro Iwamatsu +Date: Mon, 25 Jun 2012 17:34:14 +0000 +Subject: net/sh-eth: Add support selecting MII function for SH7734 and R8A7740 + +Ethernet IP of SH7734 and R8A7740 has selecting MII register. +The user needs to change a value according to MII to be used. +This adds the function to change the value of this register. + +Signed-off-by: Nobuhiro Iwamatsu +Signed-off-by: David S. Miller +(cherry picked from commit 5e7a76be0e48217aff6b6f34bdcce4725db999e2) + +Signed-off-by: Simon Horman +--- + drivers/net/ethernet/renesas/sh_eth.c | 108 ++++++++++++++++++++-------------- + drivers/net/ethernet/renesas/sh_eth.h | 1 + + 2 files changed, 66 insertions(+), 43 deletions(-) + +diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c +index 79bf09b..8d696e0 100644 +--- a/drivers/net/ethernet/renesas/sh_eth.c ++++ b/drivers/net/ethernet/renesas/sh_eth.c +@@ -49,6 +49,34 @@ + NETIF_MSG_RX_ERR| \ + NETIF_MSG_TX_ERR) + ++#if defined(CONFIG_CPU_SUBTYPE_SH7734) || \ ++ defined(CONFIG_CPU_SUBTYPE_SH7763) || \ ++ defined(CONFIG_ARCH_R8A7740) ++static void sh_eth_select_mii(struct net_device *ndev) ++{ ++ u32 value = 0x0; ++ struct sh_eth_private *mdp = netdev_priv(ndev); ++ ++ switch (mdp->phy_interface) { ++ case PHY_INTERFACE_MODE_GMII: ++ value = 0x2; ++ break; ++ case PHY_INTERFACE_MODE_MII: ++ value = 0x1; ++ break; ++ case PHY_INTERFACE_MODE_RMII: ++ value = 0x0; ++ break; ++ default: ++ pr_warn("PHY interface mode was not setup. Set to MII.\n"); ++ value = 0x1; ++ break; ++ } ++ ++ sh_eth_write(ndev, value, RMII_MII); ++} ++#endif ++ + /* There is CPU dependent code */ + #if defined(CONFIG_CPU_SUBTYPE_SH7724) + #define SH_ETH_RESET_DEFAULT 1 +@@ -283,6 +311,7 @@ static struct sh_eth_cpu_data *sh_eth_get_cpu_data(struct sh_eth_private *mdp) + #elif defined(CONFIG_CPU_SUBTYPE_SH7734) || defined(CONFIG_CPU_SUBTYPE_SH7763) + #define SH_ETH_HAS_TSU 1 + static void sh_eth_reset_hw_crc(struct net_device *ndev); ++ + static void sh_eth_chip_reset(struct net_device *ndev) + { + struct sh_eth_private *mdp = netdev_priv(ndev); +@@ -292,35 +321,6 @@ static void sh_eth_chip_reset(struct net_device *ndev) + mdelay(1); + } + +-static void sh_eth_reset(struct net_device *ndev) +-{ +- int cnt = 100; +- +- sh_eth_write(ndev, EDSR_ENALL, EDSR); +- sh_eth_write(ndev, sh_eth_read(ndev, EDMR) | EDMR_SRST_GETHER, EDMR); +- while (cnt > 0) { +- if (!(sh_eth_read(ndev, EDMR) & 0x3)) +- break; +- mdelay(1); +- cnt--; +- } +- if (cnt == 0) +- printk(KERN_ERR "Device reset fail\n"); +- +- /* Table Init */ +- sh_eth_write(ndev, 0x0, TDLAR); +- sh_eth_write(ndev, 0x0, TDFAR); +- sh_eth_write(ndev, 0x0, TDFXR); +- sh_eth_write(ndev, 0x0, TDFFR); +- sh_eth_write(ndev, 0x0, RDLAR); +- sh_eth_write(ndev, 0x0, RDFAR); +- sh_eth_write(ndev, 0x0, RDFXR); +- sh_eth_write(ndev, 0x0, RDFFR); +- +- /* Reset HW CRC register */ +- sh_eth_reset_hw_crc(ndev); +-} +- + static void sh_eth_set_duplex(struct net_device *ndev) + { + struct sh_eth_private *mdp = netdev_priv(ndev); +@@ -377,9 +377,43 @@ static struct sh_eth_cpu_data sh_eth_my_cpu_data = { + .tsu = 1, + #if defined(CONFIG_CPU_SUBTYPE_SH7734) + .hw_crc = 1, ++ .select_mii = 1, + #endif + }; + ++static void sh_eth_reset(struct net_device *ndev) ++{ ++ int cnt = 100; ++ ++ sh_eth_write(ndev, EDSR_ENALL, EDSR); ++ sh_eth_write(ndev, sh_eth_read(ndev, EDMR) | EDMR_SRST_GETHER, EDMR); ++ while (cnt > 0) { ++ if (!(sh_eth_read(ndev, EDMR) & 0x3)) ++ break; ++ mdelay(1); ++ cnt--; ++ } ++ if (cnt == 0) ++ printk(KERN_ERR "Device reset fail\n"); ++ ++ /* Table Init */ ++ sh_eth_write(ndev, 0x0, TDLAR); ++ sh_eth_write(ndev, 0x0, TDFAR); ++ sh_eth_write(ndev, 0x0, TDFXR); ++ sh_eth_write(ndev, 0x0, TDFFR); ++ sh_eth_write(ndev, 0x0, RDLAR); ++ sh_eth_write(ndev, 0x0, RDFAR); ++ sh_eth_write(ndev, 0x0, RDFXR); ++ sh_eth_write(ndev, 0x0, RDFFR); ++ ++ /* Reset HW CRC register */ ++ sh_eth_reset_hw_crc(ndev); ++ ++ /* Select MII mode */ ++ if (sh_eth_my_cpu_data.select_mii) ++ sh_eth_select_mii(ndev); ++} ++ + static void sh_eth_reset_hw_crc(struct net_device *ndev) + { + if (sh_eth_my_cpu_data.hw_crc) +@@ -391,25 +425,12 @@ static void sh_eth_reset_hw_crc(struct net_device *ndev) + static void sh_eth_chip_reset(struct net_device *ndev) + { + struct sh_eth_private *mdp = netdev_priv(ndev); +- unsigned long mii; + + /* reset device */ + sh_eth_tsu_write(mdp, ARSTR_ARSTR, ARSTR); + mdelay(1); + +- switch (mdp->phy_interface) { +- case PHY_INTERFACE_MODE_GMII: +- mii = 2; +- break; +- case PHY_INTERFACE_MODE_MII: +- mii = 1; +- break; +- case PHY_INTERFACE_MODE_RMII: +- default: +- mii = 0; +- break; +- } +- sh_eth_write(ndev, mii, RMII_MII); ++ sh_eth_select_mii(ndev); + } + + static void sh_eth_reset(struct net_device *ndev) +@@ -492,6 +513,7 @@ static struct sh_eth_cpu_data sh_eth_my_cpu_data = { + .no_trimd = 1, + .no_ade = 1, + .tsu = 1, ++ .select_mii = 1, + }; + + #elif defined(CONFIG_CPU_SUBTYPE_SH7619) +diff --git a/drivers/net/ethernet/renesas/sh_eth.h b/drivers/net/ethernet/renesas/sh_eth.h +index 57b8e1f..d6763b1392 100644 +--- a/drivers/net/ethernet/renesas/sh_eth.h ++++ b/drivers/net/ethernet/renesas/sh_eth.h +@@ -757,6 +757,7 @@ struct sh_eth_cpu_data { + unsigned no_trimd:1; /* E-DMAC DO NOT have TRIMD */ + unsigned no_ade:1; /* E-DMAC DO NOT have ADE bit in EESR */ + unsigned hw_crc:1; /* E-DMAC have CSMR */ ++ unsigned select_mii:1; /* EtherC have RMII_MII (MII select register) */ + }; + + struct sh_eth_private { +-- +1.8.0.197.g5a90748 + diff --git a/patches.armadillo800/0013-net-sh-eth-Check-return-value-of-sh_eth_reset-when-c.patch b/patches.armadillo800/0013-net-sh-eth-Check-return-value-of-sh_eth_reset-when-c.patch new file mode 100644 index 000000000000..1cca1a6b8fa9 --- /dev/null +++ b/patches.armadillo800/0013-net-sh-eth-Check-return-value-of-sh_eth_reset-when-c.patch @@ -0,0 +1,215 @@ +From d9b780ce68b329aa745868803ec0419a3fd6975f Mon Sep 17 00:00:00 2001 +From: Nobuhiro Iwamatsu +Date: Mon, 25 Jun 2012 17:35:12 +0000 +Subject: net/sh-eth: Check return value of sh_eth_reset when chip reset fail + +The sh_eth_reset function resets chip, but this performs nothing when failed. +This changes sh_eth_reset return an error, when this failed in reset. + +Signed-off-by: Nobuhiro Iwamatsu +Signed-off-by: David S. Miller +(cherry picked from commit 5cee1d37c9f565f1aa515408863dbb13db67dab9) + +Signed-off-by: Simon Horman +--- + drivers/net/ethernet/renesas/sh_eth.c | 88 ++++++++++++++++++++++------------- + 1 file changed, 56 insertions(+), 32 deletions(-) + +diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c +index 8d696e0..326cb91 100644 +--- a/drivers/net/ethernet/renesas/sh_eth.c ++++ b/drivers/net/ethernet/renesas/sh_eth.c +@@ -130,6 +130,8 @@ static struct sh_eth_cpu_data sh_eth_my_cpu_data = { + #elif defined(CONFIG_CPU_SUBTYPE_SH7757) + #define SH_ETH_HAS_BOTH_MODULES 1 + #define SH_ETH_HAS_TSU 1 ++static int sh_eth_check_reset(struct net_device *ndev); ++ + static void sh_eth_set_duplex(struct net_device *ndev) + { + struct sh_eth_private *mdp = netdev_priv(ndev); +@@ -204,23 +206,19 @@ static void sh_eth_chip_reset_giga(struct net_device *ndev) + } + + static int sh_eth_is_gether(struct sh_eth_private *mdp); +-static void sh_eth_reset(struct net_device *ndev) ++static int sh_eth_reset(struct net_device *ndev) + { + struct sh_eth_private *mdp = netdev_priv(ndev); +- int cnt = 100; ++ int ret = 0; + + if (sh_eth_is_gether(mdp)) { + sh_eth_write(ndev, 0x03, EDSR); + sh_eth_write(ndev, sh_eth_read(ndev, EDMR) | EDMR_SRST_GETHER, + EDMR); +- while (cnt > 0) { +- if (!(sh_eth_read(ndev, EDMR) & 0x3)) +- break; +- mdelay(1); +- cnt--; +- } +- if (cnt < 0) +- printk(KERN_ERR "Device reset fail\n"); ++ ++ ret = sh_eth_check_reset(ndev); ++ if (ret) ++ goto out; + + /* Table Init */ + sh_eth_write(ndev, 0x0, TDLAR); +@@ -238,6 +236,9 @@ static void sh_eth_reset(struct net_device *ndev) + sh_eth_write(ndev, sh_eth_read(ndev, EDMR) & ~EDMR_SRST_ETHER, + EDMR); + } ++ ++out: ++ return ret; + } + + static void sh_eth_set_duplex_giga(struct net_device *ndev) +@@ -310,6 +311,7 @@ static struct sh_eth_cpu_data *sh_eth_get_cpu_data(struct sh_eth_private *mdp) + + #elif defined(CONFIG_CPU_SUBTYPE_SH7734) || defined(CONFIG_CPU_SUBTYPE_SH7763) + #define SH_ETH_HAS_TSU 1 ++static int sh_eth_check_reset(struct net_device *ndev); + static void sh_eth_reset_hw_crc(struct net_device *ndev); + + static void sh_eth_chip_reset(struct net_device *ndev) +@@ -381,20 +383,16 @@ static struct sh_eth_cpu_data sh_eth_my_cpu_data = { + #endif + }; + +-static void sh_eth_reset(struct net_device *ndev) ++static int sh_eth_reset(struct net_device *ndev) + { +- int cnt = 100; ++ int ret = 0; + + sh_eth_write(ndev, EDSR_ENALL, EDSR); + sh_eth_write(ndev, sh_eth_read(ndev, EDMR) | EDMR_SRST_GETHER, EDMR); +- while (cnt > 0) { +- if (!(sh_eth_read(ndev, EDMR) & 0x3)) +- break; +- mdelay(1); +- cnt--; +- } +- if (cnt == 0) +- printk(KERN_ERR "Device reset fail\n"); ++ ++ ret = sh_eth_check_reset(ndev); ++ if (ret) ++ goto out; + + /* Table Init */ + sh_eth_write(ndev, 0x0, TDLAR); +@@ -412,6 +410,8 @@ static void sh_eth_reset(struct net_device *ndev) + /* Select MII mode */ + if (sh_eth_my_cpu_data.select_mii) + sh_eth_select_mii(ndev); ++out: ++ return ret; + } + + static void sh_eth_reset_hw_crc(struct net_device *ndev) +@@ -422,6 +422,8 @@ static void sh_eth_reset_hw_crc(struct net_device *ndev) + + #elif defined(CONFIG_ARCH_R8A7740) + #define SH_ETH_HAS_TSU 1 ++static int sh_eth_check_reset(struct net_device *ndev); ++ + static void sh_eth_chip_reset(struct net_device *ndev) + { + struct sh_eth_private *mdp = netdev_priv(ndev); +@@ -433,20 +435,16 @@ static void sh_eth_chip_reset(struct net_device *ndev) + sh_eth_select_mii(ndev); + } + +-static void sh_eth_reset(struct net_device *ndev) ++static int sh_eth_reset(struct net_device *ndev) + { +- int cnt = 100; ++ int ret = 0; + + sh_eth_write(ndev, EDSR_ENALL, EDSR); + sh_eth_write(ndev, sh_eth_read(ndev, EDMR) | EDMR_SRST_GETHER, EDMR); +- while (cnt > 0) { +- if (!(sh_eth_read(ndev, EDMR) & 0x3)) +- break; +- mdelay(1); +- cnt--; +- } +- if (cnt == 0) +- printk(KERN_ERR "Device reset fail\n"); ++ ++ ret = sh_eth_check_reset(ndev); ++ if (ret) ++ goto out; + + /* Table Init */ + sh_eth_write(ndev, 0x0, TDLAR); +@@ -457,6 +455,9 @@ static void sh_eth_reset(struct net_device *ndev) + sh_eth_write(ndev, 0x0, RDFAR); + sh_eth_write(ndev, 0x0, RDFXR); + sh_eth_write(ndev, 0x0, RDFFR); ++ ++out: ++ return ret; + } + + static void sh_eth_set_duplex(struct net_device *ndev) +@@ -565,11 +566,31 @@ static void sh_eth_set_default_cpu_data(struct sh_eth_cpu_data *cd) + + #if defined(SH_ETH_RESET_DEFAULT) + /* Chip Reset */ +-static void sh_eth_reset(struct net_device *ndev) ++static int sh_eth_reset(struct net_device *ndev) + { + sh_eth_write(ndev, sh_eth_read(ndev, EDMR) | EDMR_SRST_ETHER, EDMR); + mdelay(3); + sh_eth_write(ndev, sh_eth_read(ndev, EDMR) & ~EDMR_SRST_ETHER, EDMR); ++ ++ return 0; ++} ++#else ++static int sh_eth_check_reset(struct net_device *ndev) ++{ ++ int ret = 0; ++ int cnt = 100; ++ ++ while (cnt > 0) { ++ if (!(sh_eth_read(ndev, EDMR) & 0x3)) ++ break; ++ mdelay(1); ++ cnt--; ++ } ++ if (cnt < 0) { ++ printk(KERN_ERR "Device reset fail\n"); ++ ret = -ETIMEDOUT; ++ } ++ return ret; + } + #endif + +@@ -924,7 +945,9 @@ static int sh_eth_dev_init(struct net_device *ndev) + u32 val; + + /* Soft Reset */ +- sh_eth_reset(ndev); ++ ret = sh_eth_reset(ndev); ++ if (ret) ++ goto out; + + /* Descriptor format */ + sh_eth_ring_format(ndev); +@@ -998,6 +1021,7 @@ static int sh_eth_dev_init(struct net_device *ndev) + + netif_start_queue(ndev); + ++out: + return ret; + } + +-- +1.8.0.197.g5a90748 + diff --git a/patches.armadillo800/0014-net-sh_eth-remove-unnecessary-function.patch b/patches.armadillo800/0014-net-sh_eth-remove-unnecessary-function.patch new file mode 100644 index 000000000000..029365f01b9b --- /dev/null +++ b/patches.armadillo800/0014-net-sh_eth-remove-unnecessary-function.patch @@ -0,0 +1,94 @@ +From da239ac021220b753bc1f21495ed187275f935aa Mon Sep 17 00:00:00 2001 +From: Yoshihiro Shimoda +Date: Tue, 26 Jun 2012 19:59:51 +0000 +Subject: net: sh_eth: remove unnecessary function + +The sh_eth_timer() called mod_timer() for itself. So, this patch +removes the function. + +Signed-off-by: Yoshihiro Shimoda +Signed-off-by: David S. Miller +(cherry picked from commit c26502680e59af556211fc3fd3ae0f2aa5d98440) + +Signed-off-by: Simon Horman +--- + drivers/net/ethernet/renesas/sh_eth.c | 22 ---------------------- + drivers/net/ethernet/renesas/sh_eth.h | 1 - + 2 files changed, 23 deletions(-) + +diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c +index 326cb91..cf0bc31 100644 +--- a/drivers/net/ethernet/renesas/sh_eth.c ++++ b/drivers/net/ethernet/renesas/sh_eth.c +@@ -1339,14 +1339,6 @@ other_irq: + return ret; + } + +-static void sh_eth_timer(unsigned long data) +-{ +- struct net_device *ndev = (struct net_device *)data; +- struct sh_eth_private *mdp = netdev_priv(ndev); +- +- mod_timer(&mdp->timer, jiffies + (10 * HZ)); +-} +- + /* PHY state control function */ + static void sh_eth_adjust_link(struct net_device *ndev) + { +@@ -1594,11 +1586,6 @@ static int sh_eth_open(struct net_device *ndev) + if (ret) + goto out_free_irq; + +- /* Set the timer to check for link beat. */ +- init_timer(&mdp->timer); +- mdp->timer.expires = (jiffies + (24 * HZ)) / 10;/* 2.4 sec. */ +- setup_timer(&mdp->timer, sh_eth_timer, (unsigned long)ndev); +- + return ret; + + out_free_irq: +@@ -1623,9 +1610,6 @@ static void sh_eth_tx_timeout(struct net_device *ndev) + /* tx_errors count up */ + ndev->stats.tx_errors++; + +- /* timer off */ +- del_timer_sync(&mdp->timer); +- + /* Free all the skbuffs in the Rx queue. */ + for (i = 0; i < RX_RING_SIZE; i++) { + rxdesc = &mdp->rx_ring[i]; +@@ -1643,10 +1627,6 @@ static void sh_eth_tx_timeout(struct net_device *ndev) + + /* device init */ + sh_eth_dev_init(ndev); +- +- /* timer on */ +- mdp->timer.expires = (jiffies + (24 * HZ)) / 10;/* 2.4 sec. */ +- add_timer(&mdp->timer); + } + + /* Packet transmit function */ +@@ -1719,8 +1699,6 @@ static int sh_eth_close(struct net_device *ndev) + + free_irq(ndev->irq, ndev); + +- del_timer_sync(&mdp->timer); +- + /* Free all the skbuffs in the Rx queue. */ + sh_eth_ring_free(ndev); + +diff --git a/drivers/net/ethernet/renesas/sh_eth.h b/drivers/net/ethernet/renesas/sh_eth.h +index d6763b1392..5af3f2a 100644 +--- a/drivers/net/ethernet/renesas/sh_eth.h ++++ b/drivers/net/ethernet/renesas/sh_eth.h +@@ -772,7 +772,6 @@ struct sh_eth_private { + struct sh_eth_txdesc *tx_ring; + struct sk_buff **rx_skbuff; + struct sk_buff **tx_skbuff; +- struct timer_list timer; + spinlock_t lock; + u32 cur_rx, dirty_rx; /* Producer/consumer ring indices */ + u32 cur_tx, dirty_tx; +-- +1.8.0.197.g5a90748 + diff --git a/patches.armadillo800/0015-net-sh_eth-remove-unnecessary-members-definitions.patch b/patches.armadillo800/0015-net-sh_eth-remove-unnecessary-members-definitions.patch new file mode 100644 index 000000000000..95923c02d692 --- /dev/null +++ b/patches.armadillo800/0015-net-sh_eth-remove-unnecessary-members-definitions.patch @@ -0,0 +1,140 @@ +From c0de8fd97587b151f04aeb92c1946d30e04b3f8a Mon Sep 17 00:00:00 2001 +From: Yoshihiro Shimoda +Date: Tue, 26 Jun 2012 19:59:58 +0000 +Subject: net: sh_eth: remove unnecessary members/definitions + +This patch removes unnecessary members in sh_th_private. +This patch also removes unnecessary definitions in sh_eth.h + +Signed-off-by: Yoshihiro Shimoda +Signed-off-by: David S. Miller +(cherry picked from commit 2ecbb783c3bf5a63f555c39deef308dcc1902b7f) + +Signed-off-by: Simon Horman +--- + drivers/net/ethernet/renesas/sh_eth.c | 7 +--- + drivers/net/ethernet/renesas/sh_eth.h | 69 ----------------------------------- + 2 files changed, 1 insertion(+), 75 deletions(-) + +diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c +index cf0bc31..43e76d2 100644 +--- a/drivers/net/ethernet/renesas/sh_eth.c ++++ b/drivers/net/ethernet/renesas/sh_eth.c +@@ -941,7 +941,6 @@ static int sh_eth_dev_init(struct net_device *ndev) + { + int ret = 0; + struct sh_eth_private *mdp = netdev_priv(ndev); +- u_int32_t rx_int_var, tx_int_var; + u32 val; + + /* Soft Reset */ +@@ -971,9 +970,7 @@ static int sh_eth_dev_init(struct net_device *ndev) + /* Frame recv control */ + sh_eth_write(ndev, mdp->cd->rmcr_value, RMCR); + +- rx_int_var = mdp->rx_int_var = DESC_I_RINT8 | DESC_I_RINT5; +- tx_int_var = mdp->tx_int_var = DESC_I_TINT2; +- sh_eth_write(ndev, rx_int_var | tx_int_var, TRSCER); ++ sh_eth_write(ndev, DESC_I_RINT8 | DESC_I_RINT5 | DESC_I_TINT2, TRSCER); + + if (mdp->cd->bculr) + sh_eth_write(ndev, 0x800, BCULR); /* Burst sycle set */ +@@ -2336,8 +2333,6 @@ static int sh_eth_drv_probe(struct platform_device *pdev) + + /* debug message level */ + mdp->msg_enable = SH_ETH_DEF_MSG_ENABLE; +- mdp->post_rx = POST_RX >> (devno << 1); +- mdp->post_fw = POST_FW >> (devno << 1); + + /* read and set MAC address */ + read_mac_address(ndev, pd->mac_addr); +diff --git a/drivers/net/ethernet/renesas/sh_eth.h b/drivers/net/ethernet/renesas/sh_eth.h +index 5af3f2a..37a0702 100644 +--- a/drivers/net/ethernet/renesas/sh_eth.h ++++ b/drivers/net/ethernet/renesas/sh_eth.h +@@ -585,71 +585,6 @@ enum RPADIR_BIT { + /* FDR */ + #define DEFAULT_FDR_INIT 0x00000707 + +-enum phy_offsets { +- PHY_CTRL = 0, PHY_STAT = 1, PHY_IDT1 = 2, PHY_IDT2 = 3, +- PHY_ANA = 4, PHY_ANL = 5, PHY_ANE = 6, +- PHY_16 = 16, +-}; +- +-/* PHY_CTRL */ +-enum PHY_CTRL_BIT { +- PHY_C_RESET = 0x8000, PHY_C_LOOPBK = 0x4000, PHY_C_SPEEDSL = 0x2000, +- PHY_C_ANEGEN = 0x1000, PHY_C_PWRDN = 0x0800, PHY_C_ISO = 0x0400, +- PHY_C_RANEG = 0x0200, PHY_C_DUPLEX = 0x0100, PHY_C_COLT = 0x0080, +-}; +-#define DM9161_PHY_C_ANEGEN 0 /* auto nego special */ +- +-/* PHY_STAT */ +-enum PHY_STAT_BIT { +- PHY_S_100T4 = 0x8000, PHY_S_100X_F = 0x4000, PHY_S_100X_H = 0x2000, +- PHY_S_10T_F = 0x1000, PHY_S_10T_H = 0x0800, PHY_S_ANEGC = 0x0020, +- PHY_S_RFAULT = 0x0010, PHY_S_ANEGA = 0x0008, PHY_S_LINK = 0x0004, +- PHY_S_JAB = 0x0002, PHY_S_EXTD = 0x0001, +-}; +- +-/* PHY_ANA */ +-enum PHY_ANA_BIT { +- PHY_A_NP = 0x8000, PHY_A_ACK = 0x4000, PHY_A_RF = 0x2000, +- PHY_A_FCS = 0x0400, PHY_A_T4 = 0x0200, PHY_A_FDX = 0x0100, +- PHY_A_HDX = 0x0080, PHY_A_10FDX = 0x0040, PHY_A_10HDX = 0x0020, +- PHY_A_SEL = 0x001e, +-}; +-/* PHY_ANL */ +-enum PHY_ANL_BIT { +- PHY_L_NP = 0x8000, PHY_L_ACK = 0x4000, PHY_L_RF = 0x2000, +- PHY_L_FCS = 0x0400, PHY_L_T4 = 0x0200, PHY_L_FDX = 0x0100, +- PHY_L_HDX = 0x0080, PHY_L_10FDX = 0x0040, PHY_L_10HDX = 0x0020, +- PHY_L_SEL = 0x001f, +-}; +- +-/* PHY_ANE */ +-enum PHY_ANE_BIT { +- PHY_E_PDF = 0x0010, PHY_E_LPNPA = 0x0008, PHY_E_NPA = 0x0004, +- PHY_E_PRX = 0x0002, PHY_E_LPANEGA = 0x0001, +-}; +- +-/* DM9161 */ +-enum PHY_16_BIT { +- PHY_16_BP4B45 = 0x8000, PHY_16_BPSCR = 0x4000, PHY_16_BPALIGN = 0x2000, +- PHY_16_BP_ADPOK = 0x1000, PHY_16_Repeatmode = 0x0800, +- PHY_16_TXselect = 0x0400, +- PHY_16_Rsvd = 0x0200, PHY_16_RMIIEnable = 0x0100, +- PHY_16_Force100LNK = 0x0080, +- PHY_16_APDLED_CTL = 0x0040, PHY_16_COLLED_CTL = 0x0020, +- PHY_16_RPDCTR_EN = 0x0010, +- PHY_16_ResetStMch = 0x0008, PHY_16_PreamSupr = 0x0004, +- PHY_16_Sleepmode = 0x0002, +- PHY_16_RemoteLoopOut = 0x0001, +-}; +- +-#define POST_RX 0x08 +-#define POST_FW 0x04 +-#define POST0_RX (POST_RX) +-#define POST0_FW (POST_FW) +-#define POST1_RX (POST_RX >> 2) +-#define POST1_FW (POST_FW >> 2) +-#define POST_ALL (POST0_RX | POST0_FW | POST1_RX | POST1_FW) +- + /* ARSTR */ + enum ARSTR_BIT { ARSTR_ARSTR = 0x00000001, }; + +@@ -786,10 +721,6 @@ struct sh_eth_private { + int msg_enable; + int speed; + int duplex; +- u32 rx_int_var, tx_int_var; /* interrupt control variables */ +- char post_rx; /* POST receive */ +- char post_fw; /* POST forward */ +- struct net_device_stats tsu_stats; /* TSU forward status */ + int port; /* for TSU */ + int vlan_num_ids; /* for VLAN tag filter */ + +-- +1.8.0.197.g5a90748 + diff --git a/patches.armadillo800/0016-net-sh_eth-fix-up-the-buffer-pointers.patch b/patches.armadillo800/0016-net-sh_eth-fix-up-the-buffer-pointers.patch new file mode 100644 index 000000000000..5e09276e0726 --- /dev/null +++ b/patches.armadillo800/0016-net-sh_eth-fix-up-the-buffer-pointers.patch @@ -0,0 +1,94 @@ +From ec575069aff289fc8d05d09b897bb05e55e90adf Mon Sep 17 00:00:00 2001 +From: Yoshihiro Shimoda +Date: Tue, 26 Jun 2012 20:00:01 +0000 +Subject: net: sh_eth: fix up the buffer pointers + +After freeing the buffer, the driver should change the value of +the pointer to NULL. + +Signed-off-by: Yoshihiro Shimoda +Signed-off-by: David S. Miller +(cherry picked from commit 91c77550000a7d888aaf9f9ac13e3e3485d18560) + +Signed-off-by: Simon Horman +--- + drivers/net/ethernet/renesas/sh_eth.c | 31 ++++++++++++++++++++++++------- + 1 file changed, 24 insertions(+), 7 deletions(-) + +diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c +index 43e76d2..2dd2ff5 100644 +--- a/drivers/net/ethernet/renesas/sh_eth.c ++++ b/drivers/net/ethernet/renesas/sh_eth.c +@@ -788,6 +788,7 @@ static void sh_eth_ring_free(struct net_device *ndev) + } + } + kfree(mdp->rx_skbuff); ++ mdp->rx_skbuff = NULL; + + /* Free Tx skb ringbuffer */ + if (mdp->tx_skbuff) { +@@ -797,6 +798,7 @@ static void sh_eth_ring_free(struct net_device *ndev) + } + } + kfree(mdp->tx_skbuff); ++ mdp->tx_skbuff = NULL; + } + + /* format skb and descriptor buffer */ +@@ -933,10 +935,31 @@ desc_ring_free: + skb_ring_free: + /* Free Rx and Tx skb ring buffer */ + sh_eth_ring_free(ndev); ++ mdp->tx_ring = NULL; ++ mdp->rx_ring = NULL; + + return ret; + } + ++static void sh_eth_free_dma_buffer(struct sh_eth_private *mdp) ++{ ++ int ringsize; ++ ++ if (mdp->rx_ring) { ++ ringsize = sizeof(struct sh_eth_rxdesc) * RX_RING_SIZE; ++ dma_free_coherent(NULL, ringsize, mdp->rx_ring, ++ mdp->rx_desc_dma); ++ mdp->rx_ring = NULL; ++ } ++ ++ if (mdp->tx_ring) { ++ ringsize = sizeof(struct sh_eth_txdesc) * TX_RING_SIZE; ++ dma_free_coherent(NULL, ringsize, mdp->tx_ring, ++ mdp->tx_desc_dma); ++ mdp->tx_ring = NULL; ++ } ++} ++ + static int sh_eth_dev_init(struct net_device *ndev) + { + int ret = 0; +@@ -1677,7 +1700,6 @@ static int sh_eth_start_xmit(struct sk_buff *skb, struct net_device *ndev) + static int sh_eth_close(struct net_device *ndev) + { + struct sh_eth_private *mdp = netdev_priv(ndev); +- int ringsize; + + netif_stop_queue(ndev); + +@@ -1700,12 +1722,7 @@ static int sh_eth_close(struct net_device *ndev) + sh_eth_ring_free(ndev); + + /* free DMA buffer */ +- ringsize = sizeof(struct sh_eth_rxdesc) * RX_RING_SIZE; +- dma_free_coherent(NULL, ringsize, mdp->rx_ring, mdp->rx_desc_dma); +- +- /* free DMA buffer */ +- ringsize = sizeof(struct sh_eth_txdesc) * TX_RING_SIZE; +- dma_free_coherent(NULL, ringsize, mdp->tx_ring, mdp->tx_desc_dma); ++ sh_eth_free_dma_buffer(mdp); + + pm_runtime_put_sync(&mdp->pdev->dev); + +-- +1.8.0.197.g5a90748 + diff --git a/patches.armadillo800/0017-net-sh_eth-add-support-for-set_ringparam-get_ringpar.patch b/patches.armadillo800/0017-net-sh_eth-add-support-for-set_ringparam-get_ringpar.patch new file mode 100644 index 000000000000..d1a976c408bd --- /dev/null +++ b/patches.armadillo800/0017-net-sh_eth-add-support-for-set_ringparam-get_ringpar.patch @@ -0,0 +1,407 @@ +From 53432c5cc072269a7e3ac40d2731da16434a24b2 Mon Sep 17 00:00:00 2001 +From: Yoshihiro Shimoda +Date: Tue, 26 Jun 2012 20:00:03 +0000 +Subject: net: sh_eth: add support for set_ringparam/get_ringparam + +This patch supports the ethtool's set_ringparam() and get_ringparam(). + +Signed-off-by: Yoshihiro Shimoda +Signed-off-by: David S. Miller +(cherry picked from commit 525b8075edda9c2ab4b81e210505bd7487ea6e56) + +Signed-off-by: Simon Horman +--- + drivers/net/ethernet/renesas/sh_eth.c | 139 ++++++++++++++++++++++++++-------- + drivers/net/ethernet/renesas/sh_eth.h | 6 ++ + 2 files changed, 112 insertions(+), 33 deletions(-) + +diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c +index 2dd2ff5..af0b867 100644 +--- a/drivers/net/ethernet/renesas/sh_eth.c ++++ b/drivers/net/ethernet/renesas/sh_eth.c +@@ -782,7 +782,7 @@ static void sh_eth_ring_free(struct net_device *ndev) + + /* Free Rx skb ringbuffer */ + if (mdp->rx_skbuff) { +- for (i = 0; i < RX_RING_SIZE; i++) { ++ for (i = 0; i < mdp->num_rx_ring; i++) { + if (mdp->rx_skbuff[i]) + dev_kfree_skb(mdp->rx_skbuff[i]); + } +@@ -792,7 +792,7 @@ static void sh_eth_ring_free(struct net_device *ndev) + + /* Free Tx skb ringbuffer */ + if (mdp->tx_skbuff) { +- for (i = 0; i < TX_RING_SIZE; i++) { ++ for (i = 0; i < mdp->num_tx_ring; i++) { + if (mdp->tx_skbuff[i]) + dev_kfree_skb(mdp->tx_skbuff[i]); + } +@@ -809,8 +809,8 @@ static void sh_eth_ring_format(struct net_device *ndev) + struct sk_buff *skb; + struct sh_eth_rxdesc *rxdesc = NULL; + struct sh_eth_txdesc *txdesc = NULL; +- int rx_ringsize = sizeof(*rxdesc) * RX_RING_SIZE; +- int tx_ringsize = sizeof(*txdesc) * TX_RING_SIZE; ++ int rx_ringsize = sizeof(*rxdesc) * mdp->num_rx_ring; ++ int tx_ringsize = sizeof(*txdesc) * mdp->num_tx_ring; + + mdp->cur_rx = mdp->cur_tx = 0; + mdp->dirty_rx = mdp->dirty_tx = 0; +@@ -818,7 +818,7 @@ static void sh_eth_ring_format(struct net_device *ndev) + memset(mdp->rx_ring, 0, rx_ringsize); + + /* build Rx ring buffer */ +- for (i = 0; i < RX_RING_SIZE; i++) { ++ for (i = 0; i < mdp->num_rx_ring; i++) { + /* skb */ + mdp->rx_skbuff[i] = NULL; + skb = netdev_alloc_skb(ndev, mdp->rx_buf_sz); +@@ -844,7 +844,7 @@ static void sh_eth_ring_format(struct net_device *ndev) + } + } + +- mdp->dirty_rx = (u32) (i - RX_RING_SIZE); ++ mdp->dirty_rx = (u32) (i - mdp->num_rx_ring); + + /* Mark the last entry as wrapping the ring. */ + rxdesc->status |= cpu_to_edmac(mdp, RD_RDEL); +@@ -852,7 +852,7 @@ static void sh_eth_ring_format(struct net_device *ndev) + memset(mdp->tx_ring, 0, tx_ringsize); + + /* build Tx ring buffer */ +- for (i = 0; i < TX_RING_SIZE; i++) { ++ for (i = 0; i < mdp->num_tx_ring; i++) { + mdp->tx_skbuff[i] = NULL; + txdesc = &mdp->tx_ring[i]; + txdesc->status = cpu_to_edmac(mdp, TD_TFP); +@@ -886,7 +886,7 @@ static int sh_eth_ring_init(struct net_device *ndev) + mdp->rx_buf_sz += NET_IP_ALIGN; + + /* Allocate RX and TX skb rings */ +- mdp->rx_skbuff = kmalloc(sizeof(*mdp->rx_skbuff) * RX_RING_SIZE, ++ mdp->rx_skbuff = kmalloc(sizeof(*mdp->rx_skbuff) * mdp->num_rx_ring, + GFP_KERNEL); + if (!mdp->rx_skbuff) { + dev_err(&ndev->dev, "Cannot allocate Rx skb\n"); +@@ -894,7 +894,7 @@ static int sh_eth_ring_init(struct net_device *ndev) + return ret; + } + +- mdp->tx_skbuff = kmalloc(sizeof(*mdp->tx_skbuff) * TX_RING_SIZE, ++ mdp->tx_skbuff = kmalloc(sizeof(*mdp->tx_skbuff) * mdp->num_tx_ring, + GFP_KERNEL); + if (!mdp->tx_skbuff) { + dev_err(&ndev->dev, "Cannot allocate Tx skb\n"); +@@ -903,7 +903,7 @@ static int sh_eth_ring_init(struct net_device *ndev) + } + + /* Allocate all Rx descriptors. */ +- rx_ringsize = sizeof(struct sh_eth_rxdesc) * RX_RING_SIZE; ++ rx_ringsize = sizeof(struct sh_eth_rxdesc) * mdp->num_rx_ring; + mdp->rx_ring = dma_alloc_coherent(NULL, rx_ringsize, &mdp->rx_desc_dma, + GFP_KERNEL); + +@@ -917,7 +917,7 @@ static int sh_eth_ring_init(struct net_device *ndev) + mdp->dirty_rx = 0; + + /* Allocate all Tx descriptors. */ +- tx_ringsize = sizeof(struct sh_eth_txdesc) * TX_RING_SIZE; ++ tx_ringsize = sizeof(struct sh_eth_txdesc) * mdp->num_tx_ring; + mdp->tx_ring = dma_alloc_coherent(NULL, tx_ringsize, &mdp->tx_desc_dma, + GFP_KERNEL); + if (!mdp->tx_ring) { +@@ -946,21 +946,21 @@ static void sh_eth_free_dma_buffer(struct sh_eth_private *mdp) + int ringsize; + + if (mdp->rx_ring) { +- ringsize = sizeof(struct sh_eth_rxdesc) * RX_RING_SIZE; ++ ringsize = sizeof(struct sh_eth_rxdesc) * mdp->num_rx_ring; + dma_free_coherent(NULL, ringsize, mdp->rx_ring, + mdp->rx_desc_dma); + mdp->rx_ring = NULL; + } + + if (mdp->tx_ring) { +- ringsize = sizeof(struct sh_eth_txdesc) * TX_RING_SIZE; ++ ringsize = sizeof(struct sh_eth_txdesc) * mdp->num_tx_ring; + dma_free_coherent(NULL, ringsize, mdp->tx_ring, + mdp->tx_desc_dma); + mdp->tx_ring = NULL; + } + } + +-static int sh_eth_dev_init(struct net_device *ndev) ++static int sh_eth_dev_init(struct net_device *ndev, bool start) + { + int ret = 0; + struct sh_eth_private *mdp = netdev_priv(ndev); +@@ -1008,7 +1008,8 @@ static int sh_eth_dev_init(struct net_device *ndev) + RFLR); + + sh_eth_write(ndev, sh_eth_read(ndev, EESR), EESR); +- sh_eth_write(ndev, mdp->cd->eesipr_value, EESIPR); ++ if (start) ++ sh_eth_write(ndev, mdp->cd->eesipr_value, EESIPR); + + /* PAUSE Prohibition */ + val = (sh_eth_read(ndev, ECMR) & ECMR_DM) | +@@ -1023,7 +1024,8 @@ static int sh_eth_dev_init(struct net_device *ndev) + sh_eth_write(ndev, mdp->cd->ecsr_value, ECSR); + + /* E-MAC Interrupt Enable register */ +- sh_eth_write(ndev, mdp->cd->ecsipr_value, ECSIPR); ++ if (start) ++ sh_eth_write(ndev, mdp->cd->ecsipr_value, ECSIPR); + + /* Set MAC address */ + update_mac_address(ndev); +@@ -1036,10 +1038,12 @@ static int sh_eth_dev_init(struct net_device *ndev) + if (mdp->cd->tpauser) + sh_eth_write(ndev, TPAUSER_UNLIMITED, TPAUSER); + +- /* Setting the Rx mode will start the Rx process. */ +- sh_eth_write(ndev, EDRRR_R, EDRRR); ++ if (start) { ++ /* Setting the Rx mode will start the Rx process. */ ++ sh_eth_write(ndev, EDRRR_R, EDRRR); + +- netif_start_queue(ndev); ++ netif_start_queue(ndev); ++ } + + out: + return ret; +@@ -1054,7 +1058,7 @@ static int sh_eth_txfree(struct net_device *ndev) + int entry = 0; + + for (; mdp->cur_tx - mdp->dirty_tx > 0; mdp->dirty_tx++) { +- entry = mdp->dirty_tx % TX_RING_SIZE; ++ entry = mdp->dirty_tx % mdp->num_tx_ring; + txdesc = &mdp->tx_ring[entry]; + if (txdesc->status & cpu_to_edmac(mdp, TD_TACT)) + break; +@@ -1067,7 +1071,7 @@ static int sh_eth_txfree(struct net_device *ndev) + freeNum++; + } + txdesc->status = cpu_to_edmac(mdp, TD_TFP); +- if (entry >= TX_RING_SIZE - 1) ++ if (entry >= mdp->num_tx_ring - 1) + txdesc->status |= cpu_to_edmac(mdp, TD_TDLE); + + ndev->stats.tx_packets++; +@@ -1082,8 +1086,8 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status) + struct sh_eth_private *mdp = netdev_priv(ndev); + struct sh_eth_rxdesc *rxdesc; + +- int entry = mdp->cur_rx % RX_RING_SIZE; +- int boguscnt = (mdp->dirty_rx + RX_RING_SIZE) - mdp->cur_rx; ++ int entry = mdp->cur_rx % mdp->num_rx_ring; ++ int boguscnt = (mdp->dirty_rx + mdp->num_rx_ring) - mdp->cur_rx; + struct sk_buff *skb; + u16 pkt_len = 0; + u32 desc_status; +@@ -1134,13 +1138,13 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status) + ndev->stats.rx_bytes += pkt_len; + } + rxdesc->status |= cpu_to_edmac(mdp, RD_RACT); +- entry = (++mdp->cur_rx) % RX_RING_SIZE; ++ entry = (++mdp->cur_rx) % mdp->num_rx_ring; + rxdesc = &mdp->rx_ring[entry]; + } + + /* Refill the Rx ring buffers. */ + for (; mdp->cur_rx - mdp->dirty_rx > 0; mdp->dirty_rx++) { +- entry = mdp->dirty_rx % RX_RING_SIZE; ++ entry = mdp->dirty_rx % mdp->num_rx_ring; + rxdesc = &mdp->rx_ring[entry]; + /* The size of the buffer is 16 byte boundary. */ + rxdesc->buffer_length = ALIGN(mdp->rx_buf_sz, 16); +@@ -1157,7 +1161,7 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status) + skb_checksum_none_assert(skb); + rxdesc->addr = virt_to_phys(PTR_ALIGN(skb->data, 4)); + } +- if (entry >= RX_RING_SIZE - 1) ++ if (entry >= mdp->num_rx_ring - 1) + rxdesc->status |= + cpu_to_edmac(mdp, RD_RACT | RD_RFP | RD_RDEL); + else +@@ -1557,6 +1561,71 @@ static void sh_eth_get_strings(struct net_device *ndev, u32 stringset, u8 *data) + } + } + ++static void sh_eth_get_ringparam(struct net_device *ndev, ++ struct ethtool_ringparam *ring) ++{ ++ struct sh_eth_private *mdp = netdev_priv(ndev); ++ ++ ring->rx_max_pending = RX_RING_MAX; ++ ring->tx_max_pending = TX_RING_MAX; ++ ring->rx_pending = mdp->num_rx_ring; ++ ring->tx_pending = mdp->num_tx_ring; ++} ++ ++static int sh_eth_set_ringparam(struct net_device *ndev, ++ struct ethtool_ringparam *ring) ++{ ++ struct sh_eth_private *mdp = netdev_priv(ndev); ++ int ret; ++ ++ if (ring->tx_pending > TX_RING_MAX || ++ ring->rx_pending > RX_RING_MAX || ++ ring->tx_pending < TX_RING_MIN || ++ ring->rx_pending < RX_RING_MIN) ++ return -EINVAL; ++ if (ring->rx_mini_pending || ring->rx_jumbo_pending) ++ return -EINVAL; ++ ++ if (netif_running(ndev)) { ++ netif_tx_disable(ndev); ++ /* Disable interrupts by clearing the interrupt mask. */ ++ sh_eth_write(ndev, 0x0000, EESIPR); ++ /* Stop the chip's Tx and Rx processes. */ ++ sh_eth_write(ndev, 0, EDTRR); ++ sh_eth_write(ndev, 0, EDRRR); ++ synchronize_irq(ndev->irq); ++ } ++ ++ /* Free all the skbuffs in the Rx queue. */ ++ sh_eth_ring_free(ndev); ++ /* Free DMA buffer */ ++ sh_eth_free_dma_buffer(mdp); ++ ++ /* Set new parameters */ ++ mdp->num_rx_ring = ring->rx_pending; ++ mdp->num_tx_ring = ring->tx_pending; ++ ++ ret = sh_eth_ring_init(ndev); ++ if (ret < 0) { ++ dev_err(&ndev->dev, "%s: sh_eth_ring_init failed.\n", __func__); ++ return ret; ++ } ++ ret = sh_eth_dev_init(ndev, false); ++ if (ret < 0) { ++ dev_err(&ndev->dev, "%s: sh_eth_dev_init failed.\n", __func__); ++ return ret; ++ } ++ ++ if (netif_running(ndev)) { ++ sh_eth_write(ndev, mdp->cd->eesipr_value, EESIPR); ++ /* Setting the Rx mode will start the Rx process. */ ++ sh_eth_write(ndev, EDRRR_R, EDRRR); ++ netif_wake_queue(ndev); ++ } ++ ++ return 0; ++} ++ + static const struct ethtool_ops sh_eth_ethtool_ops = { + .get_settings = sh_eth_get_settings, + .set_settings = sh_eth_set_settings, +@@ -1567,6 +1636,8 @@ static const struct ethtool_ops sh_eth_ethtool_ops = { + .get_strings = sh_eth_get_strings, + .get_ethtool_stats = sh_eth_get_ethtool_stats, + .get_sset_count = sh_eth_get_sset_count, ++ .get_ringparam = sh_eth_get_ringparam, ++ .set_ringparam = sh_eth_set_ringparam, + }; + + /* network device open function */ +@@ -1597,7 +1668,7 @@ static int sh_eth_open(struct net_device *ndev) + goto out_free_irq; + + /* device init */ +- ret = sh_eth_dev_init(ndev); ++ ret = sh_eth_dev_init(ndev, true); + if (ret) + goto out_free_irq; + +@@ -1631,7 +1702,7 @@ static void sh_eth_tx_timeout(struct net_device *ndev) + ndev->stats.tx_errors++; + + /* Free all the skbuffs in the Rx queue. */ +- for (i = 0; i < RX_RING_SIZE; i++) { ++ for (i = 0; i < mdp->num_rx_ring; i++) { + rxdesc = &mdp->rx_ring[i]; + rxdesc->status = 0; + rxdesc->addr = 0xBADF00D0; +@@ -1639,14 +1710,14 @@ static void sh_eth_tx_timeout(struct net_device *ndev) + dev_kfree_skb(mdp->rx_skbuff[i]); + mdp->rx_skbuff[i] = NULL; + } +- for (i = 0; i < TX_RING_SIZE; i++) { ++ for (i = 0; i < mdp->num_tx_ring; i++) { + if (mdp->tx_skbuff[i]) + dev_kfree_skb(mdp->tx_skbuff[i]); + mdp->tx_skbuff[i] = NULL; + } + + /* device init */ +- sh_eth_dev_init(ndev); ++ sh_eth_dev_init(ndev, true); + } + + /* Packet transmit function */ +@@ -1658,7 +1729,7 @@ static int sh_eth_start_xmit(struct sk_buff *skb, struct net_device *ndev) + unsigned long flags; + + spin_lock_irqsave(&mdp->lock, flags); +- if ((mdp->cur_tx - mdp->dirty_tx) >= (TX_RING_SIZE - 4)) { ++ if ((mdp->cur_tx - mdp->dirty_tx) >= (mdp->num_tx_ring - 4)) { + if (!sh_eth_txfree(ndev)) { + if (netif_msg_tx_queued(mdp)) + dev_warn(&ndev->dev, "TxFD exhausted.\n"); +@@ -1669,7 +1740,7 @@ static int sh_eth_start_xmit(struct sk_buff *skb, struct net_device *ndev) + } + spin_unlock_irqrestore(&mdp->lock, flags); + +- entry = mdp->cur_tx % TX_RING_SIZE; ++ entry = mdp->cur_tx % mdp->num_tx_ring; + mdp->tx_skbuff[entry] = skb; + txdesc = &mdp->tx_ring[entry]; + /* soft swap. */ +@@ -1683,7 +1754,7 @@ static int sh_eth_start_xmit(struct sk_buff *skb, struct net_device *ndev) + else + txdesc->buffer_length = skb->len; + +- if (entry >= TX_RING_SIZE - 1) ++ if (entry >= mdp->num_tx_ring - 1) + txdesc->status |= cpu_to_edmac(mdp, TD_TACT | TD_TDLE); + else + txdesc->status |= cpu_to_edmac(mdp, TD_TACT); +@@ -2313,6 +2384,8 @@ static int sh_eth_drv_probe(struct platform_device *pdev) + ether_setup(ndev); + + mdp = netdev_priv(ndev); ++ mdp->num_tx_ring = TX_RING_SIZE; ++ mdp->num_rx_ring = RX_RING_SIZE; + mdp->addr = ioremap(res->start, resource_size(res)); + if (mdp->addr == NULL) { + ret = -ENOMEM; +diff --git a/drivers/net/ethernet/renesas/sh_eth.h b/drivers/net/ethernet/renesas/sh_eth.h +index 37a0702..bae84fd 100644 +--- a/drivers/net/ethernet/renesas/sh_eth.h ++++ b/drivers/net/ethernet/renesas/sh_eth.h +@@ -27,6 +27,10 @@ + #define TX_TIMEOUT (5*HZ) + #define TX_RING_SIZE 64 /* Tx ring size */ + #define RX_RING_SIZE 64 /* Rx ring size */ ++#define TX_RING_MIN 64 ++#define RX_RING_MIN 64 ++#define TX_RING_MAX 1024 ++#define RX_RING_MAX 1024 + #define ETHERSMALL 60 + #define PKT_BUF_SZ 1538 + #define SH_ETH_TSU_TIMEOUT_MS 500 +@@ -701,6 +705,8 @@ struct sh_eth_private { + const u16 *reg_offset; + void __iomem *addr; + void __iomem *tsu_addr; ++ u32 num_rx_ring; ++ u32 num_tx_ring; + dma_addr_t rx_desc_dma; + dma_addr_t tx_desc_dma; + struct sh_eth_rxdesc *rx_ring; +-- +1.8.0.197.g5a90748 + diff --git a/patches.armadillo800/0018-net-sh_eth-Add-eth-support-for-R8A7779-device.patch b/patches.armadillo800/0018-net-sh_eth-Add-eth-support-for-R8A7779-device.patch new file mode 100644 index 000000000000..91821e19678b --- /dev/null +++ b/patches.armadillo800/0018-net-sh_eth-Add-eth-support-for-R8A7779-device.patch @@ -0,0 +1,71 @@ +From 404932d6f9282b0b5acf10d854fd65611f884521 Mon Sep 17 00:00:00 2001 +From: Phil Edworthy +Date: Tue, 14 Aug 2012 20:33:29 +0000 +Subject: net: sh_eth: Add eth support for R8A7779 device + +Signed-off-by: Phil Edworthy +Signed-off-by: David S. Miller +(cherry picked from commit d0418bb7123f44b23d69ac349eec7daf9103472f) + +Signed-off-by: Simon Horman +--- + drivers/net/ethernet/renesas/Kconfig | 4 ++-- + drivers/net/ethernet/renesas/sh_eth.c | 11 ++++++++--- + 2 files changed, 10 insertions(+), 5 deletions(-) + +diff --git a/drivers/net/ethernet/renesas/Kconfig b/drivers/net/ethernet/renesas/Kconfig +index 46df3a0..24c2305 100644 +--- a/drivers/net/ethernet/renesas/Kconfig ++++ b/drivers/net/ethernet/renesas/Kconfig +@@ -8,7 +8,7 @@ config SH_ETH + (CPU_SUBTYPE_SH7710 || CPU_SUBTYPE_SH7712 || \ + CPU_SUBTYPE_SH7763 || CPU_SUBTYPE_SH7619 || \ + CPU_SUBTYPE_SH7724 || CPU_SUBTYPE_SH7734 || \ +- CPU_SUBTYPE_SH7757 || ARCH_R8A7740) ++ CPU_SUBTYPE_SH7757 || ARCH_R8A7740 || ARCH_R8A7779) + select CRC32 + select NET_CORE + select MII +@@ -18,4 +18,4 @@ config SH_ETH + Renesas SuperH Ethernet device driver. + This driver supporting CPUs are: + - SH7619, SH7710, SH7712, SH7724, SH7734, SH7763, SH7757, +- and R8A7740. ++ R8A7740 and R8A7779. +diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c +index af0b867..bad8f2e 100644 +--- a/drivers/net/ethernet/renesas/sh_eth.c ++++ b/drivers/net/ethernet/renesas/sh_eth.c +@@ -78,7 +78,7 @@ static void sh_eth_select_mii(struct net_device *ndev) + #endif + + /* There is CPU dependent code */ +-#if defined(CONFIG_CPU_SUBTYPE_SH7724) ++#if defined(CONFIG_CPU_SUBTYPE_SH7724) || defined(CONFIG_ARCH_R8A7779) + #define SH_ETH_RESET_DEFAULT 1 + static void sh_eth_set_duplex(struct net_device *ndev) + { +@@ -93,13 +93,18 @@ static void sh_eth_set_duplex(struct net_device *ndev) + static void sh_eth_set_rate(struct net_device *ndev) + { + struct sh_eth_private *mdp = netdev_priv(ndev); ++ unsigned int bits = ECMR_RTM; ++ ++#if defined(CONFIG_ARCH_R8A7779) ++ bits |= ECMR_ELB; ++#endif + + switch (mdp->speed) { + case 10: /* 10BASE */ +- sh_eth_write(ndev, sh_eth_read(ndev, ECMR) & ~ECMR_RTM, ECMR); ++ sh_eth_write(ndev, sh_eth_read(ndev, ECMR) & ~bits, ECMR); + break; + case 100:/* 100BASE */ +- sh_eth_write(ndev, sh_eth_read(ndev, ECMR) | ECMR_RTM, ECMR); ++ sh_eth_write(ndev, sh_eth_read(ndev, ECMR) | bits, ECMR); + break; + default: + break; +-- +1.8.0.197.g5a90748 + diff --git a/patches.armadillo800/0019-ASoC-add-generic-simple-card-support.patch b/patches.armadillo800/0019-ASoC-add-generic-simple-card-support.patch new file mode 100644 index 000000000000..23ec1ddda304 --- /dev/null +++ b/patches.armadillo800/0019-ASoC-add-generic-simple-card-support.patch @@ -0,0 +1,239 @@ +From e824e077a91eecb30f3a4124516811ffc382b5a8 Mon Sep 17 00:00:00 2001 +From: Kuninori Morimoto +Date: Sun, 8 Apr 2012 21:17:50 -0700 +Subject: ASoC: add generic simple-card support + +Current ASoC requires card.c file to each platforms in order to +specifies its CPU and Codecs pair. +But the differences between these were only value/strings of setting. +In order to reduce duplicate driver, this patch adds generic/simple-card. + +Signed-off-by: Kuninori Morimoto +Signed-off-by: Mark Brown +(cherry picked from commit f2390880ec0264a0ed26b32c23bc23435b4297da) + +Signed-off-by: Simon Horman +--- + include/sound/simple_card.h | 38 ++++++++++++++ + sound/soc/Kconfig | 3 ++ + sound/soc/Makefile | 1 + + sound/soc/generic/Kconfig | 4 ++ + sound/soc/generic/Makefile | 3 ++ + sound/soc/generic/simple-card.c | 114 ++++++++++++++++++++++++++++++++++++++++ + 6 files changed, 163 insertions(+) + create mode 100644 include/sound/simple_card.h + create mode 100644 sound/soc/generic/Kconfig + create mode 100644 sound/soc/generic/Makefile + create mode 100644 sound/soc/generic/simple-card.c + +diff --git a/include/sound/simple_card.h b/include/sound/simple_card.h +new file mode 100644 +index 0000000..4b62b8d +--- /dev/null ++++ b/include/sound/simple_card.h +@@ -0,0 +1,38 @@ ++/* ++ * ASoC simple sound card support ++ * ++ * Copyright (C) 2012 Renesas Solutions Corp. ++ * Kuninori Morimoto ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ */ ++ ++#ifndef __SIMPLE_CARD_H ++#define __SIMPLE_CARD_H ++ ++#include ++ ++struct asoc_simple_dai_init_info { ++ unsigned int fmt; ++ unsigned int cpu_daifmt; ++ unsigned int codec_daifmt; ++ unsigned int sysclk; ++}; ++ ++struct asoc_simple_card_info { ++ const char *name; ++ const char *card; ++ const char *cpu_dai; ++ const char *codec; ++ const char *platform; ++ const char *codec_dai; ++ struct asoc_simple_dai_init_info *init; /* for snd_link.init */ ++ ++ /* used in simple-card.c */ ++ struct snd_soc_dai_link snd_link; ++ struct snd_soc_card snd_card; ++}; ++ ++#endif /* __SIMPLE_CARD_H */ +diff --git a/sound/soc/Kconfig b/sound/soc/Kconfig +index 91c9855..38be639 100644 +--- a/sound/soc/Kconfig ++++ b/sound/soc/Kconfig +@@ -52,5 +52,8 @@ source "sound/soc/txx9/Kconfig" + # Supported codecs + source "sound/soc/codecs/Kconfig" + ++# generic frame-work ++source "sound/soc/generic/Kconfig" ++ + endif # SND_SOC + +diff --git a/sound/soc/Makefile b/sound/soc/Makefile +index 2feaf37..b55db9c 100644 +--- a/sound/soc/Makefile ++++ b/sound/soc/Makefile +@@ -6,6 +6,7 @@ obj-$(CONFIG_SND_SOC_DMAENGINE_PCM) += snd-soc-dmaengine-pcm.o + + obj-$(CONFIG_SND_SOC) += snd-soc-core.o + obj-$(CONFIG_SND_SOC) += codecs/ ++obj-$(CONFIG_SND_SOC) += generic/ + obj-$(CONFIG_SND_SOC) += atmel/ + obj-$(CONFIG_SND_SOC) += au1x/ + obj-$(CONFIG_SND_SOC) += blackfin/ +diff --git a/sound/soc/generic/Kconfig b/sound/soc/generic/Kconfig +new file mode 100644 +index 0000000..610f612 +--- /dev/null ++++ b/sound/soc/generic/Kconfig +@@ -0,0 +1,4 @@ ++config SND_SIMPLE_CARD ++ tristate "ASoC Simple sound card support" ++ help ++ This option enables generic simple sound card support +diff --git a/sound/soc/generic/Makefile b/sound/soc/generic/Makefile +new file mode 100644 +index 0000000..9c3b246 +--- /dev/null ++++ b/sound/soc/generic/Makefile +@@ -0,0 +1,3 @@ ++snd-soc-simple-card-objs := simple-card.o ++ ++obj-$(CONFIG_SND_SIMPLE_CARD) += snd-soc-simple-card.o +diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c +new file mode 100644 +index 0000000..b4b4cab +--- /dev/null ++++ b/sound/soc/generic/simple-card.c +@@ -0,0 +1,114 @@ ++/* ++ * ASoC simple sound card support ++ * ++ * Copyright (C) 2012 Renesas Solutions Corp. ++ * Kuninori Morimoto ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ */ ++ ++#include ++#include ++#include ++ ++#define asoc_simple_get_card_info(p) \ ++ container_of(p->dai_link, struct asoc_simple_card_info, snd_link) ++ ++static int asoc_simple_card_dai_init(struct snd_soc_pcm_runtime *rtd) ++{ ++ struct asoc_simple_card_info *cinfo = asoc_simple_get_card_info(rtd); ++ struct asoc_simple_dai_init_info *iinfo = cinfo->init; ++ struct snd_soc_dai *codec = rtd->codec_dai; ++ struct snd_soc_dai *cpu = rtd->cpu_dai; ++ unsigned int cpu_daifmt = iinfo->fmt | iinfo->cpu_daifmt; ++ unsigned int codec_daifmt = iinfo->fmt | iinfo->codec_daifmt; ++ int ret; ++ ++ if (codec_daifmt) { ++ ret = snd_soc_dai_set_fmt(codec, codec_daifmt); ++ if (ret < 0) ++ return ret; ++ } ++ ++ if (iinfo->sysclk) { ++ ret = snd_soc_dai_set_sysclk(codec, 0, iinfo->sysclk, 0); ++ if (ret < 0) ++ return ret; ++ } ++ ++ if (cpu_daifmt) { ++ ret = snd_soc_dai_set_fmt(cpu, cpu_daifmt); ++ if (ret < 0) ++ return ret; ++ } ++ ++ return 0; ++} ++ ++static int asoc_simple_card_probe(struct platform_device *pdev) ++{ ++ struct asoc_simple_card_info *cinfo = pdev->dev.platform_data; ++ ++ if (!cinfo) { ++ dev_err(&pdev->dev, "no info for asoc-simple-card\n"); ++ return -EINVAL; ++ } ++ ++ if (!cinfo->name || ++ !cinfo->card || ++ !cinfo->cpu_dai || ++ !cinfo->codec || ++ !cinfo->platform || ++ !cinfo->codec_dai) { ++ dev_err(&pdev->dev, "insufficient asoc_simple_card_info settings\n"); ++ return -EINVAL; ++ } ++ ++ /* ++ * init snd_soc_dai_link ++ */ ++ cinfo->snd_link.name = cinfo->name; ++ cinfo->snd_link.stream_name = cinfo->name; ++ cinfo->snd_link.cpu_dai_name = cinfo->cpu_dai; ++ cinfo->snd_link.platform_name = cinfo->platform; ++ cinfo->snd_link.codec_name = cinfo->codec; ++ cinfo->snd_link.codec_dai_name = cinfo->codec_dai; ++ ++ /* enable snd_link.init if cinfo has settings */ ++ if (cinfo->init) ++ cinfo->snd_link.init = asoc_simple_card_dai_init; ++ ++ /* ++ * init snd_soc_card ++ */ ++ cinfo->snd_card.name = cinfo->card; ++ cinfo->snd_card.owner = THIS_MODULE; ++ cinfo->snd_card.dai_link = &cinfo->snd_link; ++ cinfo->snd_card.num_links = 1; ++ cinfo->snd_card.dev = &pdev->dev; ++ ++ return snd_soc_register_card(&cinfo->snd_card); ++} ++ ++static int asoc_simple_card_remove(struct platform_device *pdev) ++{ ++ struct asoc_simple_card_info *cinfo = pdev->dev.platform_data; ++ ++ return snd_soc_unregister_card(&cinfo->snd_card); ++} ++ ++static struct platform_driver asoc_simple_card = { ++ .driver = { ++ .name = "asoc-simple-card", ++ }, ++ .probe = asoc_simple_card_probe, ++ .remove = asoc_simple_card_remove, ++}; ++ ++module_platform_driver(asoc_simple_card); ++ ++MODULE_LICENSE("GPL"); ++MODULE_DESCRIPTION("ASoC Simple Sound Card"); ++MODULE_AUTHOR("Kuninori Morimoto "); +-- +1.8.0.197.g5a90748 + diff --git a/patches.armadillo800/0020-ASoC-sh-fsi-use-simple-card-instead-of-fsi-ak4642.patch b/patches.armadillo800/0020-ASoC-sh-fsi-use-simple-card-instead-of-fsi-ak4642.patch new file mode 100644 index 000000000000..a6129227a8f3 --- /dev/null +++ b/patches.armadillo800/0020-ASoC-sh-fsi-use-simple-card-instead-of-fsi-ak4642.patch @@ -0,0 +1,358 @@ +From 69dbe4e265126dd9dcd679d7f707c73fa86b88ef Mon Sep 17 00:00:00 2001 +From: Kuninori Morimoto +Date: Sun, 8 Apr 2012 21:18:28 -0700 +Subject: ASoC: sh: fsi: use simple-card instead of fsi-ak4642 + +This patch uses simple-card driver instead of fsi-ak4642 on each board. +To select AK4642 driver, each boards select it on Kconfig. + +This patch removes fsi-ak4642 driver which is no longer needed + +Signed-off-by: Kuninori Morimoto +Signed-off-by: Mark Brown +(cherry picked from commit af8a2fe12fae1b59178dc96e396e5665bcbea7da) + +Signed-off-by: Simon Horman +--- + arch/arm/mach-shmobile/Kconfig | 2 + + arch/arm/mach-shmobile/board-ap4evb.c | 15 ++++- + arch/arm/mach-shmobile/board-mackerel.c | 15 ++++- + arch/sh/boards/Kconfig | 1 + + arch/sh/boards/mach-se/7724/setup.c | 15 ++++- + include/sound/sh_fsi.h | 12 ---- + sound/soc/sh/Kconfig | 8 --- + sound/soc/sh/Makefile | 2 - + sound/soc/sh/fsi-ak4642.c | 108 -------------------------------- + 9 files changed, 39 insertions(+), 139 deletions(-) + delete mode 100644 sound/soc/sh/fsi-ak4642.c + +diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig +index 34560ca..2cda0c2 100644 +--- a/arch/arm/mach-shmobile/Kconfig ++++ b/arch/arm/mach-shmobile/Kconfig +@@ -58,6 +58,7 @@ config MACH_AP4EVB + depends on ARCH_SH7372 + select ARCH_REQUIRE_GPIOLIB + select SH_LCD_MIPI_DSI ++ select SND_SOC_AK4642 if SND_SIMPLE_CARD + + choice + prompt "AP4EVB LCD panel selection" +@@ -82,6 +83,7 @@ config MACH_MACKEREL + bool "mackerel board" + depends on ARCH_SH7372 + select ARCH_REQUIRE_GPIOLIB ++ select SND_SOC_AK4642 if SND_SIMPLE_CARD + + config MACH_KOTA2 + bool "KOTA2 board" +diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c +index b56dde2..b397512 100644 +--- a/arch/arm/mach-shmobile/board-ap4evb.c ++++ b/arch/arm/mach-shmobile/board-ap4evb.c +@@ -50,6 +50,7 @@ + #include + + #include ++#include + + #include