* [PATCH 1/6] fbdev: sh_mobile_lcdcfb: add struct sh_mobile_lcdc_clock_source
From: Kuninori Morimoto @ 2011-09-30 8:33 UTC (permalink / raw)
To: linux-sh
LCDC clock sorce on SH-Mobile/R-Mobile chip is
not same as SH chip.
This patch adds struct sh_mobile_lcdc_clock_source so that
clock source will be selected more flexibly.
This patch has LCDC_CLK_xxx for compatibility.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
arch/arm/mach-shmobile/board-ag5evm.c | 2 +-
arch/arm/mach-shmobile/board-ap4evb.c | 4 ++--
arch/arm/mach-shmobile/board-kota2.c | 2 +-
arch/arm/mach-shmobile/board-mackerel.c | 2 +-
drivers/video/sh_mobile_lcdcfb.c | 17 ++++-------------
include/video/sh_mobile_lcdc.h | 14 +++++++++++---
6 files changed, 20 insertions(+), 21 deletions(-)
diff --git a/arch/arm/mach-shmobile/board-ag5evm.c b/arch/arm/mach-shmobile/board-ag5evm.c
index b36dc61..2cbf158 100644
--- a/arch/arm/mach-shmobile/board-ag5evm.c
+++ b/arch/arm/mach-shmobile/board-ag5evm.c
@@ -262,7 +262,7 @@ static const struct fb_videomode lcdc0_modes[] = {
};
static struct sh_mobile_lcdc_info lcdc0_info = {
- .clock_source = LCDC_CLK_PERIPHERAL,
+ .clock_source = LCDC_CLK_SRC(1, NULL), /* HSbyteCLK */
.ch[0] = {
.chan = LCDC_CHAN_MAINLCD,
.interface_type = RGB24,
diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c
index 5aa5ddd..1c997b8 100644
--- a/arch/arm/mach-shmobile/board-ap4evb.c
+++ b/arch/arm/mach-shmobile/board-ap4evb.c
@@ -806,7 +806,7 @@ static struct sh_mobile_meram_cfg hdmi_meram_cfg = {
};
static struct sh_mobile_lcdc_info sh_mobile_lcdc1_info = {
- .clock_source = LCDC_CLK_EXTERNAL,
+ .clock_source = LCDC_CLK_SRC(2, NULL), /* HDMI */
.meram_dev = &meram_info,
.ch[0] = {
.chan = LCDC_CHAN_MAINLCD,
@@ -1343,7 +1343,7 @@ static void __init ap4evb_init(void)
i2c_register_board_info(1, &tsc_device, 1);
/* LCDC0 */
- lcdc_info.clock_source = LCDC_CLK_PERIPHERAL;
+ lcdc_info.clock_source = LCDC_CLK_SRC(1, NULL);
lcdc_info.ch[0].interface_type = RGB24;
lcdc_info.ch[0].clock_divider = 1;
lcdc_info.ch[0].flags = LCDC_FLAGS_DWPOL;
diff --git a/arch/arm/mach-shmobile/board-kota2.c b/arch/arm/mach-shmobile/board-kota2.c
index 5b76d5d..b7a1d23 100644
--- a/arch/arm/mach-shmobile/board-kota2.c
+++ b/arch/arm/mach-shmobile/board-kota2.c
@@ -306,7 +306,7 @@ static struct fb_videomode lcdc0_modes[] = {
};
static struct sh_mobile_lcdc_info lcdc0_info = {
- .clock_source = LCDC_CLK_PERIPHERAL,
+ .clock_source = LCDC_CLK_SRC(1, NULL), /* HSbyteCLK */
.ch[0] = {
.chan = LCDC_CHAN_MAINLCD,
.bpp = 32,
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
index d41c01f..b7efd26 100644
--- a/arch/arm/mach-shmobile/board-mackerel.c
+++ b/arch/arm/mach-shmobile/board-mackerel.c
@@ -447,7 +447,7 @@ static struct sh_mobile_meram_cfg hdmi_meram_cfg = {
/* HDMI */
static struct sh_mobile_lcdc_info hdmi_lcdc_info = {
.meram_dev = &mackerel_meram_info,
- .clock_source = LCDC_CLK_EXTERNAL,
+ .clock_source = LCDC_CLK_SRC(2, NULL), /* HDMI */
.ch[0] = {
.chan = LCDC_CHAN_MAINLCD,
.bpp = 16,
diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
index 8cda40c..38dd2d0 100644
--- a/drivers/video/sh_mobile_lcdcfb.c
+++ b/drivers/video/sh_mobile_lcdcfb.c
@@ -815,21 +815,12 @@ static int sh_mobile_lcdc_check_interface(struct sh_mobile_lcdc_chan *ch)
}
static int sh_mobile_lcdc_setup_clocks(struct platform_device *pdev,
- int clock_source,
+ struct sh_mobile_lcdc_clk_src *clk_src,
struct sh_mobile_lcdc_priv *priv)
{
- char *str;
- int icksel;
+ char *str = clk_src->str;
- switch (clock_source) {
- case LCDC_CLK_BUS: str = "bus_clk"; icksel = 0; break;
- case LCDC_CLK_PERIPHERAL: str = "peripheral_clk"; icksel = 1; break;
- case LCDC_CLK_EXTERNAL: str = NULL; icksel = 2; break;
- default:
- return -EINVAL;
- }
-
- priv->lddckr = icksel << 16;
+ priv->lddckr = clk_src->icksel << 16;
if (str) {
priv->dot_clk = clk_get(&pdev->dev, str);
@@ -1498,7 +1489,7 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev)
if (!priv->base)
goto err1;
- error = sh_mobile_lcdc_setup_clocks(pdev, pdata->clock_source, priv);
+ error = sh_mobile_lcdc_setup_clocks(pdev, &pdata->clock_source, priv);
if (error) {
dev_err(&pdev->dev, "unable to setup clocks\n");
goto err1;
diff --git a/include/video/sh_mobile_lcdc.h b/include/video/sh_mobile_lcdc.h
index d964e68..602286c 100644
--- a/include/video/sh_mobile_lcdc.h
+++ b/include/video/sh_mobile_lcdc.h
@@ -30,8 +30,6 @@ enum { LCDC_CHAN_DISABLED = 0,
LCDC_CHAN_MAINLCD,
LCDC_CHAN_SUBLCD };
-enum { LCDC_CLK_BUS, LCDC_CLK_PERIPHERAL, LCDC_CLK_EXTERNAL };
-
#define LCDC_FLAGS_DWPOL (1 << 0) /* Rising edge dot clock data latch */
#define LCDC_FLAGS_DIPOL (1 << 1) /* Active low display enable polarity */
#define LCDC_FLAGS_DAPOL (1 << 2) /* Active low display data polarity */
@@ -91,8 +89,18 @@ struct sh_mobile_lcdc_chan_cfg {
struct sh_mobile_meram_cfg *meram_cfg;
};
+struct sh_mobile_lcdc_clk_src {
+ char *str;
+ int icksel;
+};
+
+#define LCDC_CLK_SRC(i, s) { .icksel = i, .str = s }
+#define LCDC_CLK_BUS LCDC_CLK_SRC(0, "bus_clk")
+#define LCDC_CLK_PERIPHERAL LCDC_CLK_SRC(1, "peripheral_clk")
+#define LCDC_CLK_EXTERNAL LCDC_CLK_SRC(2, NULL)
+
struct sh_mobile_lcdc_info {
- int clock_source;
+ struct sh_mobile_lcdc_clk_src clock_source;
struct sh_mobile_lcdc_chan_cfg ch[2];
struct sh_mobile_meram_info *meram_dev;
};
--
1.7.4.1
^ permalink raw reply related
* [PATCH 2/6] fbdev: sh_mipi_dsi: Add HSxxCLK support
From: Kuninori Morimoto @ 2011-09-30 8:33 UTC (permalink / raw)
To: linux-sh
SH MIPI manual explains the calculation method of HBP/HFP.
it is based on HSbyteCLK settings.
SH73a0 chip can use HS6divCLK/HS4divCLK for it.
This patch has compatibility to SH7372 mipi
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
arch/arm/mach-shmobile/board-ag5evm.c | 3 ++-
arch/arm/mach-shmobile/board-ap4evb.c | 3 ++-
arch/arm/mach-shmobile/board-kota2.c | 3 ++-
drivers/video/sh_mipi_dsi.c | 14 ++++++++++----
include/video/sh_mipi_dsi.h | 4 ++++
5 files changed, 20 insertions(+), 7 deletions(-)
diff --git a/arch/arm/mach-shmobile/board-ag5evm.c b/arch/arm/mach-shmobile/board-ag5evm.c
index 2cbf158..4222837 100644
--- a/arch/arm/mach-shmobile/board-ag5evm.c
+++ b/arch/arm/mach-shmobile/board-ag5evm.c
@@ -365,7 +365,8 @@ static struct sh_mipi_dsi_info mipidsi0_info = {
.vsynw_offset = 20,
.clksrc = 1,
.flags = SH_MIPI_DSI_HSABM |
- SH_MIPI_DSI_SYNC_PULSES_MODE,
+ SH_MIPI_DSI_SYNC_PULSES_MODE |,
+ SH_MIPI_DSI_HSbyteCLK,
.set_dot_clock = sh_mipi_set_dot_clock,
};
diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c
index 1c997b8..44c86f6 100644
--- a/arch/arm/mach-shmobile/board-ap4evb.c
+++ b/arch/arm/mach-shmobile/board-ap4evb.c
@@ -604,7 +604,8 @@ static struct sh_mipi_dsi_info mipidsi0_info = {
.lcd_chan = &lcdc_info.ch[0],
.lane = 2,
.vsynw_offset = 17,
- .flags = SH_MIPI_DSI_SYNC_PULSES_MODE,
+ .flags = SH_MIPI_DSI_SYNC_PULSES_MODE |,
+ SH_MIPI_DSI_HSbyteCLK,
.set_dot_clock = sh_mipi_set_dot_clock,
};
diff --git a/arch/arm/mach-shmobile/board-kota2.c b/arch/arm/mach-shmobile/board-kota2.c
index b7a1d23..9a2d77d 100644
--- a/arch/arm/mach-shmobile/board-kota2.c
+++ b/arch/arm/mach-shmobile/board-kota2.c
@@ -416,7 +416,8 @@ static struct sh_mipi_dsi_info mipidsi0_info = {
.flags = SH_MIPI_DSI_HSABM |
SH_MIPI_DSI_HBPBM |
SH_MIPI_DSI_HFPBM |
- SH_MIPI_DSI_SYNC_BURST_MODE,
+ SH_MIPI_DSI_SYNC_BURST_MODE |
+ SH_MIPI_DSI_HSbyteCLK,
.extra_array = sh_mipi_extra_dcs,
.extra_array_len= ARRAY_SIZE(sh_mipi_extra_dcs),
.set_dot_clock = sh_mipi_set_dot_clock,
diff --git a/drivers/video/sh_mipi_dsi.c b/drivers/video/sh_mipi_dsi.c
index e42cd81..a87dcfe 100644
--- a/drivers/video/sh_mipi_dsi.c
+++ b/drivers/video/sh_mipi_dsi.c
@@ -159,7 +159,7 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi,
void __iomem *base = mipi->base;
struct sh_mobile_lcdc_chan_cfg *ch = pdata->lcd_chan;
u32 pctype, datatype, pixfmt, linelength, vmctr2, excmd;
- u32 tmp, top, bottom, delay;
+ u32 tmp, top, bottom, delay, div;
bool yuv;
int i, bpp;
@@ -370,17 +370,23 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi,
bottom = 0x00000001;
delay = 0;
+ div = 1; /* HSbyteCLK is calculation base
+ * HS4divCLK = HSbyteCLK/2
+ * HS6divCLK is not supported for now */
+ if (pdata->flags & SH_MIPI_DSI_HS4divCLK)
+ div = 2;
+
if (pdata->flags & SH_MIPI_DSI_HFPBM) { /* HBPLEN */
top = ch->lcd_cfg[0].hsync_len + ch->lcd_cfg[0].left_margin;
- top = ((pdata->lane * top) - 10) << 16;
+ top = ((pdata->lane * top / div) - 10) << 16;
}
if (pdata->flags & SH_MIPI_DSI_HBPBM) { /* HFPLEN */
bottom = ch->lcd_cfg[0].right_margin;
- bottom = (pdata->lane * bottom) - 12;
+ bottom = (pdata->lane * bottom / div) - 12;
}
bpp = linelength / ch->lcd_cfg[0].xres; /* byte / pixel */
- if (pdata->lane > bpp) {
+ if ((pdata->lane / div) > bpp) {
tmp = ch->lcd_cfg[0].xres / bpp; /* output cycle */
tmp = ch->lcd_cfg[0].xres - tmp; /* (input - output) cycle */
delay = (pdata->lane * tmp);
diff --git a/include/video/sh_mipi_dsi.h b/include/video/sh_mipi_dsi.h
index 5ded705..f745f02 100644
--- a/include/video/sh_mipi_dsi.h
+++ b/include/video/sh_mipi_dsi.h
@@ -35,6 +35,10 @@ struct sh_mobile_lcdc_chan_cfg;
#define SH_MIPI_DSI_HSEE (1 << 5)
#define SH_MIPI_DSI_HSAE (1 << 6)
+#define SH_MIPI_DSI_HSbyteCLK (1 << 24)
+#define SH_MIPI_DSI_HS6divCLK (1 << 25)
+#define SH_MIPI_DSI_HS4divCLK (1 << 26)
+
#define SH_MIPI_DSI_SYNC_PULSES_MODE (SH_MIPI_DSI_VSEE | \
SH_MIPI_DSI_HSEE | \
SH_MIPI_DSI_HSAE)
--
1.7.4.1
^ permalink raw reply related
* [PATCH 3/6] fbdev: sh_mipi_dsi: sh_mipi has pdata instead of dev
From: Kuninori Morimoto @ 2011-09-30 8:33 UTC (permalink / raw)
To: linux-sh
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
drivers/video/sh_mipi_dsi.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/video/sh_mipi_dsi.c b/drivers/video/sh_mipi_dsi.c
index a87dcfe..e7a87de0 100644
--- a/drivers/video/sh_mipi_dsi.c
+++ b/drivers/video/sh_mipi_dsi.c
@@ -59,7 +59,7 @@ struct sh_mipi {
void __iomem *base;
void __iomem *linkbase;
struct clk *dsit_clk;
- struct device *dev;
+ struct platform_device *pdev;
void *next_board_data;
void (*next_display_on)(void *board_data, struct fb_info *info);
@@ -135,7 +135,7 @@ static void mipi_display_on(void *arg, struct fb_info *info)
{
struct sh_mipi *mipi = arg;
- pm_runtime_get_sync(mipi->dev);
+ pm_runtime_get_sync(&mipi->pdev->dev);
sh_mipi_dsi_enable(mipi, true);
if (mipi->next_display_on)
@@ -150,7 +150,7 @@ static void mipi_display_off(void *arg)
mipi->next_display_off(mipi->next_board_data);
sh_mipi_dsi_enable(mipi, false);
- pm_runtime_put(mipi->dev);
+ pm_runtime_put(&mipi->pdev->dev);
}
static int __init sh_mipi_setup(struct sh_mipi *mipi,
@@ -489,7 +489,7 @@ static int __init sh_mipi_probe(struct platform_device *pdev)
goto emap2;
}
- mipi->dev = &pdev->dev;
+ mipi->pdev = pdev;
mipi->dsit_clk = clk_get(&pdev->dev, "dsit_clk");
if (IS_ERR(mipi->dsit_clk)) {
--
1.7.4.1
^ permalink raw reply related
* [PATCH 4/6] fbdev: sh_mipi_dsi: fixup setup timing of sh_mipi_setup()
From: Kuninori Morimoto @ 2011-09-30 8:34 UTC (permalink / raw)
To: linux-sh
sh_mipi_setup() should be called after setting of CPG
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
drivers/video/sh_mipi_dsi.c | 79 ++++++++++++++++++++++++-------------------
1 files changed, 44 insertions(+), 35 deletions(-)
diff --git a/drivers/video/sh_mipi_dsi.c b/drivers/video/sh_mipi_dsi.c
index e7a87de0..005c9fd 100644
--- a/drivers/video/sh_mipi_dsi.c
+++ b/drivers/video/sh_mipi_dsi.c
@@ -131,28 +131,6 @@ static void sh_mipi_shutdown(struct platform_device *pdev)
sh_mipi_dsi_enable(mipi, false);
}
-static void mipi_display_on(void *arg, struct fb_info *info)
-{
- struct sh_mipi *mipi = arg;
-
- pm_runtime_get_sync(&mipi->pdev->dev);
- sh_mipi_dsi_enable(mipi, true);
-
- if (mipi->next_display_on)
- mipi->next_display_on(mipi->next_board_data, info);
-}
-
-static void mipi_display_off(void *arg)
-{
- struct sh_mipi *mipi = arg;
-
- if (mipi->next_display_off)
- mipi->next_display_off(mipi->next_board_data);
-
- sh_mipi_dsi_enable(mipi, false);
- pm_runtime_put(&mipi->pdev->dev);
-}
-
static int __init sh_mipi_setup(struct sh_mipi *mipi,
struct sh_mipi_dsi_info *pdata)
{
@@ -434,6 +412,50 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi,
return 0;
}
+static void mipi_display_on(void *arg, struct fb_info *info)
+{
+ struct sh_mipi *mipi = arg;
+ struct sh_mipi_dsi_info *pdata = mipi->pdev->dev.platform_data;
+ int ret;
+
+ pm_runtime_get_sync(&mipi->pdev->dev);
+
+ ret = pdata->set_dot_clock(mipi->pdev, mipi->base, 1);
+ if (ret < 0)
+ goto mipi_display_on_fail1;
+
+ ret = sh_mipi_setup(mipi, pdata);
+ if (ret < 0)
+ goto mipi_display_on_fail2;
+
+ sh_mipi_dsi_enable(mipi, true);
+
+ if (mipi->next_display_on)
+ mipi->next_display_on(mipi->next_board_data, info);
+
+ return;
+
+mipi_display_on_fail1:
+ pm_runtime_put_sync(&mipi->pdev->dev);
+mipi_display_on_fail2:
+ pdata->set_dot_clock(mipi->pdev, mipi->base, 0);
+}
+
+static void mipi_display_off(void *arg)
+{
+ struct sh_mipi *mipi = arg;
+ struct sh_mipi_dsi_info *pdata = mipi->pdev->dev.platform_data;
+
+ if (mipi->next_display_off)
+ mipi->next_display_off(mipi->next_board_data);
+
+ sh_mipi_dsi_enable(mipi, false);
+
+ pdata->set_dot_clock(mipi->pdev, mipi->base, 0);
+
+ pm_runtime_put_sync(&mipi->pdev->dev);
+}
+
static int __init sh_mipi_probe(struct platform_device *pdev)
{
struct sh_mipi *mipi;
@@ -518,14 +540,6 @@ static int __init sh_mipi_probe(struct platform_device *pdev)
pm_runtime_enable(&pdev->dev);
pm_runtime_resume(&pdev->dev);
- ret = sh_mipi_setup(mipi, pdata);
- if (ret < 0)
- goto emipisetup;
-
- ret = pdata->set_dot_clock(pdev, mipi->base, 1);
- if (ret < 0)
- goto emipisetup;
-
mutex_unlock(&array_lock);
platform_set_drvdata(pdev, mipi);
@@ -542,10 +556,6 @@ static int __init sh_mipi_probe(struct platform_device *pdev)
return 0;
-emipisetup:
- mipi_dsi[idx] = NULL;
- pm_runtime_disable(&pdev->dev);
- clk_disable(mipi->dsit_clk);
eclkton:
esettrate:
clk_put(mipi->dsit_clk);
@@ -599,7 +609,6 @@ static int __exit sh_mipi_remove(struct platform_device *pdev)
pm_runtime_disable(&pdev->dev);
clk_disable(mipi->dsit_clk);
clk_put(mipi->dsit_clk);
- pdata->set_dot_clock(pdev, mipi->base, 0);
iounmap(mipi->linkbase);
if (res2)
--
1.7.4.1
^ permalink raw reply related
* [PATCH 5/6] fbdev: sh_mipi_dsi: fixup setup timing of SYSCONF
From: Kuninori Morimoto @ 2011-09-30 8:34 UTC (permalink / raw)
To: linux-sh
SYSCONF should be set after PHYCTRL
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
drivers/video/sh_mipi_dsi.c | 23 +++++++++++------------
1 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/drivers/video/sh_mipi_dsi.c b/drivers/video/sh_mipi_dsi.c
index 005c9fd..b3cdcd5 100644
--- a/drivers/video/sh_mipi_dsi.c
+++ b/drivers/video/sh_mipi_dsi.c
@@ -252,18 +252,6 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi,
/* setup DSI link */
/*
- * Default = ULPS enable |
- * Contention detection enabled |
- * EoT packet transmission enable |
- * CRC check enable |
- * ECC check enable
- * additionally enable first two lanes
- */
- bitmap_fill((unsigned long*)&tmp, pdata->lane);
- tmp |= 0x00003700;
- iowrite32(tmp, base + SYSCONF);
-
- /*
* T_wakeup = 0x7000
* T_hs-trail = 3
* T_hs-prepare = 3
@@ -293,6 +281,17 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi,
/* Deassert resets, power on */
iowrite32(0x03070001, base + PHYCTRL);
+ /*
+ * Default = ULPS enable |
+ * Contention detection enabled |
+ * EoT packet transmission enable |
+ * CRC check enable |
+ * ECC check enable
+ */
+ bitmap_fill((unsigned long *)&tmp, pdata->lane);
+ tmp |= 0x00003700;
+ iowrite32(tmp, base + SYSCONF);
+
/* setup l-bridge */
/*
--
1.7.4.1
^ permalink raw reply related
* [PATCH 6/6] fbdev: sh_mipi_dsi: fixup setup timing DSICTRL
From: Kuninori Morimoto @ 2011-09-30 8:34 UTC (permalink / raw)
To: linux-sh
DSICTRL should be called after all mipi settings
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
drivers/video/sh_mipi_dsi.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/video/sh_mipi_dsi.c b/drivers/video/sh_mipi_dsi.c
index b3cdcd5..050070e 100644
--- a/drivers/video/sh_mipi_dsi.c
+++ b/drivers/video/sh_mipi_dsi.c
@@ -271,8 +271,6 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi,
iowrite32(0x0fffffff, base + TATOVSET);
/* Peripheral reset timeout, default 0xffffffff */
iowrite32(0x0fffffff, base + PRTOVSET);
- /* Enable timeout counters */
- iowrite32(0x00000f00, base + DSICTRL);
/* Interrupts not used, disable all */
iowrite32(0, base + DSIINTE);
/* DSI-Tx bias on */
@@ -408,6 +406,9 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi,
GET_EXPARAM(excmd));
}
+ /* Enable timeout counters */
+ iowrite32(0x00000f00, base + DSICTRL);
+
return 0;
}
--
1.7.4.1
^ permalink raw reply related
* Re: [PATCH 2/2] usb: r8a66597-udc: add support for SUDMAC
From: Yoshihiro Shimoda @ 2011-09-30 9:49 UTC (permalink / raw)
To: linux-sh
In-Reply-To: <4E803B16.1090905@renesas.com>
Hi,
2011/09/30 17:17, Felipe Balbi wrote:
> Hi,
>
< snip >
> On Mon, Sep 26, 2011 at 05:43:02PM +0900, Yoshihiro Shimoda wrote:
>> @@ -186,6 +187,51 @@ static inline void control_reg_sqclr(struct r8a66597 *r8a66597, u16 pipenum)
>> printk(KERN_ERR "unexpect pipe num(%d)\n", pipenum);
>> }
>>
>> +static void control_reg_sqset(struct r8a66597 *r8a66597, u16 pipenum)
>> +{
>> + unsigned long offset;
>> +
>> + pipe_stop(r8a66597, pipenum);
>> +
>> + if (pipenum = 0)
>> + r8a66597_bset(r8a66597, SQSET, DCPCTR);
>> + else if (pipenum < R8A66597_MAX_NUM_PIPE) {
>> + offset = get_pipectr_addr(pipenum);
>> + r8a66597_bset(r8a66597, SQSET, offset);
>> + } else
>> + printk(KERN_ERR "unexpect pipe num(%d)\n", pipenum);
>
> according to CodingStyle, if one branch as braces, all of them should
> have. Also, try to avoid printk(), I guess you have a *dev here to use
> dev_err(). Besides this, I guess it looks fine.
>
I knew the rule, but I mistook the code...
I will fix it. And I also use dev_err() instead of printk().
Best regards,
Yoshihiro Shimoda
^ permalink raw reply
* Re: [PATCH 2/2] usb: r8a66597-udc: add support for SUDMAC
From: Felipe Balbi @ 2011-09-30 9:55 UTC (permalink / raw)
To: linux-sh
In-Reply-To: <4E803B16.1090905@renesas.com>
[-- Attachment #1: Type: text/plain, Size: 1322 bytes --]
Hi,
On Fri, Sep 30, 2011 at 06:49:15PM +0900, Yoshihiro Shimoda wrote:
> Hi,
> 2011/09/30 17:17, Felipe Balbi wrote:
> > Hi,
> >
> < snip >
> > On Mon, Sep 26, 2011 at 05:43:02PM +0900, Yoshihiro Shimoda wrote:
> >> @@ -186,6 +187,51 @@ static inline void control_reg_sqclr(struct r8a66597 *r8a66597, u16 pipenum)
> >> printk(KERN_ERR "unexpect pipe num(%d)\n", pipenum);
> >> }
> >>
> >> +static void control_reg_sqset(struct r8a66597 *r8a66597, u16 pipenum)
> >> +{
> >> + unsigned long offset;
> >> +
> >> + pipe_stop(r8a66597, pipenum);
> >> +
> >> + if (pipenum == 0)
> >> + r8a66597_bset(r8a66597, SQSET, DCPCTR);
> >> + else if (pipenum < R8A66597_MAX_NUM_PIPE) {
> >> + offset = get_pipectr_addr(pipenum);
> >> + r8a66597_bset(r8a66597, SQSET, offset);
> >> + } else
> >> + printk(KERN_ERR "unexpect pipe num(%d)\n", pipenum);
> >
> > according to CodingStyle, if one branch as braces, all of them should
> > have. Also, try to avoid printk(), I guess you have a *dev here to use
> > dev_err(). Besides this, I guess it looks fine.
> >
>
> I knew the rule, but I mistook the code...
> I will fix it. And I also use dev_err() instead of printk().
it might also be wise to add a patch, before this one, converting
printk() to dev_* macros, I guess ;-)
--
balbi
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 490 bytes --]
^ permalink raw reply
* Re: [PATCH 2/2] usb: r8a66597-udc: add support for SUDMAC
From: Yoshihiro Shimoda @ 2011-09-30 10:48 UTC (permalink / raw)
To: linux-sh
In-Reply-To: <4E803B16.1090905@renesas.com>
Hi,
2011/09/30 18:55, Felipe Balbi wrote:
> Hi,
>
> On Fri, Sep 30, 2011 at 06:49:15PM +0900, Yoshihiro Shimoda wrote:
>> Hi,
>> 2011/09/30 17:17, Felipe Balbi wrote:
>>> Hi,
>>>
>> < snip >
>>> On Mon, Sep 26, 2011 at 05:43:02PM +0900, Yoshihiro Shimoda wrote:
>>>> @@ -186,6 +187,51 @@ static inline void control_reg_sqclr(struct r8a66597 *r8a66597, u16 pipenum)
>>>> printk(KERN_ERR "unexpect pipe num(%d)\n", pipenum);
>>>> }
>>>>
>>>> +static void control_reg_sqset(struct r8a66597 *r8a66597, u16 pipenum)
>>>> +{
>>>> + unsigned long offset;
>>>> +
>>>> + pipe_stop(r8a66597, pipenum);
>>>> +
>>>> + if (pipenum = 0)
>>>> + r8a66597_bset(r8a66597, SQSET, DCPCTR);
>>>> + else if (pipenum < R8A66597_MAX_NUM_PIPE) {
>>>> + offset = get_pipectr_addr(pipenum);
>>>> + r8a66597_bset(r8a66597, SQSET, offset);
>>>> + } else
>>>> + printk(KERN_ERR "unexpect pipe num(%d)\n", pipenum);
>>>
>>> according to CodingStyle, if one branch as braces, all of them should
>>> have. Also, try to avoid printk(), I guess you have a *dev here to use
>>> dev_err(). Besides this, I guess it looks fine.
>>>
>>
>> I knew the rule, but I mistook the code...
>> I will fix it. And I also use dev_err() instead of printk().
>
> it might also be wise to add a patch, before this one, converting
> printk() to dev_* macros, I guess ;-)
>
I think so. :)
I wrote such patch and I will submit it soon.
Best regards,
Yoshihiro Shimoda
^ permalink raw reply
* [PATCH v2 1/4] usb: r8a66597-udc: change prototype of
From: Yoshihiro Shimoda @ 2011-09-30 11:07 UTC (permalink / raw)
To: linux-sh
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
about v2:
- divide a patch for changing prototype only
drivers/usb/gadget/r8a66597-udc.c | 4 ++--
drivers/usb/gadget/r8a66597-udc.h | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/gadget/r8a66597-udc.c b/drivers/usb/gadget/r8a66597-udc.c
index 50991e5..cd2cd16 100644
--- a/drivers/usb/gadget/r8a66597-udc.c
+++ b/drivers/usb/gadget/r8a66597-udc.c
@@ -733,7 +733,7 @@ static void irq_ep0_write(struct r8a66597_ep *ep, struct r8a66597_request *req)
/* write fifo */
if (req->req.buf) {
if (size > 0)
- r8a66597_write_fifo(r8a66597, ep->fifoaddr, buf, size);
+ r8a66597_write_fifo(r8a66597, ep, buf, size);
if ((size = 0) || ((size % ep->ep.maxpacket) != 0))
r8a66597_bset(r8a66597, BVAL, ep->fifoctr);
}
@@ -780,7 +780,7 @@ static void irq_packet_write(struct r8a66597_ep *ep,
/* write fifo */
if (req->req.buf) {
- r8a66597_write_fifo(r8a66597, ep->fifoaddr, buf, size);
+ r8a66597_write_fifo(r8a66597, ep, buf, size);
if ((size = 0)
|| ((size % ep->ep.maxpacket) != 0)
|| ((bufsize != ep->ep.maxpacket)
diff --git a/drivers/usb/gadget/r8a66597-udc.h b/drivers/usb/gadget/r8a66597-udc.h
index 503f766..c6193fb 100644
--- a/drivers/usb/gadget/r8a66597-udc.h
+++ b/drivers/usb/gadget/r8a66597-udc.h
@@ -183,11 +183,11 @@ static inline void r8a66597_write(struct r8a66597 *r8a66597, u16 val,
}
static inline void r8a66597_write_fifo(struct r8a66597 *r8a66597,
- unsigned long offset,
+ struct r8a66597_ep *ep,
unsigned char *buf,
int len)
{
- void __iomem *fifoaddr = r8a66597->reg + offset;
+ void __iomem *fifoaddr = r8a66597->reg + ep->fifoaddr;
int adj = 0;
int i;
--
1.7.1
^ permalink raw reply related
* [PATCH v2 2/4] usb: r8a66597-udc: add function for external controller
From: Yoshihiro Shimoda @ 2011-09-30 11:07 UTC (permalink / raw)
To: linux-sh
R8A66597 has the pin of WR0 and WR1. So, if one write-pin of CPU
connects to the pins, we have to change the setting of FIFOSEL
register in the controller. If we don't change the setting,
the controller cannot send the data of odd length.
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
about v2:
- divide a patch to only improve function.
drivers/usb/gadget/r8a66597-udc.h | 34 +++++++++++++++++++---------------
1 files changed, 19 insertions(+), 15 deletions(-)
diff --git a/drivers/usb/gadget/r8a66597-udc.h b/drivers/usb/gadget/r8a66597-udc.h
index c6193fb..37d0dd5 100644
--- a/drivers/usb/gadget/r8a66597-udc.h
+++ b/drivers/usb/gadget/r8a66597-udc.h
@@ -182,6 +182,21 @@ static inline void r8a66597_write(struct r8a66597 *r8a66597, u16 val,
iowrite16(val, r8a66597->reg + offset);
}
+static inline void r8a66597_mdfy(struct r8a66597 *r8a66597,
+ u16 val, u16 pat, unsigned long offset)
+{
+ u16 tmp;
+ tmp = r8a66597_read(r8a66597, offset);
+ tmp = tmp & (~pat);
+ tmp = tmp | val;
+ r8a66597_write(r8a66597, tmp, offset);
+}
+
+#define r8a66597_bclr(r8a66597, val, offset) \
+ r8a66597_mdfy(r8a66597, 0, val, offset)
+#define r8a66597_bset(r8a66597, val, offset) \
+ r8a66597_mdfy(r8a66597, val, 0, offset)
+
static inline void r8a66597_write_fifo(struct r8a66597 *r8a66597,
struct r8a66597_ep *ep,
unsigned char *buf,
@@ -215,18 +230,12 @@ static inline void r8a66597_write_fifo(struct r8a66597 *r8a66597,
adj = 0x01; /* 16-bit wide */
}
+ if (r8a66597->pdata->wr0_shorted_to_wr1)
+ r8a66597_bclr(r8a66597, MBW_16, ep->fifosel);
for (i = 0; i < len; i++)
iowrite8(buf[i], fifoaddr + adj - (i & adj));
-}
-
-static inline void r8a66597_mdfy(struct r8a66597 *r8a66597,
- u16 val, u16 pat, unsigned long offset)
-{
- u16 tmp;
- tmp = r8a66597_read(r8a66597, offset);
- tmp = tmp & (~pat);
- tmp = tmp | val;
- r8a66597_write(r8a66597, tmp, offset);
+ if (r8a66597->pdata->wr0_shorted_to_wr1)
+ r8a66597_bclr(r8a66597, MBW_16, ep->fifosel);
}
static inline u16 get_xtal_from_pdata(struct r8a66597_platdata *pdata)
@@ -251,11 +260,6 @@ static inline u16 get_xtal_from_pdata(struct r8a66597_platdata *pdata)
return clock;
}
-#define r8a66597_bclr(r8a66597, val, offset) \
- r8a66597_mdfy(r8a66597, 0, val, offset)
-#define r8a66597_bset(r8a66597, val, offset) \
- r8a66597_mdfy(r8a66597, val, 0, offset)
-
#define get_pipectr_addr(pipenum) (PIPE1CTR + (pipenum - 1) * 2)
#define enable_irq_ready(r8a66597, pipenum) \
--
1.7.1
^ permalink raw reply related
* [PATCH v2 3/4] usb: r8a66597-udc: use dev_*() instead of printk()
From: Yoshihiro Shimoda @ 2011-09-30 11:07 UTC (permalink / raw)
To: linux-sh
This patch also fix the balance of braces.
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
about v2:
- before adding a new function, convert the printk() to dev_*().
drivers/usb/gadget/r8a66597-udc.c | 99 ++++++++++++++++++++++---------------
drivers/usb/gadget/r8a66597-udc.h | 1 +
2 files changed, 60 insertions(+), 40 deletions(-)
diff --git a/drivers/usb/gadget/r8a66597-udc.c b/drivers/usb/gadget/r8a66597-udc.c
index cd2cd16..fdc49f0 100644
--- a/drivers/usb/gadget/r8a66597-udc.c
+++ b/drivers/usb/gadget/r8a66597-udc.c
@@ -115,13 +115,15 @@ static inline u16 control_reg_get_pid(struct r8a66597 *r8a66597, u16 pipenum)
u16 pid = 0;
unsigned long offset;
- if (pipenum = 0)
+ if (pipenum = 0) {
pid = r8a66597_read(r8a66597, DCPCTR) & PID;
- else if (pipenum < R8A66597_MAX_NUM_PIPE) {
+ } else if (pipenum < R8A66597_MAX_NUM_PIPE) {
offset = get_pipectr_addr(pipenum);
pid = r8a66597_read(r8a66597, offset) & PID;
- } else
- printk(KERN_ERR "unexpect pipe num (%d)\n", pipenum);
+ } else {
+ dev_err(r8a66597_to_dev(r8a66597), "unexpect pipe num (%d)\n",
+ pipenum);
+ }
return pid;
}
@@ -131,13 +133,15 @@ static inline void control_reg_set_pid(struct r8a66597 *r8a66597, u16 pipenum,
{
unsigned long offset;
- if (pipenum = 0)
+ if (pipenum = 0) {
r8a66597_mdfy(r8a66597, pid, PID, DCPCTR);
- else if (pipenum < R8A66597_MAX_NUM_PIPE) {
+ } else if (pipenum < R8A66597_MAX_NUM_PIPE) {
offset = get_pipectr_addr(pipenum);
r8a66597_mdfy(r8a66597, pid, PID, offset);
- } else
- printk(KERN_ERR "unexpect pipe num (%d)\n", pipenum);
+ } else {
+ dev_err(r8a66597_to_dev(r8a66597), "unexpect pipe num (%d)\n",
+ pipenum);
+ }
}
static inline void pipe_start(struct r8a66597 *r8a66597, u16 pipenum)
@@ -160,13 +164,15 @@ static inline u16 control_reg_get(struct r8a66597 *r8a66597, u16 pipenum)
u16 ret = 0;
unsigned long offset;
- if (pipenum = 0)
+ if (pipenum = 0) {
ret = r8a66597_read(r8a66597, DCPCTR);
- else if (pipenum < R8A66597_MAX_NUM_PIPE) {
+ } else if (pipenum < R8A66597_MAX_NUM_PIPE) {
offset = get_pipectr_addr(pipenum);
ret = r8a66597_read(r8a66597, offset);
- } else
- printk(KERN_ERR "unexpect pipe num (%d)\n", pipenum);
+ } else {
+ dev_err(r8a66597_to_dev(r8a66597), "unexpect pipe num (%d)\n",
+ pipenum);
+ }
return ret;
}
@@ -177,13 +183,15 @@ static inline void control_reg_sqclr(struct r8a66597 *r8a66597, u16 pipenum)
pipe_stop(r8a66597, pipenum);
- if (pipenum = 0)
+ if (pipenum = 0) {
r8a66597_bset(r8a66597, SQCLR, DCPCTR);
- else if (pipenum < R8A66597_MAX_NUM_PIPE) {
+ } else if (pipenum < R8A66597_MAX_NUM_PIPE) {
offset = get_pipectr_addr(pipenum);
r8a66597_bset(r8a66597, SQCLR, offset);
- } else
- printk(KERN_ERR "unexpect pipe num(%d)\n", pipenum);
+ } else {
+ dev_err(r8a66597_to_dev(r8a66597), "unexpect pipe num (%d)\n",
+ pipenum);
+ }
}
static inline int get_buffer_size(struct r8a66597 *r8a66597, u16 pipenum)
@@ -297,17 +305,18 @@ static void pipe_buffer_release(struct r8a66597 *r8a66597,
if (info->pipe = 0)
return;
- if (is_bulk_pipe(info->pipe))
+ if (is_bulk_pipe(info->pipe)) {
r8a66597->bulk--;
- else if (is_interrupt_pipe(info->pipe))
+ } else if (is_interrupt_pipe(info->pipe)) {
r8a66597->interrupt--;
- else if (is_isoc_pipe(info->pipe)) {
+ } else if (is_isoc_pipe(info->pipe)) {
r8a66597->isochronous--;
if (info->type = R8A66597_BULK)
r8a66597->bulk--;
- } else
- printk(KERN_ERR "ep_release: unexpect pipenum (%d)\n",
- info->pipe);
+ } else {
+ dev_err(r8a66597_to_dev(r8a66597),
+ "ep_release: unexpect pipenum (%d)\n", info->pipe);
+ }
}
static void pipe_initialize(struct r8a66597_ep *ep)
@@ -381,7 +390,8 @@ static int alloc_pipe_config(struct r8a66597_ep *ep,
case USB_ENDPOINT_XFER_BULK:
if (r8a66597->bulk >= R8A66597_MAX_NUM_BULK) {
if (r8a66597->isochronous >= R8A66597_MAX_NUM_ISOC) {
- printk(KERN_ERR "bulk pipe is insufficient\n");
+ dev_err(r8a66597_to_dev(r8a66597),
+ "bulk pipe is insufficient\n");
return -ENODEV;
} else {
info.pipe = R8A66597_BASE_PIPENUM_ISOC
@@ -397,7 +407,8 @@ static int alloc_pipe_config(struct r8a66597_ep *ep,
break;
case USB_ENDPOINT_XFER_INT:
if (r8a66597->interrupt >= R8A66597_MAX_NUM_INT) {
- printk(KERN_ERR "interrupt pipe is insufficient\n");
+ dev_err(r8a66597_to_dev(r8a66597),
+ "interrupt pipe is insufficient\n");
return -ENODEV;
}
info.pipe = R8A66597_BASE_PIPENUM_INT + r8a66597->interrupt;
@@ -406,7 +417,8 @@ static int alloc_pipe_config(struct r8a66597_ep *ep,
break;
case USB_ENDPOINT_XFER_ISOC:
if (r8a66597->isochronous >= R8A66597_MAX_NUM_ISOC) {
- printk(KERN_ERR "isochronous pipe is insufficient\n");
+ dev_err(r8a66597_to_dev(r8a66597),
+ "isochronous pipe is insufficient\n");
return -ENODEV;
}
info.pipe = R8A66597_BASE_PIPENUM_ISOC + r8a66597->isochronous;
@@ -414,7 +426,7 @@ static int alloc_pipe_config(struct r8a66597_ep *ep,
counter = &r8a66597->isochronous;
break;
default:
- printk(KERN_ERR "unexpect xfer type\n");
+ dev_err(r8a66597_to_dev(r8a66597), "unexpect xfer type\n");
return -EINVAL;
}
ep->type = info.type;
@@ -429,7 +441,8 @@ static int alloc_pipe_config(struct r8a66597_ep *ep,
ret = pipe_buffer_setting(r8a66597, &info);
if (ret < 0) {
- printk(KERN_ERR "pipe_buffer_setting fail\n");
+ dev_err(r8a66597_to_dev(r8a66597),
+ "pipe_buffer_setting fail\n");
return ret;
}
@@ -564,7 +577,8 @@ static void start_ep0(struct r8a66597_ep *ep, struct r8a66597_request *req)
control_end(ep->r8a66597, 0);
break;
default:
- printk(KERN_ERR "start_ep0: unexpect ctsq(%x)\n", ctsq);
+ dev_err(r8a66597_to_dev(ep->r8a66597),
+ "start_ep0: unexpect ctsq(%x)\n", ctsq);
break;
}
}
@@ -718,7 +732,8 @@ static void irq_ep0_write(struct r8a66597_ep *ep, struct r8a66597_request *req)
do {
tmp = r8a66597_read(r8a66597, ep->fifoctr);
if (i++ > 100000) {
- printk(KERN_ERR "pipe0 is busy. maybe cpu i/o bus"
+ dev_err(r8a66597_to_dev(r8a66597),
+ "pipe0 is busy. maybe cpu i/o bus "
"conflict. please power off this controller.");
return;
}
@@ -769,7 +784,8 @@ static void irq_packet_write(struct r8a66597_ep *ep,
if (unlikely((tmp & FRDY) = 0)) {
pipe_stop(r8a66597, pipenum);
pipe_irq_disable(r8a66597, pipenum);
- printk(KERN_ERR "write fifo not ready. pipnum=%d\n", pipenum);
+ dev_err(r8a66597_to_dev(r8a66597),
+ "write fifo not ready. pipnum=%d\n", pipenum);
return;
}
@@ -819,7 +835,7 @@ static void irq_packet_read(struct r8a66597_ep *ep,
req->req.status = -EPIPE;
pipe_stop(r8a66597, pipenum);
pipe_irq_disable(r8a66597, pipenum);
- printk(KERN_ERR "read fifo not ready");
+ dev_err(r8a66597_to_dev(r8a66597), "read fifo not ready");
return;
}
@@ -1095,7 +1111,7 @@ static void r8a66597_update_usb_speed(struct r8a66597 *r8a66597)
break;
default:
r8a66597->gadget.speed = USB_SPEED_UNKNOWN;
- printk(KERN_ERR "USB speed unknown\n");
+ dev_err(r8a66597_to_dev(r8a66597), "USB speed unknown\n");
}
}
@@ -1158,7 +1174,8 @@ __acquires(r8a66597->lock)
control_end(r8a66597, 0);
break;
default:
- printk(KERN_ERR "ctrl_stage: unexpect ctsq(%x)\n", ctsq);
+ dev_err(r8a66597_to_dev(r8a66597),
+ "ctrl_stage: unexpect ctsq(%x)\n", ctsq);
break;
}
}
@@ -1458,13 +1475,15 @@ static int r8a66597_start(struct usb_gadget_driver *driver,
retval = device_add(&r8a66597->gadget.dev);
if (retval) {
- printk(KERN_ERR "device_add error (%d)\n", retval);
+ dev_err(r8a66597_to_dev(r8a66597), "device_add error (%d)\n",
+ retval);
goto error;
}
retval = bind(&r8a66597->gadget);
if (retval) {
- printk(KERN_ERR "bind to driver error (%d)\n", retval);
+ dev_err(r8a66597_to_dev(r8a66597),
+ "bind to driver error (%d)\n", retval);
device_del(&r8a66597->gadget.dev);
goto error;
}
@@ -1579,7 +1598,7 @@ static int __init r8a66597_probe(struct platform_device *pdev)
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) {
ret = -ENODEV;
- printk(KERN_ERR "platform_get_resource error.\n");
+ dev_err(&pdev->dev, "platform_get_resource error.\n");
goto clean_up;
}
@@ -1589,14 +1608,14 @@ static int __init r8a66597_probe(struct platform_device *pdev)
if (irq < 0) {
ret = -ENODEV;
- printk(KERN_ERR "platform_get_irq error.\n");
+ dev_err(&pdev->dev, "platform_get_irq error.\n");
goto clean_up;
}
reg = ioremap(res->start, resource_size(res));
if (reg = NULL) {
ret = -ENOMEM;
- printk(KERN_ERR "ioremap error.\n");
+ dev_err(&pdev->dev, "ioremap error.\n");
goto clean_up;
}
@@ -1604,7 +1623,7 @@ static int __init r8a66597_probe(struct platform_device *pdev)
r8a66597 = kzalloc(sizeof(struct r8a66597), GFP_KERNEL);
if (r8a66597 = NULL) {
ret = -ENOMEM;
- printk(KERN_ERR "kzalloc error\n");
+ dev_err(&pdev->dev, "kzalloc error\n");
goto clean_up;
}
@@ -1646,7 +1665,7 @@ static int __init r8a66597_probe(struct platform_device *pdev)
ret = request_irq(irq, r8a66597_irq, IRQF_DISABLED | IRQF_SHARED,
udc_name, r8a66597);
if (ret < 0) {
- printk(KERN_ERR "request_irq error (%d)\n", ret);
+ dev_err(&pdev->dev, "request_irq error (%d)\n", ret);
goto clean_up2;
}
diff --git a/drivers/usb/gadget/r8a66597-udc.h b/drivers/usb/gadget/r8a66597-udc.h
index 37d0dd5..99681c7 100644
--- a/drivers/usb/gadget/r8a66597-udc.h
+++ b/drivers/usb/gadget/r8a66597-udc.h
@@ -124,6 +124,7 @@ struct r8a66597 {
#define gadget_to_r8a66597(_gadget) \
container_of(_gadget, struct r8a66597, gadget)
#define r8a66597_to_gadget(r8a66597) (&r8a66597->gadget)
+#define r8a66597_to_dev(r8a66597) (r8a66597->gadget.dev.parent)
static inline u16 r8a66597_read(struct r8a66597 *r8a66597, unsigned long offset)
{
--
1.7.1
^ permalink raw reply related
* [PATCH v2 4/4] usb: r8a66597-udc: add support for SUDMAC
From: Yoshihiro Shimoda @ 2011-09-30 11:07 UTC (permalink / raw)
To: linux-sh
SH7757 has a USB function with internal DMA controller (SUDMAC).
This patch supports the SUDMAC. The SUDMAC is incompatible with
general-purpose DMAC. So, it doesn't use dmaengine.
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
about v2:
- fix balance of braces.
- use dev_err() instead of printk().
drivers/usb/gadget/r8a66597-udc.c | 364 +++++++++++++++++++++++++++++++++++--
drivers/usb/gadget/r8a66597-udc.h | 26 +++-
include/linux/usb/r8a66597.h | 60 ++++++
3 files changed, 430 insertions(+), 20 deletions(-)
diff --git a/drivers/usb/gadget/r8a66597-udc.c b/drivers/usb/gadget/r8a66597-udc.c
index fdc49f0..a4c78b7 100644
--- a/drivers/usb/gadget/r8a66597-udc.c
+++ b/drivers/usb/gadget/r8a66597-udc.c
@@ -28,13 +28,14 @@
#include <linux/clk.h>
#include <linux/err.h>
#include <linux/slab.h>
+#include <linux/dma-mapping.h>
#include <linux/usb/ch9.h>
#include <linux/usb/gadget.h>
#include "r8a66597-udc.h"
-#define DRIVER_VERSION "2009-08-18"
+#define DRIVER_VERSION "2011-09-26"
static const char udc_name[] = "r8a66597_udc";
static const char *r8a66597_ep_name[] = {
@@ -194,6 +195,54 @@ static inline void control_reg_sqclr(struct r8a66597 *r8a66597, u16 pipenum)
}
}
+static void control_reg_sqset(struct r8a66597 *r8a66597, u16 pipenum)
+{
+ unsigned long offset;
+
+ pipe_stop(r8a66597, pipenum);
+
+ if (pipenum = 0) {
+ r8a66597_bset(r8a66597, SQSET, DCPCTR);
+ } else if (pipenum < R8A66597_MAX_NUM_PIPE) {
+ offset = get_pipectr_addr(pipenum);
+ r8a66597_bset(r8a66597, SQSET, offset);
+ } else {
+ dev_err(r8a66597_to_dev(r8a66597),
+ "unexpect pipe num(%d)\n", pipenum);
+ }
+}
+
+static u16 control_reg_sqmon(struct r8a66597 *r8a66597, u16 pipenum)
+{
+ unsigned long offset;
+
+ if (pipenum = 0) {
+ return r8a66597_read(r8a66597, DCPCTR) & SQMON;
+ } else if (pipenum < R8A66597_MAX_NUM_PIPE) {
+ offset = get_pipectr_addr(pipenum);
+ return r8a66597_read(r8a66597, offset) & SQMON;
+ } else {
+ dev_err(r8a66597_to_dev(r8a66597),
+ "unexpect pipe num(%d)\n", pipenum);
+ }
+
+ return 0;
+}
+
+static u16 save_usb_toggle(struct r8a66597 *r8a66597, u16 pipenum)
+{
+ return control_reg_sqmon(r8a66597, pipenum);
+}
+
+static void restore_usb_toggle(struct r8a66597 *r8a66597, u16 pipenum,
+ u16 toggle)
+{
+ if (toggle)
+ control_reg_sqset(r8a66597, pipenum);
+ else
+ control_reg_sqclr(r8a66597, pipenum);
+}
+
static inline int get_buffer_size(struct r8a66597 *r8a66597, u16 pipenum)
{
u16 tmp;
@@ -230,18 +279,51 @@ static inline unsigned short mbw_value(struct r8a66597 *r8a66597)
return MBW_16;
}
+static void r8a66597_change_curpipe(struct r8a66597 *r8a66597, u16 pipenum,
+ u16 isel, u16 fifosel)
+{
+ u16 tmp, mask, loop;
+ int i = 0;
+
+ if (!pipenum) {
+ mask = ISEL | CURPIPE;
+ loop = isel;
+ } else {
+ mask = CURPIPE;
+ loop = pipenum;
+ }
+ r8a66597_mdfy(r8a66597, loop, mask, fifosel);
+
+ do {
+ tmp = r8a66597_read(r8a66597, fifosel);
+ if (i++ > 1000000) {
+ dev_err(r8a66597_to_dev(r8a66597),
+ "r8a66597: register%x, loop %x "
+ "is timeout\n", fifosel, loop);
+ break;
+ }
+ ndelay(1);
+ } while ((tmp & mask) != loop);
+}
+
static inline void pipe_change(struct r8a66597 *r8a66597, u16 pipenum)
{
struct r8a66597_ep *ep = r8a66597->pipenum2ep[pipenum];
if (ep->use_dma)
- return;
+ r8a66597_bclr(r8a66597, DREQE, ep->fifosel);
r8a66597_mdfy(r8a66597, pipenum, CURPIPE, ep->fifosel);
ndelay(450);
- r8a66597_bset(r8a66597, mbw_value(r8a66597), ep->fifosel);
+ if (r8a66597_is_sudmac(r8a66597) && ep->use_dma)
+ r8a66597_bclr(r8a66597, mbw_value(r8a66597), ep->fifosel);
+ else
+ r8a66597_bset(r8a66597, mbw_value(r8a66597), ep->fifosel);
+
+ if (ep->use_dma)
+ r8a66597_bset(r8a66597, DREQE, ep->fifosel);
}
static int pipe_buffer_setting(struct r8a66597 *r8a66597,
@@ -346,9 +428,15 @@ static void r8a66597_ep_setting(struct r8a66597 *r8a66597,
ep->fifoaddr = CFIFO;
ep->fifosel = CFIFOSEL;
ep->fifoctr = CFIFOCTR;
- ep->fifotrn = 0;
ep->pipectr = get_pipectr_addr(pipenum);
+ if (is_bulk_pipe(pipenum) || is_isoc_pipe(pipenum)) {
+ ep->pipetre = get_pipetre_addr(pipenum);
+ ep->pipetrn = get_pipetrn_addr(pipenum);
+ } else {
+ ep->pipetre = 0;
+ ep->pipetrn = 0;
+ }
ep->pipenum = pipenum;
ep->ep.maxpacket = le16_to_cpu(desc->wMaxPacketSize);
r8a66597->pipenum2ep[pipenum] = ep;
@@ -508,6 +596,124 @@ static void start_ep0_write(struct r8a66597_ep *ep,
}
}
+static void disable_fifosel(struct r8a66597 *r8a66597, u16 pipenum,
+ u16 fifosel)
+{
+ u16 tmp;
+
+ tmp = r8a66597_read(r8a66597, fifosel) & CURPIPE;
+ if (tmp = pipenum)
+ r8a66597_change_curpipe(r8a66597, 0, 0, fifosel);
+}
+
+static void change_bfre_mode(struct r8a66597 *r8a66597, u16 pipenum,
+ int enable)
+{
+ struct r8a66597_ep *ep = r8a66597->pipenum2ep[pipenum];
+ u16 tmp, toggle;
+
+ /* check current BFRE bit */
+ r8a66597_write(r8a66597, pipenum, PIPESEL);
+ tmp = r8a66597_read(r8a66597, PIPECFG) & R8A66597_BFRE;
+ if ((enable && tmp) || (!enable && !tmp))
+ return;
+
+ /* change BFRE bit */
+ pipe_stop(r8a66597, pipenum);
+ disable_fifosel(r8a66597, pipenum, CFIFOSEL);
+ disable_fifosel(r8a66597, pipenum, D0FIFOSEL);
+ disable_fifosel(r8a66597, pipenum, D1FIFOSEL);
+
+ toggle = save_usb_toggle(r8a66597, pipenum);
+
+ r8a66597_write(r8a66597, pipenum, PIPESEL);
+ if (enable)
+ r8a66597_bset(r8a66597, R8A66597_BFRE, PIPECFG);
+ else
+ r8a66597_bclr(r8a66597, R8A66597_BFRE, PIPECFG);
+
+ /* initialize for internal BFRE flag */
+ r8a66597_bset(r8a66597, ACLRM, ep->pipectr);
+ r8a66597_bclr(r8a66597, ACLRM, ep->pipectr);
+
+ restore_usb_toggle(r8a66597, pipenum, toggle);
+}
+
+static int sudmac_alloc_channel(struct r8a66597 *r8a66597,
+ struct r8a66597_ep *ep,
+ struct r8a66597_request *req)
+{
+ struct r8a66597_dma *dma;
+
+ if (!r8a66597_is_sudmac(r8a66597))
+ return -ENODEV;
+
+ /* Check transfer type */
+ if (!is_bulk_pipe(ep->pipenum))
+ return -EIO;
+
+ if (r8a66597->dma.used)
+ return -EBUSY;
+
+ /* set SUDMAC parameters */
+ dma = &r8a66597->dma;
+ dma->used = 1;
+ if (ep->desc->bEndpointAddress & USB_DIR_IN) {
+ dma->dir = 1;
+ } else {
+ dma->dir = 0;
+ change_bfre_mode(r8a66597, ep->pipenum, 1);
+ }
+
+ /* set r8a66597_ep paramters */
+ ep->use_dma = 1;
+ ep->dma = dma;
+ ep->fifoaddr = D0FIFO;
+ ep->fifosel = D0FIFOSEL;
+ ep->fifoctr = D0FIFOCTR;
+
+ /* dma mapping */
+ req->req.dma = dma_map_single(r8a66597_to_dev(ep->r8a66597),
+ req->req.buf, req->req.length,
+ dma->dir ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
+
+ return 0;
+}
+
+static void sudmac_free_channel(struct r8a66597 *r8a66597,
+ struct r8a66597_ep *ep,
+ struct r8a66597_request *req)
+{
+ if (!r8a66597_is_sudmac(r8a66597))
+ return;
+
+ dma_unmap_single(r8a66597_to_dev(ep->r8a66597),
+ req->req.dma, req->req.length,
+ ep->dma->dir ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
+
+ r8a66597_bclr(r8a66597, DREQE, ep->fifosel);
+ r8a66597_change_curpipe(r8a66597, 0, 0, ep->fifosel);
+
+ ep->dma->used = 0;
+ ep->use_dma = 0;
+ ep->fifoaddr = CFIFO;
+ ep->fifosel = CFIFOSEL;
+ ep->fifoctr = CFIFOCTR;
+}
+
+static void sudmac_start(struct r8a66597 *r8a66597, struct r8a66597_ep *ep,
+ struct r8a66597_request *req)
+{
+ BUG_ON(req->req.length = 0);
+
+ r8a66597_sudmac_write(r8a66597, LBA_WAIT, CH0CFG);
+ r8a66597_sudmac_write(r8a66597, req->req.dma, CH0BA);
+ r8a66597_sudmac_write(r8a66597, req->req.length, CH0BBC);
+ r8a66597_sudmac_write(r8a66597, CH0ENDE, DINTCTRL);
+
+ r8a66597_sudmac_write(r8a66597, DEN, CH0DEN);
+}
+
static void start_packet_write(struct r8a66597_ep *ep,
struct r8a66597_request *req)
{
@@ -518,11 +724,29 @@ static void start_packet_write(struct r8a66597_ep *ep,
disable_irq_empty(r8a66597, ep->pipenum);
pipe_start(r8a66597, ep->pipenum);
- tmp = r8a66597_read(r8a66597, ep->fifoctr);
- if (unlikely((tmp & FRDY) = 0))
- pipe_irq_enable(r8a66597, ep->pipenum);
- else
- irq_packet_write(ep, req);
+ if (req->req.length = 0) {
+ transfer_complete(ep, req, 0);
+ } else {
+ r8a66597_write(r8a66597, ~(1 << ep->pipenum), BRDYSTS);
+ if (sudmac_alloc_channel(r8a66597, ep, req) < 0) {
+ /* PIO mode */
+ pipe_change(r8a66597, ep->pipenum);
+ disable_irq_empty(r8a66597, ep->pipenum);
+ pipe_start(r8a66597, ep->pipenum);
+ tmp = r8a66597_read(r8a66597, ep->fifoctr);
+ if (unlikely((tmp & FRDY) = 0))
+ pipe_irq_enable(r8a66597, ep->pipenum);
+ else
+ irq_packet_write(ep, req);
+ } else {
+ /* DMA mode */
+ pipe_change(r8a66597, ep->pipenum);
+ disable_irq_nrdy(r8a66597, ep->pipenum);
+ pipe_start(r8a66597, ep->pipenum);
+ enable_irq_nrdy(r8a66597, ep->pipenum);
+ sudmac_start(r8a66597, ep, req);
+ }
+ }
}
static void start_packet_read(struct r8a66597_ep *ep,
@@ -537,17 +761,26 @@ static void start_packet_read(struct r8a66597_ep *ep,
pipe_start(r8a66597, pipenum);
pipe_irq_enable(r8a66597, pipenum);
} else {
- if (ep->use_dma) {
- r8a66597_bset(r8a66597, TRCLR, ep->fifosel);
- pipe_change(r8a66597, pipenum);
- r8a66597_bset(r8a66597, TRENB, ep->fifosel);
+ pipe_stop(r8a66597, pipenum);
+ if (ep->pipetre) {
+ enable_irq_nrdy(r8a66597, pipenum);
+ r8a66597_write(r8a66597, TRCLR, ep->pipetre);
r8a66597_write(r8a66597,
- (req->req.length + ep->ep.maxpacket - 1)
- / ep->ep.maxpacket,
- ep->fifotrn);
+ DIV_ROUND_UP(req->req.length, ep->ep.maxpacket),
+ ep->pipetrn);
+ r8a66597_bset(r8a66597, TRENB, ep->pipetre);
+ }
+
+ if (sudmac_alloc_channel(r8a66597, ep, req) < 0) {
+ /* PIO mode */
+ change_bfre_mode(r8a66597, ep->pipenum, 0);
+ pipe_start(r8a66597, pipenum); /* trigger once */
+ pipe_irq_enable(r8a66597, pipenum);
+ } else {
+ pipe_change(r8a66597, pipenum);
+ sudmac_start(r8a66597, ep, req);
+ pipe_start(r8a66597, pipenum); /* trigger once */
}
- pipe_start(r8a66597, pipenum); /* trigger once */
- pipe_irq_enable(r8a66597, pipenum);
}
}
@@ -704,6 +937,9 @@ __acquires(r8a66597->lock)
if (!list_empty(&ep->queue))
restart = 1;
+ if (ep->use_dma)
+ sudmac_free_channel(ep->r8a66597, ep, req);
+
spin_unlock(&ep->r8a66597->lock);
req->req.complete(&ep->ep, &req->req);
spin_lock(&ep->r8a66597->lock);
@@ -1180,6 +1416,65 @@ __acquires(r8a66597->lock)
}
}
+static void sudmac_finish(struct r8a66597 *r8a66597, struct r8a66597_ep *ep)
+{
+ u16 pipenum;
+ struct r8a66597_request *req;
+ u32 len;
+ int i = 0;
+
+ pipenum = ep->pipenum;
+ pipe_change(r8a66597, pipenum);
+
+ while (!(r8a66597_read(r8a66597, ep->fifoctr) & FRDY)) {
+ udelay(1);
+ if (unlikely(i++ >= 10000)) { /* timeout = 10 msec */
+ dev_err(r8a66597_to_dev(r8a66597),
+ "%s: FRDY was not set (%d)\n",
+ __func__, pipenum);
+ return;
+ }
+ }
+
+ r8a66597_bset(r8a66597, BCLR, ep->fifoctr);
+ req = get_request_from_ep(ep);
+
+ /* prepare parameters */
+ len = r8a66597_sudmac_read(r8a66597, CH0CBC);
+ req->req.actual += len;
+
+ /* clear */
+ r8a66597_sudmac_write(r8a66597, CH0STCLR, DSTSCLR);
+
+ /* check transfer finish */
+ if ((!req->req.zero && (req->req.actual = req->req.length))
+ || (len % ep->ep.maxpacket)) {
+ if (ep->dma->dir) {
+ disable_irq_ready(r8a66597, pipenum);
+ enable_irq_empty(r8a66597, pipenum);
+ } else {
+ /* Clear the interrupt flag for next transfer */
+ r8a66597_write(r8a66597, ~(1 << pipenum), BRDYSTS);
+ transfer_complete(ep, req, 0);
+ }
+ }
+}
+
+static void r8a66597_sudmac_irq(struct r8a66597 *r8a66597)
+{
+ u32 irqsts;
+ struct r8a66597_ep *ep;
+ u16 pipenum;
+
+ irqsts = r8a66597_sudmac_read(r8a66597, DINTSTS);
+ if (irqsts & CH0ENDS) {
+ r8a66597_sudmac_write(r8a66597, CH0ENDC, DINTSTSCLR);
+ pipenum = (r8a66597_read(r8a66597, D0FIFOSEL) & CURPIPE);
+ ep = r8a66597->pipenum2ep[pipenum];
+ sudmac_finish(r8a66597, ep);
+ }
+}
+
static irqreturn_t r8a66597_irq(int irq, void *_r8a66597)
{
struct r8a66597 *r8a66597 = _r8a66597;
@@ -1190,6 +1485,9 @@ static irqreturn_t r8a66597_irq(int irq, void *_r8a66597)
u16 savepipe;
u16 mask0;
+ if (r8a66597_is_sudmac(r8a66597))
+ r8a66597_sudmac_irq(r8a66597);
+
spin_lock(&r8a66597->lock);
intsts0 = r8a66597_read(r8a66597, INTSTS0);
@@ -1566,6 +1864,8 @@ static int __exit r8a66597_remove(struct platform_device *pdev)
usb_del_gadget_udc(&r8a66597->gadget);
del_timer_sync(&r8a66597->timer);
iounmap(r8a66597->reg);
+ if (r8a66597->pdata->sudmac)
+ iounmap(r8a66597->sudmac_reg);
free_irq(platform_get_irq(pdev, 0), r8a66597);
r8a66597_free_request(&r8a66597->ep[0].ep, r8a66597->ep0_req);
#ifdef CONFIG_HAVE_CLK
@@ -1582,6 +1882,26 @@ static void nop_completion(struct usb_ep *ep, struct usb_request *r)
{
}
+static int __init r8a66597_sudmac_ioremap(struct r8a66597 *r8a66597,
+ struct platform_device *pdev)
+{
+ struct resource *res;
+
+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "sudmac");
+ if (!res) {
+ dev_err(&pdev->dev, "platform_get_resource error(sudmac).\n");
+ return -ENODEV;
+ }
+
+ r8a66597->sudmac_reg = ioremap(res->start, resource_size(res));
+ if (r8a66597->sudmac_reg = NULL) {
+ dev_err(&pdev->dev, "ioremap error(sudmac).\n");
+ return -ENOMEM;
+ }
+
+ return 0;
+}
+
static int __init r8a66597_probe(struct platform_device *pdev)
{
#ifdef CONFIG_HAVE_CLK
@@ -1659,6 +1979,11 @@ static int __init r8a66597_probe(struct platform_device *pdev)
clk_enable(r8a66597->clk);
}
#endif
+ if (r8a66597->pdata->sudmac) {
+ ret = r8a66597_sudmac_ioremap(r8a66597, pdev);
+ if (ret < 0)
+ goto clean_up2;
+ }
disable_controller(r8a66597); /* make sure controller is disabled */
@@ -1691,7 +2016,6 @@ static int __init r8a66597_probe(struct platform_device *pdev)
r8a66597->ep[0].fifoaddr = CFIFO;
r8a66597->ep[0].fifosel = CFIFOSEL;
r8a66597->ep[0].fifoctr = CFIFOCTR;
- r8a66597->ep[0].fifotrn = 0;
r8a66597->ep[0].pipectr = get_pipectr_addr(0);
r8a66597->pipenum2ep[0] = &r8a66597->ep[0];
r8a66597->epaddr2ep[0] = &r8a66597->ep[0];
@@ -1724,6 +2048,8 @@ clean_up2:
#endif
clean_up:
if (r8a66597) {
+ if (r8a66597->sudmac_reg)
+ iounmap(r8a66597->sudmac_reg);
if (r8a66597->ep0_req)
r8a66597_free_request(&r8a66597->ep[0].ep,
r8a66597->ep0_req);
diff --git a/drivers/usb/gadget/r8a66597-udc.h b/drivers/usb/gadget/r8a66597-udc.h
index 99681c7..4946b4e 100644
--- a/drivers/usb/gadget/r8a66597-udc.h
+++ b/drivers/usb/gadget/r8a66597-udc.h
@@ -53,6 +53,7 @@
((pipenum >= R8A66597_BASE_PIPENUM_ISOC) && \
(pipenum < (R8A66597_BASE_PIPENUM_ISOC + R8A66597_MAX_NUM_ISOC)))
+#define r8a66597_is_sudmac(r8a66597) (r8a66597->pdata->sudmac)
struct r8a66597_pipe_info {
u16 pipe;
u16 epnum;
@@ -70,6 +71,7 @@ struct r8a66597_request {
struct r8a66597_ep {
struct usb_ep ep;
struct r8a66597 *r8a66597;
+ struct r8a66597_dma *dma;
struct list_head queue;
unsigned busy:1;
@@ -85,13 +87,20 @@ struct r8a66597_ep {
unsigned char fifoaddr;
unsigned char fifosel;
unsigned char fifoctr;
- unsigned char fifotrn;
unsigned char pipectr;
+ unsigned char pipetre;
+ unsigned char pipetrn;
+};
+
+struct r8a66597_dma {
+ unsigned used:1;
+ unsigned dir:1; /* 1 = IN(write), 0 = OUT(read) */
};
struct r8a66597 {
spinlock_t lock;
void __iomem *reg;
+ void __iomem *sudmac_reg;
#ifdef CONFIG_HAVE_CLK
struct clk *clk;
@@ -104,6 +113,7 @@ struct r8a66597 {
struct r8a66597_ep ep[R8A66597_MAX_NUM_PIPE];
struct r8a66597_ep *pipenum2ep[R8A66597_MAX_NUM_PIPE];
struct r8a66597_ep *epaddr2ep[16];
+ struct r8a66597_dma dma;
struct timer_list timer;
struct usb_request *ep0_req; /* for internal request */
@@ -261,7 +271,21 @@ static inline u16 get_xtal_from_pdata(struct r8a66597_platdata *pdata)
return clock;
}
+static inline u32 r8a66597_sudmac_read(struct r8a66597 *r8a66597,
+ unsigned long offset)
+{
+ return ioread32(r8a66597->sudmac_reg + offset);
+}
+
+static inline void r8a66597_sudmac_write(struct r8a66597 *r8a66597, u32 val,
+ unsigned long offset)
+{
+ iowrite32(val, r8a66597->sudmac_reg + offset);
+}
+
#define get_pipectr_addr(pipenum) (PIPE1CTR + (pipenum - 1) * 2)
+#define get_pipetre_addr(pipenum) (PIPE1TRE + (pipenum - 1) * 4)
+#define get_pipetrn_addr(pipenum) (PIPE1TRN + (pipenum - 1) * 4)
#define enable_irq_ready(r8a66597, pipenum) \
enable_pipe_irq(r8a66597, pipenum, BRDYENB)
diff --git a/include/linux/usb/r8a66597.h b/include/linux/usb/r8a66597.h
index b6b8660..55805f9 100644
--- a/include/linux/usb/r8a66597.h
+++ b/include/linux/usb/r8a66597.h
@@ -48,6 +48,9 @@ struct r8a66597_platdata {
/* (external controller only) set one = WR0_N shorted to WR1_N */
unsigned wr0_shorted_to_wr1:1;
+
+ /* set one = using SUDMAC */
+ unsigned sudmac:1;
};
/* Register definitions */
@@ -417,5 +420,62 @@ struct r8a66597_platdata {
#define USBSPD 0x00C0
#define RTPORT 0x0001
+/* SUDMAC registers */
+#define CH0CFG 0x00
+#define CH1CFG 0x04
+#define CH0BA 0x10
+#define CH1BA 0x14
+#define CH0BBC 0x18
+#define CH1BBC 0x1C
+#define CH0CA 0x20
+#define CH1CA 0x24
+#define CH0CBC 0x28
+#define CH1CBC 0x2C
+#define CH0DEN 0x30
+#define CH1DEN 0x34
+#define DSTSCLR 0x38
+#define DBUFCTRL 0x3C
+#define DINTCTRL 0x40
+#define DINTSTS 0x44
+#define DINTSTSCLR 0x48
+#define CH0SHCTRL 0x50
+#define CH1SHCTRL 0x54
+
+/* SUDMAC Configuration Registers */
+#define SENDBUFM 0x1000 /* b12: Transmit Buffer Mode */
+#define RCVENDM 0x0100 /* b8: Receive Data Transfer End Mode */
+#define LBA_WAIT 0x0030 /* b5-4: Local Bus Access Wait */
+
+/* DMA Enable Registers */
+#define DEN 0x0001 /* b1: DMA Transfer Enable */
+
+/* DMA Status Clear Register */
+#define CH1STCLR 0x0002 /* b2: Ch1 DMA Status Clear */
+#define CH0STCLR 0x0001 /* b1: Ch0 DMA Status Clear */
+
+/* DMA Buffer Control Register */
+#define CH1BUFW 0x0200 /* b9: Ch1 DMA Buffer Data Transfer Enable */
+#define CH0BUFW 0x0100 /* b8: Ch0 DMA Buffer Data Transfer Enable */
+#define CH1BUFS 0x0002 /* b2: Ch1 DMA Buffer Data Status */
+#define CH0BUFS 0x0001 /* b1: Ch0 DMA Buffer Data Status */
+
+/* DMA Interrupt Control Register */
+#define CH1ERRE 0x0200 /* b9: Ch1 SHwy Res Err Detect Int Enable */
+#define CH0ERRE 0x0100 /* b8: Ch0 SHwy Res Err Detect Int Enable */
+#define CH1ENDE 0x0002 /* b2: Ch1 DMA Transfer End Int Enable */
+#define CH0ENDE 0x0001 /* b1: Ch0 DMA Transfer End Int Enable */
+
+/* DMA Interrupt Status Register */
+#define CH1ERRS 0x0200 /* b9: Ch1 SHwy Res Err Detect Int Status */
+#define CH0ERRS 0x0100 /* b8: Ch0 SHwy Res Err Detect Int Status */
+#define CH1ENDS 0x0002 /* b2: Ch1 DMA Transfer End Int Status */
+#define CH0ENDS 0x0001 /* b1: Ch0 DMA Transfer End Int Status */
+
+/* DMA Interrupt Status Clear Register */
+#define CH1ERRC 0x0200 /* b9: Ch1 SHwy Res Err Detect Int Stat Clear */
+#define CH0ERRC 0x0100 /* b8: Ch0 SHwy Res Err Detect Int Stat Clear */
+#define CH1ENDC 0x0002 /* b2: Ch1 DMA Transfer End Int Stat Clear */
+#define CH0ENDC 0x0001 /* b1: Ch0 DMA Transfer End Int Stat Clear */
+
#endif /* __LINUX_USB_R8A66597_H */
--
1.7.1
^ permalink raw reply related
* Re: [PATCH 3/3] PM / QoS: Add function dev_pm_qos_read_value() (v2)
From: Rafael J. Wysocki @ 2011-09-30 16:46 UTC (permalink / raw)
To: Jean Pihet
Cc: Linux PM mailing list, LKML, Linux-sh list, Magnus Damm,
Kevin Hilman, Ming Lei
In-Reply-To: <CAORVsuV4ccJvJg-zCrhVXJKmHkEYLLQh032=BMh7qH27bTK5uQ@mail.gmail.com>
On Friday, September 30, 2011, Jean Pihet wrote:
> Hi Rafael,
>
> On Thu, Sep 29, 2011 at 10:33 PM, Rafael J. Wysocki <rjw@sisk.pl> wrote:
> > Hi,
> >
> > On Thursday, September 29, 2011, Jean Pihet wrote:
> >> Hi Rafael,
> >>
> >> I have a few minor remarks, inlined below.
> >
> > In the meantime it turned out that the patch caused a build failure
> > for CONFIG_PM_SLEEP unset (your original patches won't really work
> > in this case too), so I posted a patch to fix it. However, since
> > you had remarks anyway, I've simply folded the fix into the next
> > version of the $subject patch, which is appended.
> OK to me.
>
> I have 2 remarks though:
> - some drivers are using the power_state field in the suspend/resume
> operation, IIUC without conflict. Can you confirm?
Yes, I can. There are no conflicts.
> - the power_state field is scheduled for removal, cf.
> Documentation/feature-removal-schedule.txt. That does not look
> correct.
It still is schediled for removal, but we can't remove it right now
anyway because of the users mentioned above. I'll replace this field
with a one-bit flag when we're ready to drop it (some time in future).
Thanks,
Rafael
^ permalink raw reply
* Re: [PATCH] mailmap: Fix up renesas member's attribution
From: Nobuhiro Iwamatsu @ 2011-09-30 19:22 UTC (permalink / raw)
To: linux-sh
In-Reply-To: <871uv0qg68.wl%kuninori.morimoto.gx@renesas.com>
Sorry, I misread it.
Nobuhiro
2011/9/30 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:
>
> Hi Iwamatsu-san
>
> Thank you for your check
>
>> An e-mail address of Goda is wrong.
>> It is yusuke.goda.sx@renesas.com.
>
> No. it is not wrong.
> This patch solved his "old" email address/name
>
> Best regards
> ---
> Kuninori Morimoto
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sh" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
Nobuhiro Iwamatsu
^ permalink raw reply
* Re: [PATCH 4/5] ARM: mach-shmobile: r8a7740: Add i2c support
From: Nobuhiro Iwamatsu @ 2011-09-30 19:29 UTC (permalink / raw)
To: linux-sh
In-Reply-To: <8762kcqglg.wl%kuninori.morimoto.gx@renesas.com>
2011/9/30 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:
>
> Hi Iwamatsu-san
>
> Thank you for your check
>
>> > +static void r8a7740_i2c_workaround(struct platform_device *pdev)
>> > +{
>> > + struct resource *res;
>> > + void __iomem *reg;
>> > +
>> > + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>> > + if (!res) {
>>
>> if (unlikely(res = NULL)) { ?
>> Please check NULL.
>
> Sorry. what is your opinion ?
>
> if (!res) checks NULL I think.
> or do you mean add "unlikely()" ?
Both.
This function was return pointer or NULL.
Best regards,
Nobuhiro
--
Nobuhiro Iwamatsu
iwamatsu at {nigauri.org / debian.org}
GPG ID: 40AD1FA6
^ permalink raw reply
* Re: [PATCH] net: sh_eth: fix build failure
From: Nobuhiro Iwamatsu @ 2011-09-30 19:36 UTC (permalink / raw)
To: David Miller; +Cc: yoshihiro.shimoda.uh, sfr, netdev, linux-sh
In-Reply-To: <20110930.035449.1012299223616580574.davem@davemloft.net>
I see.
Thanks you.
Nobuhiro
2011/9/30 David Miller <davem@davemloft.net>:
> From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> Date: Fri, 30 Sep 2011 16:51:34 +0900
>
>> 2011/09/30 15:55, Nobuhiro Iwamatsu wrote:
>>> 2011/9/30 Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>:
>> < snip >
>>>> +#include <linux/kernel.h>
>>>> +#include <linux/spinlock.h>
>>> These are not required.
>>
>> The Documentation/SubmitChecklist says the following:
>>
>> ============================
>> 1: If you use a facility then #include the file that defines/declares
>> that facility. Don't depend on other header files pulling in ones
>> that you use.
>> ============================
>>
>> The sh_eth driver uses spinlock functions and some macros of kernel.h.
>> So, I think that I have to write their "#include" in the driver.
>
> Agreed.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sh" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
Nobuhiro Iwamatsu
^ permalink raw reply
* (no subject)
From: Mrs Sabah Halif @ 2011-10-02 7:06 UTC (permalink / raw)
To: linux-sh
--
Good day,my name is Mrs Sabah Halif am in urgent need of your
assistance please contact me via ( sabahhalif@yahoo.com.hk )
^ permalink raw reply
* [PATCH 4/5 v2] ARM: mach-shmobile: r8a7740: Add i2c support
From: Kuninori Morimoto @ 2011-10-03 0:38 UTC (permalink / raw)
To: linux-sh
r8a7740 I2C needs work around
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
v1 -> v2
o i2c_read/write macro doesn't include local variable
o add unlikely()
arch/arm/mach-shmobile/setup-r8a7740.c | 102 ++++++++++++++++++++++++++++++++
1 files changed, 102 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-shmobile/setup-r8a7740.c b/arch/arm/mach-shmobile/setup-r8a7740.c
index b067383..718cb82 100644
--- a/arch/arm/mach-shmobile/setup-r8a7740.c
+++ b/arch/arm/mach-shmobile/setup-r8a7740.c
@@ -17,8 +17,10 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <linux/delay.h>
#include <linux/kernel.h>
#include <linux/init.h>
+#include <linux/io.h>
#include <linux/platform_device.h>
#include <linux/serial_sci.h>
#include <linux/sh_timer.h>
@@ -242,10 +244,110 @@ static struct platform_device *r8a7740_early_devices[] __initdata = {
&cmt10_device,
};
+/* I2C */
+static struct resource i2c0_resources[] = {
+ [0] = {
+ .name = "IIC0",
+ .start = 0xfff20000,
+ .end = 0xfff20425 - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = gic_spi(201),
+ .end = gic_spi(204),
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+static struct resource i2c1_resources[] = {
+ [0] = {
+ .name = "IIC1",
+ .start = 0xe6c20000,
+ .end = 0xe6c20425 - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = gic_spi(70),
+ .end = gic_spi(73),
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+static struct platform_device i2c0_device = {
+ .name = "i2c-sh_mobile",
+ .id = 0,
+ .resource = i2c0_resources,
+ .num_resources = ARRAY_SIZE(i2c0_resources),
+};
+
+static struct platform_device i2c1_device = {
+ .name = "i2c-sh_mobile",
+ .id = 1,
+ .resource = i2c1_resources,
+ .num_resources = ARRAY_SIZE(i2c1_resources),
+};
+
+static struct platform_device *r8a7740_late_devices[] __initdata = {
+ &i2c0_device,
+ &i2c1_device,
+};
+
+#define ICCR 0x0004
+#define ICSTART 0x0070
+
+#define i2c_read(reg, offset) ioread8(reg + offset)
+#define i2c_write(reg, offset, data) iowrite8(data, reg + offset)
+
+static void r8a7740_i2c_workaround(struct platform_device *pdev)
+{
+ struct resource *res;
+ void __iomem *reg;
+
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (unlikely(!res)) {
+ pr_err("r8a7740 i2c workaround fail (cannot find resource)\n");
+ return;
+ }
+
+ reg = ioremap(res->start, resource_size(res));
+ if (unlikely(!reg)) {
+ pr_err("r8a7740 i2c workaround fail (cannot map IO)\n");
+ return;
+ }
+
+ i2c_write(reg, ICCR, i2c_read(reg, ICCR) | 0x80);
+ i2c_read(reg, ICCR); /* dummy read */
+
+ i2c_write(reg, ICSTART, i2c_read(reg, ICSTART) | 0x10);
+ i2c_read(reg, ICSTART); /* dummy read */
+
+ mdelay(100);
+
+ i2c_write(reg, ICCR, 0x01);
+ i2c_read(reg, ICCR);
+ i2c_write(reg, ICSTART, 0x00);
+ i2c_read(reg, ICSTART);
+
+ i2c_write(reg, ICCR, 0x10);
+ mdelay(100);
+ i2c_write(reg, ICCR, 0x00);
+ mdelay(100);
+ i2c_write(reg, ICCR, 0x10);
+ mdelay(100);
+
+ iounmap(reg);
+}
+
void __init r8a7740_add_standard_devices(void)
{
+ /* I2C work-around */
+ r8a7740_i2c_workaround(&i2c0_device);
+ r8a7740_i2c_workaround(&i2c1_device);
+
platform_add_devices(r8a7740_early_devices,
ARRAY_SIZE(r8a7740_early_devices));
+ platform_add_devices(r8a7740_late_devices,
+ ARRAY_SIZE(r8a7740_late_devices));
}
void __init r8a7740_add_early_devices(void)
--
1.7.4.1
^ permalink raw reply related
* [PATCH v2] sh: Take into account the base of System RAM in virt_to_phys()
From: Simon Horman @ 2011-10-03 1:05 UTC (permalink / raw)
To: linux-sh
Previously virt_to_phys() assumed that physical memory always started
at address 0. This is not always the case.
Tested on an sh7757lcr (32bit system) whose only System RAM region is
40000000-4effffff and an ecovec24 (29bit system).
Signed-off-by: Simon Horman <horms@verge.net.au>
---
kexec/arch/sh/kexec-sh.c | 45 ++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 44 insertions(+), 1 deletions(-)
v2
* Only use the base of System RAM as an offset into physical memory
if 32bit addressing is in use.
diff --git a/kexec/arch/sh/kexec-sh.c b/kexec/arch/sh/kexec-sh.c
index 4b21ee8..94ebbc7 100644
--- a/kexec/arch/sh/kexec-sh.c
+++ b/kexec/arch/sh/kexec-sh.c
@@ -185,13 +185,56 @@ void kexec_sh_setup_zero_page(char *zero_page_buf, size_t zero_page_size,
}
}
+static int is_32bit(void)
+{
+ const char *cpuinfo = "/proc/cpuinfo";
+ char line[MAX_LINE], key[MAX_LINE], value[MAX_LINE];
+ FILE *fp;
+ int count;
+ int status = 0;
+
+ fp = fopen(cpuinfo, "r");
+ if (!fp)
+ die("Cannot open %s\n", cpuinfo);
+
+ while(fgets(line, sizeof(line), fp) != 0) {
+ count = sscanf(line, "%s : %s", key, value);
+ if (count != 2)
+ continue;
+ if (!strcmp(key, "address sizes")) {
+ if (!strcmp(value, "32 bits physical"))
+ status = 1;
+ break;
+ }
+ }
+
+ fclose(fp);
+
+ return status;
+}
+
unsigned long virt_to_phys(unsigned long addr)
{
unsigned long seg = addr & 0xe0000000;
+ unsigned long long start = 0;
+
if (seg != 0x80000000 && seg != 0xc0000000)
die("Virtual address %p is not in P1 or P2\n", (void *)addr);
- return addr - seg;
+ /* If 32bit addressing is used then the base of system RAM
+ * is an offset into physical memory. */
+ if (is_32bit()) {
+ unsigned long long end;
+ int ret;
+
+ /* Assume there is only one "System RAM" region */
+ ret = parse_iomem_single("System RAM\n", &start, &end);
+ if (ret)
+ die("Could not parse System RAM region "
+ "in /proc/iomem\n");
+ }
+
+ return addr - seg + start;
}
/*
--
1.7.5.4
^ permalink raw reply related
* Re: [PATCH 4/5 v2] ARM: mach-shmobile: r8a7740: Add i2c support
From: Magnus Damm @ 2011-10-03 4:21 UTC (permalink / raw)
To: linux-sh
In-Reply-To: <87r52ugasd.wl%kuninori.morimoto.gx@renesas.com>
On Mon, Oct 3, 2011 at 9:38 AM, Kuninori Morimoto
<kuninori.morimoto.gx@renesas.com> wrote:
> r8a7740 I2C needs work around
>
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
> v1 -> v2
>
> o i2c_read/write macro doesn't include local variable
> o add unlikely()
>
> arch/arm/mach-shmobile/setup-r8a7740.c | 102 ++++++++++++++++++++++++++++++++
> 1 files changed, 102 insertions(+), 0 deletions(-)
Hi Morimoto-san,
Thanks for your work on A1 SoC support. In general I think your code
looks good and I'm also happy to see that my i2c-sh_mobile driver can
be used on yet another SoC.
The workaround in this patch, do you know exactly what you are fixing
with this patch? I wonder, is it a hardware errata workaround, or is
it a fix for a potential messy state left by the boot loader?
Perhaps the boot loader makes use of more advanced hardware features
that the linux driver doesn't suppport yet, like DMA or HighSpeed?
Have you tried resetting the I2C channels using the SRCRn registers in
the CPG? If not, please give it a go and see if it helps. If it helps
then perhaps we should work on adding some generic reset support for
the hardware blocks.
Thanks,
/ magnus
^ permalink raw reply
* Re: [PATCH 4/5 v2] ARM: mach-shmobile: r8a7740: Add i2c support
From: Kuninori Morimoto @ 2011-10-03 4:49 UTC (permalink / raw)
To: linux-sh
In-Reply-To: <87r52ugasd.wl%kuninori.morimoto.gx@renesas.com>
Hi Magnus
Thank you for your check
> Thanks for your work on A1 SoC support. In general I think your code
> looks good and I'm also happy to see that my i2c-sh_mobile driver can
> be used on yet another SoC.
>
> The workaround in this patch, do you know exactly what you are fixing
> with this patch? I wonder, is it a hardware errata workaround, or is
> it a fix for a potential messy state left by the boot loader?
>
> Perhaps the boot loader makes use of more advanced hardware features
> that the linux driver doesn't suppport yet, like DMA or HighSpeed?
>
> Have you tried resetting the I2C channels using the SRCRn registers in
> the CPG? If not, please give it a go and see if it helps. If it helps
> then perhaps we should work on adding some generic reset support for
> the hardware blocks.
A1 chip has errata on I2C I/O pad reset, and this work-around is for it.
It is lasting errata.
Shall I add this comment on patch (v3) ?
Best regards
---
Kuninori Morimoto
^ permalink raw reply
* Re: [PATCH 4/5 v2] ARM: mach-shmobile: r8a7740: Add i2c support
From: Magnus Damm @ 2011-10-03 7:18 UTC (permalink / raw)
To: linux-sh
In-Reply-To: <87r52ugasd.wl%kuninori.morimoto.gx@renesas.com>
Hi Moriimoto-san,
On Mon, Oct 3, 2011 at 1:49 PM, Kuninori Morimoto
<kuninori.morimoto.gx@renesas.com> wrote:
>
> Hi Magnus
>
> Thank you for your check
>
>> Thanks for your work on A1 SoC support. In general I think your code
>> looks good and I'm also happy to see that my i2c-sh_mobile driver can
>> be used on yet another SoC.
>>
>> The workaround in this patch, do you know exactly what you are fixing
>> with this patch? I wonder, is it a hardware errata workaround, or is
>> it a fix for a potential messy state left by the boot loader?
>>
>> Perhaps the boot loader makes use of more advanced hardware features
>> that the linux driver doesn't suppport yet, like DMA or HighSpeed?
>>
>> Have you tried resetting the I2C channels using the SRCRn registers in
>> the CPG? If not, please give it a go and see if it helps. If it helps
>> then perhaps we should work on adding some generic reset support for
>> the hardware blocks.
>
> A1 chip has errata on I2C I/O pad reset, and this work-around is for it.
> It is lasting errata.
>
> Shall I add this comment on patch (v3) ?
Nah, no need. It's not such a big deal IMO. I just wanted to check
with you if SRCR solved the issue since that code will most likely
become much cleaner. Also, if/when we add power domain support then
you most likely will have to redo this fix after powering off. That's
however a problem for later.
Thanks,
/ magnus
A
^ permalink raw reply
* Re: [PATCH 4/5 v2] ARM: mach-shmobile: r8a7740: Add i2c support
From: Kuninori Morimoto @ 2011-10-03 7:32 UTC (permalink / raw)
To: linux-sh
In-Reply-To: <87r52ugasd.wl%kuninori.morimoto.gx@renesas.com>
Hi Magnus
Thank you for your check
> > A1 chip has errata on I2C I/O pad reset, and this work-around is for it.
> > It is lasting errata.
> >
> > Shall I add this comment on patch (v3) ?
>
> Nah, no need. It's not such a big deal IMO. I just wanted to check
> with you if SRCR solved the issue since that code will most likely
> become much cleaner. Also, if/when we add power domain support then
> you most likely will have to redo this fix after powering off. That's
> however a problem for later.
OK. I understand.
But it works well for now.
I hope it is good start for A1 chip
Best regards
---
Kuninori Morimoto
^ permalink raw reply
* [PATCH V8 0/4] cpuidle: Global registration of idle states with
From: Deepthi Dharwar @ 2011-10-03 7:54 UTC (permalink / raw)
To: khilman, venki, ak, len.brown, peterz, santosh.shilimkar, arjan,
lenb
Cc: linux-sh, linux-kernel, linux-acpi, linux-pm, linux-omap,
linux-arm-kernel
Version 6 of this patch series dated 22nd Sept 2011 was
Acked-by: Arjan van de Ven <arjan@linux.intel.com>
Acked-by: Kevin Hilman <khilman@ti.com> for OMAP specific parts.
Reviewed-by: Kevin Hilman <khilman@ti.com>
Tested-by: Jean Pihet <j-pihet@ti.com>
Hi Len,
Can you please queue this series for the next mainline merge window by merging
it into your development tree and also linux-next for further testing.
I also tested it by applying these patches on your ACPI tree hosted @github.
Thanks
-Deepthi
--
The following patch series implements global registration of cpuidle
states, and also has the necessary data structure changes to
accommodate the per-cpu writable members of the cpuidle_states
structure.
This patch series had been in discussion earlier and
following are the links to the previous discussions.
v7 --> https://lkml.org/lkml/2011/9/27/74
v6 --> https://lkml.org/lkml/2011/9/22/58
v5 --> https://lkml.org/lkml/2011/6/6/259
v4 --> https://lkml.org/lkml/2011/4/28/312
v3 --> https://lkml.org/lkml/2011/2/8/73
v2 --> https://lkml.org/lkml/2011/1/13/98
v1 --> https://lkml.org/lkml/2011/3/22/161
Changes from previous version (V7):
1. Rebased and tested it on 3.1-rc8
2. As suggested by Kevin in V7, Signature of Jean
was moved from signed-off tag to tested-by.
Tests done:
1. Compile tested for ARM using the following configs: da8xx_omapl_defconfig,
exynos4_defconfig, kirkwood_defconfig, omap2plus_defconfig,
at91rm9200_defconfig
2. Boot tested on x86 nehalem with multiple C-states for both intel_idle
and acpi_idle drivers.
3. Boot tested on T60p thinkpad that has T2600 cpu with multiple C-states.
Also tested the case when there is dynamic changes in C-states
AC <-> Battery Power switch.
Brief description of the patches:
Core change in this series is to split the cpuidle_device structure
into two parts, i.e global and per-cpu basis.
The per-cpu pieces are mostly generic statistics that can be independent
of current running driver. As a result of these changes, there is single
copy of cpuidle_states structure and single registration done by one
cpu. The low level driver is free to set per-cpu driver data on
each cpu if needed using the cpuidle_set_statedata() as the case
today. Only in very rare cases asymmetric C-states exist which can be
handled within the cpuidle driver. Most architectures do not have
asymmetric C-states.
First two patches in the series facilitate splitting of cpuidle_states
and cpuidle_device structure and next two patches do the actual split,
change the API's and make existing code follow the changed API.
[1/4] - Move the idle residency accounting part from cpuidle.c to
the respective low level drivers, so that the accounting can
be accurately maintained if the driver decides to demote the
chosen (suggested) by the governor.
[2/4] - removes the cpuidle_device()->prepare API since is is not
widely used and the only use case was to allow software
demotion using CPUIDLE_FLAG_IGNORE flag. Both these
functions can be absorbed within the cpuidle back-end
driver ad hence deprecating the prepare routine and the
CPUIDLE_FLAG_IGNORE flag.
- Ref: https://lkml.org/lkml/2011/3/25/52
[3/4] - Splits the usage statistics (read/write) part out of
cpuidle_state structure, so that the states can become read
only and hence made global.
[4/4] - Most APIs will now need to pass pointer to both global
cpuidle_driver and per-cpu cpuidle_device structure.
arch/arm/mach-at91/cpuidle.c | 41 +++--
arch/arm/mach-davinci/cpuidle.c | 51 ++++---
arch/arm/mach-exynos4/cpuidle.c | 30 ++--
arch/arm/mach-kirkwood/cpuidle.c | 42 +++---
arch/arm/mach-omap2/cpuidle34xx.c | 133 +++++++++++------
arch/sh/kernel/cpu/shmobile/cpuidle.c | 28 ++--
drivers/acpi/processor_driver.c | 20 ---
drivers/acpi/processor_idle.c | 251 +++++++++++++++++++++++++++------
drivers/cpuidle/cpuidle.c | 86 ++++-------
drivers/cpuidle/driver.c | 25 +++
drivers/cpuidle/governors/ladder.c | 41 ++++-
drivers/cpuidle/governors/menu.c | 29 ++--
drivers/cpuidle/sysfs.c | 22 ++-
drivers/idle/intel_idle.c | 130 +++++++++++++----
include/acpi/processor.h | 1
include/linux/cpuidle.h | 52 ++++---
16 files changed, 650 insertions(+), 332 deletions(-)
--
-Deepthi
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox