mfd: introduce a driver for LPSS devices on SPT
Subsystems (9)
Andy Shevchenko
reviewerv5 cover mfd: introduce a driver for LPSS devices on SPT
The new coming Intel platforms such as Skylake will contain Sunrisepoint PCH.
The driver is based on MFD framework since the main device, i.e. serial bus controller, contains register space for itself, DMA part, and an additional address space (convergence layer).
The public specification of the register map is avaiable in [1].
This is fifth generation of the patch series to bring support LPSS devices found on Intel Sunrisepoint (Intel Skylake PCH). Previous one can be found here [2].
The series has few logical parts:
- patches 1-3 prepares PM core, ACPI, and driver core (PM) to handle our case
- patches 4-6 introduce unregistering platform devices in MFD in reversed order
- patch 7 implements iDMA 64-bit driver
- patch 8 introduces an MFD driver for LPSS devices
The patch 7 can be applied independently, though it's better if it goes before patch 8.
The driver has been tested with SPI and UART on Intel Skylake PCH.
[1] https://download.01.org/future-platform-configuration-hub/skylake/register-definitions/332219-002.pdf
[2] http://www.spinics.net/lists/linux-acpi/msg58622.html
Changelog v5:
- rebase on top of v4.2-rc1
- patch 3 is modified accordingly to new changes in drivers/base/dd.c
- correct Rafael's email in patch 3
Changelog v4:
- replace patch 3 by Rafael's suggession
- append ACKs from Rafael
- rebase on top of v4.1-rc8
Changelog v3:
- rework patch 3 to be used for all kind of devices (address Alan comment)
- iDMA 64-bit driver improvements:
- fix burst-to-register conversion
- remove excessive locking
- do not expose core part to the user (Kconfig)
- address most of Lee's comments
- append ACKs
- rebase on top of v4.1-rc6
Changelog v2:
- new DMA driver to fully support iDMA 64-bit IP
- patch 3 is added to wake up parent devices when ->probe(), ->remove(), or
->shutdown()
- MFD core is unregistering devices in reversed order
- address few Lee's comments on v1
- address Russel's comment, therefore use clkdev_create() helper
- intel-lpss{,-acpi,-pci} are modified regarding to above changes
Andy Shevchenko (5):
klist: implement klist_prev()
driver core: implement device_for_each_child_reverse()
mfd: make mfd_remove_devices() iterate in reverse order
dmaengine: add a driver for Intel integrated DMA 64-bit
mfd: Add support for Intel Sunrisepoint LPSS devices
Mika Westerberg (2):
PM / QoS: Make it possible to expose device latency tolerance to
userspace
ACPI / PM: Attach ACPI power domain only once
Rafael J. Wysocki (1):
Driver core: wakeup the parent device before trying probe
drivers/acpi/device_pm.c | 8 + drivers/acpi/internal.h | 2 + drivers/acpi/scan.c | 46 ++- drivers/base/core.c | 43 +++ drivers/base/dd.c | 20 ++ drivers/base/power/power.h | 2 + drivers/base/power/qos.c | 37 +++ drivers/base/power/sysfs.c | 11 + drivers/dma/Kconfig | 5 + drivers/dma/Makefile | 1 + drivers/dma/idma64.c | 724 ++++++++++++++++++++++++++++++++++++++++++ drivers/dma/idma64.h | 232 ++++++++++++++ drivers/mfd/Kconfig | 23 ++ drivers/mfd/Makefile | 3 + drivers/mfd/intel-lpss-acpi.c | 84 +++++ drivers/mfd/intel-lpss-pci.c | 113 +++++++ drivers/mfd/intel-lpss.c | 524 ++++++++++++++++++++++++++++++ drivers/mfd/intel-lpss.h | 62 ++++ drivers/mfd/mfd-core.c | 2 +- include/linux/device.h | 2 + include/linux/klist.h | 1 + include/linux/pm_qos.h | 5 + lib/klist.c | 41 +++ 23 files changed, 1974 insertions(+), 17 deletions(-) create mode 100644 drivers/dma/idma64.c create mode 100644 drivers/dma/idma64.h create mode 100644 drivers/mfd/intel-lpss-acpi.c create mode 100644 drivers/mfd/intel-lpss-pci.c create mode 100644 drivers/mfd/intel-lpss.c create mode 100644 drivers/mfd/intel-lpss.h
Signature · 1 line
2.1.4
Andy Shevchenko
reviewerPATCH v5 1/8 PM / QoS: Make it possible to expose device latency tolerance to userspace
From: Mika Westerberg <[email protected]>
Typically when a device is created the bus core it belongs to (for example PCI) does not know if the device supports things like latency tolerance. This is left to the driver that binds to the device in question. However, at that time the device has already been created and there is no way to set its dev->power.set_latency_tolerance anymore.
So follow what has been done for other PM QoS attributes as well and allow drivers to expose and hide latency tolerance from userspace, if the device supports it.
--- drivers/base/power/power.h | 2 ++ drivers/base/power/qos.c | 37 +++++++++++++++++++++++++++++++++++++ drivers/base/power/sysfs.c | 11 +++++++++++ include/linux/pm_qos.h | 5 +++++ 4 files changed, 55 insertions(+)
drivers/base/power/power.h +2 -0
@@ -73,6 +73,8 @@ extern int pm_qos_sysfs_add_resume_latency(struct device *dev);extern void pm_qos_sysfs_remove_resume_latency (struct device *dev);extern int pm_qos_sysfs_add_flags (struct device *dev);extern void pm_qos_sysfs_remove_flags (struct device *dev); +extern int pm_qos_sysfs_add_latency_tolerance (struct device *dev); +extern void pm_qos_sysfs_remove_latency_tolerance (struct device *dev);#else /* CONFIG_PM */
drivers/base/power/qos.c +37 -0
@@ -883,3 +883,40 @@ int dev_pm_qos_update_user_latency_tolerance(struct device *dev, s32 val)mutex_unlock (&dev_pm_qos_mtx);return ret; } + +/** +* dev_pm_qos_expose_latency_tolerance - Expose latency tolerance to userspace +* @dev: Device whose latency tolerance to expose +*/ +int dev_pm_qos_expose_latency_tolerance (struct device *dev) +{ +int ret; + +if (!dev->power.set_latency_tolerance) +return -EINVAL ; + +mutex_lock (&dev_pm_qos_sysfs_mtx); + ret =pm_qos_sysfs_add_latency_tolerance (dev); +mutex_unlock (&dev_pm_qos_sysfs_mtx); + +return ret; +} +EXPORT_SYMBOL_GPL (dev_pm_qos_expose_latency_tolerance); + +/** +* dev_pm_qos_hide_latency_tolerance - Hide latency tolerance from userspace +* @dev: Device whose latency tolerance to hide +*/ +void dev_pm_qos_hide_latency_tolerance (struct device *dev) +{ +mutex_lock (&dev_pm_qos_sysfs_mtx); +pm_qos_sysfs_remove_latency_tolerance (dev); +mutex_unlock (&dev_pm_qos_sysfs_mtx); + +/* Remove the request from user space now */ +pm_runtime_get_sync (dev); +dev_pm_qos_update_user_latency_tolerance (dev, +PM_QOS_LATENCY_TOLERANCE_NO_CONSTRAINT ); +pm_runtime_put (dev); +} +EXPORT_SYMBOL_GPL (dev_pm_qos_hide_latency_tolerance);
drivers/base/power/sysfs.c +11 -0
@@ -738,6 +738,17 @@ void pm_qos_sysfs_remove_flags(struct device *dev)sysfs_unmerge_group (&dev->kobj, &pm_qos_flags_attr_group); } +int pm_qos_sysfs_add_latency_tolerance (struct device *dev) +{ +return sysfs_merge_group (&dev->kobj, + &pm_qos_latency_tolerance_attr_group); +} + +void pm_qos_sysfs_remove_latency_tolerance (struct device *dev) +{ +sysfs_unmerge_group (&dev->kobj, &pm_qos_latency_tolerance_attr_group); +} +void rpm_sysfs_remove (struct device *dev) {sysfs_unmerge_group (&dev->kobj, &pm_runtime_attr_group);
include/linux/pm_qos.h +5 -0
@@ -161,6 +161,8 @@ void dev_pm_qos_hide_flags(struct device *dev);int dev_pm_qos_update_flags (struct device *dev,s32 mask,bool set);s32 dev_pm_qos_get_user_latency_tolerance (struct device *dev);int dev_pm_qos_update_user_latency_tolerance (struct device *dev,s32 val); +int dev_pm_qos_expose_latency_tolerance (struct device *dev); +void dev_pm_qos_hide_latency_tolerance (struct device *dev);static inline s32 dev_pm_qos_requested_resume_latency (struct device *dev) {
@@ -229,6 +231,9 @@ static inline s32 dev_pm_qos_get_user_latency_tolerance(struct device *dev) {return PM_QOS_LATENCY_TOLERANCE_NO_CONSTRAINT ; }static inline int dev_pm_qos_update_user_latency_tolerance (struct device *dev,s32 val) {return 0 ; } +static inline int dev_pm_qos_expose_latency_tolerance (struct device *dev) + {return 0 ; } +static inline void dev_pm_qos_hide_latency_tolerance (struct device *dev) {}static inline s32 dev_pm_qos_requested_resume_latency (struct device *dev) {return 0 ; }static inline s32 dev_pm_qos_requested_flags (struct device *dev) {return 0 ; }
Signature · 1 line
2.1.4
Andy Shevchenko
reviewerPATCH v5 2/8 ACPI / PM: Attach ACPI power domain only once
In reply to Andy ShevchenkoFrom: Mika Westerberg <[email protected]>
Some devices, like MFD subdevices, share a single ACPI companion device so that they are able to access their resources and children. However, currently all these subdevices are attached to the ACPI power domain and this might cause that the power methods for the companion device get called more than once.
In order to solve this we attach the ACPI power domain only to the first physical device that is bound to the ACPI companion device. In case of MFD devices, this is the parent MFD device itself.
--- drivers/acpi/device_pm.c | 8 ++++++++ drivers/acpi/internal.h | 2 ++ drivers/acpi/scan.c | 46 ++++++++++++++++++++++++++++++---------------- 3 files changed, 40 insertions(+), 16 deletions(-)
drivers/acpi/device_pm.c +8 -0
@@ -1123,6 +1123,14 @@ int acpi_dev_pm_attach(struct device *dev, bool power_on)if (dev->pm_domain)return -EEXIST ; +/* +* Only attach the power domain to the first device if the +* companion is shared by multiple. This is to prevent doing power +* management twice. +*/ +if (!acpi_device_is_first_physical_node (adev, dev)) +return -EBUSY ; +acpi_add_pm_notifier (adev, dev, acpi_pm_notify_work_func); dev->pm_domain = &acpi_general_pm_domain;if (power_on) {
drivers/acpi/internal.h +2 -0
@@ -97,6 +97,8 @@ void acpi_device_add_finalize(struct acpi_device *device);void acpi_free_pnp_ids (struct acpi_device_pnp *pnp);bool acpi_device_is_present (struct acpi_device *adev);bool acpi_device_is_battery (struct acpi_device *adev); +bool acpi_device_is_first_physical_node (struct acpi_device *adev, +const struct device *dev);/* -------------------------------------------------------------------------- Power Resource
drivers/acpi/scan.c +30 -16
64 lines not on this page · raw message
Signature · 1 line
2.1.4
Andy Shevchenko
reviewerPATCH v5 3/8 Driver core: wakeup the parent device before trying probe
In reply to Andy ShevchenkoFrom: "Rafael J. Wysocki" <[email protected]>
If the parent is still suspended when driver probe is attempted, the result may be failure.
For example, if the parent is a PCI MFD device that has been suspended when we try to probe our device, any register reads will return 0xffffffff.
To fix the problem, making sure the parent is always awake before attempting driver probe.
--- drivers/base/dd.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
drivers/base/dd.c +20 -0
@@ -399,6 +399,8 @@ EXPORT_SYMBOL_GPL(wait_for_device_probe);* * This function must be called with @dev lock held. When called for a * USB interface, @dev->parent lock must be held as well. +* +* If the device has a parent, runtime-resume the parent before driver probing. */ int driver_probe_device (struct device_driver *drv,struct device *dev) {
@@ -410,10 +412,16 @@ int driver_probe_device(struct device_driver *drv, struct device *dev)pr_debug ("bus: '%s': %s: matched device %s with driver %s\n" , drv->bus->name, __func__,dev_name (dev), drv->name); +if (dev->parent) +pm_runtime_get_sync (dev->parent); +pm_runtime_barrier (dev); ret =really_probe (dev, drv);pm_request_idle (dev); +if (dev->parent) +pm_runtime_put (dev->parent); +return ret; }
@@ -507,11 +515,17 @@ static void __device_attach_async_helper(void *_dev, async_cookie_t cookie)device_lock (dev); +if (dev->parent) +pm_runtime_get_sync (dev->parent); +bus_for_each_drv (dev->bus,NULL , &data, __device_attach_driver);dev_dbg (dev,"async probe completed\n" );pm_request_idle (dev); +if (dev->parent) +pm_runtime_put (dev->parent); +device_unlock (dev);put_device (dev);
@@ -541,6 +555,9 @@ static int __device_attach(struct device *dev, bool allow_async) .want_async = false, }; +if (dev->parent) +pm_runtime_get_sync (dev->parent); + ret =bus_for_each_drv (dev->bus,NULL , &data, __device_attach_driver);if (!ret && allow_async && data.have_async) {
@@ -557,6 +574,9 @@ static int __device_attach(struct device *dev, bool allow_async) }else {pm_request_idle (dev); } + +if (dev->parent) +pm_runtime_put (dev->parent); } out_unlock:device_unlock (dev);
Signature · 1 line
2.1.4
Andy Shevchenko
reviewerPATCH v5 4/8 klist: implement klist_prev()
In reply to Andy Shevchenkoklist_prev() gets the previous element in the list. It is useful to traverse through the list in reverse order, for example, to provide LIFO (last in first out) variant of access.
--- include/linux/klist.h | 1 + lib/klist.c | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+)
include/linux/klist.h +1 -0
@@ -63,6 +63,7 @@ extern void klist_iter_init(struct klist *k, struct klist_iter *i);extern void klist_iter_init_node (struct klist *k,struct klist_iter *i,struct klist_node *n);extern void klist_iter_exit (struct klist_iter *i); +extern struct klist_node *klist_prev (struct klist_iter *i);extern struct klist_node *klist_next (struct klist_iter *i);#endif
lib/klist.c +41 -0
47 lines not on this page · raw message
Signature · 1 line
2.1.4
Andy Shevchenko
reviewerPATCH v5 5/8 driver core: implement device_for_each_child_reverse()
In reply to Andy ShevchenkoThe new function device_for_each_child_reverse() is helpful to traverse the registered devices in a reversed order, e.g. in the case when an operation on each device should be done first on the last added device, then on one before last and so on.
--- drivers/base/core.c | 43 +++++++++++++++++++++++++++++++++++++++++++ include/linux/device.h | 2 ++ 2 files changed, 45 insertions(+)
drivers/base/core.c +43 -0
@@ -1252,6 +1252,19 @@ void device_unregister(struct device *dev) }EXPORT_SYMBOL_GPL (device_unregister); +static struct device *prev_device (struct klist_iter *i) +{ +struct klist_node *n =klist_prev (i); +struct device *dev =NULL ; +struct device_private *p; + +if (n) { + p =to_device_private_parent (n); + dev = p->device; + } +return dev; +} +static struct device *next_device (struct klist_iter *i) {struct klist_node *n =klist_next (i);
@@ -1341,6 +1354,36 @@ int device_for_each_child(struct device *parent, void *data,EXPORT_SYMBOL_GPL (device_for_each_child);/** +* device_for_each_child_reverse - device child iterator in reversed order. +* @parent: parent struct device. +* @fn: function to be called for each device. +* @data: data for the callback. +* +* Iterate over @parent's child devices, and call @fn for each, +* passing it @data. +* +* We check the return of @fn each time. If it returns anything +* other than 0, we break out and return that value. +*/ +int device_for_each_child_reverse (struct device *parent,void *data, +int (*fn)(struct device *dev,void *data)) +{ +struct klist_iter i; +struct device *child; +int error =0 ; + +if (!parent->p) +return 0 ; + +klist_iter_init (&parent->p->klist_children, &i); +while ((child =prev_device (&i)) && !error) + error =fn (child, data); +klist_iter_exit (&i); +return error; +} +EXPORT_SYMBOL_GPL (device_for_each_child_reverse); + +/** * device_find_child - device iterator for locating a particular device. * @parent: parent struct device * @match: Callback function to check device
include/linux/device.h +2 -0
@@ -958,6 +958,8 @@ extern int __must_check device_add(struct device *dev);extern void device_del (struct device *dev);extern int device_for_each_child (struct device *dev,void *data,int (*fn)(struct device *dev,void *data)); +extern int device_for_each_child_reverse (struct device *dev,void *data, +int (*fn)(struct device *dev,void *data));extern struct device *device_find_child (struct device *dev,void *data,int (*match)(struct device *dev,void *data));extern int device_rename (struct device *dev,const char *new_name);
Signature · 1 line
2.1.4
Andy Shevchenko
reviewerPATCH v5 6/8 mfd: make mfd_remove_devices() iterate in reverse order
In reply to Andy ShevchenkoThe newly introduced device_for_each_child_reverse() would be used when MFD core removes the device.
After this patch applied the devices will be removed in a reversed order. This behaviour is useful when devices have implicit dependency on order, i.e. consider MFD device with serial bus controller, such as SPI, and DMA IP that is attached to serial bus controller: before remove the DMA driver we have to be ensured that no DMA transfers is ongoing and the requested channel are unused.
--- drivers/mfd/mfd-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mfd/mfd-core.c +1 -1
@@ -302,7 +302,7 @@ void mfd_remove_devices(struct device *parent) {atomic_t *cnts =NULL ; -device_for_each_child (parent, &cnts, mfd_remove_devices_fn); +device_for_each_child_reverse (parent, &cnts, mfd_remove_devices_fn);kfree (cnts); }EXPORT_SYMBOL (mfd_remove_devices);
Signature · 1 line
2.1.4
Andy Shevchenko
reviewerPATCH v5 7/8 dmaengine: add a driver for Intel integrated DMA 64-bit
In reply to Andy ShevchenkoIntel integrated DMA (iDMA) 64-bit is a specific IP that is used as a part of LPSS devices such as HSUART or SPI. The iDMA IP is attached for private usage on each host controller independently.
While it has similarities with Synopsys DesignWare DMA, the following distinctions doesn't allow to use the existing driver:
- 64-bit mode with corresponding changes in Hardware Linked List data structure
- many slight differences in the channel registers
Moreover this driver is based on the DMA virtual channels framework that helps to make the driver cleaner and easy to understand.
--- drivers/dma/Kconfig | 5 + drivers/dma/Makefile | 1 + drivers/dma/idma64.c | 724 +++++++++++++++++++++++++++++++++++++++++++++++++++ drivers/dma/idma64.h | 232 +++++++++++++++++ 4 files changed, 962 insertions(+) create mode 100644 drivers/dma/idma64.c create mode 100644 drivers/dma/idma64.h
drivers/dma/Kconfig +5 -0
@@ -85,6 +85,11 @@ config INTEL_IOP_ADMA help Enable support for the Intel(R) IOP Series RAID engines. +config IDMA64 + tristate "Intel integrated DMA 64-bit support" + select DMA_ENGINE + select DMA_VIRTUAL_CHANNELS + source "drivers/dma/dw/Kconfig" config AT_HDMAC
drivers/dma/Makefile +1 -0
@@ -14,6 +14,7 @@ obj-$(CONFIG_HSU_DMA) += hsu/ obj-$(CONFIG_MPC512X_DMA) += mpc512x_dma.o obj-$(CONFIG_PPC_BESTCOMM) += bestcomm/ obj-$(CONFIG_MV_XOR) += mv_xor.o +obj-$(CONFIG_IDMA64) += idma64.o obj-$(CONFIG_DW_DMAC_CORE) += dw/ obj-$(CONFIG_AT_HDMAC) += at_hdmac.o obj-$(CONFIG_AT_XDMAC) += at_xdmac.o
drivers/dma/idma64.c new file +724 -0
724 lines not on this page · raw message
drivers/dma/idma64.h new file +232 -0
232 lines not on this page · raw message
Signature · 1 line
2.1.4
Re: [PATCH v5 7/8] dmaengine: add a driver for Intel integrated DMA 64-bit
drivers/dma/Kconfig config INTEL_IOP_ADMA · line 91
Quoted 4 lines · Andy Shevchenko
drivers/dma/Kconfig +4
-0+config IDMA64 + tristate "Intel integrated DMA 64-bit support" + select DMA_ENGINE + select DMA_VIRTUAL_CHANNELS
no help text?
Quoted 16 lines
drivers/dma/idma64.c new file +16
-0+static void idma64_chan_init (struct idma64 *idma64,struct idma64_chan *idma64c) +{ +u32 cfghi =IDMA64C_CFGH_SRC_PER (1 ) |IDMA64C_CFGH_DST_PER (0 ); +u32 cfglo =0 ; + +/* Enforce FIFO drain when channel is suspended */ + cfglo |=IDMA64C_CFGL_CH_DRAIN ; + +/* Set default burst alignment */ + cfglo |=IDMA64C_CFGL_DST_BURST_ALIGN |IDMA64C_CFGL_SRC_BURST_ALIGN ; + +channel_writel (idma64c,CFG_LO , cfglo); +channel_writel (idma64c,CFG_HI , cfghi); + +/* Enable interrupts */ +channel_set_bit (idma64,MASK (XFER ), idma64c->mask);
drivers/dma/idma64.c line 88
Quoted 10 lines
drivers/dma/idma64.c new file +10
-0+channel_set_bit (idma64,MASK (ERROR ), idma64c->mask); + +/* +* Enforce the controller to be turned on. +* +* The iDMA is turned off in ->probe() and looses context during system +* suspend / resume cycle. That's why we have to enable it each time we +* use it. +*/ +idma64_on (idma64);
would it be better that you do this in resume and runtime_resume cycle. That way it need not be called for every channel init
drivers/dma/idma64.c line 358
Quoted 7 lines
drivers/dma/idma64.c new file +7
-0+static size_t idma64_desc_size (struct idma64_desc *desc,unsigned int active) +{ +size_t bytes =0 ; +unsigned int i; + +for (i = active; i < desc->ndesc; i++) + bytes += desc->hw[i].len;
it can help for the non active case to have this size stored in desc while preparing, that gets rid of runtime calculation for that case
drivers/dma/idma64.c line 366
Quoted 8 lines
drivers/dma/idma64.c new file +8
-0+ +return bytes; +} + +static size_t idma64_pending_desc_size (struct idma64_desc *desc) +{ +return idma64_desc_size (desc,0 ); +}
why not invoke with 0 arg from caller?
drivers/dma/idma64.c line 505
Quoted 8 lines
drivers/dma/idma64.c new file +8
-0+static int idma64_terminate_all (struct dma_chan *chan) +{ +struct idma64_chan *idma64c =to_idma64_chan (chan); +unsigned long flags; +LIST_HEAD (head); + +spin_lock_irqsave (&idma64c->vchan.lock, flags); +idma64_stop_transfer (idma64c);
I dont think this is the right method for terminate. Can you check, it might be that we have to suspend the channel before terminating an active one. For non active case this should be okay
Quoted 4 lines
drivers/dma/idma64.c new file +4
-0+static int idma64_alloc_chan_resources (struct dma_chan *chan) +{ +struct idma64_chan *idma64c =to_idma64_chan (chan); +
drivers/dma/idma64.c line 530
Quoted 10 lines
drivers/dma/idma64.c new file +10
-0+/* Create a pool of consistent memory blocks for hardware descriptors */ + idma64c->pool =dma_pool_create (dev_name (chan2dev (chan)), + chan->device->dev, +sizeof (struct idma64_lli ),8 ,0 ); +if (!idma64c->pool) { +dev_err (chan2dev (chan),"No memory for descriptors\n" ); +return -ENOMEM ; + } + +return 0 ;
this should return the number descriptors you allocated for the pool
drivers/dma/idma64.c line 707
Quoted 3 lines
drivers/dma/idma64.c new file +3
-0+ +static const struct dev_pm_ops idma64_dev_pm_ops = { +SET_LATE_SYSTEM_SLEEP_PM_OPS (idma64_suspend_late, idma64_resume_early)
any reason why late ops?
Signature · 1 line
~Vinod
Re: [PATCH v5 7/8] dmaengine: add a driver for Intel integrated DMA 64-bit
Quoted 6 lines · Vinod Koul
drivers/dma/Kconfig config INTEL_IOP_ADMA · line 91
Quoted 4 lines · Andy Shevchenko
drivers/dma/Kconfig +4
-0+config IDMA64 + tristate "Intel integrated DMA 64-bit support" + select DMA_ENGINE + select DMA_VIRTUAL_CHANNELSno help text?
Will fix.
Quoted 21 lines
Quoted 21 lines
drivers/dma/idma64.c new file +20
-0+static void idma64_chan_init (struct idma64 *idma64,struct idma64_chan *idma64c) +{ +u32 cfghi =IDMA64C_CFGH_SRC_PER (1 ) |IDMA64C_CFGH_DST_PER (0 ); +u32 cfglo =0 ; + +/* Enforce FIFO drain when channel is suspended */ + cfglo |=IDMA64C_CFGL_CH_DRAIN ; + +/* Set default burst alignment */ + cfglo |=IDMA64C_CFGL_DST_BURST_ALIGN |IDMA64C_CFGL_SRC_BURST_ALIGN ; + +channel_writel (idma64c,CFG_LO , cfglo); +channel_writel (idma64c,CFG_HI , cfghi); + +/* Enable interrupts */ +channel_set_bit (idma64,MASK (XFER ), idma64c->mask); +channel_set_bit (idma64,MASK (ERROR ), idma64c->mask); + +/* +* Enforce the controller to be turned on.
Quoted 8 lines
drivers/dma/idma64.c line 88
Quoted 6 lines
drivers/dma/idma64.c new file +6
-0+* +* The iDMA is turned off in ->probe() and looses context during system +* suspend / resume cycle. That's why we have to enable it each time we +* use it. +*/ +idma64_on (idma64);would it be better that you do this in resume and
runtime_resumecycle. That way it need not be called for every channel init
Mika, I don't remember details here, but this piece came from you. Can you shed a light?
My understanding that DMA IP is private to the host controller and has the same power rail. Thus, there is no need to do separate power management for it, which makes things more complicated for no profit. It is also needed for time period from probe till first transfer (otherwise we have to check the status of DMA anyway and enable it if required), which currently remains DMA off.
Quoted 10 lines
drivers/dma/idma64.c line 358
Quoted 8 lines
drivers/dma/idma64.c new file +7
-0+static size_t idma64_desc_size (struct idma64_desc *desc,unsigned int active) +{ +size_t bytes =0 ; +unsigned int i; + +for (i = active; i < desc->ndesc; i++) + bytes += desc->hw[i].len;it can help for the non active case to have this size stored in desc while preparing, that gets rid of runtime calculation for that case
I don't see much improvement, since it's a rare cases, but waste of memory. If you consider that should be done I can implement it.
Quoted 9 lines
drivers/dma/idma64.c line 366
Quoted 8 lines
drivers/dma/idma64.c new file +8
-0+ +return bytes; +} + +static size_t idma64_pending_desc_size (struct idma64_desc *desc) +{ +return idma64_desc_size (desc,0 ); +}why not invoke with 0 arg from caller?
Just for sake of making neat code. This is really minor and if you think better to call directly the mentioned function I can do that.
Quoted 12 lines
drivers/dma/idma64.c line 505
Quoted 9 lines
drivers/dma/idma64.c new file +8
-0+static int idma64_terminate_all (struct dma_chan *chan) +{ +struct idma64_chan *idma64c =to_idma64_chan (chan); +unsigned long flags; +LIST_HEAD (head); + +spin_lock_irqsave (&idma64c->vchan.lock, flags); +idma64_stop_transfer (idma64c);I dont think this is the right method for terminate. Can you check, it might be that we have to suspend the channel before terminating an active one. For non active case this should be okay
Do you mean hardware can become into wrong state?
Only what can actually happen is the data loss which is in DMA FIFO, but we already know we would like to terminate the transfer we don't care about any data loss since that.
I didn't see any specifics to that in the public specification (see cover letter for a link).
Quoted 16 lines
Quoted 5 lines
drivers/dma/idma64.c new file +4
-0+static int idma64_alloc_chan_resources (struct dma_chan *chan) +{ +struct idma64_chan *idma64c =to_idma64_chan (chan); +drivers/dma/idma64.c line 530
Quoted 10 lines
drivers/dma/idma64.c new file +10
-0+/* Create a pool of consistent memory blocks for hardware descriptors */ + idma64c->pool =dma_pool_create (dev_name (chan2dev (chan)), + chan->device->dev, +sizeof (struct idma64_lli ),8 ,0 ); +if (!idma64c->pool) { +dev_err (chan2dev (chan),"No memory for descriptors\n" ); +return -ENOMEM ; + } + +return 0 ;this should return the number descriptors you allocated for the pool
Yes, which is exactly zero on this stage.
Quoted 5 lines
drivers/dma/idma64.c line 707
Quoted 4 lines
drivers/dma/idma64.c new file +3
-0+ +static const struct dev_pm_ops idma64_dev_pm_ops = { +SET_LATE_SYSTEM_SLEEP_PM_OPS (idma64_suspend_late, idma64_resume_early)any reason why late ops?
We already discussed this several times. There is no dependency between DMA and its users during PM cycles. We have to be sure that device (host controller) is quiescent before we stop DMA.
Quoted 9 lines
--
~Vinod--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v5 7/8] dmaengine: add a driver for Intel integrated DMA 64-bit
Quoted 32 lines · Andy Shevchenko
Quoted 20 lines
Quoted 20 lines
drivers/dma/idma64.c new file +20
-0+static void idma64_chan_init (struct idma64 *idma64,struct idma64_chan *idma64c) +{ +u32 cfghi =IDMA64C_CFGH_SRC_PER (1 ) |IDMA64C_CFGH_DST_PER (0 ); +u32 cfglo =0 ; + +/* Enforce FIFO drain when channel is suspended */ + cfglo |=IDMA64C_CFGL_CH_DRAIN ; + +/* Set default burst alignment */ + cfglo |=IDMA64C_CFGL_DST_BURST_ALIGN |IDMA64C_CFGL_SRC_BURST_ALIGN ; + +channel_writel (idma64c,CFG_LO , cfglo); +channel_writel (idma64c,CFG_HI , cfghi); + +/* Enable interrupts */ +channel_set_bit (idma64,MASK (XFER ), idma64c->mask); +channel_set_bit (idma64,MASK (ERROR ), idma64c->mask); + +/* +* Enforce the controller to be turned on. Quoted 8 lines
drivers/dma/idma64.c line 88
Quoted 6 lines
drivers/dma/idma64.c new file +6
-0+* +* The iDMA is turned off in ->probe() and looses context during system +* suspend / resume cycle. That's why we have to enable it each time we +* use it. +*/ +idma64_on (idma64);would it be better that you do this in resume and
runtime_resumecycle. That way it need not be called for every channel initMika, I don't remember details here, but this piece came from you. Can you shed a light?
Quoted 6 lines
My understanding that DMA IP is private to the host controller and has the same power rail. Thus, there is no need to do separate power management for it, which makes things more complicated for no profit. It is also needed for time period from probe till first transfer (otherwise we have to check the status of DMA anyway and enable it if required), which currently remains DMA off.
so who does runtime management of this power rail and whosoever does that how do they ensure the dma is not active at that time?
Quoted 12 lines
Quoted 11 lines
drivers/dma/idma64.c line 358
Quoted 9 lines
drivers/dma/idma64.c new file +7
-0+static size_t idma64_desc_size (struct idma64_desc *desc,unsigned int active) +{ +size_t bytes =0 ; +unsigned int i; + +for (i = active; i < desc->ndesc; i++) + bytes += desc->hw[i].len;it can help for the non active case to have this size stored in desc while preparing, that gets rid of runtime calculation for that case
Quoted 2 lines
I don't see much improvement, since it's a rare cases, but waste of memory. If you consider that should be done I can implement it.
The users of timing information will invoke this in non sleeping context so it will help in using one more variable, maybe a good trade off. Also if this is a rare case do you have use of this calculation and code?
Quoted 12 lines
Quoted 11 lines
drivers/dma/idma64.c line 505
Quoted 8 lines
drivers/dma/idma64.c new file +8
-0+static int idma64_terminate_all (struct dma_chan *chan) +{ +struct idma64_chan *idma64c =to_idma64_chan (chan); +unsigned long flags; +LIST_HEAD (head); + +spin_lock_irqsave (&idma64c->vchan.lock, flags); +idma64_stop_transfer (idma64c);I dont think this is the right method for terminate. Can you check, it might be that we have to suspend the channel before terminating an active one. For non active case this should be okay
Quoted 1 line
Do you mean hardware can become into wrong state?
Yes at least that was true for 32bit version of this IP
Quoted 3 lines
Only what can actually happen is the data loss which is in DMA FIFO, but we already know we would like to terminate the transfer we don't care about any data loss since that.
The terminate flow expect you to suspend the channel first and then terminate
Quoted 7 lines
Quoted 3 lines
drivers/dma/idma64.c line 707
Quoted 2 lines
drivers/dma/idma64.c new file +2
-0+static const struct dev_pm_ops idma64_dev_pm_ops = { +SET_LATE_SYSTEM_SLEEP_PM_OPS (idma64_suspend_late, idma64_resume_early)any reason why late ops?
We already discussed this several times. There is no dependency between DMA and its users during PM cycles. We have to be sure that device (host controller) is quiescent before we stop DMA.
And the realities change! you should be looking at deferred probing for this rather than using late ops. Clients should be suspended first which means they should be probed last and in the probe ensure all the resources (dma) are available if not defer the probe.
Signature · 1 line
~Vinod
Re: [PATCH v5 7/8] dmaengine: add a driver for Intel integrated DMA 64-bit
Quoted 33 lines · Vinod Koul
Quoted 32 lines · Andy Shevchenko
Quoted 20 lines
Quoted 20 lines
drivers/dma/idma64.c new file +20
-0+static void idma64_chan_init (struct idma64 *idma64,struct idma64_chan *idma64c) +{ +u32 cfghi =IDMA64C_CFGH_SRC_PER (1 ) |IDMA64C_CFGH_DST_PER (0 ); +u32 cfglo =0 ; + +/* Enforce FIFO drain when channel is suspended */ + cfglo |=IDMA64C_CFGL_CH_DRAIN ; + +/* Set default burst alignment */ + cfglo |=IDMA64C_CFGL_DST_BURST_ALIGN |IDMA64C_CFGL_SRC_BURST_ALIGN ; + +channel_writel (idma64c,CFG_LO , cfglo); +channel_writel (idma64c,CFG_HI , cfghi); + +/* Enable interrupts */ +channel_set_bit (idma64,MASK (XFER ), idma64c->mask); +channel_set_bit (idma64,MASK (ERROR ), idma64c->mask); + +/* +* Enforce the controller to be turned on. Quoted 8 lines
drivers/dma/idma64.c line 88
Quoted 6 lines
drivers/dma/idma64.c new file +6
-0+* +* The iDMA is turned off in ->probe() and looses context during system +* suspend / resume cycle. That's why we have to enable it each time we +* use it. +*/ +idma64_on (idma64);would it be better that you do this in resume and
runtime_resumecycle. That way it need not be called for every channel initMika, I don't remember details here, but this piece came from you. Can you shed a light?
Quoted 8 lines
Quoted 6 lines
My understanding that DMA IP is private to the host controller and has the same power rail. Thus, there is no need to do separate power management for it, which makes things more complicated for no profit. It is also needed for time period from probe till first transfer (otherwise we have to check the status of DMA anyway and enable it if required), which currently remains DMA off.
so who does runtime management of this power rail and whosoever does that how do they ensure the dma is not active at that time?
The host controller driver knows this and it makes it so. Anyway, even if we introduce PM callbacks in this driver how to solve the issue to run very first transfer in a neat way?
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
drivers/dma/idma64.c line 358
Quoted 7 lines
drivers/dma/idma64.c new file +7
-0+static size_t idma64_desc_size (struct idma64_desc *desc,unsigned int active) +{ +size_t bytes =0 ; +unsigned int i; + +for (i = active; i < desc->ndesc; i++) + bytes += desc->hw[i].len;it can help for the non active case to have this size stored in desc while preparing, that gets rid of runtime calculation for that case
Quoted 5 lines
Quoted 2 lines
I don't see much improvement, since it's a rare cases, but waste of memory. If you consider that should be done I can implement it.
The users of timing information will invoke this in non sleeping context so it will help in using one more variable, maybe a good trade off. Also if this is a rare case do you have use of this calculation and code?
I have no calculations done, but the residue check is used only in one case for now, i.e. in the UART driver (see 8250_dma.c). That code serializes requests, so it will not ask for pending descriptor size. The case when we start the DMA and immediately ask for residue is unlike (when UART RX timeout happens).
Quoted 12 lines
Quoted 12 lines
Quoted 11 lines
drivers/dma/idma64.c line 505
Quoted 8 lines
drivers/dma/idma64.c new file +8
-0+static int idma64_terminate_all (struct dma_chan *chan) +{ +struct idma64_chan *idma64c =to_idma64_chan (chan); +unsigned long flags; +LIST_HEAD (head); + +spin_lock_irqsave (&idma64c->vchan.lock, flags); +idma64_stop_transfer (idma64c);I dont think this is the right method for terminate. Can you check, it might be that we have to suspend the channel before terminating an active one. For non active case this should be okay
Quoted 2 lines
Quoted 1 line
Do you mean hardware can become into wrong state?
Yes at least that was true for 32bit version of this IP
Can you elaborate what exactly is happening? We can do a test then and check. For now on we experienced no problems.
Quoted 5 lines
Quoted 4 lines
Only what can actually happen is the data loss which is in DMA FIFO, but we already know we would like to terminate the transfer we don't care about any data loss since that.
The terminate flow expect you to suspend the channel first and then terminate
Hm... I didn't see anything in the specification. Can you point out where it's described?
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
drivers/dma/idma64.c line 707
Quoted 3 lines
drivers/dma/idma64.c new file +2
-0+static const struct dev_pm_ops idma64_dev_pm_ops = { +SET_LATE_SYSTEM_SLEEP_PM_OPS (idma64_suspend_late, idma64_resume_early)any reason why late ops?
We already discussed this several times. There is no dependency between DMA and its users during PM cycles. We have to be sure that device (host controller) is quiescent before we stop DMA.
Quoted 6 lines
And the realities change! you should be looking at deferred probing for this rather than using late ops.
Clients should be suspended first which means
they should be probed last and in the probe ensure all the resources (dma) are available if not defer the probe.
Ah, deferred probe here makes no sense. We have set probing ordering in the MFD driver (for our drivers).
Looks like we may use normal calls.
Quoted 3 lines
--
~Vinod
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v5 7/8] dmaengine: add a driver for Intel integrated DMA 64-bit
Quoted 40 lines · Andy Shevchenko
Quoted 39 lines · Vinod Koul
Quoted 38 lines · Andy Shevchenko
Quoted 20 lines
Quoted 20 lines
drivers/dma/idma64.c new file +20
-0+static void idma64_chan_init (struct idma64 *idma64,struct idma64_chan *idma64c) +{ +u32 cfghi =IDMA64C_CFGH_SRC_PER (1 ) |IDMA64C_CFGH_DST_PER (0 ); +u32 cfglo =0 ; + +/* Enforce FIFO drain when channel is suspended */ + cfglo |=IDMA64C_CFGL_CH_DRAIN ; + +/* Set default burst alignment */ + cfglo |=IDMA64C_CFGL_DST_BURST_ALIGN |IDMA64C_CFGL_SRC_BURST_ALIGN ; + +channel_writel (idma64c,CFG_LO , cfglo); +channel_writel (idma64c,CFG_HI , cfghi); + +/* Enable interrupts */ +channel_set_bit (idma64,MASK (XFER ), idma64c->mask); +channel_set_bit (idma64,MASK (ERROR ), idma64c->mask); + +/* +* Enforce the controller to be turned on. Quoted 8 lines
drivers/dma/idma64.c line 88
Quoted 6 lines
drivers/dma/idma64.c new file +6
-0+* +* The iDMA is turned off in ->probe() and looses context during system +* suspend / resume cycle. That's why we have to enable it each time we +* use it. +*/ +idma64_on (idma64);would it be better that you do this in resume and
runtime_resumecycle. That way it need not be called for every channel initMika, I don't remember details here, but this piece came from you. Can you shed a light?
My understanding that DMA IP is private to the host controller and has the same power rail. Thus, there is no need to do separate power management for it, which makes things more complicated for no profit. It is also needed for time period from probe till first transfer (otherwise we have to check the status of DMA anyway and enable it if required), which currently remains DMA off.
Quoted 6 lines
Quoted 2 lines
so who does runtime management of this power rail and whosoever does that how do they ensure the dma is not active at that time?
The host controller driver knows this and it makes it so. Anyway, even if we introduce PM callbacks in this driver how to solve the issue to run very first transfer in a neat way?
And how does it know?
In PM callback case, your runtime resume should enable the controller
Quoted 34 lines
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
drivers/dma/idma64.c line 358
Quoted 7 lines
drivers/dma/idma64.c new file +7
-0+static size_t idma64_desc_size (struct idma64_desc *desc,unsigned int active) +{ +size_t bytes =0 ; +unsigned int i; + +for (i = active; i < desc->ndesc; i++) + bytes += desc->hw[i].len;it can help for the non active case to have this size stored in desc while preparing, that gets rid of runtime calculation for that case
Quoted 5 lines
Quoted 2 lines
I don't see much improvement, since it's a rare cases, but waste of memory. If you consider that should be done I can implement it.
The users of timing information will invoke this in non sleeping context so it will help in using one more variable, maybe a good trade off. Also if this is a rare case do you have use of this calculation and code?
I have no calculations done, but the residue check is used only in one case for now, i.e. in the UART driver (see
8250_dma.c). That code serializes requests, so it will not ask for pending descriptor size. The case when we start the DMA and immediately ask for residue is unlike (when UART RX timeout happens).Quoted 12 lines
Quoted 12 lines
Quoted 11 lines
drivers/dma/idma64.c line 505
Quoted 8 lines
drivers/dma/idma64.c new file +8
-0+static int idma64_terminate_all (struct dma_chan *chan) +{ +struct idma64_chan *idma64c =to_idma64_chan (chan); +unsigned long flags; +LIST_HEAD (head); + +spin_lock_irqsave (&idma64c->vchan.lock, flags); +idma64_stop_transfer (idma64c);I dont think this is the right method for terminate. Can you check, it might be that we have to suspend the channel before terminating an active one. For non active case this should be okay
Quoted 5 lines
Quoted 2 lines
Quoted 1 line
Do you mean hardware can become into wrong state?
Yes at least that was true for 32bit version of this IP
Can you elaborate what exactly is happening? We can do a test then and check. For now on we experienced no problems.
While you are doing transfers, try terminating. After that doesnt next transaction on same channel work well, if not then please try suspending first before terminating
Quoted 7 lines
Quoted 4 lines
Quoted 3 lines
Only what can actually happen is the data loss which is in DMA FIFO, but we already know we would like to terminate the transfer we don't care about any data loss since that.
The terminate flow expect you to suspend the channel first and then terminate
Hm... I didn't see anything in the specification. Can you point out where it's described?
I dont have specs to point, but we did see this issue on 32bit BYT iDMA and designer told us to follow this flow
Quoted 10 lines
Quoted 9 lines
Quoted 7 lines
Quoted 3 lines
drivers/dma/idma64.c line 707
Quoted 2 lines
drivers/dma/idma64.c new file +2
-0+static const struct dev_pm_ops idma64_dev_pm_ops = { +SET_LATE_SYSTEM_SLEEP_PM_OPS (idma64_suspend_late, idma64_resume_early)any reason why late ops?
We already discussed this several times. There is no dependency between DMA and its users during PM cycles. We have to be sure that device (host controller) is quiescent before we stop DMA.
And the realities change! you should be looking at deferred probing for this rather than using late ops.
Quoted 7 lines
Quoted 3 lines
Clients should be suspended first which means
they should be probed last and in the probe ensure all the resources (dma) are available if not defer the probe.Ah, deferred probe here makes no sense. We have set probing ordering in the MFD driver (for our drivers).
Looks like we may use normal calls.
Most of the cases where people use last ops doesnt warrant them so checking is always a good idea :)
Signature · 1 line
~Vinod
Andy Shevchenko
reviewerRe: [PATCH v5 7/8] dmaengine: add a driver for Intel integrated DMA 64-bit
Quoted 58 lines · Vinod Koul
Quoted 57 lines · Andy Shevchenko
Quoted 54 lines · Vinod Koul
Quoted 39 lines · Andy Shevchenko
Quoted 26 lines
Quoted 26 lines
+static void
idma64_chan_init(struct idma64 *idma64, struct idma64_chan *idma64c)(quoted diff) +2
-0+{ + u32 cfghi = IDMA64C_CFGH_SRC_PER(1) |
IDMA64C_CFGH_DST_PER(0);drivers/dma/idma64.c new file +7
-0+u32 cfglo =0 ; + +/* Enforce FIFO drain when channel is suspended */ + cfglo |=IDMA64C_CFGL_CH_DRAIN ; + +/* Set default burst alignment */ + cfglo |= IDMA64C_CFGL_DST_BURST_ALIGN |
IDMA64C_CFGL_SRC_BURST_ALIGN;drivers/dma/idma64.c new file +12
-0+ +channel_writel (idma64c,CFG_LO , cfglo); +channel_writel (idma64c,CFG_HI , cfghi); + +/* Enable interrupts */ +channel_set_bit (idma64,MASK (XFER ), idma64c->mask); +channel_set_bit (idma64,MASK (ERROR ), idma64c->mask); + +/* +* Enforce the controller to be turned on. +* +* The iDMA is turned off in ->probe() and looses context during system
Quoted 8 lines
drivers/dma/idma64.c line 88
Quoted 5 lines
+ * suspend / resume cycle. That's why we have to
enable it each time wedrivers/dma/idma64.c new file +3
-0+* use it. +*/ +idma64_on (idma64);would it be better that you do this in resume and
runtime_resumecycle. That
way it need not be called for every channel initMika, I don't remember details here, but this piece came from you. Can
you shed a light?Quoted 11 lines
My understanding that DMA IP is private to the host controller and has
the same power rail. Thus, there is no need to do separate power
management for it, which makes things more complicated for no profit.
It is also needed for time period from probe till first transfer
(otherwise we have to check the status of DMA anyway and enable it if
required), which currently remains DMA off.so who does runtime management of this power rail and whosoever does that
how do they ensure the dma is not active at that time?
Quoted 6 lines
Quoted 4 lines
The host controller driver knows this and it makes it so. Anyway, even if we introduce PM callbacks in this driver how to solve
the issue to run very first transfer in a neat way?And how does it know?
It should not start any transfer when system goes suspend (and terminates on going ones). It might be that not all drivers currently implement the described work flow.
Quoted 2 lines
In PM callback case, your runtime resume should enable the controller
PM runtime is an overkill here because it's not exactly turning power rail off on the device, though reference counting would makes sense.
Quoted 22 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 14 lines
drivers/dma/idma64.c line 505
Quoted 9 lines
drivers/dma/idma64.c new file +8
-0+static int idma64_terminate_all (struct dma_chan *chan) +{ +struct idma64_chan *idma64c =to_idma64_chan (chan); +unsigned long flags; +LIST_HEAD (head); + +spin_lock_irqsave (&idma64c->vchan.lock, flags); +idma64_stop_transfer (idma64c);I dont think this is the right method for terminate. Can you check, it
might be that we have to suspend the channel before terminating an active
one. For non active case this should be okayQuoted 6 lines
Quoted 2 lines
Quoted 1 line
Do you mean hardware can become into wrong state?
Yes at least that was true for 32bit version of this IP
Can you elaborate what exactly is happening? We can do a test then and
check. For now on we experienced no problems.
Quoted 5 lines
While you are doing transfers, try terminating. After that doesnt next
transaction on same channel work well, if not then please try suspending
first before terminating
I will think how to test this. Meanwhile do you think it's a show stopper for driver right now?
Quoted 14 lines
Quoted 11 lines
Quoted 8 lines
Quoted 6 lines
Only what can actually happen is the data loss which is in DMA FIFO,
but we already know we would like to terminate the transfer we don't
care about any data loss since that.The terminate flow expect you to suspend the channel first and then terminate
Hm... I didn't see anything in the specification. Can you point out where it's described?
I dont have specs to point, but we did see this issue on 32bit BYT iDMA and designer told us to follow this flow
Signature · 2 lines
Andy Shevchenko <[email protected]> Intel Finland Oy
Andy Shevchenko
reviewerPATCH v5 8/8 mfd: Add support for Intel Sunrisepoint LPSS devices
In reply to Andy ShevchenkoThe new coming Intel platforms such as Skylake will contain Sunrisepoint PCH. The main difference to the previous platforms is that the LPSS devices are compound devices where usually main (SPI, HSUART, or I2C) and DMA IPs are present.
This patch brings the driver for such devices found on Sunrisepoint PCH.
--- drivers/mfd/Kconfig | 23 ++ drivers/mfd/Makefile | 3 + drivers/mfd/intel-lpss-acpi.c | 84 +++++++ drivers/mfd/intel-lpss-pci.c | 113 +++++++++ drivers/mfd/intel-lpss.c | 524 ++++++++++++++++++++++++++++++++++++++++++ drivers/mfd/intel-lpss.h | 62 +++++ 6 files changed, 809 insertions(+) create mode 100644 drivers/mfd/intel-lpss-acpi.c create mode 100644 drivers/mfd/intel-lpss-pci.c create mode 100644 drivers/mfd/intel-lpss.c create mode 100644 drivers/mfd/intel-lpss.h
drivers/mfd/Kconfig +23 -0
@@ -328,6 +328,29 @@ config INTEL_SOC_PMIC thermal, charger and related power management functions on these systems. +config MFD_INTEL_LPSS + tristate + select COMMON_CLK + select MFD_CORE + +config MFD_INTEL_LPSS_ACPI + tristate "Intel Low Power Subsystem support in ACPI mode" + select MFD_INTEL_LPSS + depends on X86 && ACPI + help + This driver supports Intel Low Power Subsystem (LPSS) devices such as + I2C, SPI and HS-UART starting from Intel Sunrisepoint (Intel Skylake + PCH) in ACPI mode. + +config MFD_INTEL_LPSS_PCI + tristate "Intel Low Power Subsystem support in PCI mode" + select MFD_INTEL_LPSS + depends on X86 && PCI + help + This driver supports Intel Low Power Subsystem (LPSS) devices such as + I2C, SPI and HS-UART starting from Intel Sunrisepoint (Intel Skylake + PCH) in PCI mode. + config MFD_INTEL_MSIC bool "Intel MSIC" depends on INTEL_SCU_IPC
drivers/mfd/Makefile +3 -0
@@ -161,6 +161,9 @@ obj-$(CONFIG_TPS65911_COMPARATOR) += tps65911-comparator.o obj-$(CONFIG_MFD_TPS65090) += tps65090.o obj-$(CONFIG_MFD_AAT2870_CORE) += aat2870-core.o obj-$(CONFIG_MFD_ATMEL_HLCDC) += atmel-hlcdc.o +obj-$(CONFIG_MFD_INTEL_LPSS) += intel-lpss.o +obj-$(CONFIG_MFD_INTEL_LPSS_PCI) += intel-lpss-pci.o +obj-$(CONFIG_MFD_INTEL_LPSS_ACPI) += intel-lpss-acpi.o obj-$(CONFIG_MFD_INTEL_MSIC) += intel_msic.o obj-$(CONFIG_MFD_PALMAS) += palmas.o obj-$(CONFIG_MFD_VIPERBOARD) += viperboard.o
drivers/mfd/intel-lpss-acpi.c new file +84 -0
84 lines not on this page · raw message
drivers/mfd/intel-lpss-pci.c new file +113 -0
113 lines not on this page · raw message
drivers/mfd/intel-lpss.c new file +524 -0
524 lines not on this page · raw message
drivers/mfd/intel-lpss.h new file +62 -0
62 lines not on this page · raw message
Signature · 1 line
2.1.4
Re: [PATCH v5 8/8] mfd: Add support for Intel Sunrisepoint LPSS devices
Stephen,
Can you review the clock implementation please? It looks fragile to me as it relies heavily on device names constructed of MFD cell names and IDA numbers cat'ed together!
Quoted 877 lines
The new coming Intel platforms such as Skylake will contain Sunrisepoint PCH. The main difference to the previous platforms is that the LPSS devices are compound devices where usually main (SPI, HSUART, or I2C) and DMA IPs are present.
This patch brings the driver for such devices found on Sunrisepoint PCH.
Signed-off-by Mika Westerberg <[email protected]>Signed-off-by Andy Shevchenko <[email protected]>--- drivers/mfd/Kconfig | 23 ++ drivers/mfd/Makefile | 3 + drivers/mfd/intel-lpss-acpi.c | 84 +++++++ drivers/mfd/intel-lpss-pci.c | 113 +++++++++ drivers/mfd/intel-lpss.c | 524 ++++++++++++++++++++++++++++++++++++++++++ drivers/mfd/intel-lpss.h | 62 +++++ 6 files changed, 809 insertions(+) create mode 100644 drivers/mfd/intel-lpss-acpi.c create mode 100644 drivers/mfd/intel-lpss-pci.c create mode 100644 drivers/mfd/intel-lpss.c create mode 100644 drivers/mfd/intel-lpss.hdrivers/mfd/Kconfig +23
-0@@ -328,6 +328,29 @@ config INTEL_SOC_PMIC thermal, charger and related power management functions on these systems. +config MFD_INTEL_LPSS + tristate + select COMMON_CLK + select MFD_CORE + +config MFD_INTEL_LPSS_ACPI + tristate "Intel Low Power Subsystem support in ACPI mode" + select MFD_INTEL_LPSS + depends on X86 && ACPI + help + This driver supports Intel Low Power Subsystem (LPSS) devices such as + I2C, SPI and HS-UART starting from Intel Sunrisepoint (Intel Skylake + PCH) in ACPI mode. + +config MFD_INTEL_LPSS_PCI + tristate "Intel Low Power Subsystem support in PCI mode" + select MFD_INTEL_LPSS + depends on X86 && PCI + help + This driver supports Intel Low Power Subsystem (LPSS) devices such as + I2C, SPI and HS-UART starting from Intel Sunrisepoint (Intel Skylake + PCH) in PCI mode. + config MFD_INTEL_MSIC bool "Intel MSIC" depends on INTEL_SCU_IPCdrivers/mfd/Makefile +3
-0@@ -161,6 +161,9 @@ obj-$(CONFIG_TPS65911_COMPARATOR) += tps65911-comparator.o obj-$(CONFIG_MFD_TPS65090) += tps65090.o obj-$(CONFIG_MFD_AAT2870_CORE) += aat2870-core.o obj-$(CONFIG_MFD_ATMEL_HLCDC) += atmel-hlcdc.o +obj-$(CONFIG_MFD_INTEL_LPSS) += intel-lpss.o +obj-$(CONFIG_MFD_INTEL_LPSS_PCI) += intel-lpss-pci.o +obj-$(CONFIG_MFD_INTEL_LPSS_ACPI) += intel-lpss-acpi.o obj-$(CONFIG_MFD_INTEL_MSIC) += intel_msic.o obj-$(CONFIG_MFD_PALMAS) += palmas.o obj-$(CONFIG_MFD_VIPERBOARD) += viperboard.odrivers/mfd/intel-lpss-acpi.c new file +84
-0@@ -0,0 +1,84 @@ +/* +* Intel LPSS ACPI support. +* +* Copyright (C) 2015, Intel Corporation +* +* Authors: Andy Shevchenko <[email protected]> +* Mika Westerberg <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#include <linux/acpi.h> +#include <linux/ioport.h> +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/pm.h> +#include <linux/pm_runtime.h> +#include <linux/platform_device.h> + +#include "intel-lpss.h" + +static const struct intel_lpss_platform_info spt_info = { + .clk_rate =120000000 , +}; + +static const struct acpi_device_id intel_lpss_acpi_ids[] = { +/* SPT */ + {"INT3446" , (kernel_ulong_t)&spt_info }, + {"INT3447" , (kernel_ulong_t)&spt_info }, + { } +}; +MODULE_DEVICE_TABLE (acpi, intel_lpss_acpi_ids); + +static int intel_lpss_acpi_probe (struct platform_device *pdev) +{ +struct intel_lpss_platform_info *info; +const struct acpi_device_id *id; + + id =acpi_match_device (intel_lpss_acpi_ids, &pdev->dev); +if (!id) +return -ENODEV ; + + info =devm_kmemdup (&pdev->dev, (void *)id->driver_data,sizeof (*info), +GFP_KERNEL ); +if (!info) +return -ENOMEM ; + + info->mem =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); + info->irq =platform_get_irq (pdev,0 ); + +pm_runtime_set_active (&pdev->dev); +pm_runtime_enable (&pdev->dev); + +return intel_lpss_probe (&pdev->dev, info); +} + +static int intel_lpss_acpi_remove (struct platform_device *pdev) +{ +intel_lpss_remove (&pdev->dev); +pm_runtime_disable (&pdev->dev); + +return 0 ; +} + +static INTEL_LPSS_PM_OPS (intel_lpss_acpi_pm_ops); + +static struct platform_driver intel_lpss_acpi_driver = { + .probe = intel_lpss_acpi_probe, + .remove = intel_lpss_acpi_remove, + .driver = { + .name ="intel-lpss" , + .acpi_match_table = intel_lpss_acpi_ids, + .pm = &intel_lpss_acpi_pm_ops, + }, +}; + +module_platform_driver (intel_lpss_acpi_driver); + +MODULE_AUTHOR ("Andy Shevchenko <[email protected]>" ); +MODULE_AUTHOR ("Mika Westerberg <[email protected]>" ); +MODULE_DESCRIPTION ("Intel LPSS ACPI driver" ); +MODULE_LICENSE ("GPL v2" );drivers/mfd/intel-lpss-pci.c new file +113
-0@@ -0,0 +1,113 @@ +/* +* Intel LPSS PCI support. +* +* Copyright (C) 2015, Intel Corporation +* +* Authors: Andy Shevchenko <[email protected]> +* Mika Westerberg <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#include <linux/ioport.h> +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/pci.h> +#include <linux/pm.h> +#include <linux/pm_runtime.h> + +#include "intel-lpss.h" + +static int intel_lpss_pci_probe (struct pci_dev *pdev, +const struct pci_device_id *id) +{ +struct intel_lpss_platform_info *info; +int ret; + + ret =pcim_enable_device (pdev); +if (ret) +return ret; + + info =devm_kmemdup (&pdev->dev, (void *)id->driver_data,sizeof (*info), +GFP_KERNEL ); +if (!info) +return -ENOMEM ; + + info->mem = &pdev->resource[0 ]; + info->irq = pdev->irq; + +/* Probably it is enough to set this for iDMA capable devices only */ +pci_set_master (pdev); + + ret =intel_lpss_probe (&pdev->dev, info); +if (ret) +return ret; + +pm_runtime_put (&pdev->dev); +pm_runtime_allow (&pdev->dev); + +return 0 ; +} + +static void intel_lpss_pci_remove (struct pci_dev *pdev) +{ +pm_runtime_forbid (&pdev->dev); +pm_runtime_get_sync (&pdev->dev); + +intel_lpss_remove (&pdev->dev); +} + +static INTEL_LPSS_PM_OPS (intel_lpss_pci_pm_ops); + +static const struct intel_lpss_platform_info spt_info = { + .clk_rate =120000000 , +}; + +static const struct intel_lpss_platform_info spt_uart_info = { + .clk_rate =120000000 , + .clk_con_id ="baudclk" , +}; + +static const struct pci_device_id intel_lpss_pci_ids[] = { +/* SPT-LP */ + {PCI_VDEVICE (INTEL ,0x9d27 ), (kernel_ulong_t)&spt_uart_info }, + {PCI_VDEVICE (INTEL ,0x9d28 ), (kernel_ulong_t)&spt_uart_info }, + {PCI_VDEVICE (INTEL ,0x9d29 ), (kernel_ulong_t)&spt_info }, + {PCI_VDEVICE (INTEL ,0x9d2a ), (kernel_ulong_t)&spt_info }, + {PCI_VDEVICE (INTEL ,0x9d60 ), (kernel_ulong_t)&spt_info }, + {PCI_VDEVICE (INTEL ,0x9d61 ), (kernel_ulong_t)&spt_info }, + {PCI_VDEVICE (INTEL ,0x9d62 ), (kernel_ulong_t)&spt_info }, + {PCI_VDEVICE (INTEL ,0x9d63 ), (kernel_ulong_t)&spt_info }, + {PCI_VDEVICE (INTEL ,0x9d64 ), (kernel_ulong_t)&spt_info }, + {PCI_VDEVICE (INTEL ,0x9d65 ), (kernel_ulong_t)&spt_info }, + {PCI_VDEVICE (INTEL ,0x9d66 ), (kernel_ulong_t)&spt_uart_info }, +/* SPT-H */ + {PCI_VDEVICE (INTEL ,0xa127 ), (kernel_ulong_t)&spt_uart_info }, + {PCI_VDEVICE (INTEL ,0xa128 ), (kernel_ulong_t)&spt_uart_info }, + {PCI_VDEVICE (INTEL ,0xa129 ), (kernel_ulong_t)&spt_info }, + {PCI_VDEVICE (INTEL ,0xa12a ), (kernel_ulong_t)&spt_info }, + {PCI_VDEVICE (INTEL ,0xa160 ), (kernel_ulong_t)&spt_info }, + {PCI_VDEVICE (INTEL ,0xa161 ), (kernel_ulong_t)&spt_info }, + {PCI_VDEVICE (INTEL ,0xa166 ), (kernel_ulong_t)&spt_uart_info }, + { } +}; +MODULE_DEVICE_TABLE (pci, intel_lpss_pci_ids); + +static struct pci_driver intel_lpss_pci_driver = { + .name ="intel-lpss" , + .id_table = intel_lpss_pci_ids, + .probe = intel_lpss_pci_probe, + .remove = intel_lpss_pci_remove, + .driver = { + .pm = &intel_lpss_pci_pm_ops, + }, +}; + +module_pci_driver (intel_lpss_pci_driver); + +MODULE_AUTHOR ("Andy Shevchenko <[email protected]>" ); +MODULE_AUTHOR ("Mika Westerberg <[email protected]>" ); +MODULE_DESCRIPTION ("Intel LPSS PCI driver" ); +MODULE_LICENSE ("GPL v2" );drivers/mfd/intel-lpss.c new file +524
-0@@ -0,0 +1,524 @@ +/* +* Intel Sunrisepoint LPSS core support. +* +* Copyright (C) 2015, Intel Corporation +* +* Authors: Andy Shevchenko <[email protected]> +* Mika Westerberg <[email protected]> +* Heikki Krogerus <[email protected]> +* Jarkko Nikula <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#include <linux/clk.h> +#include <linux/clkdev.h> +#include <linux/clk-provider.h> +#include <linux/debugfs.h> +#include <linux/idr.h> +#include <linux/ioport.h> +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/mfd/core.h> +#include <linux/pm_qos.h> +#include <linux/pm_runtime.h> +#include <linux/seq_file.h> + +#include "intel-lpss.h" + +#define LPSS_DEV_OFFSET 0x000 +#define LPSS_DEV_SIZE 0x200 +#define LPSS_PRIV_OFFSET 0x200 +#define LPSS_PRIV_SIZE 0x100 +#define LPSS_IDMA64_OFFSET 0x800 +#define LPSS_IDMA64_SIZE 0x800 + +/* Offsets from lpss->priv */ +#define LPSS_PRIV_RESETS 0x04 +#define LPSS_PRIV_RESETS_FUNC BIT(2) +#define LPSS_PRIV_RESETS_IDMA 0x3 + +#define LPSS_PRIV_ACTIVELTR 0x10 +#define LPSS_PRIV_IDLELTR 0x14 + +#define LPSS_PRIV_LTR_REQ BIT(15) +#define LPSS_PRIV_LTR_SCALE_MASK 0xc00 +#define LPSS_PRIV_LTR_SCALE_1US 0x800 +#define LPSS_PRIV_LTR_SCALE_32US 0xc00 +#define LPSS_PRIV_LTR_VALUE_MASK 0x3ff + +#define LPSS_PRIV_SSP_REG 0x20 +#define LPSS_PRIV_SSP_REG_DIS_DMA_FIN BIT(0) + +#define LPSS_PRIV_REMAP_ADDR_LO 0x40 +#define LPSS_PRIV_REMAP_ADDR_HI 0x44 + +#define LPSS_PRIV_CAPS 0xfc +#define LPSS_PRIV_CAPS_NO_IDMA BIT(8) +#define LPSS_PRIV_CAPS_TYPE_SHIFT 4 +#define LPSS_PRIV_CAPS_TYPE_MASK (0xf << LPSS_PRIV_CAPS_TYPE_SHIFT) + +/* This matches the type field in CAPS register */ +enum intel_lpss_dev_type { +LPSS_DEV_I2C =0 , +LPSS_DEV_UART , +LPSS_DEV_SPI , +}; + +struct intel_lpss { +const struct intel_lpss_platform_info *info; +enum intel_lpss_dev_type type; +struct clk *clk; +struct clk_lookup *clock; +const struct mfd_cell *cell; +struct device *dev; +void __iomem *priv; +int devid; +u32 caps; +u32 active_ltr; +u32 idle_ltr; +struct dentry *debugfs; +}; + +static const struct resource intel_lpss_dev_resources[] = { +DEFINE_RES_MEM_NAMED (LPSS_DEV_OFFSET ,LPSS_DEV_SIZE ,"lpss_dev" ), +DEFINE_RES_MEM_NAMED (LPSS_PRIV_OFFSET ,LPSS_PRIV_SIZE ,"lpss_priv" ), +DEFINE_RES_IRQ (0 ), +}; + +static const struct resource intel_lpss_idma64_resources[] = { +DEFINE_RES_MEM (LPSS_IDMA64_OFFSET ,LPSS_IDMA64_SIZE ), +DEFINE_RES_IRQ (0 ), +}; + +#define LPSS_IDMA64_DRIVER_NAME "idma64" + +/* +* Cells needs to be ordered so that the iDMA is created first. This is +* because we need to be sure the DMA is available when the host controller +* driver is probed. +*/ +static const struct mfd_cell intel_lpss_idma64_cell = { + .name =LPSS_IDMA64_DRIVER_NAME , + .num_resources =ARRAY_SIZE (intel_lpss_idma64_resources), + .resources = intel_lpss_idma64_resources, +}; + +static const struct mfd_cell intel_lpss_i2c_cell = { + .name ="i2c_designware" , + .num_resources =ARRAY_SIZE (intel_lpss_dev_resources), + .resources = intel_lpss_dev_resources, +}; + +static const struct mfd_cell intel_lpss_uart_cell = { + .name ="dw-apb-uart" , + .num_resources =ARRAY_SIZE (intel_lpss_dev_resources), + .resources = intel_lpss_dev_resources, +}; + +static const struct mfd_cell intel_lpss_spi_cell = { + .name ="pxa2xx-spi" , + .num_resources =ARRAY_SIZE (intel_lpss_dev_resources), + .resources = intel_lpss_dev_resources, +}; + +static DEFINE_IDA (intel_lpss_devid_ida); +static struct dentry *intel_lpss_debugfs; + +static int intel_lpss_request_dma_module (const char *name) +{ +static bool intel_lpss_dma_requested; + +if (intel_lpss_dma_requested) +return 0 ; + + intel_lpss_dma_requested = true; +return request_module ("%s" , name); +} + +static void intel_lpss_cache_ltr (struct intel_lpss *lpss) +{ + lpss->active_ltr =readl (lpss->priv +LPSS_PRIV_ACTIVELTR ); + lpss->idle_ltr =readl (lpss->priv +LPSS_PRIV_IDLELTR ); +} + +static int intel_lpss_debugfs_add (struct intel_lpss *lpss) +{ +struct dentry *dir; + + dir =debugfs_create_dir (dev_name (lpss->dev), intel_lpss_debugfs); +if (IS_ERR (dir)) +return PTR_ERR (dir); + +/* Cache the values into lpss structure */ +intel_lpss_cache_ltr (lpss); + +debugfs_create_x32 ("capabilities" ,S_IRUGO , dir, &lpss->caps); +debugfs_create_x32 ("active_ltr" ,S_IRUGO , dir, &lpss->active_ltr); +debugfs_create_x32 ("idle_ltr" ,S_IRUGO , dir, &lpss->idle_ltr); + + lpss->debugfs = dir; +return 0 ; +} + +static void intel_lpss_debugfs_remove (struct intel_lpss *lpss) +{ +debugfs_remove_recursive (lpss->debugfs); +} + +static void intel_lpss_ltr_set (struct device *dev,s32 val) +{ +struct intel_lpss *lpss =dev_get_drvdata (dev); +u32 ltr; + +/* +* Program latency tolerance (LTR) accordingly what has been asked +* by the PM QoS layer or disable it in case we were passed +* negative value or PM_QOS_LATENCY_ANY. +*/ + ltr =readl (lpss->priv +LPSS_PRIV_ACTIVELTR ); + +if (val ==PM_QOS_LATENCY_ANY || val <0 ) { + ltr &= ~LPSS_PRIV_LTR_REQ ; + }else { + ltr |=LPSS_PRIV_LTR_REQ ; + ltr &= ~LPSS_PRIV_LTR_SCALE_MASK ; + ltr &= ~LPSS_PRIV_LTR_VALUE_MASK ; + +if (val >LPSS_PRIV_LTR_VALUE_MASK ) + ltr |=LPSS_PRIV_LTR_SCALE_32US | val >>5 ; +else + ltr |=LPSS_PRIV_LTR_SCALE_1US | val; + } + +if (ltr == lpss->active_ltr) +return ; + +writel (ltr, lpss->priv +LPSS_PRIV_ACTIVELTR ); +writel (ltr, lpss->priv +LPSS_PRIV_IDLELTR ); + +/* Cache the values into lpss structure */ +intel_lpss_cache_ltr (lpss); +} + +static void intel_lpss_ltr_expose (struct intel_lpss *lpss) +{ + lpss->dev->power.set_latency_tolerance = intel_lpss_ltr_set; +dev_pm_qos_expose_latency_tolerance (lpss->dev); +} + +static void intel_lpss_ltr_hide (struct intel_lpss *lpss) +{ +dev_pm_qos_hide_latency_tolerance (lpss->dev); + lpss->dev->power.set_latency_tolerance =NULL ; +} + +static int intel_lpss_assign_devs (struct intel_lpss *lpss) +{ +unsigned int type; + + type = lpss->caps &LPSS_PRIV_CAPS_TYPE_MASK ; + type >>=LPSS_PRIV_CAPS_TYPE_SHIFT ; + +switch (type) { +case LPSS_DEV_I2C : + lpss->cell = &intel_lpss_i2c_cell; +break ; +case LPSS_DEV_UART : + lpss->cell = &intel_lpss_uart_cell; +break ; +case LPSS_DEV_SPI : + lpss->cell = &intel_lpss_spi_cell; +break ; +default : +return -ENODEV ; + } + + lpss->type = type; + +return 0 ; +} + +static bool intel_lpss_has_idma (const struct intel_lpss *lpss) +{ +return (lpss->caps &LPSS_PRIV_CAPS_NO_IDMA ) ==0 ; +} + +static void intel_lpss_set_remap_addr (const struct intel_lpss *lpss) +{ +resource_size_t addr = lpss->info->mem->start; + +writel (addr, lpss->priv +LPSS_PRIV_REMAP_ADDR_LO ); +#if BITS_PER_LONG >32 +writel (addr >>32 , lpss->priv +LPSS_PRIV_REMAP_ADDR_HI ); +#else +writel (0 , lpss->priv +LPSS_PRIV_REMAP_ADDR_HI ); +#endif +} + +static void intel_lpss_deassert_reset (const struct intel_lpss *lpss) +{ +u32 value =LPSS_PRIV_RESETS_FUNC |LPSS_PRIV_RESETS_IDMA ; + +/* Bring out the device from reset */ +writel (value, lpss->priv +LPSS_PRIV_RESETS ); +} + +static void intel_lpss_init_dev (const struct intel_lpss *lpss) +{ +u32 value =LPSS_PRIV_SSP_REG_DIS_DMA_FIN ; + +intel_lpss_deassert_reset (lpss); + +if (!intel_lpss_has_idma (lpss)) +return ; + +intel_lpss_set_remap_addr (lpss); + +/* Make sure that SPI multiblock DMA transfers are re-enabled */ +if (lpss->type ==LPSS_DEV_SPI ) +writel (value, lpss->priv +LPSS_PRIV_SSP_REG ); +} + +static void intel_lpss_unregister_clock_tree (struct clk *clk) +{ +struct clk *parent; + +while (clk) { + parent =clk_get_parent (clk); +clk_unregister (clk); + clk = parent; + } +} + +static int intel_lpss_register_clock_divider (struct intel_lpss *lpss, +const char *devname, +struct clk **clk) +{ +char name[32 ]; +struct clk *tmp = *clk; + +snprintf (name,sizeof (name),"%s-enable" , devname); + tmp =clk_register_gate (NULL , name,__clk_get_name (tmp),0 , + lpss->priv,0 ,0 ,NULL ); +if (IS_ERR (tmp)) +return PTR_ERR (tmp); + +snprintf (name,sizeof (name),"%s-div" , devname); + tmp =clk_register_fractional_divider (NULL , name,__clk_get_name (tmp), +0 , lpss->priv,1 ,15 ,16 ,15 ,0 , +NULL ); +if (IS_ERR (tmp)) +return PTR_ERR (tmp); + *clk = tmp; + +snprintf (name,sizeof (name),"%s-update" , devname); + tmp =clk_register_gate (NULL , name,__clk_get_name (tmp), +CLK_SET_RATE_PARENT , lpss->priv,31 ,0 ,NULL ); +if (IS_ERR (tmp)) +return PTR_ERR (tmp); + *clk = tmp; + +return 0 ; +} + +static int intel_lpss_register_clock (struct intel_lpss *lpss) +{ +const struct mfd_cell *cell = lpss->cell; +struct clk *clk; +char devname[24 ]; +int ret; + +if (!lpss->info->clk_rate) +return 0 ; + +/* Root clock */ + clk =clk_register_fixed_rate (NULL ,dev_name (lpss->dev),NULL , +CLK_IS_ROOT , lpss->info->clk_rate); +if (IS_ERR (clk)) +return PTR_ERR (clk); + +snprintf (devname,sizeof (devname),"%s.%d" , cell->name, lpss->devid); + +/* +* Support for clock divider only if it has some preset value. +* Otherwise we assume that the divider is not used. +*/ +if (lpss->type !=LPSS_DEV_I2C ) { + ret =intel_lpss_register_clock_divider (lpss, devname, &clk); +if (ret) + goto err_clk_register; + } + + ret = -ENOMEM ; + +/* Clock for the host controller */ + lpss->clock =clkdev_create (clk, lpss->info->clk_con_id,"%s" , devname); +if (!lpss->clock) + goto err_clk_register; + + lpss->clk = clk; + +return 0 ; + +err_clk_register: +intel_lpss_unregister_clock_tree (clk); + +return ret; +} + +static void intel_lpss_unregister_clock (struct intel_lpss *lpss) +{ +if (IS_ERR_OR_NULL (lpss->clk)) +return ; + +clkdev_drop (lpss->clock); +intel_lpss_unregister_clock_tree (lpss->clk); +} + +int intel_lpss_probe (struct device *dev, +const struct intel_lpss_platform_info *info) +{ +struct intel_lpss *lpss; +int ret; + +if (!info || !info->mem || info->irq <=0 ) +return -EINVAL ; + + lpss =devm_kzalloc (dev,sizeof (*lpss),GFP_KERNEL ); +if (!lpss) +return -ENOMEM ; + + lpss->priv =devm_ioremap (dev, info->mem->start +LPSS_PRIV_OFFSET , +LPSS_PRIV_SIZE ); +if (!lpss->priv) +return -ENOMEM ; + + lpss->info = info; + lpss->dev = dev; + lpss->caps =readl (lpss->priv +LPSS_PRIV_CAPS ); + +dev_set_drvdata (dev, lpss); + + ret =intel_lpss_assign_devs (lpss); +if (ret) +return ret; + +intel_lpss_init_dev (lpss); + + lpss->devid =ida_simple_get (&intel_lpss_devid_ida,0 ,0 ,GFP_KERNEL ); +if (lpss->devid <0 ) +return lpss->devid; + + ret =intel_lpss_register_clock (lpss); +if (ret) + goto err_clk_register; + +intel_lpss_ltr_expose (lpss); + + ret =intel_lpss_debugfs_add (lpss); +if (ret) +dev_warn (dev,"Failed to create debugfs entries\n" ); + +if (intel_lpss_has_idma (lpss)) { +/* +* Ensure the DMA driver is loaded before the host +* controller device appears, so that the host controller +* driver can request its DMA channels as early as +* possible. +* +* If the DMA module is not there that's OK as well. +*/ +intel_lpss_request_dma_module (LPSS_IDMA64_DRIVER_NAME ); + + ret =mfd_add_devices (dev, lpss->devid, &intel_lpss_idma64_cell, +1 , info->mem, info->irq,NULL ); +if (ret) +dev_warn (dev,"Failed to add %s, fallback to PIO\n" , +LPSS_IDMA64_DRIVER_NAME ); + } + + ret =mfd_add_devices (dev, lpss->devid, lpss->cell, +1 , info->mem, info->irq,NULL ); +if (ret) + goto err_remove_ltr; + +return 0 ; + +err_remove_ltr: +intel_lpss_debugfs_remove (lpss); +intel_lpss_ltr_hide (lpss); + +err_clk_register: +ida_simple_remove (&intel_lpss_devid_ida, lpss->devid); + +return ret; +} +EXPORT_SYMBOL_GPL (intel_lpss_probe); + +void intel_lpss_remove (struct device *dev) +{ +struct intel_lpss *lpss =dev_get_drvdata (dev); + +mfd_remove_devices (dev); +intel_lpss_debugfs_remove (lpss); +intel_lpss_ltr_hide (lpss); +intel_lpss_unregister_clock (lpss); +ida_simple_remove (&intel_lpss_devid_ida, lpss->devid); +} +EXPORT_SYMBOL_GPL (intel_lpss_remove); + +static int resume_lpss_device (struct device *dev,void *data) +{ +pm_runtime_resume (dev); +return 0 ; +} + +int intel_lpss_prepare (struct device *dev) +{ +/* +* Resume both child devices before entering system sleep. This +* ensures that they are in proper state before they get suspended. +*/ +device_for_each_child_reverse (dev,NULL , resume_lpss_device); +return 0 ; +} +EXPORT_SYMBOL_GPL (intel_lpss_prepare); + +int intel_lpss_suspend (struct device *dev) +{ +return 0 ; +} +EXPORT_SYMBOL_GPL (intel_lpss_suspend); + +int intel_lpss_resume (struct device *dev) +{ +struct intel_lpss *lpss =dev_get_drvdata (dev); + +intel_lpss_init_dev (lpss); + +return 0 ; +} +EXPORT_SYMBOL_GPL (intel_lpss_resume); + +static int __init intel_lpss_init (void ) +{ + intel_lpss_debugfs =debugfs_create_dir ("intel_lpss" ,NULL ); +return 0 ; +} +module_init (intel_lpss_init); + +static void __exit intel_lpss_exit(void) +{ +debugfs_remove (intel_lpss_debugfs); +} +module_exit (intel_lpss_exit); + +MODULE_AUTHOR ("Andy Shevchenko <[email protected]>" ); +MODULE_AUTHOR ("Mika Westerberg <[email protected]>" ); +MODULE_AUTHOR ("Heikki Krogerus <[email protected]>" ); +MODULE_AUTHOR ("Jarkko Nikula <[email protected]>" ); +MODULE_DESCRIPTION ("Intel LPSS core driver" ); +MODULE_LICENSE ("GPL v2" );drivers/mfd/intel-lpss.h new file +62
-0@@ -0,0 +1,62 @@ +/* +* Intel LPSS core support. +* +* Copyright (C) 2015, Intel Corporation +* +* Authors: Andy Shevchenko <[email protected]> +* Mika Westerberg <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#ifndef __MFD_INTEL_LPSS_H +#define __MFD_INTEL_LPSS_H + +struct device ; +struct resource ; + +struct intel_lpss_platform_info { +struct resource *mem; +int irq; +unsigned long clk_rate; +const char *clk_con_id; +}; + +int intel_lpss_probe (struct device *dev, +const struct intel_lpss_platform_info *info); +void intel_lpss_remove (struct device *dev); + +#ifdef CONFIG_PM +int intel_lpss_prepare (struct device *dev); +int intel_lpss_suspend (struct device *dev); +int intel_lpss_resume (struct device *dev); + +#ifdef CONFIG_PM_SLEEP +#define INTEL_LPSS_SLEEP_PM_OPS \ + .prepare = intel_lpss_prepare, \ + .suspend = intel_lpss_suspend, \ + .resume = intel_lpss_resume, \ + .freeze = intel_lpss_suspend, \ + .thaw = intel_lpss_resume, \ + .poweroff = intel_lpss_suspend, \ + .restore = intel_lpss_resume, +#endif + +#define INTEL_LPSS_RUNTIME_PM_OPS \ + .runtime_suspend = intel_lpss_suspend, \ + .runtime_resume = intel_lpss_resume, + +#else /* !CONFIG_PM */ +#define INTEL_LPSS_SLEEP_PM_OPS +#define INTEL_LPSS_RUNTIME_PM_OPS +#endif /* CONFIG_PM */ + +#define INTEL_LPSS_PM_OPS (name) \ +const struct dev_pm_ops name = { \ + INTEL_LPSS_SLEEP_PM_OPS \ + INTEL_LPSS_RUNTIME_PM_OPS \ +} + +#endif /* __MFD_INTEL_LPSS_H */
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Andy Shevchenko
reviewerQuoted 30 lines · Andy Shevchenko
The new coming Intel platforms such as Skylake will contain Sunrisepoint PCH.
The driver is based on MFD framework since the main device, i.e. serial bus
controller, contains register space for itself, DMA part, and an additional
address space (convergence layer).The public specification of the register map is avaiable in [1].
This is fifth generation of the patch series to bring support LPSS devices
found on Intel Sunrisepoint (Intel Skylake PCH). Previous one can be found here
[2].The series has few logical parts:
- patches 1-3 prepares PM core, ACPI, and driver core (PM) to handle our case
- patches 4-6 introduce unregistering platform devices in MFD in reversed
order
- patch 7 implements iDMA 64-bit driver
- patch 8 introduces an MFD driver for LPSS devicesThe patch 7 can be applied independently, though it's better if it goes before
patch 8.
Quoted 5 lines
The driver has been tested with SPI and UART on Intel Skylake PCH.
[1] https://download.01.org/future-platform-configuration
-hub/skylake/register-definitions/332219-002.pdf
[2] http://www.spinics.net/lists/linux-acpi/msg58622.html
Gentle ping on this.
Vinod, can you Ack the DMA driver?
Quoted 80 lines
Changelog v5:
- rebase on top of v4.2-rc1
- patch 3 is modified accordingly to new changes indrivers/base/dd.c
- correct Rafael's email in patch 3Changelog v4:
- replace patch 3 by Rafael's suggession
- append ACKs from Rafael
- rebase on top of v4.1-rc8Changelog v3:
- rework patch 3 to be used for all kind of devices (address Alan
comment)
- iDMA 64-bit driver improvements:
- fix burst-to-register conversion
- remove excessive locking
- do not expose core part to the user (Kconfig)
- address most of Lee's comments
- append ACKs
- rebase on top of v4.1-rc6Changelog v2:
- new DMA driver to fully support iDMA 64-bit IP
- patch 3 is added to wake up parent devices when ->probe(),
->remove(), or->shutdown()- MFD core is unregistering devices in reversed order
- address few Lee's comments on v1
- address Russel's comment, therefore useclkdev_create()helper
- intel-lpss{,-acpi,-pci} are modified regarding to above changesAndy Shevchenko (5):
klist: implementklist_prev()
driver core: implementdevice_for_each_child_reverse()
mfd: makemfd_remove_devices()iterate in reverse order
dmaengine: add a driver for Intel integrated DMA 64-bit
mfd: Add support for Intel Sunrisepoint LPSS devicesMika Westerberg (2):
PM / QoS: Make it possible to expose device latency tolerance to
userspace
ACPI / PM: Attach ACPI power domain only onceRafael J. Wysocki (1):
Driver core: wakeup the parent device before trying probedrivers/acpi/device_pm.c | 8 + drivers/acpi/internal.h | 2 + drivers/acpi/scan.c | 46 ++- drivers/base/core.c | 43 +++ drivers/base/dd.c | 20 ++ drivers/base/power/power.h | 2 + drivers/base/power/qos.c | 37 +++ drivers/base/power/sysfs.c | 11 + drivers/dma/Kconfig | 5 + drivers/dma/Makefile | 1 + drivers/dma/idma64.c | 724 ++++++++++++++++++++++++++++++++++++++++++ drivers/dma/idma64.h | 232 ++++++++++++++ drivers/mfd/Kconfig | 23 ++ drivers/mfd/Makefile | 3 + drivers/mfd/intel-lpss-acpi.c | 84 +++++ drivers/mfd/intel-lpss-pci.c | 113 +++++++ drivers/mfd/intel-lpss.c | 524 ++++++++++++++++++++++++++++++ drivers/mfd/intel-lpss.h | 62 ++++ drivers/mfd/mfd-core.c | 2 +- include/linux/device.h | 2 + include/linux/klist.h | 1 + include/linux/pm_qos.h | 5 + lib/klist.c | 41 +++ 23 files changed, 1974 insertions(+), 17 deletions(-) create mode 100644 drivers/dma/idma64.c create mode 100644 drivers/dma/idma64.h create mode 100644 drivers/mfd/intel-lpss-acpi.c create mode 100644 drivers/mfd/intel-lpss-pci.c create mode 100644 drivers/mfd/intel-lpss.c create mode 100644 drivers/mfd/intel-lpss.h
Signature · 2 lines
Andy Shevchenko <[email protected]> Intel Finland Oy
Quoted 33 lines · Andy Shevchenko
Quoted 32 lines · Andy Shevchenko
The new coming Intel platforms such as Skylake will contain Sunrisepoint PCH.
The driver is based on MFD framework since the main device, i.e. serial bus
controller, contains register space for itself, DMA part, and an additional
address space (convergence layer).The public specification of the register map is avaiable in [1].
This is fifth generation of the patch series to bring support LPSS devices
found on Intel Sunrisepoint (Intel Skylake PCH). Previous one can be found here
[2].The series has few logical parts:
- patches 1-3 prepares PM core, ACPI, and driver core (PM) to handle our case
- patches 4-6 introduce unregistering platform devices in MFD in reversed
order
- patch 7 implements iDMA 64-bit driver
- patch 8 introduces an MFD driver for LPSS devicesThe patch 7 can be applied independently, though it's better if it goes before
patch 8.The driver has been tested with SPI and UART on Intel Skylake PCH.
Quoted 7 lines
Quoted 3 lines
[1] https://download.01.org/future-platform-configuration
-hub/skylake/register-definitions/332219-002.pdf
[2] http://www.spinics.net/lists/linux-acpi/msg58622.htmlGentle ping on this.
Vinod, can you Ack the DMA driver?
I thought it was independent and can go thru dmaengine tree..?
Signature · 1 line
~Vinod
Andy Shevchenko
reviewerQuoted 39 lines · Vinod Koul
Quoted 38 lines · Andy Shevchenko
Quoted 37 lines · Andy Shevchenko
The new coming Intel platforms such as Skylake will contain Sunrisepoint PCH.
The driver is based on MFD framework since the main device, i.e. serial bus
controller, contains register space for itself, DMA part, and an additional
address space (convergence layer).The public specification of the register map is avaiable in [1].
This is fifth generation of the patch series to bring support LPSS
devices
found on Intel Sunrisepoint (Intel Skylake PCH). Previous one can be
found here
[2].The series has few logical parts:
- patches 1-3 prepares PM core, ACPI, and driver core (PM) to handle
our case
- patches 4-6 introduce unregistering platform devices in MFD in reversed
order
- patch 7 implements iDMA 64-bit driver
- patch 8 introduces an MFD driver for LPSS devicesThe patch 7 can be applied independently, though it's better if it
goes before
patch 8.The driver has been tested with SPI and UART on Intel Skylake PCH.
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines
[1] https://download.01.org/future-platform-configuration
-hub/skylake/register-definitions/332219-002.pdf
[2] http://www.spinics.net/lists/linux-acpi/msg58622.htmlGentle ping on this.
Vinod, can you Ack the DMA driver?
I thought it was independent and can go thru dmaengine tree..?
Technically yes, logically it doesn't make much sense to go outside of the series, on one hand we will have driver without users, on the other the actual user may experience performance issues. So, the first one is preferred if we push this driver separately. You may go ahead if you have no objections.
Signature · 2 lines
Andy Shevchenko <[email protected]> Intel Finland Oy
Andy Shevchenko
reviewerQuoted 30 lines · Andy Shevchenko
The new coming Intel platforms such as Skylake will contain Sunrisepoint PCH.
The driver is based on MFD framework since the main device, i.e. serial bus
controller, contains register space for itself, DMA part, and an additional
address space (convergence layer).The public specification of the register map is avaiable in [1].
This is fifth generation of the patch series to bring support LPSS devices
found on Intel Sunrisepoint (Intel Skylake PCH). Previous one can be found here
[2].The series has few logical parts:
- patches 1-3 prepares PM core, ACPI, and driver core (PM) to handle our case
- patches 4-6 introduce unregistering platform devices in MFD in reversed
order
- patch 7 implements iDMA 64-bit driver
- patch 8 introduces an MFD driver for LPSS devicesThe patch 7 can be applied independently, though it's better if it goes before
patch 8.
Quoted 5 lines
The driver has been tested with SPI and UART on Intel Skylake PCH.
[1] https://download.01.org/future-platform-configuration
-hub/skylake/register-definitions/332219-002.pdf
[2] http://www.spinics.net/lists/linux-acpi/msg58622.html
Lee, can we move forward this thing somehow?
We may create a topic branch for you where we apply already Acked patches (1-5) to reduce burden on reviewers. Would it help?
Quoted 80 lines
Changelog v5:
- rebase on top of v4.2-rc1
- patch 3 is modified accordingly to new changes indrivers/base/dd.c
- correct Rafael's email in patch 3Changelog v4:
- replace patch 3 by Rafael's suggession
- append ACKs from Rafael
- rebase on top of v4.1-rc8Changelog v3:
- rework patch 3 to be used for all kind of devices (address Alan
comment)
- iDMA 64-bit driver improvements:
- fix burst-to-register conversion
- remove excessive locking
- do not expose core part to the user (Kconfig)
- address most of Lee's comments
- append ACKs
- rebase on top of v4.1-rc6Changelog v2:
- new DMA driver to fully support iDMA 64-bit IP
- patch 3 is added to wake up parent devices when ->probe(),
->remove(), or->shutdown()- MFD core is unregistering devices in reversed order
- address few Lee's comments on v1
- address Russel's comment, therefore useclkdev_create()helper
- intel-lpss{,-acpi,-pci} are modified regarding to above changesAndy Shevchenko (5):
klist: implementklist_prev()
driver core: implementdevice_for_each_child_reverse()
mfd: makemfd_remove_devices()iterate in reverse order
dmaengine: add a driver for Intel integrated DMA 64-bit
mfd: Add support for Intel Sunrisepoint LPSS devicesMika Westerberg (2):
PM / QoS: Make it possible to expose device latency tolerance to
userspace
ACPI / PM: Attach ACPI power domain only onceRafael J. Wysocki (1):
Driver core: wakeup the parent device before trying probedrivers/acpi/device_pm.c | 8 + drivers/acpi/internal.h | 2 + drivers/acpi/scan.c | 46 ++- drivers/base/core.c | 43 +++ drivers/base/dd.c | 20 ++ drivers/base/power/power.h | 2 + drivers/base/power/qos.c | 37 +++ drivers/base/power/sysfs.c | 11 + drivers/dma/Kconfig | 5 + drivers/dma/Makefile | 1 + drivers/dma/idma64.c | 724 ++++++++++++++++++++++++++++++++++++++++++ drivers/dma/idma64.h | 232 ++++++++++++++ drivers/mfd/Kconfig | 23 ++ drivers/mfd/Makefile | 3 + drivers/mfd/intel-lpss-acpi.c | 84 +++++ drivers/mfd/intel-lpss-pci.c | 113 +++++++ drivers/mfd/intel-lpss.c | 524 ++++++++++++++++++++++++++++++ drivers/mfd/intel-lpss.h | 62 ++++ drivers/mfd/mfd-core.c | 2 +- include/linux/device.h | 2 + include/linux/klist.h | 1 + include/linux/pm_qos.h | 5 + lib/klist.c | 41 +++ 23 files changed, 1974 insertions(+), 17 deletions(-) create mode 100644 drivers/dma/idma64.c create mode 100644 drivers/dma/idma64.h create mode 100644 drivers/mfd/intel-lpss-acpi.c create mode 100644 drivers/mfd/intel-lpss-pci.c create mode 100644 drivers/mfd/intel-lpss.c create mode 100644 drivers/mfd/intel-lpss.h
Signature · 2 lines
Andy Shevchenko <[email protected]> Intel Finland Oy
Quoted 33 lines · Andy Shevchenko
Quoted 32 lines · Andy Shevchenko
The new coming Intel platforms such as Skylake will contain Sunrisepoint PCH.
The driver is based on MFD framework since the main device, i.e. serial bus
controller, contains register space for itself, DMA part, and an additional
address space (convergence layer).The public specification of the register map is avaiable in [1].
This is fifth generation of the patch series to bring support LPSS devices
found on Intel Sunrisepoint (Intel Skylake PCH). Previous one can be found here
[2].The series has few logical parts:
- patches 1-3 prepares PM core, ACPI, and driver core (PM) to handle our case
- patches 4-6 introduce unregistering platform devices in MFD in reversed
order
- patch 7 implements iDMA 64-bit driver
- patch 8 introduces an MFD driver for LPSS devicesThe patch 7 can be applied independently, though it's better if it goes before
patch 8.The driver has been tested with SPI and UART on Intel Skylake PCH.
Quoted 8 lines
Quoted 3 lines
[1] https://download.01.org/future-platform-configuration
-hub/skylake/register-definitions/332219-002.pdf
[2] http://www.spinics.net/lists/linux-acpi/msg58622.htmlLee, can we move forward this thing somehow?
We may create a topic branch for you where we apply already Acked patches (1-5) to reduce burden on reviewers. Would it help?
I just need one of the clock guys to take a look at the MFD patch before I apply the set.
What other Acks are you waiting on?
NB: I don't need a branch, it's easier for me to apply patches from my mbox.
Quoted 80 lines
Quoted 79 lines
Changelog v5:
- rebase on top of v4.2-rc1
- patch 3 is modified accordingly to new changes indrivers/base/dd.c
- correct Rafael's email in patch 3Changelog v4:
- replace patch 3 by Rafael's suggession
- append ACKs from Rafael
- rebase on top of v4.1-rc8Changelog v3:
- rework patch 3 to be used for all kind of devices (address Alan
comment)
- iDMA 64-bit driver improvements:
- fix burst-to-register conversion
- remove excessive locking
- do not expose core part to the user (Kconfig)
- address most of Lee's comments
- append ACKs
- rebase on top of v4.1-rc6Changelog v2:
- new DMA driver to fully support iDMA 64-bit IP
- patch 3 is added to wake up parent devices when ->probe(),
->remove(), or->shutdown()- MFD core is unregistering devices in reversed order
- address few Lee's comments on v1
- address Russel's comment, therefore useclkdev_create()helper
- intel-lpss{,-acpi,-pci} are modified regarding to above changesAndy Shevchenko (5):
klist: implementklist_prev()
driver core: implementdevice_for_each_child_reverse()
mfd: makemfd_remove_devices()iterate in reverse order
dmaengine: add a driver for Intel integrated DMA 64-bit
mfd: Add support for Intel Sunrisepoint LPSS devicesMika Westerberg (2):
PM / QoS: Make it possible to expose device latency tolerance to
userspace
ACPI / PM: Attach ACPI power domain only onceRafael J. Wysocki (1):
Driver core: wakeup the parent device before trying probedrivers/acpi/device_pm.c | 8 + drivers/acpi/internal.h | 2 + drivers/acpi/scan.c | 46 ++- drivers/base/core.c | 43 +++ drivers/base/dd.c | 20 ++ drivers/base/power/power.h | 2 + drivers/base/power/qos.c | 37 +++ drivers/base/power/sysfs.c | 11 + drivers/dma/Kconfig | 5 + drivers/dma/Makefile | 1 + drivers/dma/idma64.c | 724 ++++++++++++++++++++++++++++++++++++++++++ drivers/dma/idma64.h | 232 ++++++++++++++ drivers/mfd/Kconfig | 23 ++ drivers/mfd/Makefile | 3 + drivers/mfd/intel-lpss-acpi.c | 84 +++++ drivers/mfd/intel-lpss-pci.c | 113 +++++++ drivers/mfd/intel-lpss.c | 524 ++++++++++++++++++++++++++++++ drivers/mfd/intel-lpss.h | 62 ++++ drivers/mfd/mfd-core.c | 2 +- include/linux/device.h | 2 + include/linux/klist.h | 1 + include/linux/pm_qos.h | 5 + lib/klist.c | 41 +++ 23 files changed, 1974 insertions(+), 17 deletions(-) create mode 100644 drivers/dma/idma64.c create mode 100644 drivers/dma/idma64.h create mode 100644 drivers/mfd/intel-lpss-acpi.c create mode 100644 drivers/mfd/intel-lpss-pci.c create mode 100644 drivers/mfd/intel-lpss.c create mode 100644 drivers/mfd/intel-lpss.h
Signature · 8 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Andy Shevchenko
reviewerQuoted 44 lines · Lee Jones
Quoted 42 lines · Andy Shevchenko
Quoted 40 lines · Andy Shevchenko
The new coming Intel platforms such as Skylake will contain Sunrisepoint PCH.
The driver is based on MFD framework since the main device, i.e. serial bus
controller, contains register space for itself, DMA part, and an additional
address space (convergence layer).The public specification of the register map is avaiable in [1].
This is fifth generation of the patch series to bring support LPSS
devices
found on Intel Sunrisepoint (Intel Skylake PCH). Previous one can be
found here
[2].The series has few logical parts:
- patches 1-3 prepares PM core, ACPI, and driver core (PM) to handle
our case
- patches 4-6 introduce unregistering platform devices in MFD in reversed
order
- patch 7 implements iDMA 64-bit driver
- patch 8 introduces an MFD driver for LPSS devicesThe patch 7 can be applied independently, though it's better if it
goes before
patch 8.The driver has been tested with SPI and UART on Intel Skylake PCH.
[1] https://download.01.org/future-platform-configuration
-hub/skylake/register-definitions/332219-002.pdf
[2] http://www.spinics.net/lists/linux-acpi/msg58622.html
Quoted 7 lines
Quoted 4 lines
Lee, can we move forward this thing somehow?
We may create a topic branch for you where we apply already Acked patches (1-5) to reduce burden on reviewers. Would it help?
I just need one of the clock guys to take a look at the MFD patch before I apply the set.
Understood, thanks for clarification. I hope Stephen will find time to answer soon.
Quoted 2 lines
What other Acks are you waiting on?
Vinod's only, though you may apply everything else w/o idma64. JFYI, besides Vinod's comments our Q/A found a bug in idma64 (it will be fixe d in next iteration next week).
Quoted 4 lines
NB: I don't need a branch, it's easier for me to apply patches from my
mbox.
Okay, let's stick this approach.
Quoted 87 lines
Quoted 86 lines
Quoted 85 lines
Changelog v5:
- rebase on top of v4.2-rc1
- patch 3 is modified accordingly to new changes indrivers/base/dd.c
- correct Rafael's email in patch 3Changelog v4:
- replace patch 3 by Rafael's suggession
- append ACKs from Rafael
- rebase on top of v4.1-rc8Changelog v3:
- rework patch 3 to be used for all kind of devices (address
Alan
comment)
- iDMA 64-bit driver improvements:
- fix burst-to-register conversion
- remove excessive locking
- do not expose core part to the user (Kconfig)
- address most of Lee's comments
- append ACKs
- rebase on top of v4.1-rc6Changelog v2:
- new DMA driver to fully support iDMA 64-bit IP
- patch 3 is added to wake up parent devices when ->probe(),
->remove(), or->shutdown()- MFD core is unregistering devices in reversed order
- address few Lee's comments on v1
- address Russel's comment, therefore useclkdev_create()
helper
- intel-lpss{,-acpi,-pci} are modified regarding to above
changesAndy Shevchenko (5):
klist: implementklist_prev()
driver core: implementdevice_for_each_child_reverse()
mfd: makemfd_remove_devices()iterate in reverse order
dmaengine: add a driver for Intel integrated DMA 64-bit
mfd: Add support for Intel Sunrisepoint LPSS devicesMika Westerberg (2):
PM / QoS: Make it possible to expose device latency tolerance
to
userspace
ACPI / PM: Attach ACPI power domain only onceRafael J. Wysocki (1):
Driver core: wakeup the parent device before trying probedrivers/acpi/device_pm.c | 8 + drivers/acpi/internal.h | 2 + drivers/acpi/scan.c | 46 ++- drivers/base/core.c | 43 +++ drivers/base/dd.c | 20 ++ drivers/base/power/power.h | 2 + drivers/base/power/qos.c | 37 +++ drivers/base/power/sysfs.c | 11 + drivers/dma/Kconfig | 5 + drivers/dma/Makefile | 1 + drivers/dma/idma64.c | 724 ++++++++++++++++++++++++++++++++++++++++++ drivers/dma/idma64.h | 232 ++++++++++++++ drivers/mfd/Kconfig | 23 ++ drivers/mfd/Makefile | 3 + drivers/mfd/intel-lpss-acpi.c | 84 +++++ drivers/mfd/intel-lpss-pci.c | 113 +++++++ drivers/mfd/intel-lpss.c | 524 ++++++++++++++++++++++++++++++ drivers/mfd/intel-lpss.h | 62 ++++ drivers/mfd/mfd-core.c | 2 +- include/linux/device.h | 2 + include/linux/klist.h | 1 + include/linux/pm_qos.h | 5 + lib/klist.c | 41 +++ 23 files changed, 1974 insertions(+), 17 deletions(-) create mode 100644 drivers/dma/idma64.c create mode 100644 drivers/dma/idma64.h create mode 100644 drivers/mfd/intel-lpss-acpi.c create mode 100644 drivers/mfd/intel-lpss-pci.c create mode 100644 drivers/mfd/intel-lpss.c create mode 100644 drivers/mfd/intel-lpss.h
Signature · 2 lines
Andy Shevchenko <[email protected]> Intel Finland Oy