* [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
* sh_mipi_dsi:
From: kuninori.morimoto.gx @ 2011-09-30 8:32 UTC (permalink / raw)
To: linux-sh
Dear Paul, Magnus, and SH-ML members
These are sh_mipi_dsi update patches.
Kuninori Morimoto (6):
fbdev: sh_mobile_lcdcfb: add struct sh_mobile_lcdc_clock_source
fbdev: sh_mipi_dsi: Add HSxxCLK support
fbdev: sh_mipi_dsi: sh_mipi has pdata instead of dev
fbdev: sh_mipi_dsi: fixup setup timing of sh_mipi_setup()
fbdev: sh_mipi_dsi: fixup setup timing of SYSCONF
fbdev: sh_mipi_dsi: fixup setup timing DSICTRL
current LCDC driver has LCDC_CLK_xxx flags to select clock source.
But SH-Mobile / R-Mobile LCDC clock source is not same as SH LCDC.
ex) current AP4 board select LCDC_CLK_EXTERNAL to select HDMI clocks
1st patch modify lcdc clock source select method.
But it has compatibility for old LCDC (I hope =).
#2 - #6 patches are update patches for sh mipi driver.
It care HS4divCLK which needs 1920x1080p 60Hz output.
But you can NOT find HS4divCLK explain and calculation method
on AP5R manual.
^ permalink raw reply
* Re: [PATCH 2/2] usb: r8a66597-udc: add support for SUDMAC
From: Felipe Balbi @ 2011-09-30 8:17 UTC (permalink / raw)
To: linux-sh
In-Reply-To: <4E803B16.1090905@renesas.com>
[-- Attachment #1: Type: text/plain, Size: 2032 bytes --]
Hi,
On Mon, Sep 26, 2011 at 05:43:02PM +0900, Yoshihiro Shimoda wrote:
> 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>
> ---
> drivers/usb/gadget/r8a66597-udc.c | 359 +++++++++++++++++++++++++++++++++++--
> drivers/usb/gadget/r8a66597-udc.h | 26 +++-
> include/linux/usb/r8a66597.h | 60 ++++++
> 3 files changed, 425 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/usb/gadget/r8a66597-udc.c b/drivers/usb/gadget/r8a66597-udc.c
> index cd2cd16..4d27cb3 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[] = {
> @@ -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.
--
balbi
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 490 bytes --]
^ permalink raw reply
* Re: [PATCH 3/3] PM / QoS: Add function dev_pm_qos_read_value() (v2)
From: Jean Pihet @ 2011-09-30 8:08 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Linux PM mailing list, LKML, Linux-sh list, Magnus Damm,
Kevin Hilman, Ming Lei
In-Reply-To: <201109292233.52378.rjw@sisk.pl>
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?
- the power_state field is scheduled for removal, cf.
Documentation/feature-removal-schedule.txt. That does not look
correct.
...
>> > +static void __dev_pm_qos_constraints_init(struct device *dev)
>> I would change the name or add a comment stating that this is an
>> internal function which reinits the constraints field under the lock.
>
> This function was used only once, so it wasn't really necessary. I simply
> removed it.
>
> Thanks,
> Rafael
>
> ---
> From: Rafael J. Wysocki <rjw@sisk.pl>
> Subject: PM / QoS: Add function dev_pm_qos_read_value() (v3)
>
> To read the current PM QoS value for a given device we need to
> make sure that the device's power.constraints object won't be
> removed while we're doing that. For this reason, put the
> operation under dev->power.lock and acquire the lock
> around the initialization and removal of power.constraints.
>
> Moreover, since we're using the value of power.constraints to
> determine whether or not the object is present, the
> power.constraints_state field isn't necessary any more and may be
> removed. However, dev_pm_qos_add_request() needs to check if the
> device is being removed from the system before allocating a new
> PM QoS constraints object for it, so make it use the
> power.power_state field of struct device for this purpose.
>
> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Regards,
Jean
^ permalink raw reply
* Re: [PATCH 4/5] ARM: mach-shmobile: r8a7740: Add i2c support
From: Kuninori Morimoto @ 2011-09-30 8:08 UTC (permalink / raw)
To: linux-sh
In-Reply-To: <8762kcqglg.wl%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()" ?
Best regards
---
Kuninori Morimoto
^ permalink raw reply
* Re: R-Mobile A1 support
From: Kuninori Morimoto @ 2011-09-30 7:56 UTC (permalink / raw)
To: linux-sh
In-Reply-To: <87bou4qgof.wl%kuninori.morimoto.gx@renesas.com>
Hi Iwamatsu-san
> Do you forget to send an email of 2/5?
Hmm.. strange..
I sent 2/5 email, but linux-sh ML didn't get it ?
OK. I will re-send it
Best regards
---
Kuninori Morimoto
^ permalink raw reply
* Re: [PATCH] net: sh_eth: fix build failure
From: David Miller @ 2011-09-30 7:54 UTC (permalink / raw)
To: yoshihiro.shimoda.uh; +Cc: nobuhiro.iwamatsu.yj, sfr, netdev, linux-sh
In-Reply-To: <4E857506.5030501@renesas.com>
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.
^ permalink raw reply
* Re: [PATCH] mailmap: Fix up renesas member's attribution
From: Kuninori Morimoto @ 2011-09-30 7:54 UTC (permalink / raw)
To: linux-sh
In-Reply-To: <871uv0qg68.wl%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
^ permalink raw reply
* Re: [PATCH] net: sh_eth: fix build failure
From: Yoshihiro Shimoda @ 2011-09-30 7:51 UTC (permalink / raw)
To: Nobuhiro Iwamatsu; +Cc: David S. Miller, Stephen Rothwell, netdev, SH-Linux
In-Reply-To: <CABMQnVLRO1q=Oi7CWE=CJqYcUBD6s+z1JTWrO8W1wVmFwuA45w@mail.gmail.com>
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.
Best regards,
Yoshihiro Shimoda
>
> Best regards,
> Nobuhiro
> Nobuhiro Iwamatsu
>
^ permalink raw reply
* Re: [PATCH] net: sh_eth: fix build failure
From: Nobuhiro Iwamatsu @ 2011-09-30 6:55 UTC (permalink / raw)
To: Yoshihiro Shimoda; +Cc: David S. Miller, Stephen Rothwell, netdev, SH-Linux
In-Reply-To: <4E8534A9.3050002@renesas.com>
2011/9/30 Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>:
> The following commit removed some including headers:
> "net: sh_eth: move the asm/sh_eth.h to include/linux/"
> (commit id: d4fa0e35fdbd54acf791fa3793d6d17f7795f7ae)
>
> Then, the build failure happened on the linux-next:
>
> drivers/net/ethernet/renesas/sh_eth.c:601: error: 'THIS_MODULE' undeclared here (not in a function)
> drivers/net/ethernet/renesas/sh_eth.c:1970: error: expected declaration specifiers or '...' before string constant
> drivers/net/ethernet/renesas/sh_eth.c:1970: warning: data definition has no type or storage class
> drivers/net/ethernet/renesas/sh_eth.c:1970: warning: type defaults to 'int' in declaration of 'MODULE_AUTHOR'
> drivers/net/ethernet/renesas/sh_eth.c:1970: warning: function declaration isn't a prototype
> drivers/net/ethernet/renesas/sh_eth.c:1971: error: expected declaration specifiers or '...' before string constant
> drivers/net/ethernet/renesas/sh_eth.c:1971: warning: data definition has no type or storage class
> drivers/net/ethernet/renesas/sh_eth.c:1971: warning: type defaults to 'int' in declaration of 'MODULE_DESCRIPTION'
> drivers/net/ethernet/renesas/sh_eth.c:1971: warning: function declaration isn't a prototype
> drivers/net/ethernet/renesas/sh_eth.c:1972: error: expected declaration specifiers or '...' before string constant
> drivers/net/ethernet/renesas/sh_eth.c:1972: warning: data definition has no type or storage class
> drivers/net/ethernet/renesas/sh_eth.c:1972: warning: type defaults to 'int' in declaration of 'MODULE_LICENSE'
> drivers/net/ethernet/renesas/sh_eth.c:1972: warning: function declaration isn't a prototype
>
> This patch fixes the issue. This patch also get back include/kernel.h
> and linux/spinlock.h.
>
> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> ---
> drivers/net/ethernet/renesas/sh_eth.c | 3 +++
> 1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
> index 6aa0704..9b23074 100644
> --- a/drivers/net/ethernet/renesas/sh_eth.c
> +++ b/drivers/net/ethernet/renesas/sh_eth.c
> @@ -21,6 +21,9 @@
> */
>
> #include <linux/init.h>
> +#include <linux/module.h>
This is required.
> +#include <linux/kernel.h>
> +#include <linux/spinlock.h>
These are not required.
> #include <linux/interrupt.h>
> #include <linux/dma-mapping.h>
> #include <linux/etherdevice.h>
Best regards,
Nobuhiro
Nobuhiro Iwamatsu
^ permalink raw reply
* Re: [PATCH 4/5] ARM: mach-shmobile: r8a7740: Add i2c support
From: Nobuhiro Iwamatsu @ 2011-09-30 6:35 UTC (permalink / raw)
To: linux-sh
In-Reply-To: <8762kcqglg.wl%kuninori.morimoto.gx@renesas.com>
Hi,
2011/9/29 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:
> r8a7740 I2C needs work around
>
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
> 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..ab43651 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(offset) ioread8(reg + offset)
> +#define i2c_write(offset, data) iowrite8(data, reg + offset)
The macro must not depend on the specific local variable.
> +
> +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.
> + pr_err("r8a7740 i2c workaround fail (cannot find resource)\n");
> + return;
> + }
> +
> + reg = ioremap(res->start, resource_size(res));
> + if (!reg) {
And this.
Best regards,
Nobuhiro
--
Nobuhiro Iwamatsu
iwamatsu at {nigauri.org / debian.org}
GPG ID: 40AD1FA6
^ permalink raw reply
* Re: [PATCH] sh: modify the asm/sh_eth.h to linux/sh_eth.h in some boards
From: Nobuhiro Iwamatsu @ 2011-09-30 6:18 UTC (permalink / raw)
To: linux-sh
In-Reply-To: <4E82D17A.7050108@renesas.com>
Tested-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
2011/9/28 Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>:
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> ---
> - This patch depends on the following patch:
> - net: sh_eth: move the asm/sh_eth.h to include/linux/
> - This patch doesn't contain board-sh7757lcr.c, because
> it needs more modification.
>
> arch/sh/boards/board-espt.c | 2 +-
> arch/sh/boards/mach-ecovec24/setup.c | 2 +-
> arch/sh/boards/mach-se/7724/setup.c | 2 +-
> arch/sh/boards/mach-sh7763rdp/setup.c | 2 +-
> 4 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/arch/sh/boards/board-espt.c b/arch/sh/boards/board-espt.c
> index 9da92ac..b3ae9d3 100644
> --- a/arch/sh/boards/board-espt.c
> +++ b/arch/sh/boards/board-espt.c
> @@ -13,9 +13,9 @@
> #include <linux/interrupt.h>
> #include <linux/mtd/physmap.h>
> #include <linux/io.h>
> +#include <linux/sh_eth.h>
> #include <asm/machvec.h>
> #include <asm/sizes.h>
> -#include <asm/sh_eth.h>
>
> /* NOR Flash */
> static struct mtd_partition espt_nor_flash_partitions[] = {
> diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c
> index b24d69d..7f74985 100644
> --- a/arch/sh/boards/mach-ecovec24/setup.c
> +++ b/arch/sh/boards/mach-ecovec24/setup.c
> @@ -28,13 +28,13 @@
> #include <linux/spi/mmc_spi.h>
> #include <linux/input.h>
> #include <linux/input/sh_keysc.h>
> +#include <linux/sh_eth.h>
> #include <video/sh_mobile_lcdc.h>
> #include <sound/sh_fsi.h>
> #include <media/sh_mobile_ceu.h>
> #include <media/tw9910.h>
> #include <media/mt9t112.h>
> #include <asm/heartbeat.h>
> -#include <asm/sh_eth.h>
> #include <asm/clock.h>
> #include <asm/suspend.h>
> #include <cpu/sh7724.h>
> diff --git a/arch/sh/boards/mach-se/7724/setup.c b/arch/sh/boards/mach-se/7724/setup.c
> index d007567..b747c0a 100644
> --- a/arch/sh/boards/mach-se/7724/setup.c
> +++ b/arch/sh/boards/mach-se/7724/setup.c
> @@ -23,12 +23,12 @@
> #include <linux/input.h>
> #include <linux/input/sh_keysc.h>
> #include <linux/usb/r8a66597.h>
> +#include <linux/sh_eth.h>
> #include <video/sh_mobile_lcdc.h>
> #include <media/sh_mobile_ceu.h>
> #include <sound/sh_fsi.h>
> #include <asm/io.h>
> #include <asm/heartbeat.h>
> -#include <asm/sh_eth.h>
> #include <asm/clock.h>
> #include <asm/suspend.h>
> #include <cpu/sh7724.h>
> diff --git a/arch/sh/boards/mach-sh7763rdp/setup.c b/arch/sh/boards/mach-sh7763rdp/setup.c
> index f3d828f..dd036f1 100644
> --- a/arch/sh/boards/mach-sh7763rdp/setup.c
> +++ b/arch/sh/boards/mach-sh7763rdp/setup.c
> @@ -17,8 +17,8 @@
> #include <linux/mtd/physmap.h>
> #include <linux/fb.h>
> #include <linux/io.h>
> +#include <linux/sh_eth.h>
> #include <mach/sh7763rdp.h>
> -#include <asm/sh_eth.h>
> #include <asm/sh7760fb.h>
>
> /* NOR Flash */
> --
> 1.7.1
> --
> 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: R-Mobile A1 support
From: Nobuhiro Iwamatsu @ 2011-09-30 6:14 UTC (permalink / raw)
To: linux-sh
In-Reply-To: <87bou4qgof.wl%kuninori.morimoto.gx@renesas.com>
Hi,
Do you forget to send an email of 2/5?
Best regards,
Nobuhiro
2011/9/29 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:
>
> Dear Paul, Magnus
>
> These are basic R-Mobile A1 chip and bonito board support patches
>
> Kuninori Morimoto (5):
> serial: sh-sci: clean up white space
> ARM: mach-shmobile: R-Mobile A1 support.
> ARM: mach-shmobile: bonito: Add dip-switch selector
> ARM: mach-shmobile: r8a7740: Add i2c support
> ARM: mach-shmobile: bonito: add PMIC settings
>
> This patch used xxx-r8a7740.c as file name.
> This A1 chip support is based on v0.1 manual for now.
> It will be fixed in the future
>
> 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] mailmap: Fix up renesas member's attribution
From: Nobuhiro Iwamatsu @ 2011-09-30 6:07 UTC (permalink / raw)
To: linux-sh
In-Reply-To: <871uv0qg68.wl%kuninori.morimoto.gx@renesas.com>
Hi,
An e-mail address of Goda is wrong.
It is yusuke.goda.sx@renesas.com.
Best regards,
Nobuhiro
2011年9月29日10:40 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:
> Some renesas member had used multi name on same email address.
> This patch will cleanup git shortlog for renesas member.
>
> Cc: Yusuke Goda <yusuke.goda.sx@renesas.com>
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
> .mailmap | 2 ++
> 1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/.mailmap b/.mailmap
> index a4806f0..9b0d026 100644
> --- a/.mailmap
> +++ b/.mailmap
> @@ -68,6 +68,7 @@ Juha Yrjola <juha.yrjola@solidboot.com>
> Kay Sievers <kay.sievers@vrfy.org>
> Kenneth W Chen <kenneth.w.chen@intel.com>
> Koushik <raghavendra.koushik@neterion.com>
> +Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> Leonid I Ananiev <leonid.i.ananiev@intel.com>
> Linas Vepstas <linas@austin.ibm.com>
> Mark Brown <broonie@sirena.org.uk>
> @@ -111,3 +112,4 @@ Uwe Kleine-K�+Snig <ukl@pengutronix.de>
> Uwe Kleine-K�+Snig <Uwe.Kleine-Koenig@digi.com>
> Valdis Kletnieks <Valdis.Kletnieks@vt.edu>
> Takashi YOSHII <takashi.yoshii.zj@renesas.com>
> +Yusuke Goda <goda.yusuke@renesas.com>
> --
> 1.7.4.1
>
> --
> 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
* [PATCH] net: sh_eth: fix build failure
From: Yoshihiro Shimoda @ 2011-09-30 3:16 UTC (permalink / raw)
To: David S. Miller; +Cc: Stephen Rothwell, netdev, SH-Linux
The following commit removed some including headers:
"net: sh_eth: move the asm/sh_eth.h to include/linux/"
(commit id: d4fa0e35fdbd54acf791fa3793d6d17f7795f7ae)
Then, the build failure happened on the linux-next:
drivers/net/ethernet/renesas/sh_eth.c:601: error: 'THIS_MODULE' undeclared here (not in a function)
drivers/net/ethernet/renesas/sh_eth.c:1970: error: expected declaration specifiers or '...' before string constant
drivers/net/ethernet/renesas/sh_eth.c:1970: warning: data definition has no type or storage class
drivers/net/ethernet/renesas/sh_eth.c:1970: warning: type defaults to 'int' in declaration of 'MODULE_AUTHOR'
drivers/net/ethernet/renesas/sh_eth.c:1970: warning: function declaration isn't a prototype
drivers/net/ethernet/renesas/sh_eth.c:1971: error: expected declaration specifiers or '...' before string constant
drivers/net/ethernet/renesas/sh_eth.c:1971: warning: data definition has no type or storage class
drivers/net/ethernet/renesas/sh_eth.c:1971: warning: type defaults to 'int' in declaration of 'MODULE_DESCRIPTION'
drivers/net/ethernet/renesas/sh_eth.c:1971: warning: function declaration isn't a prototype
drivers/net/ethernet/renesas/sh_eth.c:1972: error: expected declaration specifiers or '...' before string constant
drivers/net/ethernet/renesas/sh_eth.c:1972: warning: data definition has no type or storage class
drivers/net/ethernet/renesas/sh_eth.c:1972: warning: type defaults to 'int' in declaration of 'MODULE_LICENSE'
drivers/net/ethernet/renesas/sh_eth.c:1972: warning: function declaration isn't a prototype
This patch fixes the issue. This patch also get back include/kernel.h
and linux/spinlock.h.
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
drivers/net/ethernet/renesas/sh_eth.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 6aa0704..9b23074 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -21,6 +21,9 @@
*/
#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/spinlock.h>
#include <linux/interrupt.h>
#include <linux/dma-mapping.h>
#include <linux/etherdevice.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-29 20:33 UTC (permalink / raw)
To: Jean Pihet
Cc: Linux PM mailing list, LKML, Linux-sh list, Magnus Damm,
Kevin Hilman, Ming Lei
In-Reply-To: <CAORVsuUopAWQuFkn1cURiv+YhEUT6=SQV5NRL5N1Y1oYn9d2NQ@mail.gmail.com>
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.
> On Sat, Sep 24, 2011 at 11:26 PM, Rafael J. Wysocki <rjw@sisk.pl> wrote:
> > From: Rafael J. Wysocki <rjw@sisk.pl>
> >
> > To read the current PM QoS value for a given device we need to
> > make sure that the device's power.constraints object won't be
> > removed while we're doing that. For this reason, put the
> > operation under dev->power.lock and acquire the lock
> > around the initialization and removal of power.constraints.
> >
> > Moreover, since we're using the value of power.constraints to
> > determine whether or not the object is present, the
> > power.constraints_state field isn't necessary any more and may be
> > removed. However, dev_pm_qos_add_request() needs to check if the
> > device is being removed from the system before allocating a new
> > PM QoS constraints object for it, so it has to use device_pm_lock()
> > and the device PM QoS initialization and destruction should be done
> > under device_pm_lock() as well.
> It might be good to mention dev_pm_qos_mtx which is used internally by
> the per-device PM QoS code.
>
> >
> > Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
> Other then the minor remarks:
> Acked-by: Jean Pihet <j-pihet@ti.com>
>
> > ---
> > drivers/base/power/main.c | 4 -
> > drivers/base/power/qos.c | 168 ++++++++++++++++++++++++++--------------------
> > include/linux/pm.h | 8 --
> > include/linux/pm_qos.h | 3
> > 4 files changed, 103 insertions(+), 80 deletions(-)
> >
> > Index: linux/drivers/base/power/qos.c
> > =================================> > --- linux.orig/drivers/base/power/qos.c
> > +++ linux/drivers/base/power/qos.c
> ...
>
> >
> > +static void __dev_pm_qos_constraints_init(struct device *dev)
> I would change the name or add a comment stating that this is an
> internal function which reinits the constraints field under the lock.
This function was used only once, so it wasn't really necessary. I simply
removed it.
Thanks,
Rafael
---
From: Rafael J. Wysocki <rjw@sisk.pl>
Subject: PM / QoS: Add function dev_pm_qos_read_value() (v3)
To read the current PM QoS value for a given device we need to
make sure that the device's power.constraints object won't be
removed while we're doing that. For this reason, put the
operation under dev->power.lock and acquire the lock
around the initialization and removal of power.constraints.
Moreover, since we're using the value of power.constraints to
determine whether or not the object is present, the
power.constraints_state field isn't necessary any more and may be
removed. However, dev_pm_qos_add_request() needs to check if the
device is being removed from the system before allocating a new
PM QoS constraints object for it, so make it use the
power.power_state field of struct device for this purpose.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
drivers/base/power/main.c | 6 -
drivers/base/power/power.h | 10 ++
drivers/base/power/qos.c | 160 +++++++++++++++++++++++++--------------------
include/linux/pm.h | 10 --
include/linux/pm_qos.h | 12 ++-
5 files changed, 114 insertions(+), 84 deletions(-)
Index: linux/drivers/base/power/qos.c
=================================--- linux.orig/drivers/base/power/qos.c
+++ linux/drivers/base/power/qos.c
@@ -30,15 +30,6 @@
* . To minimize the data usage by the per-device constraints, the data struct
* is only allocated at the first call to dev_pm_qos_add_request.
* . The data is later free'd when the device is removed from the system.
- * . The constraints_state variable from dev_pm_info tracks the data struct
- * allocation state:
- * DEV_PM_QOS_NO_DEVICE: No device present or device removed, no data
- * allocated,
- * DEV_PM_QOS_DEVICE_PRESENT: Device present, data not allocated and will be
- * allocated at the first call to dev_pm_qos_add_request,
- * DEV_PM_QOS_ALLOCATED: Device present, data allocated. The per-device
- * PM QoS constraints framework is operational and constraints can be
- * added, updated or removed using the dev_pm_qos_* API.
* . A global mutex protects the constraints users from the data being
* allocated and free'd.
*/
@@ -51,8 +42,30 @@
static DEFINE_MUTEX(dev_pm_qos_mtx);
+
static BLOCKING_NOTIFIER_HEAD(dev_pm_notifiers);
+/**
+ * dev_pm_qos_read_value - Get PM QoS constraint for a given device.
+ * @dev: Device to get the PM QoS constraint value for.
+ */
+s32 dev_pm_qos_read_value(struct device *dev)
+{
+ struct pm_qos_constraints *c;
+ unsigned long flags;
+ s32 ret = 0;
+
+ spin_lock_irqsave(&dev->power.lock, flags);
+
+ c = dev->power.constraints;
+ if (c)
+ ret = pm_qos_read_value(c);
+
+ spin_unlock_irqrestore(&dev->power.lock, flags);
+
+ return ret;
+}
+
/*
* apply_constraint
* @req: constraint request to apply
@@ -105,27 +118,31 @@ static int dev_pm_qos_constraints_alloca
}
BLOCKING_INIT_NOTIFIER_HEAD(n);
+ plist_head_init(&c->list);
+ c->target_value = PM_QOS_DEV_LAT_DEFAULT_VALUE;
+ c->default_value = PM_QOS_DEV_LAT_DEFAULT_VALUE;
+ c->type = PM_QOS_MIN;
+ c->notifiers = n;
+
+ spin_lock_irq(&dev->power.lock);
dev->power.constraints = c;
- plist_head_init(&dev->power.constraints->list);
- dev->power.constraints->target_value = PM_QOS_DEV_LAT_DEFAULT_VALUE;
- dev->power.constraints->default_value = PM_QOS_DEV_LAT_DEFAULT_VALUE;
- dev->power.constraints->type = PM_QOS_MIN;
- dev->power.constraints->notifiers = n;
- dev->power.constraints_state = DEV_PM_QOS_ALLOCATED;
+ spin_unlock_irq(&dev->power.lock);
return 0;
}
/**
- * dev_pm_qos_constraints_init
+ * dev_pm_qos_constraints_init - Initalize device's PM QoS constraints pointer.
* @dev: target device
*
- * Called from the device PM subsystem at device insertion
+ * Called from the device PM subsystem during device insertion under
+ * device_pm_lock().
*/
void dev_pm_qos_constraints_init(struct device *dev)
{
mutex_lock(&dev_pm_qos_mtx);
- dev->power.constraints_state = DEV_PM_QOS_DEVICE_PRESENT;
+ dev->power.constraints = NULL;
+ dev->power.power_state = PMSG_ON;
mutex_unlock(&dev_pm_qos_mtx);
}
@@ -133,34 +150,38 @@ void dev_pm_qos_constraints_init(struct
* dev_pm_qos_constraints_destroy
* @dev: target device
*
- * Called from the device PM subsystem at device removal
+ * Called from the device PM subsystem on device removal under device_pm_lock().
*/
void dev_pm_qos_constraints_destroy(struct device *dev)
{
struct dev_pm_qos_request *req, *tmp;
+ struct pm_qos_constraints *c;
mutex_lock(&dev_pm_qos_mtx);
- if (dev->power.constraints_state = DEV_PM_QOS_ALLOCATED) {
- /* Flush the constraints list for the device */
- plist_for_each_entry_safe(req, tmp,
- &dev->power.constraints->list,
- node) {
- /*
- * Update constraints list and call the notification
- * callbacks if needed
- */
- apply_constraint(req, PM_QOS_REMOVE_REQ,
- PM_QOS_DEFAULT_VALUE);
- memset(req, 0, sizeof(*req));
- }
+ dev->power.power_state = PMSG_INVALID;
+ c = dev->power.constraints;
+ if (!c)
+ goto out;
- kfree(dev->power.constraints->notifiers);
- kfree(dev->power.constraints);
- dev->power.constraints = NULL;
+ /* Flush the constraints list for the device */
+ plist_for_each_entry_safe(req, tmp, &c->list, node) {
+ /*
+ * Update constraints list and call the notification
+ * callbacks if needed
+ */
+ apply_constraint(req, PM_QOS_REMOVE_REQ, PM_QOS_DEFAULT_VALUE);
+ memset(req, 0, sizeof(*req));
}
- dev->power.constraints_state = DEV_PM_QOS_NO_DEVICE;
+ spin_lock_irq(&dev->power.lock);
+ dev->power.constraints = NULL;
+ spin_unlock_irq(&dev->power.lock);
+
+ kfree(c->notifiers);
+ kfree(c);
+
+ out:
mutex_unlock(&dev_pm_qos_mtx);
}
@@ -178,8 +199,9 @@ void dev_pm_qos_constraints_destroy(stru
*
* Returns 1 if the aggregated constraint value has changed,
* 0 if the aggregated constraint value has not changed,
- * -EINVAL in case of wrong parameters, -ENODEV if the device has been
- * removed from the system
+ * -EINVAL in case of wrong parameters, -ENOMEM if there's not enough memory
+ * to allocate for data structures, -ENODEV if the device has just been removed
+ * from the system.
*/
int dev_pm_qos_add_request(struct device *dev, struct dev_pm_qos_request *req,
s32 value)
@@ -195,28 +217,32 @@ int dev_pm_qos_add_request(struct device
return -EINVAL;
}
- mutex_lock(&dev_pm_qos_mtx);
req->dev = dev;
- /* Return if the device has been removed */
- if (req->dev->power.constraints_state = DEV_PM_QOS_NO_DEVICE) {
- ret = -ENODEV;
- goto out;
- }
+ mutex_lock(&dev_pm_qos_mtx);
- /*
- * Allocate the constraints data on the first call to add_request,
- * i.e. only if the data is not already allocated and if the device has
- * not been removed
- */
- if (dev->power.constraints_state = DEV_PM_QOS_DEVICE_PRESENT)
- ret = dev_pm_qos_constraints_allocate(dev);
+ if (!dev->power.constraints) {
+ if (dev->power.power_state.event = PM_EVENT_INVALID) {
+ /* The device has been removed from the system. */
+ req->dev = NULL;
+ ret = -ENODEV;
+ goto out;
+ } else {
+ /*
+ * Allocate the constraints data on the first call to
+ * add_request, i.e. only if the data is not already
+ * allocated and if the device has not been removed.
+ */
+ ret = dev_pm_qos_constraints_allocate(dev);
+ }
+ }
if (!ret)
ret = apply_constraint(req, PM_QOS_ADD_REQ, value);
-out:
+ out:
mutex_unlock(&dev_pm_qos_mtx);
+
return ret;
}
EXPORT_SYMBOL_GPL(dev_pm_qos_add_request);
@@ -252,7 +278,7 @@ int dev_pm_qos_update_request(struct dev
mutex_lock(&dev_pm_qos_mtx);
- if (req->dev->power.constraints_state = DEV_PM_QOS_ALLOCATED) {
+ if (req->dev->power.constraints) {
if (new_value != req->node.prio)
ret = apply_constraint(req, PM_QOS_UPDATE_REQ,
new_value);
@@ -293,7 +319,7 @@ int dev_pm_qos_remove_request(struct dev
mutex_lock(&dev_pm_qos_mtx);
- if (req->dev->power.constraints_state = DEV_PM_QOS_ALLOCATED) {
+ if (req->dev->power.constraints) {
ret = apply_constraint(req, PM_QOS_REMOVE_REQ,
PM_QOS_DEFAULT_VALUE);
memset(req, 0, sizeof(*req));
@@ -323,15 +349,12 @@ int dev_pm_qos_add_notifier(struct devic
mutex_lock(&dev_pm_qos_mtx);
- /* Silently return if the device has been removed */
- if (dev->power.constraints_state != DEV_PM_QOS_ALLOCATED)
- goto out;
-
- retval = blocking_notifier_chain_register(
- dev->power.constraints->notifiers,
- notifier);
+ /* Silently return if the constraints object is not present. */
+ if (dev->power.constraints)
+ retval = blocking_notifier_chain_register(
+ dev->power.constraints->notifiers,
+ notifier);
-out:
mutex_unlock(&dev_pm_qos_mtx);
return retval;
}
@@ -354,15 +377,12 @@ int dev_pm_qos_remove_notifier(struct de
mutex_lock(&dev_pm_qos_mtx);
- /* Silently return if the device has been removed */
- if (dev->power.constraints_state != DEV_PM_QOS_ALLOCATED)
- goto out;
-
- retval = blocking_notifier_chain_unregister(
- dev->power.constraints->notifiers,
- notifier);
+ /* Silently return if the constraints object is not present. */
+ if (dev->power.constraints)
+ retval = blocking_notifier_chain_unregister(
+ dev->power.constraints->notifiers,
+ notifier);
-out:
mutex_unlock(&dev_pm_qos_mtx);
return retval;
}
Index: linux/include/linux/pm_qos.h
=================================--- linux.orig/include/linux/pm_qos.h
+++ linux/include/linux/pm_qos.h
@@ -7,6 +7,7 @@
#include <linux/plist.h>
#include <linux/notifier.h>
#include <linux/miscdevice.h>
+#include <linux/device.h>
#define PM_QOS_RESERVED 0
#define PM_QOS_CPU_DMA_LATENCY 1
@@ -77,6 +78,7 @@ int pm_qos_remove_notifier(int pm_qos_cl
int pm_qos_request_active(struct pm_qos_request *req);
s32 pm_qos_read_value(struct pm_qos_constraints *c);
+s32 dev_pm_qos_read_value(struct device *dev);
int dev_pm_qos_add_request(struct device *dev, struct dev_pm_qos_request *req,
s32 value);
int dev_pm_qos_update_request(struct dev_pm_qos_request *req, s32 new_value);
@@ -117,6 +119,8 @@ static inline int pm_qos_request_active(
static inline s32 pm_qos_read_value(struct pm_qos_constraints *c)
{ return 0; }
+static inline s32 dev_pm_qos_read_value(struct device *dev)
+ { return 0; }
static inline int dev_pm_qos_add_request(struct device *dev,
struct dev_pm_qos_request *req,
s32 value)
@@ -139,9 +143,13 @@ static inline int dev_pm_qos_remove_glob
struct notifier_block *notifier)
{ return 0; }
static inline void dev_pm_qos_constraints_init(struct device *dev)
- { return; }
+{
+ dev->power.power_state = PMSG_ON;
+}
static inline void dev_pm_qos_constraints_destroy(struct device *dev)
- { return; }
+{
+ dev->power.power_state = PMSG_INVALID;
+}
#endif
#endif
Index: linux/drivers/base/power/main.c
=================================--- linux.orig/drivers/base/power/main.c
+++ linux/drivers/base/power/main.c
@@ -22,7 +22,6 @@
#include <linux/mutex.h>
#include <linux/pm.h>
#include <linux/pm_runtime.h>
-#include <linux/pm_qos.h>
#include <linux/resume-trace.h>
#include <linux/interrupt.h>
#include <linux/sched.h>
@@ -67,6 +66,7 @@ void device_pm_init(struct device *dev)
spin_lock_init(&dev->power.lock);
pm_runtime_init(dev);
INIT_LIST_HEAD(&dev->power.entry);
+ dev->power.power_state = PMSG_INVALID;
}
/**
@@ -98,8 +98,8 @@ void device_pm_add(struct device *dev)
dev_warn(dev, "parent %s should not be sleeping\n",
dev_name(dev->parent));
list_add_tail(&dev->power.entry, &dpm_list);
- mutex_unlock(&dpm_list_mtx);
dev_pm_qos_constraints_init(dev);
+ mutex_unlock(&dpm_list_mtx);
}
/**
@@ -110,9 +110,9 @@ void device_pm_remove(struct device *dev
{
pr_debug("PM: Removing info for %s:%s\n",
dev->bus ? dev->bus->name : "No Bus", dev_name(dev));
- dev_pm_qos_constraints_destroy(dev);
complete_all(&dev->power.completion);
mutex_lock(&dpm_list_mtx);
+ dev_pm_qos_constraints_destroy(dev);
list_del_init(&dev->power.entry);
mutex_unlock(&dpm_list_mtx);
device_wakeup_disable(dev);
Index: linux/include/linux/pm.h
=================================--- linux.orig/include/linux/pm.h
+++ linux/include/linux/pm.h
@@ -326,6 +326,7 @@ extern struct dev_pm_ops generic_subsys_
* requested by a driver.
*/
+#define PM_EVENT_INVALID (-1)
#define PM_EVENT_ON 0x0000
#define PM_EVENT_FREEZE 0x0001
#define PM_EVENT_SUSPEND 0x0002
@@ -346,6 +347,7 @@ extern struct dev_pm_ops generic_subsys_
#define PM_EVENT_AUTO_SUSPEND (PM_EVENT_AUTO | PM_EVENT_SUSPEND)
#define PM_EVENT_AUTO_RESUME (PM_EVENT_AUTO | PM_EVENT_RESUME)
+#define PMSG_INVALID ((struct pm_message){ .event = PM_EVENT_INVALID, })
#define PMSG_ON ((struct pm_message){ .event = PM_EVENT_ON, })
#define PMSG_FREEZE ((struct pm_message){ .event = PM_EVENT_FREEZE, })
#define PMSG_QUIESCE ((struct pm_message){ .event = PM_EVENT_QUIESCE, })
@@ -421,13 +423,6 @@ enum rpm_request {
RPM_REQ_RESUME,
};
-/* Per-device PM QoS constraints data struct state */
-enum dev_pm_qos_state {
- DEV_PM_QOS_NO_DEVICE, /* No device present */
- DEV_PM_QOS_DEVICE_PRESENT, /* Device present, data not allocated */
- DEV_PM_QOS_ALLOCATED, /* Device present, data allocated */
-};
-
struct wakeup_source;
struct pm_domain_data {
@@ -489,7 +484,6 @@ struct dev_pm_info {
#endif
struct pm_subsys_data *subsys_data; /* Owned by the subsystem. */
struct pm_qos_constraints *constraints;
- enum dev_pm_qos_state constraints_state;
};
extern void update_pm_runtime_accounting(struct device *dev);
Index: linux/drivers/base/power/power.h
=================================--- linux.orig/drivers/base/power/power.h
+++ linux/drivers/base/power/power.h
@@ -1,3 +1,5 @@
+#include <linux/pm_qos.h>
+
#ifdef CONFIG_PM_RUNTIME
extern void pm_runtime_init(struct device *dev);
@@ -35,15 +37,21 @@ extern void device_pm_move_last(struct d
static inline void device_pm_init(struct device *dev)
{
spin_lock_init(&dev->power.lock);
+ dev->power.power_state = PMSG_INVALID;
pm_runtime_init(dev);
}
+static inline void device_pm_add(struct device *dev)
+{
+ dev_pm_qos_constraints_init(dev);
+}
+
static inline void device_pm_remove(struct device *dev)
{
+ dev_pm_qos_constraints_destroy(dev);
pm_runtime_remove(dev);
}
-static inline void device_pm_add(struct device *dev) {}
static inline void device_pm_move_before(struct device *deva,
struct device *devb) {}
static inline void device_pm_move_after(struct device *deva,
^ permalink raw reply
* Re: [PATCH 3/3] PM / QoS: Add function dev_pm_qos_read_value() (v2)
From: Jean Pihet @ 2011-09-29 8:11 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Linux PM mailing list, LKML, Linux-sh list, Magnus Damm,
Kevin Hilman, Ming Lei
In-Reply-To: <201109242326.48485.rjw@sisk.pl>
Hi Rafael,
I have a few minor remarks, inlined below.
On Sat, Sep 24, 2011 at 11:26 PM, Rafael J. Wysocki <rjw@sisk.pl> wrote:
> From: Rafael J. Wysocki <rjw@sisk.pl>
>
> To read the current PM QoS value for a given device we need to
> make sure that the device's power.constraints object won't be
> removed while we're doing that. For this reason, put the
> operation under dev->power.lock and acquire the lock
> around the initialization and removal of power.constraints.
>
> Moreover, since we're using the value of power.constraints to
> determine whether or not the object is present, the
> power.constraints_state field isn't necessary any more and may be
> removed. However, dev_pm_qos_add_request() needs to check if the
> device is being removed from the system before allocating a new
> PM QoS constraints object for it, so it has to use device_pm_lock()
> and the device PM QoS initialization and destruction should be done
> under device_pm_lock() as well.
It might be good to mention dev_pm_qos_mtx which is used internally by
the per-device PM QoS code.
>
> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Other then the minor remarks:
Acked-by: Jean Pihet <j-pihet@ti.com>
> ---
> drivers/base/power/main.c | 4 -
> drivers/base/power/qos.c | 168 ++++++++++++++++++++++++++--------------------
> include/linux/pm.h | 8 --
> include/linux/pm_qos.h | 3
> 4 files changed, 103 insertions(+), 80 deletions(-)
>
> Index: linux/drivers/base/power/qos.c
> =================================> --- linux.orig/drivers/base/power/qos.c
> +++ linux/drivers/base/power/qos.c
...
>
> +static void __dev_pm_qos_constraints_init(struct device *dev)
I would change the name or add a comment stating that this is an
internal function which reinits the constraints field under the lock.
Thanks & regards,
Jean
^ permalink raw reply
* [PATCH] ARM: mach-shmobile: bonito: Add LCDC0 support
From: Kuninori Morimoto @ 2011-09-29 3:06 UTC (permalink / raw)
To: linux-sh
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
arch/arm/configs/bonito_defconfig | 59 +++++++++++++++-
arch/arm/mach-shmobile/board-bonito.c | 117 ++++++++++++++++++++++++++++++++
arch/arm/mach-shmobile/clock-r8a7740.c | 6 ++-
3 files changed, 178 insertions(+), 4 deletions(-)
diff --git a/arch/arm/configs/bonito_defconfig b/arch/arm/configs/bonito_defconfig
index adb4fc3..1cf260d 100644
--- a/arch/arm/configs/bonito_defconfig
+++ b/arch/arm/configs/bonito_defconfig
@@ -396,7 +396,7 @@ CONFIG_ALIGNMENT_TRAP=y
# CONFIG_USE_OF is not set
CONFIG_ZBOOT_ROM_TEXT=0x0
CONFIG_ZBOOT_ROM_BSS=0x0
-CONFIG_CMDLINE="console=ttySC5,115200 earlyprintk=sh-sci.5,115200 ignore_loglevel"
+CONFIG_CMDLINE="console=tty0, console=ttySC5,115200 earlyprintk=sh-sci.5,115200 ignore_loglevel"
CONFIG_CMDLINE_FROM_BOOTLOADER=y
# CONFIG_CMDLINE_EXTEND is not set
# CONFIG_CMDLINE_FORCE is not set
@@ -795,8 +795,43 @@ CONFIG_BCMA_POSSIBLE=y
# CONFIG_DRM is not set
# CONFIG_VGASTATE is not set
# CONFIG_VIDEO_OUTPUT_CONTROL is not set
-# CONFIG_FB is not set
-# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
+CONFIG_FB=y
+# CONFIG_FIRMWARE_EDID is not set
+# CONFIG_FB_DDC is not set
+# CONFIG_FB_BOOT_VESA_SUPPORT is not set
+# CONFIG_FB_CFB_FILLRECT is not set
+# CONFIG_FB_CFB_COPYAREA is not set
+# CONFIG_FB_CFB_IMAGEBLIT is not set
+# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
+CONFIG_FB_SYS_FILLRECT=y
+CONFIG_FB_SYS_COPYAREA=y
+CONFIG_FB_SYS_IMAGEBLIT=y
+# CONFIG_FB_FOREIGN_ENDIAN is not set
+CONFIG_FB_SYS_FOPS=y
+# CONFIG_FB_WMT_GE_ROPS is not set
+CONFIG_FB_DEFERRED_IO=y
+# CONFIG_FB_SVGALIB is not set
+# CONFIG_FB_MACMODES is not set
+CONFIG_FB_BACKLIGHT=y
+# CONFIG_FB_MODE_HELPERS is not set
+# CONFIG_FB_TILEBLITTING is not set
+
+#
+# Frame buffer hardware drivers
+#
+# CONFIG_FB_S1D13XXX is not set
+CONFIG_FB_SH_MOBILE_LCDC=y
+# CONFIG_FB_SH_MOBILE_HDMI is not set
+# CONFIG_FB_SH_MOBILE_MERAM is not set
+# CONFIG_FB_VIRTUAL is not set
+# CONFIG_FB_METRONOME is not set
+# CONFIG_FB_BROADSHEET is not set
+CONFIG_BACKLIGHT_LCD_SUPPORT=y
+# CONFIG_LCD_CLASS_DEVICE is not set
+CONFIG_BACKLIGHT_CLASS_DEVICE=y
+CONFIG_BACKLIGHT_GENERIC=y
+# CONFIG_BACKLIGHT_ADP8860 is not set
+# CONFIG_BACKLIGHT_ADP8870 is not set
#
# Display device support
@@ -807,6 +842,24 @@ CONFIG_BCMA_POSSIBLE=y
# Console display driver support
#
CONFIG_DUMMY_CONSOLE=y
+CONFIG_FRAMEBUFFER_CONSOLE=y
+# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
+# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
+CONFIG_FONTS=y
+# CONFIG_FONT_8x8 is not set
+CONFIG_FONT_8x16=y
+# CONFIG_FONT_6x11 is not set
+# CONFIG_FONT_7x14 is not set
+# CONFIG_FONT_PEARL_8x8 is not set
+# CONFIG_FONT_ACORN_8x8 is not set
+# CONFIG_FONT_MINI_4x6 is not set
+# CONFIG_FONT_SUN8x16 is not set
+# CONFIG_FONT_SUN12x22 is not set
+# CONFIG_FONT_10x18 is not set
+CONFIG_LOGO=y
+# CONFIG_LOGO_LINUX_MONO is not set
+CONFIG_LOGO_LINUX_VGA16=y
+# CONFIG_LOGO_LINUX_CLUT224 is not set
# CONFIG_SOUND is not set
# CONFIG_HID_SUPPORT is not set
# CONFIG_USB_SUPPORT is not set
diff --git a/arch/arm/mach-shmobile/board-bonito.c b/arch/arm/mach-shmobile/board-bonito.c
index 4b8f7ef..c697f9f 100644
--- a/arch/arm/mach-shmobile/board-bonito.c
+++ b/arch/arm/mach-shmobile/board-bonito.c
@@ -33,6 +33,7 @@
#include <asm/mach/time.h>
#include <asm/hardware/cache-l2x0.h>
#include <mach/r8a7740.h>
+#include <video/sh_mobile_lcdc.h>
/*
* CS Address device note
@@ -65,6 +66,13 @@
*/
/*
+ * LCDC0 (CN3/CN4/CN7)
+ *
+ * S38.1 = OFF
+ * S38.2 = OFF
+ */
+
+/*
* FPGA
*/
#define BUSSWMR1 0x0070
@@ -72,6 +80,7 @@
#define BUSSWMR3 0x0074
#define BUSSWMR4 0x0076
+#define LCDCR 0x10B4
#define A1MDSR 0x10E0
#define BVERR 0x1100
u16 fpga_read(u32 offset)
@@ -139,6 +148,63 @@ static int __init pmic_init(void)
device_initcall(pmic_init);
/*
+ * LCDC0
+ */
+static const struct fb_videomode lcdc0_mode = {
+ .name = "WVGA Panel",
+ .xres = 800,
+ .yres = 480,
+ .left_margin = 88,
+ .right_margin = 40,
+ .hsync_len = 128,
+ .upper_margin = 20,
+ .lower_margin = 5,
+ .vsync_len = 5,
+ .sync = 0,
+};
+
+static struct sh_mobile_lcdc_info lcdc0_info = {
+ .clock_source = LCDC_CLK_BUS,
+ .ch[0] = {
+ .chan = LCDC_CHAN_MAINLCD,
+ .bpp = 16,
+ .interface_type = RGB24,
+ .clock_divider = 5,
+ .flags = 0,
+ .lcd_cfg = &lcdc0_mode,
+ .num_cfg = 1,
+ .lcd_size_cfg = {
+ .width = 152,
+ .height = 91,
+ },
+ },
+};
+
+static struct resource lcdc0_resources[] = {
+ [0] = {
+ .name = "LCDC0",
+ .start = 0xfe940000,
+ .end = 0xfe943fff,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = gic_spi(177),
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+static struct platform_device lcdc0_device = {
+ .name = "sh_mobile_lcdc_fb",
+ .id = 0,
+ .resource = lcdc0_resources,
+ .num_resources = ARRAY_SIZE(lcdc0_resources),
+ .dev = {
+ .platform_data = &lcdc0_info,
+ .coherent_dma_mask = ~0,
+ },
+};
+
+/*
* core board devices
*/
static struct platform_device *bonito_core_devices[] __initdata = {
@@ -148,6 +214,7 @@ static struct platform_device *bonito_core_devices[] __initdata = {
* base board devices
*/
static struct platform_device *bonito_base_devices[] __initdata = {
+ &lcdc0_device,
};
/*
@@ -220,6 +287,9 @@ static void __init bonito_map_io(void)
#define BIT_ON(sw, bit) (sw & (1 << bit))
#define BIT_OFF(sw, bit) (!(sw & (1 << bit)))
+#define VCCQ1CR 0xE6058140
+#define VCCQ1LCDCR 0xE6058186
+
static void __init bonito_init(void)
{
u16 val;
@@ -279,6 +349,53 @@ static void __init bonito_init(void)
gpio_request(GPIO_FN_SCIFA5_RXD_PORT92, NULL);
}
+ /*
+ * LCDC0 (CN3)
+ */
+ if (BIT_ON(bsw2, 3) && /* S38.1 = OFF */
+ BIT_ON(bsw2, 2)) { /* S38.2 = OFF */
+ gpio_request(GPIO_FN_LCDC0_SELECT, NULL);
+ gpio_request(GPIO_FN_LCD0_D0, NULL);
+ gpio_request(GPIO_FN_LCD0_D1, NULL);
+ gpio_request(GPIO_FN_LCD0_D2, NULL);
+ gpio_request(GPIO_FN_LCD0_D3, NULL);
+ gpio_request(GPIO_FN_LCD0_D4, NULL);
+ gpio_request(GPIO_FN_LCD0_D5, NULL);
+ gpio_request(GPIO_FN_LCD0_D6, NULL);
+ gpio_request(GPIO_FN_LCD0_D7, NULL);
+ gpio_request(GPIO_FN_LCD0_D8, NULL);
+ gpio_request(GPIO_FN_LCD0_D9, NULL);
+ gpio_request(GPIO_FN_LCD0_D10, NULL);
+ gpio_request(GPIO_FN_LCD0_D11, NULL);
+ gpio_request(GPIO_FN_LCD0_D12, NULL);
+ gpio_request(GPIO_FN_LCD0_D13, NULL);
+ gpio_request(GPIO_FN_LCD0_D14, NULL);
+ gpio_request(GPIO_FN_LCD0_D15, NULL);
+ gpio_request(GPIO_FN_LCD0_D16, NULL);
+ gpio_request(GPIO_FN_LCD0_D17, NULL);
+ gpio_request(GPIO_FN_LCD0_D18_PORT163, NULL);
+ gpio_request(GPIO_FN_LCD0_D19_PORT162, NULL);
+ gpio_request(GPIO_FN_LCD0_D20_PORT161, NULL);
+ gpio_request(GPIO_FN_LCD0_D21_PORT158, NULL);
+ gpio_request(GPIO_FN_LCD0_D22_PORT160, NULL);
+ gpio_request(GPIO_FN_LCD0_D23_PORT159, NULL);
+ gpio_request(GPIO_FN_LCD0_DCK, NULL);
+ gpio_request(GPIO_FN_LCD0_VSYN, NULL);
+ gpio_request(GPIO_FN_LCD0_HSYN, NULL);
+ gpio_request(GPIO_FN_LCD0_DISP, NULL);
+ gpio_request(GPIO_FN_LCD0_LCLK_PORT165, NULL);
+
+ gpio_request(GPIO_PORT61, NULL); /* LCDDON */
+ gpio_direction_output(GPIO_PORT61, 1);
+
+ /* backlight on */
+ fpga_write(LCDCR, 1, 1);
+
+ /* drivability Max */
+ __raw_writew(0x00FF , VCCQ1LCDCR);
+ __raw_writew(0xFFFF , VCCQ1CR);
+ }
+
platform_add_devices(bonito_base_devices,
ARRAY_SIZE(bonito_base_devices));
}
diff --git a/arch/arm/mach-shmobile/clock-r8a7740.c b/arch/arm/mach-shmobile/clock-r8a7740.c
index 7937800..1e8fee0 100644
--- a/arch/arm/mach-shmobile/clock-r8a7740.c
+++ b/arch/arm/mach-shmobile/clock-r8a7740.c
@@ -251,7 +251,7 @@ static struct clk div6_clks[DIV6_NR] = {
};
enum { MSTP125,
- MSTP116, MSTP111,
+ MSTP116, MSTP111, MSTP100, MSTP117,
MSTP230,
MSTP222,
@@ -267,8 +267,10 @@ enum { MSTP125,
static struct clk mstp_clks[MSTP_NR] = {
[MSTP125] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR1, 25, 0), /* TMU0 */
+ [MSTP117] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 17, 0), /* LCDC1 */
[MSTP116] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR1, 16, 0), /* IIC0 */
[MSTP111] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR1, 11, 0), /* TMU1 */
+ [MSTP100] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 0, 0), /* LCDC0 */
[MSTP230] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 30, 0), /* SCIFA6 */
[MSTP222] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 22, 0), /* SCIFA7 */
@@ -317,8 +319,10 @@ static struct clk_lookup lookups[] = {
CLKDEV_CON_ID("sub_clk", &div6_clks[DIV6_SUB]),
/* MSTP32 clocks */
+ CLKDEV_DEV_ID("sh_mobile_lcdc_fb.0", &mstp_clks[MSTP100]),
CLKDEV_DEV_ID("sh_tmu.1", &mstp_clks[MSTP111]),
CLKDEV_DEV_ID("i2c-sh_mobile.0", &mstp_clks[MSTP116]),
+ CLKDEV_DEV_ID("sh_mobile_lcdc_fb.1", &mstp_clks[MSTP117]),
CLKDEV_DEV_ID("sh_tmu.0", &mstp_clks[MSTP125]),
CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP200]),
--
1.7.4.1
^ permalink raw reply related
* [PATCH] mailmap: Fix up renesas member's attribution
From: Kuninori Morimoto @ 2011-09-29 1:40 UTC (permalink / raw)
To: linux-sh
Some renesas member had used multi name on same email address.
This patch will cleanup git shortlog for renesas member.
Cc: Yusuke Goda <yusuke.goda.sx@renesas.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
.mailmap | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/.mailmap b/.mailmap
index a4806f0..9b0d026 100644
--- a/.mailmap
+++ b/.mailmap
@@ -68,6 +68,7 @@ Juha Yrjola <juha.yrjola@solidboot.com>
Kay Sievers <kay.sievers@vrfy.org>
Kenneth W Chen <kenneth.w.chen@intel.com>
Koushik <raghavendra.koushik@neterion.com>
+Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Leonid I Ananiev <leonid.i.ananiev@intel.com>
Linas Vepstas <linas@austin.ibm.com>
Mark Brown <broonie@sirena.org.uk>
@@ -111,3 +112,4 @@ Uwe Kleine-König <ukl@pengutronix.de>
Uwe Kleine-König <Uwe.Kleine-Koenig@digi.com>
Valdis Kletnieks <Valdis.Kletnieks@vt.edu>
Takashi YOSHII <takashi.yoshii.zj@renesas.com>
+Yusuke Goda <goda.yusuke@renesas.com>
--
1.7.4.1
^ permalink raw reply related
* [PATCH 5/5] ARM: mach-shmobile: bonito: add PMIC settings
From: Kuninori Morimoto @ 2011-09-29 1:31 UTC (permalink / raw)
To: linux-sh
bonito board needs some settings by pmic which use i2c access.
It is dependent on the device to be used.
This patch adds standard settings.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
arch/arm/mach-shmobile/board-bonito.c | 53 +++++++++++++++++++++++++++++++++
1 files changed, 53 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-shmobile/board-bonito.c b/arch/arm/mach-shmobile/board-bonito.c
index 0e9dac6..4b8f7ef 100644
--- a/arch/arm/mach-shmobile/board-bonito.c
+++ b/arch/arm/mach-shmobile/board-bonito.c
@@ -20,6 +20,7 @@
*/
#include <linux/kernel.h>
+#include <linux/i2c.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
@@ -88,6 +89,56 @@ void fpga_write(u32 offset, u16 val, u16 mask)
}
/*
+* PMIC settings
+*
+* FIXME
+*
+* bonito board needs some settings by pmic which use i2c access.
+* pmic settings use device_initcall() here for use it.
+*/
+static __u8 *pmic_settings = NULL;
+static __u8 pmic_do_2A[] = {
+ 0x1C, 0x09,
+ 0x1A, 0x80,
+ 0xff, 0xff,
+};
+
+static int __init pmic_init(void)
+{
+ struct i2c_adapter *a = i2c_get_adapter(0);
+ struct i2c_msg msg;
+ __u8 buf[2];
+ int i, ret;
+
+ if (!pmic_settings)
+ return 0;
+ if (!a)
+ return 0;
+
+ msg.addr = 0x46;
+ msg.buf = buf;
+ msg.len = 2;
+ msg.flags = 0;
+
+ for (i = 0; ; i += 2) {
+ buf[0] = pmic_settings[i + 0];
+ buf[1] = pmic_settings[i + 1];
+
+ if ((0xff = buf[0]) && (0xff = buf[1]))
+ break;
+
+ ret = i2c_transfer(a, &msg, 1);
+ if (ret < 0) {
+ pr_err("i2c transfer fail\n");
+ break;
+ }
+ }
+
+ return 0;
+}
+device_initcall(pmic_init);
+
+/*
* core board devices
*/
static struct platform_device *bonito_core_devices[] __initdata = {
@@ -175,6 +226,8 @@ static void __init bonito_init(void)
r8a7740_pinmux_init();
+ pmic_settings = pmic_do_2A;
+
/*
* core board settings
*/
--
1.7.4.1
^ permalink raw reply related
* [PATCH 4/5] ARM: mach-shmobile: r8a7740: Add i2c support
From: Kuninori Morimoto @ 2011-09-29 1:31 UTC (permalink / raw)
To: linux-sh
r8a7740 I2C needs work around
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
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..ab43651 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(offset) ioread8(reg + offset)
+#define i2c_write(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 (!res) {
+ pr_err("r8a7740 i2c workaround fail (cannot find resource)\n");
+ return;
+ }
+
+ reg = ioremap(res->start, resource_size(res));
+ if (!reg) {
+ pr_err("r8a7740 i2c workaround fail (cannot map IO)\n");
+ return;
+ }
+
+ i2c_write(ICCR, i2c_read(ICCR) | 0x80);
+ i2c_read(ICCR); /* dummy read */
+
+ i2c_write(ICSTART, i2c_read(ICSTART) | 0x10);
+ i2c_read(ICSTART); /* dummy read */
+
+ mdelay(100);
+
+ i2c_write(ICCR, 0x01);
+ i2c_read(ICCR);
+ i2c_write(ICSTART, 0x00);
+ i2c_read(ICSTART);
+
+ i2c_write(ICCR, 0x10);
+ mdelay(100);
+ i2c_write(ICCR, 0x00);
+ mdelay(100);
+ i2c_write(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 3/5] ARM: mach-shmobile: bonito: Add dip-switch selector
From: Kuninori Morimoto @ 2011-09-29 1:31 UTC (permalink / raw)
To: linux-sh
devices enable/disable are controled by dip-switch on bonito board.
If bonito core board is connected to base board,
you can check the settings from FPGA.
This patch adds basic code and controls SCIFA5 settings
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
arch/arm/mach-shmobile/board-bonito.c | 88 ++++++++++++++++++++++++++------
1 files changed, 71 insertions(+), 17 deletions(-)
diff --git a/arch/arm/mach-shmobile/board-bonito.c b/arch/arm/mach-shmobile/board-bonito.c
index ec8e6fc..0e9dac6 100644
--- a/arch/arm/mach-shmobile/board-bonito.c
+++ b/arch/arm/mach-shmobile/board-bonito.c
@@ -56,8 +56,21 @@
*/
/*
+ * SCIFA5 (CN42)
+ *
+ * S38.3 = ON
+ * S39.6 = ON
+ * S43.1 = ON
+ */
+
+/*
* FPGA
*/
+#define BUSSWMR1 0x0070
+#define BUSSWMR2 0x0072
+#define BUSSWMR3 0x0074
+#define BUSSWMR4 0x0076
+
#define A1MDSR 0x10E0
#define BVERR 0x1100
u16 fpga_read(u32 offset)
@@ -75,9 +88,15 @@ void fpga_write(u32 offset, u16 val, u16 mask)
}
/*
- * devices
+ * core board devices
+ */
+static struct platform_device *bonito_core_devices[] __initdata = {
+};
+
+/*
+ * base board devices
*/
-static struct platform_device *bonito_devices[] __initdata = {
+static struct platform_device *bonito_base_devices[] __initdata = {
};
/*
@@ -147,26 +166,18 @@ static void __init bonito_map_io(void)
/*
* board init
*/
+#define BIT_ON(sw, bit) (sw & (1 << bit))
+#define BIT_OFF(sw, bit) (!(sw & (1 << bit)))
+
static void __init bonito_init(void)
{
u16 val;
r8a7740_pinmux_init();
- /* FPGA */
- gpio_request(GPIO_FN_CS5B, NULL);
- gpio_request(GPIO_FN_CS6A, NULL);
- gpio_request(GPIO_FN_CS5A_PORT105, NULL);
- gpio_request(GPIO_FN_IRQ10, NULL);
-
- val = fpga_read(BVERR);
- pr_info("bonito version: cpu %02x, base %02x\n",
- ((val >> 8) & 0xFF),
- ((val >> 0) & 0xFF));
-
- /* SCIFA5 */
- gpio_request(GPIO_FN_SCIFA5_TXD_PORT91, NULL);
- gpio_request(GPIO_FN_SCIFA5_RXD_PORT92, NULL);
+ /*
+ * core board settings
+ */
#ifdef CONFIG_CACHE_L2X0
/* Early BRESP enable, Shared attribute override enable, 32K*8way */
@@ -174,7 +185,50 @@ static void __init bonito_init(void)
#endif
r8a7740_add_standard_devices();
- platform_add_devices(bonito_devices, ARRAY_SIZE(bonito_devices));
+
+ platform_add_devices(bonito_core_devices,
+ ARRAY_SIZE(bonito_core_devices));
+
+ /*
+ * base board settings
+ */
+ gpio_request(GPIO_PORT176, NULL);
+ gpio_direction_input(GPIO_PORT176);
+ if (!gpio_get_value(GPIO_PORT176)) {
+ u16 bsw2;
+ u16 bsw3;
+ u16 bsw4;
+
+ /*
+ * FPGA
+ */
+ gpio_request(GPIO_FN_CS5B, NULL);
+ gpio_request(GPIO_FN_CS6A, NULL);
+ gpio_request(GPIO_FN_CS5A_PORT105, NULL);
+ gpio_request(GPIO_FN_IRQ10, NULL);
+
+ val = fpga_read(BVERR);
+ pr_info("bonito version: cpu %02x, base %02x\n",
+ ((val >> 8) & 0xFF),
+ ((val >> 0) & 0xFF));
+
+ bsw2 = fpga_read(BUSSWMR2);
+ bsw3 = fpga_read(BUSSWMR3);
+ bsw4 = fpga_read(BUSSWMR4);
+
+ /*
+ * SCIFA5 (CN42)
+ */
+ if (BIT_OFF(bsw2, 1) && /* S38.3 = ON */
+ BIT_OFF(bsw3, 9) && /* S39.6 = ON */
+ BIT_OFF(bsw4, 4)) { /* S43.1 = ON */
+ gpio_request(GPIO_FN_SCIFA5_TXD_PORT91, NULL);
+ gpio_request(GPIO_FN_SCIFA5_RXD_PORT92, NULL);
+ }
+
+ platform_add_devices(bonito_base_devices,
+ ARRAY_SIZE(bonito_base_devices));
+ }
}
static void __init bonito_timer_init(void)
--
1.7.4.1
^ permalink raw reply related
* [PATCH 1/5] serial: sh-sci: clean up white space
From: Kuninori Morimoto @ 2011-09-29 1:30 UTC (permalink / raw)
To: linux-sh
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
drivers/tty/serial/sh-sci.h | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/tty/serial/sh-sci.h b/drivers/tty/serial/sh-sci.h
index e9bed03..ab6be55 100644
--- a/drivers/tty/serial/sh-sci.h
+++ b/drivers/tty/serial/sh-sci.h
@@ -11,13 +11,13 @@
#define SCxSR_ERRORS(port) (to_sci_port(port)->cfg->error_mask)
-#if defined(CONFIG_CPU_SUBTYPE_SH7705) || \
- defined(CONFIG_CPU_SUBTYPE_SH7720) || \
- defined(CONFIG_CPU_SUBTYPE_SH7721) || \
- defined(CONFIG_ARCH_SH73A0) || \
- defined(CONFIG_ARCH_SH7367) || \
- defined(CONFIG_ARCH_SH7377) || \
- defined(CONFIG_ARCH_SH7372)
+#if defined(CONFIG_CPU_SUBTYPE_SH7705) ||\
+ defined(CONFIG_CPU_SUBTYPE_SH7720) ||\
+ defined(CONFIG_CPU_SUBTYPE_SH7721) ||\
+ defined(CONFIG_ARCH_SH73A0) ||\
+ defined(CONFIG_ARCH_SH7367) ||\
+ defined(CONFIG_ARCH_SH7377) ||\
+ defined(CONFIG_ARCH_SH7372)
# define SCxSR_RDxF_CLEAR(port) (sci_in(port, SCxSR) & 0xfffc)
# define SCxSR_ERROR_CLEAR(port) (sci_in(port, SCxSR) & 0xfd73)
# define SCxSR_TDxE_CLEAR(port) (sci_in(port, SCxSR) & 0xffdf)
--
1.7.4.1
^ permalink raw reply related
* R-Mobile A1 support
From: Kuninori Morimoto @ 2011-09-29 1:29 UTC (permalink / raw)
To: linux-sh
Dear Paul, Magnus
These are basic R-Mobile A1 chip and bonito board support patches
Kuninori Morimoto (5):
serial: sh-sci: clean up white space
ARM: mach-shmobile: R-Mobile A1 support.
ARM: mach-shmobile: bonito: Add dip-switch selector
ARM: mach-shmobile: r8a7740: Add i2c support
ARM: mach-shmobile: bonito: add PMIC settings
This patch used xxx-r8a7740.c as file name.
This A1 chip support is based on v0.1 manual for now.
It will be fixed in the future
Best regards
---
Kuninori Morimoto
^ permalink raw reply
* Re: [PATCH 2/3] PM / Runtime: Don't run callbacks under lock for power.irq_safe set
From: Kevin Hilman @ 2011-09-29 0:17 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Linux PM mailing list, LKML, Linux-sh list, Magnus Damm,
jean.pihet, Ming Lei
In-Reply-To: <201109272150.42732.rjw@sisk.pl>
"Rafael J. Wysocki" <rjw@sisk.pl> writes:
> On Tuesday, September 27, 2011, Rafael J. Wysocki wrote:
>> On Tuesday, September 27, 2011, Kevin Hilman wrote:
>> > "Rafael J. Wysocki" <rjw@sisk.pl> writes:
>> >
>> > > From: Rafael J. Wysocki <rjw@sisk.pl>
>> > >
>> > > The rpm_suspend() and rpm_resume() routines execute subsystem or PM
>> > > domain callbacks under power.lock if power.irq_safe is set for the
>> > > given device. This is inconsistent with that rpm_idle() does after
>> > > commit 02b2677 (PM / Runtime: Allow _put_sync() from
>> > > interrupts-disabled context) and is problematic for subsystems and PM
>> > > domains wanting to use power.lock for synchronization in their
>> > > runtime PM callbacks.
>> > >
>> > > Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
>> >
>> > The part described here looks right, and is much better for consistency.
>> >
>> > Reviewed-by: Kevin Hilman <khilman@ti.com>
>> >
>> > but...
>> >
>> > [...]
>> >
>> > > @@ -347,6 +353,15 @@ static int rpm_suspend(struct device *de
>> > > goto out;
>> > > }
>> > >
>> > > + if (dev->power.irq_safe) {
>> > > + spin_unlock(&dev->power.lock);
>> > > +
>> > > + cpu_relax();
>> > > +
>> > > + spin_lock(&dev->power.lock);
>> > > + goto repeat;
>> > > + }
>> > > +
>> >
>> >
>> > ... AFAICT, this isn't directly related to the problem described in the
>> > changelog (or at least I didn't find it obvious),
>>
>> It is related. Whether or not it's obvious, I'm not sure. :-)
>>
>> The problem is that after the changes in __rpm_callback() another CPU may start
>> executing the same routine for the same device if dev->power.irq_safe is set
>> (previously, it would block on the dev's power.lock) and it may see
>> dev->power.runtime_status = RPM_RESUMING or
>> dev->power.runtime_status = RPM_SUSPENDING, while previously, it wouldn't
>> reach the relevant code. Thus we have to modify that code to take
>> the dev->power.irq_safe case into account.
>>
>> > and probably deserves a comment in the code as well.
>>
>> Well, the comment in the code would explain why the commit did what it did,
>> but it wouldn't be very useful afterwards IMHO.
>>
>> Perhaps I'll simply add some explanation to the changelog.
>
> Below is the patch with the new changelog, for completness.
Thanks, it's much clearer now.
Kevin
> ---
> From: Rafael J. Wysocki <rjw@sisk.pl>
> Subject: PM / Runtime: Don't run callbacks under lock for power.irq_safe set
>
> The rpm_suspend() and rpm_resume() routines execute subsystem or PM
> domain callbacks under power.lock if power.irq_safe is set for the
> given device. This is inconsistent with that rpm_idle() does after
> commit 02b2677 (PM / Runtime: Allow _put_sync() from
> interrupts-disabled context) and is problematic for subsystems and PM
> domains wanting to use power.lock for synchronization in their
> runtime PM callbacks.
>
> This change requires the code checking if the device's runtime PM
> status is RPM_SUSPENDING or RPM_RESUMING to be modified too, to take
> the power.irq_safe set case into account (that code wasn't reachable
> before with power.irq_safe set, because it's executed with the
> device's power.lock held).
>
> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
> Reviewed-by: Ming Lei <tom.leiming@gmail.com>
> Reviewed-by: Kevin Hilman <khilman@ti.com>
> ---
> drivers/base/power/runtime.c | 68 +++++++++++++++++++++++++++++--------------
> 1 file changed, 46 insertions(+), 22 deletions(-)
>
> Index: linux/drivers/base/power/runtime.c
> =================================> --- linux.orig/drivers/base/power/runtime.c
> +++ linux/drivers/base/power/runtime.c
> @@ -155,6 +155,31 @@ static int rpm_check_suspend_allowed(str
> }
>
> /**
> + * __rpm_callback - Run a given runtime PM callback for a given device.
> + * @cb: Runtime PM callback to run.
> + * @dev: Device to run the callback for.
> + */
> +static int __rpm_callback(int (*cb)(struct device *), struct device *dev)
> + __releases(&dev->power.lock) __acquires(&dev->power.lock)
> +{
> + int retval;
> +
> + if (dev->power.irq_safe)
> + spin_unlock(&dev->power.lock);
> + else
> + spin_unlock_irq(&dev->power.lock);
> +
> + retval = cb(dev);
> +
> + if (dev->power.irq_safe)
> + spin_lock(&dev->power.lock);
> + else
> + spin_lock_irq(&dev->power.lock);
> +
> + return retval;
> +}
> +
> +/**
> * rpm_idle - Notify device bus type if the device can be suspended.
> * @dev: Device to notify the bus type about.
> * @rpmflags: Flag bits.
> @@ -225,19 +250,8 @@ static int rpm_idle(struct device *dev,
> else
> callback = NULL;
>
> - if (callback) {
> - if (dev->power.irq_safe)
> - spin_unlock(&dev->power.lock);
> - else
> - spin_unlock_irq(&dev->power.lock);
> -
> - callback(dev);
> -
> - if (dev->power.irq_safe)
> - spin_lock(&dev->power.lock);
> - else
> - spin_lock_irq(&dev->power.lock);
> - }
> + if (callback)
> + __rpm_callback(callback, dev);
>
> dev->power.idle_notification = false;
> wake_up_all(&dev->power.wait_queue);
> @@ -252,22 +266,14 @@ static int rpm_idle(struct device *dev,
> * @dev: Device to run the callback for.
> */
> static int rpm_callback(int (*cb)(struct device *), struct device *dev)
> - __releases(&dev->power.lock) __acquires(&dev->power.lock)
> {
> int retval;
>
> if (!cb)
> return -ENOSYS;
>
> - if (dev->power.irq_safe) {
> - retval = cb(dev);
> - } else {
> - spin_unlock_irq(&dev->power.lock);
> -
> - retval = cb(dev);
> + retval = __rpm_callback(cb, dev);
>
> - spin_lock_irq(&dev->power.lock);
> - }
> dev->power.runtime_error = retval;
> return retval != -EACCES ? retval : -EIO;
> }
> @@ -347,6 +353,15 @@ static int rpm_suspend(struct device *de
> goto out;
> }
>
> + if (dev->power.irq_safe) {
> + spin_unlock(&dev->power.lock);
> +
> + cpu_relax();
> +
> + spin_lock(&dev->power.lock);
> + goto repeat;
> + }
> +
> /* Wait for the other suspend running in parallel with us. */
> for (;;) {
> prepare_to_wait(&dev->power.wait_queue, &wait,
> @@ -496,6 +511,15 @@ static int rpm_resume(struct device *dev
> goto out;
> }
>
> + if (dev->power.irq_safe) {
> + spin_unlock(&dev->power.lock);
> +
> + cpu_relax();
> +
> + spin_lock(&dev->power.lock);
> + goto repeat;
> + }
> +
> /* Wait for the operation carried out in parallel with us. */
> for (;;) {
> prepare_to_wait(&dev->power.wait_queue, &wait,
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
^ 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