* Re: [PATCH 0/2] ARM: mach-shmobile: clock-r8a7779: patches
From: Paul Mundt @ 2012-01-09 1:24 UTC (permalink / raw)
To: linux-sh
On Tue, Dec 20, 2011 at 12:46:56AM -0800, Kuninori Morimoto wrote:
> These are r8a7779 clock update patches which depends on Magnus's
> [ARM: mach-shmobile: r8a7779 and Marzen V2] patches
>
> Kuninori Morimoto (2):
> ARM: mach-shmobile: clock-r8a7779: add DIV4 clock support
> ARM: mach-shmobile: clock-r8a7779: clkz/clkzs support
>
Applied to rmobile/marzen, thanks.
^ permalink raw reply
* Re: [PATCH 00/05] ARM: mach-shmobile: r8a7779 and Marzen V2
From: Paul Mundt @ 2012-01-09 1:23 UTC (permalink / raw)
To: linux-sh
In-Reply-To: <20111213163603.4096.10169.sendpatchset@w520>
On Wed, Dec 14, 2011 at 01:36:03AM +0900, Magnus Damm wrote:
> ARM: mach-shmobile: r8a7779 and Marzen V2
>
> [PATCH 01/05] ARM: mach-shmobile: r8a7779 and Marzen base support V2
> [PATCH 02/05] ARM: mach-shmobile: r8a7779 PFC GPIO-only support V2
> [PATCH 03/05] ARM: mach-shmobile: r8a7779 PFC function support
> [PATCH 04/05] ARM: mach-shmobile: Marzen SCIF2/SCIF4 support
> [PATCH 05/05] ARM: mach-shmobile: Marzen LAN89218 support
>
These are now in rmobile/marzen which was branched off of rmobile-latest
with the pfc and cpg topic branches merged in.
It will need to be updated both with a defconfig and updating for the
serial changes, but these can be layered on incrementally.
^ permalink raw reply
* Re: [PATCH 00/05] ARM: mach-shmobile: r8a7779 and Marzen V2
From: Paul Mundt @ 2012-01-09 0:35 UTC (permalink / raw)
To: linux-sh
In-Reply-To: <20111213163603.4096.10169.sendpatchset@w520>
On Wed, Dec 14, 2011 at 01:36:03AM +0900, Magnus Damm wrote:
> ARM: mach-shmobile: r8a7779 and Marzen V2
>
You're still missing a defconfig.
^ permalink raw reply
* Re: [PATCH 00/05] sh: pfc: Variable bitfield width and unlock reg patches
From: Paul Mundt @ 2012-01-09 0:34 UTC (permalink / raw)
To: linux-sh
On Wed, Dec 14, 2011 at 01:00:27AM +0900, Magnus Damm wrote:
> sh: pfc: Variable bitfield width and unlock reg patches
>
> [PATCH 01/05] sh: pfc: Add gpio_read_bit() for data register access
> [PATCH 02/05] sh: pfc: Convert index to field and value pair
> [PATCH 03/05] sh: pfc: Add config_reg_helper() function
> [PATCH 04/05] sh: pfc: Variable bitfield width config register support
> [PATCH 05/05] sh: pfc: Unlock register support
>
> Update the common PFC code to support r8a7779 by adding:
> - Variable bitfield width config register support (Patch 4)
> - Unlock register support (Patch 5)
>
> Patch 1-3 contain incremental changes needed for 4.
>
> Signed-off-by: Magnus Damm <damm@opensource.se>
> ---
>
> Depends on "[PATCH] sh: pfc: ioremap() support"
>
Applied to common/pfc, thanks.
^ permalink raw reply
* Re: [PATCH 1/2] sh: add platform_device for SUDMAC in setup-sh7757
From: Paul Mundt @ 2012-01-08 23:21 UTC (permalink / raw)
To: linux-sh
In-Reply-To: <4E803B21.1030701@renesas.com>
On Thu, Jan 05, 2012 at 02:41:44PM +0900, Shimoda, Yoshihiro wrote:
> +static struct sh_dmae_pdata sudmac00_platform_data = {
> + .slave = sh7757_sudmac00_slaves,
> + .slave_num = ARRAY_SIZE(sh7757_sudmac00_slaves),
> + .channel = sh7757_sudmac_channel,
> + .channel_num = 1,
> + .no_dmars = 1,
> + .no_error_irq = 1,
> + .sudmac = 1,
> +};
You will have to re-spin this patch with the updated support patch
dropping the no_error_irq member.
^ permalink raw reply
* [GIT PULL] Power management updates for 3.3
From: Rafael J. Wysocki @ 2012-01-06 23:28 UTC (permalink / raw)
To: Linus Torvalds
Cc: LKML, Linux PM list, Linux-sh list, ACPI Devel Mailing List
Hi Linus,
Please pull power management updates (on top of commit
4962516b2309d76964f9df0d33e74f43b624a42d) for 3.3 from:
git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git pm-for-linus
with top-most commit c233523b3d392e530033a7587d7970dc62a02361
(Merge branch 'pm-sleep' into pm-for-linus).
They include:
* Freezer updates from Tejun.
* Suspend and hiberante fixes and cleanups from Srivatsa S. Bhat.
* Introduction of PM QoS into generic PM domains.
* Rework of the PM core making it execute driver callbacks directly if the corresponding
subsystem ones are not present.
* One more ACPI sleep DMI blacklist entry.
* Changes to make the freezer play better with NFS and sunrpc from Jeff Layton.
* devfreq updates.
* Assorted PM fixes.
Thanks!
Documentation/feature-removal-schedule.txt | 11 -
Documentation/power/devices.txt | 37 +-
Documentation/power/freezing-of-tasks.txt | 39 +-
Documentation/power/runtime_pm.txt | 130 ++--
arch/alpha/include/asm/thread_info.h | 2 -
arch/arm/include/asm/thread_info.h | 2 -
arch/arm/mach-s3c64xx/Kconfig | 1 +
arch/arm/mach-s3c64xx/mach-crag6410.c | 2 +-
arch/arm/mach-s3c64xx/pm.c | 176 ++++-
arch/arm/mach-shmobile/include/mach/common.h | 4 +-
arch/arm/mach-shmobile/include/mach/sh7372.h | 6 +-
arch/arm/mach-shmobile/intc-sh7372.c | 50 ++
arch/arm/mach-shmobile/pm-sh7372.c | 196 ++++--
arch/arm/mach-shmobile/setup-sh7372.c | 6 +-
arch/arm/mach-shmobile/sleep-sh7372.S | 21 +-
arch/arm/plat-samsung/include/plat/pm.h | 6 +
arch/avr32/include/asm/thread_info.h | 2 -
arch/blackfin/include/asm/thread_info.h | 2 -
arch/cris/include/asm/thread_info.h | 2 -
arch/frv/include/asm/thread_info.h | 2 -
arch/h8300/include/asm/thread_info.h | 2 -
arch/ia64/include/asm/thread_info.h | 2 -
arch/m32r/include/asm/thread_info.h | 2 -
arch/m68k/include/asm/thread_info.h | 1 -
arch/microblaze/include/asm/thread_info.h | 2 -
arch/mips/include/asm/thread_info.h | 2 -
arch/mn10300/include/asm/thread_info.h | 2 -
arch/parisc/include/asm/thread_info.h | 2 -
arch/powerpc/include/asm/thread_info.h | 2 -
arch/powerpc/kernel/vio.c | 1 -
arch/s390/include/asm/thread_info.h | 2 -
arch/sh/include/asm/thread_info.h | 2 -
arch/sparc/include/asm/thread_info_32.h | 2 -
arch/sparc/include/asm/thread_info_64.h | 2 -
arch/um/include/asm/thread_info.h | 2 -
arch/unicore32/include/asm/thread_info.h | 2 -
arch/x86/include/asm/thread_info.h | 2 -
arch/xtensa/include/asm/thread_info.h | 2 -
drivers/acpi/sleep.c | 16 +
drivers/amba/bus.c | 136 +---
drivers/base/firmware_class.c | 4 +
drivers/base/platform.c | 115 ---
drivers/base/power/Makefile | 2 +-
drivers/base/power/domain.c | 539 +++++++++----
drivers/base/power/domain_governor.c | 156 ++++
drivers/base/power/generic_ops.c | 91 +--
drivers/base/power/main.c | 375 ++++-----
drivers/base/power/qos.c | 49 +-
drivers/base/power/runtime.c | 157 +++-
drivers/bluetooth/btmrvl_main.c | 2 -
drivers/devfreq/Kconfig | 13 +
drivers/devfreq/Makefile | 3 +
drivers/devfreq/devfreq.c | 15 +-
drivers/devfreq/exynos4_bus.c | 1135 ++++++++++++++++++++++++++
drivers/dma/dmatest.c | 46 +-
drivers/input/touchscreen/st1232.c | 13 +-
drivers/mfd/twl6030-irq.c | 2 -
drivers/net/irda/stir4200.c | 2 +-
drivers/platform/x86/thinkpad_acpi.c | 15 +-
drivers/sh/intc/core.c | 8 +
drivers/sh/intc/internals.h | 1 +
drivers/staging/rts_pstor/rtsx.c | 2 -
drivers/usb/storage/usb.c | 13 +-
fs/btrfs/async-thread.c | 2 +-
fs/btrfs/disk-io.c | 8 +-
fs/ext4/super.c | 3 +-
fs/fs-writeback.c | 4 +-
fs/gfs2/log.c | 4 +-
fs/gfs2/quota.c | 4 +-
fs/jbd/journal.c | 2 +-
fs/jbd2/journal.c | 2 +-
fs/jfs/jfs_logmgr.c | 2 +-
fs/jfs/jfs_txnmgr.c | 4 +-
fs/nfs/inode.c | 3 +-
fs/nfs/nfs3proc.c | 3 +-
fs/nfs/nfs4proc.c | 5 +-
fs/nfs/proc.c | 3 +-
fs/nilfs2/segment.c | 2 +-
fs/xfs/xfs_buf.c | 2 +-
include/linux/freezer.h | 159 ++--
include/linux/kmod.h | 2 +
include/linux/kthread.h | 1 +
include/linux/platform_device.h | 30 +-
include/linux/pm.h | 15 +-
include/linux/pm_domain.h | 103 +++-
include/linux/pm_qos.h | 8 +
include/linux/pm_runtime.h | 5 +
include/linux/sched.h | 4 +-
include/linux/sh_intc.h | 1 +
include/linux/suspend.h | 35 +-
kernel/cgroup_freezer.c | 63 +-
kernel/cpu.c | 4 +-
kernel/exit.c | 3 +-
kernel/fork.c | 1 -
kernel/freezer.c | 203 +++---
kernel/kexec.c | 4 +-
kernel/kmod.c | 27 +-
kernel/kthread.c | 27 +-
kernel/power/hibernate.c | 92 +--
kernel/power/main.c | 10 +-
kernel/power/power.h | 2 +
kernel/power/process.c | 77 +-
kernel/power/suspend.c | 12 +-
kernel/power/user.c | 184 ++---
mm/backing-dev.c | 8 +-
mm/oom_kill.c | 2 +-
net/sunrpc/sched.c | 3 +-
107 files changed, 3249 insertions(+), 1530 deletions(-)
---------------
Axel Lin (1):
PM / devfreq: separate error paths from successful path
Ben Hutchings (1):
PM / Hibernate: Implement compat_ioctl for /dev/snapshot
Fenghua Yu (1):
CPU: Add right qualifiers for alloc_frozen_cpus() and cpu_hotplug_pm_sync_init()
Guennadi Liakhovetski (1):
PM / Domains: fix compilation failure for CONFIG_PM_GENERIC_DOMAINS unset
Jeff Layton (2):
Freezer / sunrpc / NFS: don't allow TASK_KILLABLE sleeps to block the freezer
PM / Freezer: fix return value of freezable_schedule_timeout_killable()
Keng-Yu Lin (1):
ACPI / PM: Do not save/restore NVS on Asus K54C/K54HR
Magnus Damm (1):
PM / shmobile: Add support for the sh7372 A4S power domain / sleep mode
Mark Brown (3):
PM / Domains: Provide an always on power domain governor
PM / shmobile: Use common always on power domain governor
ARM: S3C64XX: Implement basic power domain support
MyungJoo Ham (1):
PM/Devfreq: Add Exynos4-bus device DVFS driver for Exynos4210/4212/4412.
Oleg Nesterov (1):
freezer: fix wait_event_freezable/__thaw_task races
Rafael J. Wysocki (24):
PM / Sleep: Remove unnecessary label and jumps to it form PM core code
PM / Sleep: Simplify device_suspend_noirq()
PM / Runtime: Use device PM QoS constraints (v2)
PM / Domains: Make it possible to use per-device domain callbacks
PM / Domains: Introduce "save/restore state" device callbacks
PM / Domains: Rework system suspend callback routines (v2)
PM / Domains: Add device stop governor function (v4)
PM / Domains: Add default power off governor function (v4)
PM / Domains: Automatically update overoptimistic latency information
PM / Sleep: Unify diagnostic messages from device suspend/resume
PM / Domains: Make it possible to assign names to generic PM domains
PM / Domains: Fix default system suspend/resume operations
PM / Sleep: Simplify generic system suspend callbacks
PM / Sleep: Merge internal functions in generic_ops.c
PM / Sleep: Make pm_op() and pm_noirq_op() return callback pointers
PM: Run the driver callback directly if the subsystem one is not there
PM / Sleep: Remove forward-only callbacks from platform bus type
PM / Sleep: Remove forward-only callbacks from AMBA bus type
PM: Drop generic_subsys_pm_ops
PM / shmobile: Don't include SH7372's INTCS in syscore suspend/resume
PM / shmobile: Remove the stay_on flag from SH7372's PM domains
PM / QoS: Introduce dev_pm_qos_add_ancestor_request()
PM / input / touchscreen: Make st1232 use device PM QoS constraints
PM / shmobile: Allow the A4R domain to be turned off at run time
Srivatsa S. Bhat (15):
PM: Fix indentation and remove extraneous whitespaces in kernel/power/main.c
PM / Memory-hotplug: Avoid task freezing failures
PM / Hibernate: Refactor and simplify hibernation_snapshot() code
PM / Usermodehelper: Cleanup remnants of usermodehelper_pm_callback()
PM / Hibernate: Enable usermodehelpers in software_resume() error path
PM / Hibernate: Thaw processes in SNAPSHOT_CREATE_IMAGE ioctl test path
PM / Hibernate: Remove deprecated hibernation test modes
PM / Hibernate: Replace unintuitive 'if' condition in kernel/power/user.c with 'else'
PM / Freezer: Remove the "userspace only" constraint from freezer[_do_not]_count()
PM / Sleep: Use the freezer_count() functions in [un]lock_system_sleep() APIs
PM / Sleep: Make [un]lock_system_sleep() generic
PM / Sleep: Replace mutex_[un]lock(&pm_mutex) with [un]lock_system_sleep()
PM / Sleep: Recommend [un]lock_system_sleep() over using pm_mutex directly
PM / Sleep: Fix freezer failures due to racy usermodehelper_is_disabled()
PM / Hibernate: Remove deprecated hibernation snapshot ioctls
Stephen Rothwell (1):
Freezer: fix more fallout from the thaw_process rename
Tejun Heo (23):
freezer: fix current->state restoration race in refrigerator()
freezer: don't unnecessarily set PF_NOFREEZE explicitly
freezer: unexport refrigerator() and update try_to_freeze() slightly
freezer: implement and use kthread_freezable_should_stop()
freezer: rename thaw_process() to __thaw_task() and simplify the implementation
freezer: remove racy clear_freeze_flag() and set PF_NOFREEZE on dead tasks
freezer: don't distinguish nosig tasks on thaw
freezer: use dedicated lock instead of task_lock() + memory barrier
freezer: make freezing indicate freeze condition in effect
freezer: test freezable conditions while holding freezer_lock
freezer: kill PF_FREEZING
freezer: clean up freeze_processes() failure path
cgroup_freezer: prepare for removal of TIF_FREEZE
freezer: make freezing() test freeze conditions in effect instead of TIF_FREEZE
freezer: remove now unused TIF_FREEZE
freezer: remove should_send_signal() and update frozen()
freezer: fix set_freezable[_with_signal]() race
freezer: restructure __refrigerator()
freezer: use lock_task_sighand() in fake_signal_wake_up()
freezer: remove unused @sig_only from freeze_task()
usb_storage: don't use set_freezable_with_signal()
dmatest: don't use set_freezable_with_signal()
freezer: kill unused set_freezable_with_signal()
^ permalink raw reply
* [PATCH] mmc: tmio_mmc: fix card eject during IO with DMA
From: Guennadi Liakhovetski @ 2012-01-06 12:06 UTC (permalink / raw)
To: linux-mmc; +Cc: linux-sh, Magnus Damm, Chris Ball
When DMA is in use and the card is ejected during IO, DMA transfers have to
be terminated, otherwise the dmaengine driver fails to operate properly,
when the card is re-inserted.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
---
This goes on top of all my recent tmio_mmc patches. Even if some of them
will require some minor changes, this one, probably, will still have a
good chance to apply:-)
drivers/mmc/host/tmio_mmc.h | 7 ++++++-
drivers/mmc/host/tmio_mmc_dma.c | 12 ++++++++++++
drivers/mmc/host/tmio_mmc_pio.c | 6 +++++-
3 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
index 62d0d14..d857f5c 100644
--- a/drivers/mmc/host/tmio_mmc.h
+++ b/drivers/mmc/host/tmio_mmc.h
@@ -20,8 +20,8 @@
#include <linux/mmc/tmio.h>
#include <linux/mutex.h>
#include <linux/pagemap.h>
-#include <linux/spinlock.h>
#include <linux/scatterlist.h>
+#include <linux/spinlock.h>
/* Definitions for values the CTRL_SDIO_STATUS register can take. */
#define TMIO_SDIO_STAT_IOIRQ 0x0001
@@ -119,6 +119,7 @@ void tmio_mmc_start_dma(struct tmio_mmc_host *host, struct mmc_data *data);
void tmio_mmc_enable_dma(struct tmio_mmc_host *host, bool enable);
void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdata);
void tmio_mmc_release_dma(struct tmio_mmc_host *host);
+void tmio_mmc_abort_dma(struct tmio_mmc_host *host);
#else
static inline void tmio_mmc_start_dma(struct tmio_mmc_host *host,
struct mmc_data *data)
@@ -139,6 +140,10 @@ static inline void tmio_mmc_request_dma(struct tmio_mmc_host *host,
static inline void tmio_mmc_release_dma(struct tmio_mmc_host *host)
{
}
+
+static inline void tmio_mmc_abort_dma(struct tmio_mmc_host *host)
+{
+}
#endif
#ifdef CONFIG_PM
diff --git a/drivers/mmc/host/tmio_mmc_dma.c b/drivers/mmc/host/tmio_mmc_dma.c
index 86f259c..756759b 100644
--- a/drivers/mmc/host/tmio_mmc_dma.c
+++ b/drivers/mmc/host/tmio_mmc_dma.c
@@ -34,6 +34,18 @@ void tmio_mmc_enable_dma(struct tmio_mmc_host *host, bool enable)
#endif
}
+void tmio_mmc_abort_dma(struct tmio_mmc_host *host)
+{
+ tmio_mmc_enable_dma(host, false);
+
+ if (host->chan_rx)
+ dmaengine_terminate_all(host->chan_rx);
+ if (host->chan_tx)
+ dmaengine_terminate_all(host->chan_tx);
+
+ tmio_mmc_enable_dma(host, true);
+}
+
static void tmio_mmc_start_dma_rx(struct tmio_mmc_host *host)
{
struct scatterlist *sg = host->sg_ptr, *sg_tmp;
diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
index f68e6f3..7c4378f 100644
--- a/drivers/mmc/host/tmio_mmc_pio.c
+++ b/drivers/mmc/host/tmio_mmc_pio.c
@@ -42,8 +42,8 @@
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/scatterlist.h>
-#include <linux/workqueue.h>
#include <linux/spinlock.h>
+#include <linux/workqueue.h>
#include "tmio_mmc.h"
@@ -245,6 +245,7 @@ static void tmio_mmc_reset_work(struct work_struct *work)
/* Ready for new calls */
host->mrq = NULL;
+ tmio_mmc_abort_dma(host);
mmc_request_done(host->mmc, mrq);
}
@@ -271,6 +272,9 @@ static void tmio_mmc_finish_request(struct tmio_mmc_host *host)
host->mrq = NULL;
spin_unlock_irqrestore(&host->lock, flags);
+ if (mrq->cmd->error || (mrq->data && mrq->data->error))
+ tmio_mmc_abort_dma(host);
+
mmc_request_done(host->mmc, mrq);
}
--
1.7.2.5
^ permalink raw reply related
* [PATCH] mmc: sh_mobile_sdhi: add a callback for board specific init code
From: Bastian Hecht @ 2012-01-06 10:39 UTC (permalink / raw)
To: linux-mmc
Cc: Guennadi Liakhovetski, Magnus Damm, Chris Ball, linux-sh,
Bastian Hecht
Some boards need a preliminary setup stage to prepare the sdhi
controller.
---
drivers/mmc/host/sh_mobile_sdhi.c | 13 +++++++++++++
include/linux/mmc/sh_mobile_sdhi.h | 4 ++++
2 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
index 0df69ab..1da31a4 100644
--- a/drivers/mmc/host/sh_mobile_sdhi.c
+++ b/drivers/mmc/host/sh_mobile_sdhi.c
@@ -109,6 +109,12 @@ static int __devinit sh_mobile_sdhi_probe(struct platform_device *pdev)
mmc_data = &priv->mmc_data;
p->pdata = mmc_data;
+ if (p->init) {
+ ret = p->init(pdev);
+ if (ret)
+ goto einit;
+ }
+
snprintf(clk_name, sizeof(clk_name), "sdhi%d", pdev->id);
priv->clk = clk_get(&pdev->dev, clk_name);
if (IS_ERR(priv->clk)) {
@@ -242,6 +248,9 @@ eprobe:
#endif
clk_put(priv->clk);
eclkget:
+ if (p->cleanup)
+ p->cleanup(pdev);
+einit:
kfree(priv);
return ret;
}
@@ -269,6 +278,10 @@ static int sh_mobile_sdhi_remove(struct platform_device *pdev)
clk_disable(priv->clk);
#endif
clk_put(priv->clk);
+
+ if (p->cleanup)
+ p->cleanup(pdev);
+
kfree(priv);
return 0;
diff --git a/include/linux/mmc/sh_mobile_sdhi.h b/include/linux/mmc/sh_mobile_sdhi.h
index 86347f6..9cad001 100644
--- a/include/linux/mmc/sh_mobile_sdhi.h
+++ b/include/linux/mmc/sh_mobile_sdhi.h
@@ -22,6 +22,10 @@ struct sh_mobile_sdhi_info {
struct tmio_mmc_data *pdata;
void (*set_pwr)(struct platform_device *pdev, int state);
int (*get_cd)(struct platform_device *pdev);
+
+ /* callbacks for board specific setup code */
+ int (*init)(struct platform_device *pdev);
+ void (*cleanup)(struct platform_device *pdev);
};
#endif /* LINUX_MMC_SH_MOBILE_SDHI_H */
--
1.7.5.4
^ permalink raw reply related
* Re: [PATCH 02/11] mmc: tmio_mmc: support the generic MMC GPIO card
From: Guennadi Liakhovetski @ 2012-01-06 8:34 UTC (permalink / raw)
To: Magnus Damm
Cc: linux-mmc, Chris Ball, Paul Mundt, linux-sh, Rafael J. Wysocki,
Samuel Ortiz
In-Reply-To: <CANqRtoTLh2i9s6F_g10+RPnDvA+RkpVYqaYb6-Z=8dvk_YyGYw@mail.gmail.com>
Hi Magnus
Thanks for your review(s)!
On Fri, 6 Jan 2012, Magnus Damm wrote:
> On Wed, Jan 4, 2012 at 11:17 PM, Guennadi Liakhovetski
> <g.liakhovetski@gmx.de> wrote:
> > If the platform specified a GPIO number and IRQ trigger polarity flags, use
> > the generic MMC GPIO card hotplug helper.
> >
> > Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> > ---
> > drivers/mmc/host/tmio_mmc.h | 4 --
> > drivers/mmc/host/tmio_mmc_pio.c | 69 +++++++++++++++++----------------------
> > include/linux/mfd/tmio.h | 19 +++++++---
> > 3 files changed, 43 insertions(+), 49 deletions(-)
> > diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
> > index 0dc9804..4ef9307 100644
> > --- a/include/linux/mfd/tmio.h
> > +++ b/include/linux/mfd/tmio.h
> > @@ -1,8 +1,10 @@
> > #ifndef MFD_TMIO_H
> > #define MFD_TMIO_H
> >
> > +#include <linux/device.h>
> > #include <linux/fb.h>
> > #include <linux/io.h>
> > +#include <linux/jiffies.h>
> > #include <linux/platform_device.h>
> > #include <linux/pm_runtime.h>
> >
> > @@ -64,8 +66,8 @@
> > #define TMIO_MMC_SDIO_IRQ (1 << 2)
> > /*
> > * Some platforms can detect card insertion events with controller powered
> > - * down, in which case they have to call tmio_mmc_cd_wakeup() to power up the
> > - * controller and report the event to the driver.
> > + * down, using a GPIO IRQ, in which case they have to fill in cd_irq, cd_gpio,
> > + * and cd_flags fields of struct tmio_mmc_data.
> > */
> > #define TMIO_MMC_HAS_COLD_CD (1 << 3)
> > /*
> > @@ -98,18 +100,23 @@ struct tmio_mmc_data {
> > struct tmio_mmc_dma *dma;
> > struct device *dev;
> > bool power;
> > + unsigned int cd_gpio;
> > + unsigned int cd_irq;
> > + unsigned long cd_flags;
> > void (*set_pwr)(struct platform_device *host, int state);
> > void (*set_clk_div)(struct platform_device *host, int state);
> > int (*get_cd)(struct platform_device *host);
> > int (*write16_hook)(struct tmio_mmc_host *host, int addr);
> > };
>
> This looks much easier than callbacks and notifiers. Thanks!
>
> But why do you need to pass three values here? I expected it to be
> sufficient with GPIO and perhaps also with trigger flags. Shouldn't
> gpio_to_irq() give you the IRQ from the GPIO?
Well, it could:-) What about sh7372? sh73a0 does implement it, whereas
sh7372 only returns an error. And - yes, we can fix that one. But this
tells me - there can be other platforms like that, and they might not get
fixed quickly enough. Should we really refuse to work with them? We could
make this parameter optional: set to to an error code and the cd-gpio will
try to use gpio_to_irq(). If it fails - no luck.
> And why on earth would
> we want to trigger on something else than both edges?
Both edges seems like a logical choice to me too. But - remember the time,
when one of sh-mobile platforms didn't implement triggering on both edges?
Until we've implemented a software workaround, whereby we switch to the
opposite edge after each interrupt? Are you sure there are no such
platforms around left?
> The SoC code may me rather limited in terms of supporting
> gpio_to_irq() but that needs to be fixed then. On SH-Mobile the PFC
> code has been updated to allow this, so it's only SoC-specific code
> missing. Anyone with access to hardware and data sheet can do this,
> and if there are some issues with this then I'd be happy to help
> myself.
>
> On the cosmetic side, wouldn't it make sense to have a structure of
> these values and just pass that along? Otherwise people will mix and
> match short and ints for the GPIO and it may become rather messy over
> time.
Short for GPIO? Why would anyone use that and how can that become
messy?:-) In principle - I'm basically fine either way. If you really
prefer a struct here - we can do that too, yes.
Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
^ permalink raw reply
* Re: [PATCH 09/11] mmc: sh_mobile_sdhi: do not manage PM clocks
From: Guennadi Liakhovetski @ 2012-01-06 8:21 UTC (permalink / raw)
To: Magnus Damm
Cc: linux-mmc, Chris Ball, Paul Mundt, linux-sh, Rafael J. Wysocki,
Samuel Ortiz
In-Reply-To: <CANqRtoRqSFMmC4VySM-Aczd7AFxZrC8nzjPwaffa+=3VtWZK0g@mail.gmail.com>
On Fri, 6 Jan 2012, Magnus Damm wrote:
> Hi Guennadi,
>
> On Wed, Jan 4, 2012 at 11:17 PM, Guennadi Liakhovetski
> <g.liakhovetski@gmx.de> wrote:
> > On ARM the same clock is used by the PM subsystem and by the driver
> > directly. This leads to the clock staying permanently on, independent of
> > the runtime PM state. This patch makes clock enable and disable calls in
> > the driver SuperH-specific.
> >
> > Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> > ---
> > drivers/mmc/host/sh_mobile_sdhi.c | 6 ++++++
> > 1 files changed, 6 insertions(+), 0 deletions(-)
>
> Thanks for your patch.
>
> >From my point of view there is very little difference between SH and
> SH-Mobile ARM, so I don't understand the special treatment. Also, is
> this change really needed for SH with your recent Runtime PM patches?
I didn't try SuperH. I seem to remember, there were 2 clocks per SDHI
controller on some platforms, of which one was handled by runtime PM and
the other one directly. However, a quick look through SDHI users didn't
reveal any such cases, so, maybe I'm confusing SDHI with some other
hardware block. In that case - yes, I'd gladly remove that handling
completely!
> I believe we need to make use of the clock framework to get the clock
> rate configuration in the SDHI driver. At the same time we want to
> stop the clock as frequently as possible. I believe we should disable
> and enable the clock together with the Runtime PM get/put operations -
> pretty much exactly like our I2C master driver does. The only problem
> is, while the clock is disabled the clock rate may be changed. So we
> need to be able to notify the MMC subsystem about the new clock rate.
>
> Any ideas on how to make this happen?
Huh, if that's really possible... I'll have a look at that.
Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
^ permalink raw reply
* Re: [PATCH 0/2] dma: shdma: clear buffers on reset
From: Vinod Koul @ 2012-01-06 6:23 UTC (permalink / raw)
To: Guennadi Liakhovetski
Cc: linux-kernel, linux-sh, linux-pm, Rafael J. Wysocki, Magnus Damm
In-Reply-To: <Pine.LNX.4.64.1201041528570.30506@axis700.grange>
On Wed, 2012-01-04 at 15:34 +0100, Guennadi Liakhovetski wrote:
> This patch set fixes a runtime PM problem on shdma, whereby it fails to
> recover after the power domain has been switched off.
>
Both applied, thanks
--
~Vinod
^ permalink raw reply
* Re: [RFC][PATCH 1/3] dmaengine: shdma: add .no_error_irq flag
From: Shimoda, Yoshihiro @ 2012-01-06 4:00 UTC (permalink / raw)
To: linux-sh
In-Reply-To: <4F0537F2.4080306@renesas.com>
Hello Guennadi-san,
Thank you very much for your review and suggestion.
I think that your suggestion is very good.
So, I could remove the no_error_irq flag using platform_get_irq_byname().
My modified patch is the following. And, if it is no problem,
I will submit it again:
-------
Subject: [PATCH] dmaengine: shdma: modify the DMAC Address Error registration
The USB-DMAC/SUDMAC don't have the interrupt of DMAC Address Error.
So, only when the resource has a name and it is "error_irq", the driver
calls request_irq() for DMAC Address Error.
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
drivers/dma/shdma.c | 70 ++++++++++++++++++++++++++++----------------------
1 files changed, 39 insertions(+), 31 deletions(-)
diff --git a/drivers/dma/shdma.c b/drivers/dma/shdma.c
index f427804..9916e54 100644
--- a/drivers/dma/shdma.c
+++ b/drivers/dma/shdma.c
@@ -1233,10 +1233,10 @@ static int __init sh_dmae_probe(struct platform_device *pdev)
struct sh_dmae_pdata *pdata = pdev->dev.platform_data;
unsigned long irqflags = IRQF_DISABLED,
chan_flag[SH_DMAC_MAX_CHANNELS] = {};
- int errirq, chan_irq[SH_DMAC_MAX_CHANNELS];
+ int errirq = 0, chan_irq[SH_DMAC_MAX_CHANNELS];
int err, i, irq_cnt = 0, irqres = 0, irq_cap = 0;
struct sh_dmae_device *shdev;
- struct resource *chan, *dmars, *errirq_res, *chanirq_res;
+ struct resource *chan, *dmars, *errirq_res, *irq_res, *chanirq_res;
/* get platform data */
if (!pdata || !pdata->channel_num)
@@ -1261,8 +1261,8 @@ static int __init sh_dmae_probe(struct platform_device *pdev)
* specify IORESOURCE_IRQ_SHAREABLE in their resources, they will be
* requested with the IRQF_SHARED flag
*/
- errirq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
- if (!chan || !errirq_res)
+ irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
+ if (!chan || !irq_res)
return -ENODEV;
if (!request_mem_region(chan->start, resource_size(chan), pdev->name)) {
@@ -1341,30 +1341,36 @@ static int __init sh_dmae_probe(struct platform_device *pdev)
shdev->common.copy_align = LOG2_DEFAULT_XFER_SIZE;
#if defined(CONFIG_CPU_SH4) || defined(CONFIG_ARCH_SHMOBILE)
- chanirq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 1);
-
- if (!chanirq_res)
- chanirq_res = errirq_res;
- else
- irqres++;
-
- if (chanirq_res = errirq_res ||
- (errirq_res->flags & IORESOURCE_BITS) = IORESOURCE_IRQ_SHAREABLE)
- irqflags = IRQF_SHARED;
-
- errirq = errirq_res->start;
-
- err = request_irq(errirq, sh_dmae_err, irqflags,
- "DMAC Address Error", shdev);
- if (err) {
- dev_err(&pdev->dev,
- "DMA failed requesting irq #%d, error %d\n",
- errirq, err);
- goto eirq_err;
+ errirq_res = platform_get_resource_byname(pdev, IORESOURCE_IRQ,
+ "error_irq");
+ if (errirq_res) {
+ chanirq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 1);
+
+ if (!chanirq_res)
+ chanirq_res = errirq_res;
+ else
+ irqres++;
+
+ if (chanirq_res = errirq_res ||
+ (errirq_res->flags & IORESOURCE_BITS) =
+ IORESOURCE_IRQ_SHAREABLE)
+ irqflags = IRQF_SHARED;
+
+ errirq = errirq_res->start;
+
+ err = request_irq(errirq, sh_dmae_err, irqflags,
+ "DMAC Address Error", shdev);
+ if (err) {
+ dev_err(&pdev->dev,
+ "DMA failed requesting irq #%d, error %d\n",
+ errirq, err);
+ goto eirq_err;
+ }
+ } else {
+ chanirq_res = irq_res;
}
-
#else
- chanirq_res = errirq_res;
+ chanirq_res = irq_res;
#endif /* CONFIG_CPU_SH4 || CONFIG_ARCH_SHMOBILE */
if (chanirq_res->start = chanirq_res->end &&
@@ -1387,7 +1393,7 @@ static int __init sh_dmae_probe(struct platform_device *pdev)
break;
}
- if ((errirq_res->flags & IORESOURCE_BITS) =
+ if ((irq_res->flags & IORESOURCE_BITS) =
IORESOURCE_IRQ_SHAREABLE)
chan_flag[irq_cnt] = IRQF_SHARED;
else
@@ -1428,7 +1434,8 @@ chan_probe_err:
sh_dmae_chan_remove(shdev);
#if defined(CONFIG_CPU_SH4) || defined(CONFIG_ARCH_SHMOBILE)
- free_irq(errirq, shdev);
+ if (errirq_res)
+ free_irq(errirq, shdev);
eirq_err:
#endif
rst_err:
@@ -1461,12 +1468,13 @@ static int __exit sh_dmae_remove(struct platform_device *pdev)
{
struct sh_dmae_device *shdev = platform_get_drvdata(pdev);
struct resource *res;
- int errirq = platform_get_irq(pdev, 0);
+ struct resource *errirq_res = platform_get_resource_byname(pdev,
+ IORESOURCE_IRQ, "error_irq");
dma_async_device_unregister(&shdev->common);
- if (errirq > 0)
- free_irq(errirq, shdev);
+ if (errirq_res)
+ free_irq(errirq_res->start, shdev);
spin_lock_irq(&sh_dmae_lock);
list_del_rcu(&shdev->node);
--
Best regards,
Yoshihiro Shimoda
2012/01/05 18:01, Guennadi Liakhovetski wrote:
> Hello Shimoda-san
>
> Thank you for your patch! Yes, it is good to have shdma handle different
> DMAC types, e.g., those without an error IRQ. However, looking at your
> patch I came up with an idea: I think, the resources themselves provide
> enough information to decide, which interrupts are present and which are
> not. How about using platform_get_irq_byname() and making the error
> interrupt optional? This would eliminate the need for the .no_error_irq
> flag. What do you think?
>
> Thanks
> Guennadi
>
> On Thu, 5 Jan 2012, Shimoda, Yoshihiro wrote:
>
>> The USB-DMAC/SUDMAC don't have the interrupt of DMAC Address Error.
>> So, this patch adds the .no_error_irq flag.
>>
>> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
>> ---
>> drivers/dma/shdma.c | 50 ++++++++++++++++++++++++++---------------------
>> include/linux/sh_dma.h | 1 +
>> 2 files changed, 29 insertions(+), 22 deletions(-)
>>
>> diff --git a/drivers/dma/shdma.c b/drivers/dma/shdma.c
>> index 81809c2..97f7d24 100644
>> --- a/drivers/dma/shdma.c
>> +++ b/drivers/dma/shdma.c
>> @@ -1151,7 +1151,7 @@ static int __init sh_dmae_probe(struct platform_device *pdev)
>> struct sh_dmae_pdata *pdata = pdev->dev.platform_data;
>> unsigned long irqflags = IRQF_DISABLED,
>> chan_flag[SH_DMAC_MAX_CHANNELS] = {};
>> - int errirq, chan_irq[SH_DMAC_MAX_CHANNELS];
>> + int errirq = 0, chan_irq[SH_DMAC_MAX_CHANNELS];
>> int err, i, irq_cnt = 0, irqres = 0, irq_cap = 0;
>> struct sh_dmae_device *shdev;
>> struct resource *chan, *dmars, *errirq_res, *chanirq_res;
>> @@ -1259,26 +1259,31 @@ static int __init sh_dmae_probe(struct platform_device *pdev)
>> shdev->common.copy_align = LOG2_DEFAULT_XFER_SIZE;
>>
>> #if defined(CONFIG_CPU_SH4) || defined(CONFIG_ARCH_SHMOBILE)
>> - chanirq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 1);
>> -
>> - if (!chanirq_res)
>> + if (pdata->no_error_irq) {
>> chanirq_res = errirq_res;
>> - else
>> - irqres++;
>> -
>> - if (chanirq_res = errirq_res ||
>> - (errirq_res->flags & IORESOURCE_BITS) = IORESOURCE_IRQ_SHAREABLE)
>> - irqflags = IRQF_SHARED;
>> -
>> - errirq = errirq_res->start;
>> -
>> - err = request_irq(errirq, sh_dmae_err, irqflags,
>> - "DMAC Address Error", shdev);
>> - if (err) {
>> - dev_err(&pdev->dev,
>> - "DMA failed requesting irq #%d, error %d\n",
>> - errirq, err);
>> - goto eirq_err;
>> + } else {
>> + chanirq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 1);
>> +
>> + if (!chanirq_res)
>> + chanirq_res = errirq_res;
>> + else
>> + irqres++;
>> +
>> + if (chanirq_res = errirq_res ||
>> + (errirq_res->flags & IORESOURCE_BITS) =
>> + IORESOURCE_IRQ_SHAREABLE)
>> + irqflags = IRQF_SHARED;
>> +
>> + errirq = errirq_res->start;
>> +
>> + err = request_irq(errirq, sh_dmae_err, irqflags,
>> + "DMAC Address Error", shdev);
>> + if (err) {
>> + dev_err(&pdev->dev,
>> + "DMA failed requesting irq #%d, error %d\n",
>> + errirq, err);
>> + goto eirq_err;
>> + }
>> }
>>
>> #else
>> @@ -1346,7 +1351,8 @@ chan_probe_err:
>> sh_dmae_chan_remove(shdev);
>>
>> #if defined(CONFIG_CPU_SH4) || defined(CONFIG_ARCH_SHMOBILE)
>> - free_irq(errirq, shdev);
>> + if (!pdata->no_error_irq)
>> + free_irq(errirq, shdev);
>> eirq_err:
>> #endif
>> rst_err:
>> @@ -1383,7 +1389,7 @@ static int __exit sh_dmae_remove(struct platform_device *pdev)
>>
>> dma_async_device_unregister(&shdev->common);
>>
>> - if (errirq > 0)
>> + if (!shdev->pdata->no_error_irq && errirq > 0)
>> free_irq(errirq, shdev);
>>
>> spin_lock_irq(&sh_dmae_lock);
>> diff --git a/include/linux/sh_dma.h b/include/linux/sh_dma.h
>> index cb2dd11..b638f42 100644
>> --- a/include/linux/sh_dma.h
>> +++ b/include/linux/sh_dma.h
>> @@ -68,6 +68,7 @@ struct sh_dmae_pdata {
>> unsigned int dmaor_is_32bit:1;
>> unsigned int needs_tend_set:1;
>> unsigned int no_dmars:1;
>> + unsigned int no_error_irq:1;
>> };
>>
>> /* DMA register */
>> --
>> 1.7.1
>>
>
> ---
> Guennadi Liakhovetski, Ph.D.
> Freelance Open-Source Software Developer
> http://www.open-technology.de/
>
--
Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
EC No.
^ permalink raw reply related
* Re: [PATCH 02/11] mmc: tmio_mmc: support the generic MMC GPIO card
From: Magnus Damm @ 2012-01-06 3:01 UTC (permalink / raw)
To: Guennadi Liakhovetski
Cc: linux-mmc, Chris Ball, Paul Mundt, linux-sh, Rafael J. Wysocki,
Samuel Ortiz
In-Reply-To: <1325686636-23905-3-git-send-email-g.liakhovetski@gmx.de>
On Wed, Jan 4, 2012 at 11:17 PM, Guennadi Liakhovetski
<g.liakhovetski@gmx.de> wrote:
> If the platform specified a GPIO number and IRQ trigger polarity flags, use
> the generic MMC GPIO card hotplug helper.
>
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> ---
> drivers/mmc/host/tmio_mmc.h | 4 --
> drivers/mmc/host/tmio_mmc_pio.c | 69 +++++++++++++++++----------------------
> include/linux/mfd/tmio.h | 19 +++++++---
> 3 files changed, 43 insertions(+), 49 deletions(-)
> diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
> index 0dc9804..4ef9307 100644
> --- a/include/linux/mfd/tmio.h
> +++ b/include/linux/mfd/tmio.h
> @@ -1,8 +1,10 @@
> #ifndef MFD_TMIO_H
> #define MFD_TMIO_H
>
> +#include <linux/device.h>
> #include <linux/fb.h>
> #include <linux/io.h>
> +#include <linux/jiffies.h>
> #include <linux/platform_device.h>
> #include <linux/pm_runtime.h>
>
> @@ -64,8 +66,8 @@
> #define TMIO_MMC_SDIO_IRQ (1 << 2)
> /*
> * Some platforms can detect card insertion events with controller powered
> - * down, in which case they have to call tmio_mmc_cd_wakeup() to power up the
> - * controller and report the event to the driver.
> + * down, using a GPIO IRQ, in which case they have to fill in cd_irq, cd_gpio,
> + * and cd_flags fields of struct tmio_mmc_data.
> */
> #define TMIO_MMC_HAS_COLD_CD (1 << 3)
> /*
> @@ -98,18 +100,23 @@ struct tmio_mmc_data {
> struct tmio_mmc_dma *dma;
> struct device *dev;
> bool power;
> + unsigned int cd_gpio;
> + unsigned int cd_irq;
> + unsigned long cd_flags;
> void (*set_pwr)(struct platform_device *host, int state);
> void (*set_clk_div)(struct platform_device *host, int state);
> int (*get_cd)(struct platform_device *host);
> int (*write16_hook)(struct tmio_mmc_host *host, int addr);
> };
This looks much easier than callbacks and notifiers. Thanks!
But why do you need to pass three values here? I expected it to be
sufficient with GPIO and perhaps also with trigger flags. Shouldn't
gpio_to_irq() give you the IRQ from the GPIO? And why on earth would
we want to trigger on something else than both edges?
The SoC code may me rather limited in terms of supporting
gpio_to_irq() but that needs to be fixed then. On SH-Mobile the PFC
code has been updated to allow this, so it's only SoC-specific code
missing. Anyone with access to hardware and data sheet can do this,
and if there are some issues with this then I'd be happy to help
myself.
On the cosmetic side, wouldn't it make sense to have a structure of
these values and just pass that along? Otherwise people will mix and
match short and ints for the GPIO and it may become rather messy over
time.
Thanks,
/ magnus
^ permalink raw reply
* Re: [PATCH 06/11] mfd: tmio: remove now unneeded tmio_mmc_cd_wakeup()
From: Magnus Damm @ 2012-01-06 2:53 UTC (permalink / raw)
To: Guennadi Liakhovetski
Cc: linux-mmc, Chris Ball, Paul Mundt, linux-sh, Rafael J. Wysocki,
Samuel Ortiz
In-Reply-To: <1325686636-23905-7-git-send-email-g.liakhovetski@gmx.de>
On Wed, Jan 4, 2012 at 11:17 PM, Guennadi Liakhovetski
<g.liakhovetski@gmx.de> wrote:
> Now, that all users of tmio_mmc_cd_wakeup() have been converted over to
> drivers/mmc/core/cd-gpio.c, that function can be removed.
>
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> ---
> include/linux/mfd/tmio.h | 11 -----------
> 1 files changed, 0 insertions(+), 11 deletions(-)
>
> diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
> index 4ef9307..08fb7d2 100644
> --- a/include/linux/mfd/tmio.h
> +++ b/include/linux/mfd/tmio.h
> @@ -4,7 +4,6 @@
> #include <linux/device.h>
> #include <linux/fb.h>
> #include <linux/io.h>
> -#include <linux/jiffies.h>
> #include <linux/platform_device.h>
> #include <linux/pm_runtime.h>
>
> @@ -110,16 +109,6 @@ struct tmio_mmc_data {
> };
>
> /*
> - * This function is deprecated and will be removed soon. Please, convert your
> - * platform to use drivers/mmc/core/cd-gpio.c
> - */
> -static inline void tmio_mmc_cd_wakeup(struct tmio_mmc_data *pdata)
> -{
> - if (pdata)
> - mmc_detect_change(dev_get_drvdata(dev), msecs_to_jiffies(100));
> -}
> -
> -/*
Ok, I can clearly see the merit of removing unused code. And I do
appreciate that you clean up the code. Thank you!
The only issue is that we do however have tons of users of the SDHI
driver (just grep in arch/arm/mach-shmobile and in arch/sh) and many
of them can use other pins than the SDHI CD function for hotplug
detection. To support such configurations we need to have some way to
notify the driver instance about the hotplug change. This patch is
removing just that.
I do realize that you recently posted some generic MMC GPIO hotplug
patches, and I am happy that you agreed with me that it is better to
put it in the generic MMC core than pushing it in the SDHI or MMCIF
driver. So this development seems like a perfect fit for both the SDHI
driver and the MMCIF driver.
I'd like to see platforms move over to your MMC GPIO hotplug helpers,
but at the same time I want to keep the existing notification method
to make a smooth transition. I personally added GPIO IRQ support
rather recently to SH Mobile ARM, but it is still rather early and we
do not have many users yet. I have seen customer-specific hardware
designs using non-GPIO pins for CD handling too, and to support such
hardware we want to keep flexible notification methods. So with that
in mind I'd like to keep the options open and allow fully developed
platforms to use your MMC GPIO hotplug code, but also allow custom
platforms and boards/SoCs with more limited software support handle
hotplug notification the old way.
So please don't remove this function at this point. Give us time to move over.
Thanks,
/ magnus
^ permalink raw reply
* Re: [PATCH 09/11] mmc: sh_mobile_sdhi: do not manage PM clocks
From: Magnus Damm @ 2012-01-06 2:40 UTC (permalink / raw)
To: Guennadi Liakhovetski
Cc: linux-mmc, Chris Ball, Paul Mundt, linux-sh, Rafael J. Wysocki,
Samuel Ortiz
In-Reply-To: <1325686636-23905-10-git-send-email-g.liakhovetski@gmx.de>
Hi Guennadi,
On Wed, Jan 4, 2012 at 11:17 PM, Guennadi Liakhovetski
<g.liakhovetski@gmx.de> wrote:
> On ARM the same clock is used by the PM subsystem and by the driver
> directly. This leads to the clock staying permanently on, independent of
> the runtime PM state. This patch makes clock enable and disable calls in
> the driver SuperH-specific.
>
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> ---
> drivers/mmc/host/sh_mobile_sdhi.c | 6 ++++++
> 1 files changed, 6 insertions(+), 0 deletions(-)
Thanks for your patch.
From my point of view there is very little difference between SH and
SH-Mobile ARM, so I don't understand the special treatment. Also, is
this change really needed for SH with your recent Runtime PM patches?
I believe we need to make use of the clock framework to get the clock
rate configuration in the SDHI driver. At the same time we want to
stop the clock as frequently as possible. I believe we should disable
and enable the clock together with the Runtime PM get/put operations -
pretty much exactly like our I2C master driver does. The only problem
is, while the clock is disabled the clock rate may be changed. So we
need to be able to notify the MMC subsystem about the new clock rate.
Any ideas on how to make this happen?
Thanks,
/ magnus
^ permalink raw reply
* Re: [PATCH 06/11] mfd: tmio: remove now unneeded tmio_mmc_cd_wakeup()
From: Samuel Ortiz @ 2012-01-05 11:53 UTC (permalink / raw)
To: Guennadi Liakhovetski
Cc: linux-mmc, Chris Ball, Paul Mundt, Magnus Damm, linux-sh,
Rafael J. Wysocki
In-Reply-To: <1325686636-23905-7-git-send-email-g.liakhovetski@gmx.de>
Hi Guennadi,
On Wed, Jan 04, 2012 at 03:17:11PM +0100, Guennadi Liakhovetski wrote:
> Now, that all users of tmio_mmc_cd_wakeup() have been converted over to
> drivers/mmc/core/cd-gpio.c, that function can be removed.
>
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: Samuel Ortiz <sameo@linux.intel.com>
Cheers,
Samuel.
--
Intel Open Source Technology Centre
http://oss.intel.com/
^ permalink raw reply
* Re: [RFC][PATCH 1/3] dmaengine: shdma: add .no_error_irq flag
From: Guennadi Liakhovetski @ 2012-01-05 9:01 UTC (permalink / raw)
To: linux-sh
In-Reply-To: <4F0537F2.4080306@renesas.com>
Hello Shimoda-san
Thank you for your patch! Yes, it is good to have shdma handle different
DMAC types, e.g., those without an error IRQ. However, looking at your
patch I came up with an idea: I think, the resources themselves provide
enough information to decide, which interrupts are present and which are
not. How about using platform_get_irq_byname() and making the error
interrupt optional? This would eliminate the need for the .no_error_irq
flag. What do you think?
Thanks
Guennadi
On Thu, 5 Jan 2012, Shimoda, Yoshihiro wrote:
> The USB-DMAC/SUDMAC don't have the interrupt of DMAC Address Error.
> So, this patch adds the .no_error_irq flag.
>
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> ---
> drivers/dma/shdma.c | 50 ++++++++++++++++++++++++++---------------------
> include/linux/sh_dma.h | 1 +
> 2 files changed, 29 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/dma/shdma.c b/drivers/dma/shdma.c
> index 81809c2..97f7d24 100644
> --- a/drivers/dma/shdma.c
> +++ b/drivers/dma/shdma.c
> @@ -1151,7 +1151,7 @@ static int __init sh_dmae_probe(struct platform_device *pdev)
> struct sh_dmae_pdata *pdata = pdev->dev.platform_data;
> unsigned long irqflags = IRQF_DISABLED,
> chan_flag[SH_DMAC_MAX_CHANNELS] = {};
> - int errirq, chan_irq[SH_DMAC_MAX_CHANNELS];
> + int errirq = 0, chan_irq[SH_DMAC_MAX_CHANNELS];
> int err, i, irq_cnt = 0, irqres = 0, irq_cap = 0;
> struct sh_dmae_device *shdev;
> struct resource *chan, *dmars, *errirq_res, *chanirq_res;
> @@ -1259,26 +1259,31 @@ static int __init sh_dmae_probe(struct platform_device *pdev)
> shdev->common.copy_align = LOG2_DEFAULT_XFER_SIZE;
>
> #if defined(CONFIG_CPU_SH4) || defined(CONFIG_ARCH_SHMOBILE)
> - chanirq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 1);
> -
> - if (!chanirq_res)
> + if (pdata->no_error_irq) {
> chanirq_res = errirq_res;
> - else
> - irqres++;
> -
> - if (chanirq_res = errirq_res ||
> - (errirq_res->flags & IORESOURCE_BITS) = IORESOURCE_IRQ_SHAREABLE)
> - irqflags = IRQF_SHARED;
> -
> - errirq = errirq_res->start;
> -
> - err = request_irq(errirq, sh_dmae_err, irqflags,
> - "DMAC Address Error", shdev);
> - if (err) {
> - dev_err(&pdev->dev,
> - "DMA failed requesting irq #%d, error %d\n",
> - errirq, err);
> - goto eirq_err;
> + } else {
> + chanirq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 1);
> +
> + if (!chanirq_res)
> + chanirq_res = errirq_res;
> + else
> + irqres++;
> +
> + if (chanirq_res = errirq_res ||
> + (errirq_res->flags & IORESOURCE_BITS) =
> + IORESOURCE_IRQ_SHAREABLE)
> + irqflags = IRQF_SHARED;
> +
> + errirq = errirq_res->start;
> +
> + err = request_irq(errirq, sh_dmae_err, irqflags,
> + "DMAC Address Error", shdev);
> + if (err) {
> + dev_err(&pdev->dev,
> + "DMA failed requesting irq #%d, error %d\n",
> + errirq, err);
> + goto eirq_err;
> + }
> }
>
> #else
> @@ -1346,7 +1351,8 @@ chan_probe_err:
> sh_dmae_chan_remove(shdev);
>
> #if defined(CONFIG_CPU_SH4) || defined(CONFIG_ARCH_SHMOBILE)
> - free_irq(errirq, shdev);
> + if (!pdata->no_error_irq)
> + free_irq(errirq, shdev);
> eirq_err:
> #endif
> rst_err:
> @@ -1383,7 +1389,7 @@ static int __exit sh_dmae_remove(struct platform_device *pdev)
>
> dma_async_device_unregister(&shdev->common);
>
> - if (errirq > 0)
> + if (!shdev->pdata->no_error_irq && errirq > 0)
> free_irq(errirq, shdev);
>
> spin_lock_irq(&sh_dmae_lock);
> diff --git a/include/linux/sh_dma.h b/include/linux/sh_dma.h
> index cb2dd11..b638f42 100644
> --- a/include/linux/sh_dma.h
> +++ b/include/linux/sh_dma.h
> @@ -68,6 +68,7 @@ struct sh_dmae_pdata {
> unsigned int dmaor_is_32bit:1;
> unsigned int needs_tend_set:1;
> unsigned int no_dmars:1;
> + unsigned int no_error_irq:1;
> };
>
> /* DMA register */
> --
> 1.7.1
>
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
^ permalink raw reply
* [PATCH v2 2/2] usb: renesas_usbhs: add support for SUDMAC
From: Shimoda, Yoshihiro @ 2012-01-05 6:37 UTC (permalink / raw)
To: linux-sh
The SUDMAC uses 8-bit width only. So, when the driver uses SUDMAC,
we have to clear the MBW_32.
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
about v2:
- No change
drivers/usb/renesas_usbhs/fifo.c | 6 +++++-
include/linux/usb/renesas_usbhs.h | 1 +
2 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c
index ffdf5d1..918a1da 100644
--- a/drivers/usb/renesas_usbhs/fifo.c
+++ b/drivers/usb/renesas_usbhs/fifo.c
@@ -23,6 +23,7 @@
#define usbhsf_get_cfifo(p) (&((p)->fifo_info.cfifo))
#define usbhsf_get_d0fifo(p) (&((p)->fifo_info.d0fifo))
#define usbhsf_get_d1fifo(p) (&((p)->fifo_info.d1fifo))
+#define usbhsf_is_cfifo(p, f) (usbhsf_get_cfifo(p) = f)
#define usbhsf_fifo_is_busy(f) ((f)->pipe) /* see usbhs_pipe_select_fifo */
@@ -304,7 +305,10 @@ static int usbhsf_fifo_select(struct usbhs_pipe *pipe,
}
/* "base" will be used below */
- usbhs_write(priv, fifo->sel, base | MBW_32);
+ if (usbhs_get_dparam(priv, has_sudmac) && !usbhsf_is_cfifo(priv, fifo))
+ usbhs_write(priv, fifo->sel, base);
+ else
+ usbhs_write(priv, fifo->sel, base | MBW_32);
/* check ISEL and CURPIPE value */
while (timeout--) {
diff --git a/include/linux/usb/renesas_usbhs.h b/include/linux/usb/renesas_usbhs.h
index e5a40c3..f60db75 100644
--- a/include/linux/usb/renesas_usbhs.h
+++ b/include/linux/usb/renesas_usbhs.h
@@ -141,6 +141,7 @@ struct renesas_usbhs_driver_param {
* option:
*/
u32 has_otg:1; /* for controlling PWEN/EXTLP */
+ u32 has_sudmac:1; /* for SUDMAC */
};
/*
--
1.7.1
^ permalink raw reply related
* [PATCH v2 1/2] usb: renesas_usbhs: add IRQ resource decoding for
From: Shimoda, Yoshihiro @ 2012-01-05 6:37 UTC (permalink / raw)
To: linux-sh
In case of the SH7757, the irq number of USB module and SUDMAC
are the same. So, we have to set the IRQF_SHARED in such a case.
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
about v2:
- add a comment in git log
drivers/usb/renesas_usbhs/common.c | 11 ++++++-----
drivers/usb/renesas_usbhs/common.h | 1 +
drivers/usb/renesas_usbhs/mod.c | 2 +-
3 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c
index 08c679c..75f7d08 100644
--- a/drivers/usb/renesas_usbhs/common.c
+++ b/drivers/usb/renesas_usbhs/common.c
@@ -410,8 +410,7 @@ static int usbhs_probe(struct platform_device *pdev)
struct renesas_usbhs_platform_info *info = pdev->dev.platform_data;
struct renesas_usbhs_driver_callback *dfunc;
struct usbhs_priv *priv;
- struct resource *res;
- unsigned int irq;
+ struct resource *res, *irq_res;
int ret;
/* check platform information */
@@ -423,8 +422,8 @@ static int usbhs_probe(struct platform_device *pdev)
/* platform data */
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- irq = platform_get_irq(pdev, 0);
- if (!res || (int)irq <= 0) {
+ irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
+ if (!res || !irq_res) {
dev_err(&pdev->dev, "Not enough Renesas USB platform resources.\n");
return -ENODEV;
}
@@ -473,7 +472,9 @@ static int usbhs_probe(struct platform_device *pdev)
/*
* priv settings
*/
- priv->irq = irq;
+ priv->irq = irq_res->start;
+ if (irq_res->flags & IORESOURCE_IRQ_SHAREABLE)
+ priv->irqflags = IRQF_SHARED;
priv->pdev = pdev;
INIT_DELAYED_WORK(&priv->notify_hotplug_work, usbhsc_notify_hotplug);
spin_lock_init(usbhs_priv_to_lock(priv));
diff --git a/drivers/usb/renesas_usbhs/common.h b/drivers/usb/renesas_usbhs/common.h
index 8729da5..353ab51 100644
--- a/drivers/usb/renesas_usbhs/common.h
+++ b/drivers/usb/renesas_usbhs/common.h
@@ -241,6 +241,7 @@ struct usbhs_priv {
void __iomem *base;
unsigned int irq;
+ unsigned long irqflags;
struct renesas_usbhs_platform_callback pfunc;
struct renesas_usbhs_driver_param dparam;
diff --git a/drivers/usb/renesas_usbhs/mod.c b/drivers/usb/renesas_usbhs/mod.c
index ad96a38..9499fae 100644
--- a/drivers/usb/renesas_usbhs/mod.c
+++ b/drivers/usb/renesas_usbhs/mod.c
@@ -150,7 +150,7 @@ int usbhs_mod_probe(struct usbhs_priv *priv)
/* irq settings */
ret = request_irq(priv->irq, usbhs_interrupt,
- 0, dev_name(dev), priv);
+ priv->irqflags, dev_name(dev), priv);
if (ret) {
dev_err(dev, "irq request err\n");
goto mod_init_gadget_err;
--
1.7.1
^ permalink raw reply related
* Re: [PATCH 1/2] usb: renesas_usbhs: add IRQ resource decoding for
From: Shimoda, Yoshihiro @ 2012-01-05 5:57 UTC (permalink / raw)
To: linux-sh
In-Reply-To: <4F05318D.6070505@renesas.com>
Hi Morimoto-san,
Thank you for your comment.
2012/01/05 14:31, Kuninori Morimoto wrote:
>
> Hi Shimoda-san
>
> Can you please add the reason why this IRQF_SHARED is needed on renesas_usbhs ?
Yes. I will add the reason and submit the patch again.
Best regards,
Yoshihiro Shimoda
^ permalink raw reply
* [PATCH 2/2] sh: enable the SUDMAC of renesas_usbhs in board-sh7757lcr
From: Shimoda, Yoshihiro @ 2012-01-05 5:41 UTC (permalink / raw)
To: linux-sh
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
This patch depends on the following patch:
- usb: renesas_usbhs: add support for SUDMAC
arch/sh/boards/board-sh7757lcr.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/arch/sh/boards/board-sh7757lcr.c b/arch/sh/boards/board-sh7757lcr.c
index 0838154..40872e8 100644
--- a/arch/sh/boards/board-sh7757lcr.c
+++ b/arch/sh/boards/board-sh7757lcr.c
@@ -276,6 +276,8 @@ static struct renesas_usbhs_platform_info usb0_data = {
},
.driver_param = {
.buswait_bwait = 5,
+ .d0_tx_id = SHDMA_SLAVE_SUDMAC00,
+ .has_sudmac = 1,
}
};
@@ -288,7 +290,7 @@ static struct resource usb0_resources[] = {
[1] = {
.start = 50,
.end = 50,
- .flags = IORESOURCE_IRQ,
+ .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_SHAREABLE,
},
};
--
1.7.1
^ permalink raw reply related
* [PATCH 1/2] sh: add platform_device for SUDMAC in setup-sh7757
From: Shimoda, Yoshihiro @ 2012-01-05 5:41 UTC (permalink / raw)
To: linux-sh
In-Reply-To: <4E803B21.1030701@renesas.com>
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
This patch depends on the following patch:
- dmaengine: shdma: add support for SUDMAC
arch/sh/include/cpu-sh4/cpu/sh7757.h | 1 +
arch/sh/kernel/cpu/sh4a/setup-sh7757.c | 50 ++++++++++++++++++++++++++++++++
2 files changed, 51 insertions(+), 0 deletions(-)
diff --git a/arch/sh/include/cpu-sh4/cpu/sh7757.h b/arch/sh/include/cpu-sh4/cpu/sh7757.h
index 41f9f8b..f9be40a 100644
--- a/arch/sh/include/cpu-sh4/cpu/sh7757.h
+++ b/arch/sh/include/cpu-sh4/cpu/sh7757.h
@@ -283,5 +283,6 @@ enum {
SHDMA_SLAVE_RIIC8_RX,
SHDMA_SLAVE_RIIC9_TX,
SHDMA_SLAVE_RIIC9_RX,
+ SHDMA_SLAVE_SUDMAC00,
};
#endif /* __ASM_SH7757_H__ */
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7757.c b/arch/sh/kernel/cpu/sh4a/setup-sh7757.c
index 0555929..a3846f5 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7757.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7757.c
@@ -649,6 +649,55 @@ static struct platform_device dma3_device = {
},
};
+/* SUDMAC */
+static const struct sh_dmae_channel sh7757_sudmac_channel[] = {
+ {
+ .offset = 0,
+ .dmars = 0,
+ .dmars_bit = 0,
+ }
+};
+
+static const struct sh_dmae_slave_config sh7757_sudmac00_slaves[] = {
+ {
+ .slave_id = SHDMA_SLAVE_SUDMAC00,
+ .addr = 0xfe451000,
+ },
+};
+
+static struct sh_dmae_pdata sudmac00_platform_data = {
+ .slave = sh7757_sudmac00_slaves,
+ .slave_num = ARRAY_SIZE(sh7757_sudmac00_slaves),
+ .channel = sh7757_sudmac_channel,
+ .channel_num = 1,
+ .no_dmars = 1,
+ .no_error_irq = 1,
+ .sudmac = 1,
+};
+
+static struct resource sh7757_sudmac00_resources[] = {
+ [0] = {
+ .start = 0xfe451000,
+ .end = 0xfe451000,
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = 50,
+ .end = 50,
+ .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_SHAREABLE,
+ },
+};
+
+static struct platform_device sudmac00_device = {
+ .name = "sh-dma-engine",
+ .id = 4,
+ .resource = sh7757_sudmac00_resources,
+ .num_resources = ARRAY_SIZE(sh7757_sudmac00_resources),
+ .dev = {
+ .platform_data = &sudmac00_platform_data,
+ },
+};
+
static struct platform_device spi0_device = {
.name = "sh_spi",
.id = 0,
@@ -718,6 +767,7 @@ static struct platform_device *sh7757_devices[] __initdata = {
&dma1_device,
&dma2_device,
&dma3_device,
+ &sudmac00_device,
&spi0_device,
&usb_ehci_device,
&usb_ohci_device,
--
1.7.1
^ permalink raw reply related
* [RFC][PATCH 3/3] dmaengine: shdma: add support for SUDMAC
From: Shimoda, Yoshihiro @ 2012-01-05 5:41 UTC (permalink / raw)
To: linux-sh
The SH7757's USB module has SUDMAC. The SUDMAC's registers are imcompatible
with SH DMAC. However, since the SUDMAC is a very simple module, we can
reuse the shdma driver for SUDMAC by a few modification.
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
drivers/dma/shdma.c | 102 +++++++++++++++++++++++++++++++++++++++++++-----
include/linux/sh_dma.h | 46 +++++++++++++++++++++
2 files changed, 138 insertions(+), 10 deletions(-)
diff --git a/drivers/dma/shdma.c b/drivers/dma/shdma.c
index 24ef218..185cdb3 100644
--- a/drivers/dma/shdma.c
+++ b/drivers/dma/shdma.c
@@ -58,6 +58,11 @@ static unsigned long sh_dmae_slave_used[BITS_TO_LONGS(SH_DMA_SLAVE_NUMBER)];
static void sh_dmae_chan_ld_cleanup(struct sh_dmae_chan *sh_chan, bool all);
+static int sh_dmae_is_sudmac(struct sh_dmae_device *shdev)
+{
+ return shdev->pdata->sudmac;
+}
+
static void sh_dmae_writel(struct sh_dmae_chan *sh_dc, u32 data, u32 reg)
{
__raw_writel(data, sh_dc->base + reg / sizeof(u32));
@@ -68,6 +73,39 @@ static u32 sh_dmae_readl(struct sh_dmae_chan *sh_dc, u32 reg)
return __raw_readl(sh_dc->base + reg / sizeof(u32));
}
+static void sh_dmae_sudmac_chcr_write(struct sh_dmae_chan *sh_dc, u32 data)
+{
+ struct sh_dmae_device *shdev = to_sh_dev(sh_dc);
+
+ if (!(data & CHCR_TE)) /* clear interrupt status only */
+ sh_dmae_writel(sh_dc, CH0ENDC, DINTSTSCLR);
+
+ if (data & shdev->chcr_ie_bit)
+ sh_dmae_writel(sh_dc, CH0ENDE, DINTCTRL);
+ else
+ sh_dmae_writel(sh_dc, 0, DINTCTRL);
+
+ if (data & CHCR_DE)
+ sh_dmae_writel(sh_dc, DEN, CH0DEN);
+ else
+ sh_dmae_writel(sh_dc, 0, CH0DEN);
+}
+
+static u32 sh_dmae_sudmac_chcr_read(struct sh_dmae_chan *sh_dc)
+{
+ struct sh_dmae_device *shdev = to_sh_dev(sh_dc);
+ u32 chcr = 0;
+
+ if (sh_dmae_readl(sh_dc, DINTSTS) & CH0ENDS)
+ chcr |= CHCR_TE;
+ if (sh_dmae_readl(sh_dc, DINTCTRL) & CH0ENDE)
+ chcr |= shdev->chcr_ie_bit;
+ if (sh_dmae_readl(sh_dc, CH0DEN) & DEN)
+ chcr |= CHCR_DE;
+
+ return chcr;
+}
+
static u16 dmaor_read(struct sh_dmae_device *shdev)
{
u32 __iomem *addr = shdev->chan_reg + DMAOR / sizeof(u32);
@@ -92,14 +130,20 @@ static void chcr_write(struct sh_dmae_chan *sh_dc, u32 data)
{
struct sh_dmae_device *shdev = to_sh_dev(sh_dc);
- sh_dmae_writel(sh_dc, data, shdev->chcr_offset);
+ if (sh_dmae_is_sudmac(shdev))
+ sh_dmae_sudmac_chcr_write(sh_dc, data);
+ else
+ sh_dmae_writel(sh_dc, data, shdev->chcr_offset);
}
static u32 chcr_read(struct sh_dmae_chan *sh_dc)
{
struct sh_dmae_device *shdev = to_sh_dev(sh_dc);
- return sh_dmae_readl(sh_dc, shdev->chcr_offset);
+ if (sh_dmae_is_sudmac(shdev))
+ return sh_dmae_sudmac_chcr_read(sh_dc);
+ else
+ return sh_dmae_readl(sh_dc, shdev->chcr_offset);
}
/*
@@ -112,6 +156,9 @@ static void sh_dmae_ctl_stop(struct sh_dmae_device *shdev)
unsigned short dmaor;
unsigned long flags;
+ if (sh_dmae_is_sudmac(shdev))
+ return;
+
spin_lock_irqsave(&sh_dmae_lock, flags);
dmaor = dmaor_read(shdev);
@@ -125,6 +172,9 @@ static int sh_dmae_rst(struct sh_dmae_device *shdev)
unsigned short dmaor;
unsigned long flags;
+ if (sh_dmae_is_sudmac(shdev))
+ return 0;
+
spin_lock_irqsave(&sh_dmae_lock, flags);
dmaor = dmaor_read(shdev) & ~(DMAOR_NMIF | DMAOR_AE | DMAOR_DME);
@@ -159,6 +209,9 @@ static unsigned int calc_xmit_shift(struct sh_dmae_chan *sh_chan, u32 chcr)
int cnt = ((chcr & pdata->ts_low_mask) >> pdata->ts_low_shift) |
((chcr & pdata->ts_high_mask) >> pdata->ts_high_shift);
+ if (sh_dmae_is_sudmac(shdev))
+ return 0;
+
if (cnt >= pdata->ts_shift_num)
cnt = 0;
@@ -171,6 +224,9 @@ static u32 log2size_to_chcr(struct sh_dmae_chan *sh_chan, int l2size)
struct sh_dmae_pdata *pdata = shdev->pdata;
int i;
+ if (sh_dmae_is_sudmac(shdev))
+ return 0;
+
for (i = 0; i < pdata->ts_shift_num; i++)
if (pdata->ts_shift[i] = l2size)
break;
@@ -184,9 +240,17 @@ static u32 log2size_to_chcr(struct sh_dmae_chan *sh_chan, int l2size)
static void dmae_set_reg(struct sh_dmae_chan *sh_chan, struct sh_dmae_regs *hw)
{
- sh_dmae_writel(sh_chan, hw->sar, SAR);
- sh_dmae_writel(sh_chan, hw->dar, DAR);
- sh_dmae_writel(sh_chan, hw->tcr >> sh_chan->xmit_shift, TCR);
+ struct sh_dmae_device *shdev = to_sh_dev(sh_chan);
+
+ if (sh_dmae_is_sudmac(shdev)) {
+ sh_dmae_writel(sh_chan, LBA_WAIT | RCVENDM, CH0CFG);
+ sh_dmae_writel(sh_chan, hw->sar, CH0BA);
+ sh_dmae_writel(sh_chan, hw->tcr, CH0BBC);
+ } else {
+ sh_dmae_writel(sh_chan, hw->sar, SAR);
+ sh_dmae_writel(sh_chan, hw->dar, DAR);
+ sh_dmae_writel(sh_chan, hw->tcr >> sh_chan->xmit_shift, TCR);
+ }
}
static void dmae_start(struct sh_dmae_chan *sh_chan)
@@ -493,6 +557,7 @@ static struct sh_desc *sh_dmae_add_desc(struct sh_dmae_chan *sh_chan,
unsigned long flags, dma_addr_t *dest, dma_addr_t *src, size_t *len,
struct sh_desc **first, enum dma_data_direction direction)
{
+ struct sh_dmae_device *shdev = to_sh_dev(sh_chan);
struct sh_desc *new;
size_t copy_size;
@@ -508,7 +573,14 @@ static struct sh_desc *sh_dmae_add_desc(struct sh_dmae_chan *sh_chan,
copy_size = min(*len, (size_t)SH_DMA_TCR_MAX + 1);
- new->hw.sar = *src;
+ /*
+ * SUDMAC has a CHnBA register only. So, the driver uses "hw.sar"
+ * even if transfer direction is DMA_FROM_DEVICE.
+ */
+ if (sh_dmae_is_sudmac(shdev) && direction = DMA_FROM_DEVICE)
+ new->hw.sar = *dest;
+ else
+ new->hw.sar = *src;
new->hw.dar = *dest;
new->hw.tcr = copy_size;
@@ -701,8 +773,10 @@ static int sh_dmae_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
/* Record partial transfer */
struct sh_desc *desc = list_entry(sh_chan->ld_queue.next,
struct sh_desc, node);
- desc->partial = (desc->hw.tcr - sh_dmae_readl(sh_chan, TCR)) <<
- sh_chan->xmit_shift;
+ struct sh_dmae_device *shdev = to_sh_dev(sh_chan);
+ if (!sh_dmae_is_sudmac(shdev))
+ desc->partial = (desc->hw.tcr - sh_dmae_readl(sh_chan,
+ TCR)) << sh_chan->xmit_shift;
}
spin_unlock_irqrestore(&sh_chan->desc_lock, flags);
@@ -989,9 +1063,17 @@ static irqreturn_t sh_dmae_err(int irq, void *data)
static void dmae_do_tasklet(unsigned long data)
{
struct sh_dmae_chan *sh_chan = (struct sh_dmae_chan *)data;
+ struct sh_dmae_device *shdev = to_sh_dev(sh_chan);
struct sh_desc *desc;
- u32 sar_buf = sh_dmae_readl(sh_chan, SAR);
- u32 dar_buf = sh_dmae_readl(sh_chan, DAR);
+ u32 sar_buf, dar_buf;
+
+ if (sh_dmae_is_sudmac(shdev)) {
+ sar_buf = sh_dmae_readl(sh_chan, CH0CA);
+ dar_buf = sh_dmae_readl(sh_chan, CH0CA);
+ } else {
+ sar_buf = sh_dmae_readl(sh_chan, SAR);
+ dar_buf = sh_dmae_readl(sh_chan, DAR);
+ }
spin_lock_irq(&sh_chan->desc_lock);
list_for_each_entry(desc, &sh_chan->ld_queue, node) {
diff --git a/include/linux/sh_dma.h b/include/linux/sh_dma.h
index b638f42..0a3f4c7 100644
--- a/include/linux/sh_dma.h
+++ b/include/linux/sh_dma.h
@@ -69,6 +69,7 @@ struct sh_dmae_pdata {
unsigned int needs_tend_set:1;
unsigned int no_dmars:1;
unsigned int no_error_irq:1;
+ unsigned int sudmac:1;
};
/* DMA register */
@@ -108,4 +109,49 @@ struct sh_dmae_pdata {
#define CHCR_TE 0x00000002
#define CHCR_IE 0x00000004
+/* SUDMAC register */
+#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
+
+/* Definitions for the SUDMAC */
+#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 */
+#define DEN 0x0001 /* b0: DMA Transfer Enable */
+#define CH1STCLR 0x0002 /* b1: Ch1 DMA Status Clear */
+#define CH0STCLR 0x0001 /* b0: Ch0 DMA Status Clear */
+#define CH1BUFW 0x0200 /* b9: Ch1 DMA Buffer Data Transfer Enable */
+#define CH0BUFW 0x0100 /* b8: Ch0 DMA Buffer Data Transfer Enable */
+#define CH1BUFS 0x0002 /* b1: Ch1 DMA Buffer Data Status */
+#define CH0BUFS 0x0001 /* b0: Ch0 DMA Buffer Data Status */
+#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 /* b1: Ch1 DMA Transfer End Int Enable */
+#define CH0ENDE 0x0001 /* b0: Ch0 DMA Transfer End Int Enable */
+#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 /* b1: Ch1 DMA Transfer End Int Status */
+#define CH0ENDS 0x0001 /* b0: Ch0 DMA Transfer End Int Status */
+#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 /* b1: Ch1 DMA Transfer End Int Stat Clear */
+#define CH0ENDC 0x0001 /* b0: Ch0 DMA Transfer End Int Stat Clear */
+
#endif
--
1.7.1
^ permalink raw reply related
* [RFC][PATCH 2/3] dmaengine: shdma: use sh_dmae_writel/readl in
From: Shimoda, Yoshihiro @ 2012-01-05 5:41 UTC (permalink / raw)
To: linux-sh
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
drivers/dma/shdma.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/dma/shdma.c b/drivers/dma/shdma.c
index 97f7d24..24ef218 100644
--- a/drivers/dma/shdma.c
+++ b/drivers/dma/shdma.c
@@ -92,14 +92,14 @@ static void chcr_write(struct sh_dmae_chan *sh_dc, u32 data)
{
struct sh_dmae_device *shdev = to_sh_dev(sh_dc);
- __raw_writel(data, sh_dc->base + shdev->chcr_offset / sizeof(u32));
+ sh_dmae_writel(sh_dc, data, shdev->chcr_offset);
}
static u32 chcr_read(struct sh_dmae_chan *sh_dc)
{
struct sh_dmae_device *shdev = to_sh_dev(sh_dc);
- return __raw_readl(sh_dc->base + shdev->chcr_offset / sizeof(u32));
+ return sh_dmae_readl(sh_dc, shdev->chcr_offset);
}
/*
--
1.7.1
^ permalink raw reply related
* [RFC][PATCH 1/3] dmaengine: shdma: add .no_error_irq flag
From: Shimoda, Yoshihiro @ 2012-01-05 5:41 UTC (permalink / raw)
To: linux-sh
The USB-DMAC/SUDMAC don't have the interrupt of DMAC Address Error.
So, this patch adds the .no_error_irq flag.
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
drivers/dma/shdma.c | 50 ++++++++++++++++++++++++++---------------------
include/linux/sh_dma.h | 1 +
2 files changed, 29 insertions(+), 22 deletions(-)
diff --git a/drivers/dma/shdma.c b/drivers/dma/shdma.c
index 81809c2..97f7d24 100644
--- a/drivers/dma/shdma.c
+++ b/drivers/dma/shdma.c
@@ -1151,7 +1151,7 @@ static int __init sh_dmae_probe(struct platform_device *pdev)
struct sh_dmae_pdata *pdata = pdev->dev.platform_data;
unsigned long irqflags = IRQF_DISABLED,
chan_flag[SH_DMAC_MAX_CHANNELS] = {};
- int errirq, chan_irq[SH_DMAC_MAX_CHANNELS];
+ int errirq = 0, chan_irq[SH_DMAC_MAX_CHANNELS];
int err, i, irq_cnt = 0, irqres = 0, irq_cap = 0;
struct sh_dmae_device *shdev;
struct resource *chan, *dmars, *errirq_res, *chanirq_res;
@@ -1259,26 +1259,31 @@ static int __init sh_dmae_probe(struct platform_device *pdev)
shdev->common.copy_align = LOG2_DEFAULT_XFER_SIZE;
#if defined(CONFIG_CPU_SH4) || defined(CONFIG_ARCH_SHMOBILE)
- chanirq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 1);
-
- if (!chanirq_res)
+ if (pdata->no_error_irq) {
chanirq_res = errirq_res;
- else
- irqres++;
-
- if (chanirq_res = errirq_res ||
- (errirq_res->flags & IORESOURCE_BITS) = IORESOURCE_IRQ_SHAREABLE)
- irqflags = IRQF_SHARED;
-
- errirq = errirq_res->start;
-
- err = request_irq(errirq, sh_dmae_err, irqflags,
- "DMAC Address Error", shdev);
- if (err) {
- dev_err(&pdev->dev,
- "DMA failed requesting irq #%d, error %d\n",
- errirq, err);
- goto eirq_err;
+ } else {
+ chanirq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 1);
+
+ if (!chanirq_res)
+ chanirq_res = errirq_res;
+ else
+ irqres++;
+
+ if (chanirq_res = errirq_res ||
+ (errirq_res->flags & IORESOURCE_BITS) =
+ IORESOURCE_IRQ_SHAREABLE)
+ irqflags = IRQF_SHARED;
+
+ errirq = errirq_res->start;
+
+ err = request_irq(errirq, sh_dmae_err, irqflags,
+ "DMAC Address Error", shdev);
+ if (err) {
+ dev_err(&pdev->dev,
+ "DMA failed requesting irq #%d, error %d\n",
+ errirq, err);
+ goto eirq_err;
+ }
}
#else
@@ -1346,7 +1351,8 @@ chan_probe_err:
sh_dmae_chan_remove(shdev);
#if defined(CONFIG_CPU_SH4) || defined(CONFIG_ARCH_SHMOBILE)
- free_irq(errirq, shdev);
+ if (!pdata->no_error_irq)
+ free_irq(errirq, shdev);
eirq_err:
#endif
rst_err:
@@ -1383,7 +1389,7 @@ static int __exit sh_dmae_remove(struct platform_device *pdev)
dma_async_device_unregister(&shdev->common);
- if (errirq > 0)
+ if (!shdev->pdata->no_error_irq && errirq > 0)
free_irq(errirq, shdev);
spin_lock_irq(&sh_dmae_lock);
diff --git a/include/linux/sh_dma.h b/include/linux/sh_dma.h
index cb2dd11..b638f42 100644
--- a/include/linux/sh_dma.h
+++ b/include/linux/sh_dma.h
@@ -68,6 +68,7 @@ struct sh_dmae_pdata {
unsigned int dmaor_is_32bit:1;
unsigned int needs_tend_set:1;
unsigned int no_dmars:1;
+ unsigned int no_error_irq:1;
};
/* DMA register */
--
1.7.1
^ permalink raw reply related
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