2012-04-12 16:48:44 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2009-2011 Wind River Systems, Inc.
|
2012-11-09 22:20:01 +08:00
|
|
|
* Copyright (c) 2011 ST Microelectronics (Alessandro Rubini, Davide Ciminaghi)
|
2012-04-12 16:48:44 +08:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
* See the GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/spinlock.h>
|
|
|
|
#include <linux/errno.h>
|
|
|
|
#include <linux/device.h>
|
|
|
|
#include <linux/slab.h>
|
|
|
|
#include <linux/list.h>
|
|
|
|
#include <linux/io.h>
|
|
|
|
#include <linux/ioport.h>
|
|
|
|
#include <linux/pci.h>
|
|
|
|
#include <linux/seq_file.h>
|
|
|
|
#include <linux/platform_device.h>
|
|
|
|
#include <linux/mfd/core.h>
|
|
|
|
#include <linux/mfd/sta2x11-mfd.h>
|
2012-11-09 22:19:53 +08:00
|
|
|
#include <linux/regmap.h>
|
2012-04-12 16:48:44 +08:00
|
|
|
|
|
|
|
#include <asm/sta2x11.h>
|
|
|
|
|
2012-11-09 22:19:53 +08:00
|
|
|
static inline int __reg_within_range(unsigned int r,
|
|
|
|
unsigned int start,
|
|
|
|
unsigned int end)
|
|
|
|
{
|
|
|
|
return ((r >= start) && (r <= end));
|
|
|
|
}
|
|
|
|
|
2012-04-12 16:48:44 +08:00
|
|
|
/* This describes STA2X11 MFD chip for us, we may have several */
|
|
|
|
struct sta2x11_mfd {
|
|
|
|
struct sta2x11_instance *instance;
|
2012-11-09 22:19:53 +08:00
|
|
|
struct regmap *regmap[sta2x11_n_mfd_plat_devs];
|
2012-11-09 22:19:58 +08:00
|
|
|
spinlock_t lock[sta2x11_n_mfd_plat_devs];
|
2012-04-12 16:48:44 +08:00
|
|
|
struct list_head list;
|
2012-11-09 22:19:52 +08:00
|
|
|
void __iomem *regs[sta2x11_n_mfd_plat_devs];
|
2012-04-12 16:48:44 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
static LIST_HEAD(sta2x11_mfd_list);
|
|
|
|
|
|
|
|
/* Three functions to act on the list */
|
|
|
|
static struct sta2x11_mfd *sta2x11_mfd_find(struct pci_dev *pdev)
|
|
|
|
{
|
|
|
|
struct sta2x11_instance *instance;
|
|
|
|
struct sta2x11_mfd *mfd;
|
|
|
|
|
|
|
|
if (!pdev && !list_empty(&sta2x11_mfd_list)) {
|
2017-02-17 15:11:36 +08:00
|
|
|
pr_warn("%s: Unspecified device, using first instance\n",
|
|
|
|
__func__);
|
2012-04-12 16:48:44 +08:00
|
|
|
return list_entry(sta2x11_mfd_list.next,
|
|
|
|
struct sta2x11_mfd, list);
|
|
|
|
}
|
|
|
|
|
|
|
|
instance = sta2x11_get_instance(pdev);
|
|
|
|
if (!instance)
|
|
|
|
return NULL;
|
|
|
|
list_for_each_entry(mfd, &sta2x11_mfd_list, list) {
|
|
|
|
if (mfd->instance == instance)
|
|
|
|
return mfd;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2012-11-20 02:23:04 +08:00
|
|
|
static int sta2x11_mfd_add(struct pci_dev *pdev, gfp_t flags)
|
2012-04-12 16:48:44 +08:00
|
|
|
{
|
2012-11-09 22:19:58 +08:00
|
|
|
int i;
|
2012-04-12 16:48:44 +08:00
|
|
|
struct sta2x11_mfd *mfd = sta2x11_mfd_find(pdev);
|
|
|
|
struct sta2x11_instance *instance;
|
|
|
|
|
|
|
|
if (mfd)
|
|
|
|
return -EBUSY;
|
|
|
|
instance = sta2x11_get_instance(pdev);
|
|
|
|
if (!instance)
|
|
|
|
return -EINVAL;
|
|
|
|
mfd = kzalloc(sizeof(*mfd), flags);
|
|
|
|
if (!mfd)
|
|
|
|
return -ENOMEM;
|
|
|
|
INIT_LIST_HEAD(&mfd->list);
|
2012-11-09 22:19:58 +08:00
|
|
|
for (i = 0; i < ARRAY_SIZE(mfd->lock); i++)
|
|
|
|
spin_lock_init(&mfd->lock[i]);
|
2012-04-12 16:48:44 +08:00
|
|
|
mfd->instance = instance;
|
|
|
|
list_add(&mfd->list, &sta2x11_mfd_list);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-11-09 22:19:52 +08:00
|
|
|
/* This function is exported and is not expected to fail */
|
|
|
|
u32 __sta2x11_mfd_mask(struct pci_dev *pdev, u32 reg, u32 mask, u32 val,
|
|
|
|
enum sta2x11_mfd_plat_dev index)
|
2012-04-12 16:48:44 +08:00
|
|
|
{
|
|
|
|
struct sta2x11_mfd *mfd = sta2x11_mfd_find(pdev);
|
|
|
|
u32 r;
|
|
|
|
unsigned long flags;
|
2012-12-02 21:36:22 +08:00
|
|
|
void __iomem *regs;
|
2012-04-12 16:48:44 +08:00
|
|
|
|
|
|
|
if (!mfd) {
|
|
|
|
dev_warn(&pdev->dev, ": can't access sctl regs\n");
|
|
|
|
return 0;
|
|
|
|
}
|
2012-12-02 21:36:22 +08:00
|
|
|
|
|
|
|
regs = mfd->regs[index];
|
2012-11-09 22:19:52 +08:00
|
|
|
if (!regs) {
|
2012-04-12 16:48:44 +08:00
|
|
|
dev_warn(&pdev->dev, ": system ctl not initialized\n");
|
|
|
|
return 0;
|
|
|
|
}
|
2012-11-09 22:19:58 +08:00
|
|
|
spin_lock_irqsave(&mfd->lock[index], flags);
|
2012-11-09 22:19:52 +08:00
|
|
|
r = readl(regs + reg);
|
2012-04-12 16:48:44 +08:00
|
|
|
r &= ~mask;
|
|
|
|
r |= val;
|
|
|
|
if (mask)
|
2012-11-09 22:19:52 +08:00
|
|
|
writel(r, regs + reg);
|
2012-11-09 22:19:58 +08:00
|
|
|
spin_unlock_irqrestore(&mfd->lock[index], flags);
|
2012-04-12 16:48:44 +08:00
|
|
|
return r;
|
|
|
|
}
|
2012-11-09 22:19:52 +08:00
|
|
|
EXPORT_SYMBOL(__sta2x11_mfd_mask);
|
2012-04-12 16:48:44 +08:00
|
|
|
|
2012-11-09 22:19:54 +08:00
|
|
|
int sta2x11_mfd_get_regs_data(struct platform_device *dev,
|
|
|
|
enum sta2x11_mfd_plat_dev index,
|
|
|
|
void __iomem **regs,
|
|
|
|
spinlock_t **lock)
|
2012-04-12 16:48:44 +08:00
|
|
|
{
|
2013-07-30 16:10:05 +08:00
|
|
|
struct pci_dev *pdev = *(struct pci_dev **)dev_get_platdata(&dev->dev);
|
2012-11-09 22:19:54 +08:00
|
|
|
struct sta2x11_mfd *mfd;
|
2012-04-12 16:48:44 +08:00
|
|
|
|
2012-11-09 22:19:54 +08:00
|
|
|
if (!pdev)
|
|
|
|
return -ENODEV;
|
|
|
|
mfd = sta2x11_mfd_find(pdev);
|
|
|
|
if (!mfd)
|
|
|
|
return -ENODEV;
|
|
|
|
if (index >= sta2x11_n_mfd_plat_devs)
|
|
|
|
return -ENODEV;
|
|
|
|
*regs = mfd->regs[index];
|
|
|
|
*lock = &mfd->lock[index];
|
|
|
|
pr_debug("%s %d *regs = %p\n", __func__, __LINE__, *regs);
|
|
|
|
return *regs ? 0 : -ENODEV;
|
2012-04-12 16:48:44 +08:00
|
|
|
}
|
2012-11-09 22:19:54 +08:00
|
|
|
EXPORT_SYMBOL(sta2x11_mfd_get_regs_data);
|
2012-04-12 16:48:44 +08:00
|
|
|
|
2012-11-09 22:19:53 +08:00
|
|
|
/*
|
|
|
|
* Special sta2x11-mfd regmap lock/unlock functions
|
|
|
|
*/
|
2012-04-12 16:48:44 +08:00
|
|
|
|
2012-11-09 22:19:53 +08:00
|
|
|
static void sta2x11_regmap_lock(void *__lock)
|
|
|
|
{
|
|
|
|
spinlock_t *lock = __lock;
|
|
|
|
spin_lock(lock);
|
|
|
|
}
|
2012-04-12 16:48:44 +08:00
|
|
|
|
2012-11-09 22:19:53 +08:00
|
|
|
static void sta2x11_regmap_unlock(void *__lock)
|
|
|
|
{
|
|
|
|
spinlock_t *lock = __lock;
|
|
|
|
spin_unlock(lock);
|
|
|
|
}
|
2012-04-12 16:48:44 +08:00
|
|
|
|
2012-11-09 22:19:59 +08:00
|
|
|
/* OTP (one time programmable registers do not require locking */
|
|
|
|
static void sta2x11_regmap_nolock(void *__lock)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-11-09 22:19:53 +08:00
|
|
|
static const char *sta2x11_mfd_names[sta2x11_n_mfd_plat_devs] = {
|
2012-11-09 22:19:55 +08:00
|
|
|
[sta2x11_sctl] = STA2X11_MFD_SCTL_NAME,
|
|
|
|
[sta2x11_apbreg] = STA2X11_MFD_APBREG_NAME,
|
|
|
|
[sta2x11_apb_soc_regs] = STA2X11_MFD_APB_SOC_REGS_NAME,
|
2012-11-09 22:19:59 +08:00
|
|
|
[sta2x11_scr] = STA2X11_MFD_SCR_NAME,
|
2012-04-12 16:48:44 +08:00
|
|
|
};
|
|
|
|
|
2012-11-09 22:19:53 +08:00
|
|
|
static bool sta2x11_sctl_writeable_reg(struct device *dev, unsigned int reg)
|
|
|
|
{
|
|
|
|
return !__reg_within_range(reg, SCTL_SCPCIECSBRST, SCTL_SCRSTSTA);
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct regmap_config sta2x11_sctl_regmap_config = {
|
|
|
|
.reg_bits = 32,
|
|
|
|
.reg_stride = 4,
|
|
|
|
.val_bits = 32,
|
|
|
|
.lock = sta2x11_regmap_lock,
|
|
|
|
.unlock = sta2x11_regmap_unlock,
|
|
|
|
.max_register = SCTL_SCRSTSTA,
|
|
|
|
.writeable_reg = sta2x11_sctl_writeable_reg,
|
2012-04-12 16:48:44 +08:00
|
|
|
};
|
|
|
|
|
2012-11-09 22:19:59 +08:00
|
|
|
static bool sta2x11_scr_readable_reg(struct device *dev, unsigned int reg)
|
|
|
|
{
|
|
|
|
return (reg == STA2X11_SECR_CR) ||
|
|
|
|
__reg_within_range(reg, STA2X11_SECR_FVR0, STA2X11_SECR_FVR1);
|
|
|
|
}
|
2012-04-12 16:48:44 +08:00
|
|
|
|
2012-11-09 22:19:59 +08:00
|
|
|
static bool sta2x11_scr_writeable_reg(struct device *dev, unsigned int reg)
|
2012-04-12 16:48:44 +08:00
|
|
|
{
|
2012-11-09 22:19:59 +08:00
|
|
|
return false;
|
|
|
|
}
|
2012-04-12 16:48:44 +08:00
|
|
|
|
2012-11-09 22:19:59 +08:00
|
|
|
static struct regmap_config sta2x11_scr_regmap_config = {
|
|
|
|
.reg_bits = 32,
|
|
|
|
.reg_stride = 4,
|
|
|
|
.val_bits = 32,
|
|
|
|
.lock = sta2x11_regmap_nolock,
|
|
|
|
.unlock = sta2x11_regmap_nolock,
|
|
|
|
.max_register = STA2X11_SECR_FVR1,
|
|
|
|
.readable_reg = sta2x11_scr_readable_reg,
|
|
|
|
.writeable_reg = sta2x11_scr_writeable_reg,
|
|
|
|
};
|
2012-04-12 16:48:44 +08:00
|
|
|
|
2012-11-09 22:19:53 +08:00
|
|
|
static bool sta2x11_apbreg_readable_reg(struct device *dev, unsigned int reg)
|
|
|
|
{
|
|
|
|
/* Two blocks (CAN and MLB, SARAC) 0x100 bytes apart */
|
|
|
|
if (reg >= APBREG_BSR_SARAC)
|
|
|
|
reg -= APBREG_BSR_SARAC;
|
|
|
|
switch (reg) {
|
|
|
|
case APBREG_BSR:
|
|
|
|
case APBREG_PAER:
|
|
|
|
case APBREG_PWAC:
|
|
|
|
case APBREG_PRAC:
|
|
|
|
case APBREG_PCG:
|
|
|
|
case APBREG_PUR:
|
|
|
|
case APBREG_EMU_PCG:
|
|
|
|
return true;
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
2012-04-12 16:48:44 +08:00
|
|
|
|
2012-11-09 22:19:53 +08:00
|
|
|
static bool sta2x11_apbreg_writeable_reg(struct device *dev, unsigned int reg)
|
|
|
|
{
|
|
|
|
if (reg >= APBREG_BSR_SARAC)
|
|
|
|
reg -= APBREG_BSR_SARAC;
|
|
|
|
if (!sta2x11_apbreg_readable_reg(dev, reg))
|
|
|
|
return false;
|
|
|
|
return reg != APBREG_PAER;
|
|
|
|
}
|
2012-04-12 16:48:44 +08:00
|
|
|
|
2012-11-09 22:19:53 +08:00
|
|
|
static struct regmap_config sta2x11_apbreg_regmap_config = {
|
|
|
|
.reg_bits = 32,
|
|
|
|
.reg_stride = 4,
|
|
|
|
.val_bits = 32,
|
|
|
|
.lock = sta2x11_regmap_lock,
|
|
|
|
.unlock = sta2x11_regmap_unlock,
|
|
|
|
.max_register = APBREG_EMU_PCG_SARAC,
|
|
|
|
.readable_reg = sta2x11_apbreg_readable_reg,
|
|
|
|
.writeable_reg = sta2x11_apbreg_writeable_reg,
|
2012-11-09 22:19:52 +08:00
|
|
|
};
|
2012-04-12 16:48:44 +08:00
|
|
|
|
2012-11-09 22:19:53 +08:00
|
|
|
static bool sta2x11_apb_soc_regs_readable_reg(struct device *dev,
|
|
|
|
unsigned int reg)
|
|
|
|
{
|
|
|
|
return reg <= PCIE_SoC_INT_ROUTER_STATUS3_REG ||
|
|
|
|
__reg_within_range(reg, DMA_IP_CTRL_REG, SPARE3_RESERVED) ||
|
|
|
|
__reg_within_range(reg, MASTER_LOCK_REG,
|
|
|
|
SYSTEM_CONFIG_STATUS_REG) ||
|
|
|
|
reg == MSP_CLK_CTRL_REG ||
|
|
|
|
__reg_within_range(reg, COMPENSATION_REG1, TEST_CTL_REG);
|
|
|
|
}
|
2012-04-12 16:48:44 +08:00
|
|
|
|
2012-11-09 22:19:53 +08:00
|
|
|
static bool sta2x11_apb_soc_regs_writeable_reg(struct device *dev,
|
|
|
|
unsigned int reg)
|
|
|
|
{
|
|
|
|
if (!sta2x11_apb_soc_regs_readable_reg(dev, reg))
|
|
|
|
return false;
|
|
|
|
switch (reg) {
|
|
|
|
case PCIE_COMMON_CLOCK_CONFIG_0_4_0:
|
|
|
|
case SYSTEM_CONFIG_STATUS_REG:
|
|
|
|
case COMPENSATION_REG1:
|
|
|
|
case PCIE_SoC_INT_ROUTER_STATUS0_REG...PCIE_SoC_INT_ROUTER_STATUS3_REG:
|
|
|
|
case PCIE_PM_STATUS_0_PORT_0_4...PCIE_PM_STATUS_7_0_EP4:
|
|
|
|
return false;
|
|
|
|
default:
|
|
|
|
return true;
|
2012-04-12 16:48:44 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-11-09 22:19:53 +08:00
|
|
|
static struct regmap_config sta2x11_apb_soc_regs_regmap_config = {
|
|
|
|
.reg_bits = 32,
|
|
|
|
.reg_stride = 4,
|
|
|
|
.val_bits = 32,
|
|
|
|
.lock = sta2x11_regmap_lock,
|
|
|
|
.unlock = sta2x11_regmap_unlock,
|
|
|
|
.max_register = TEST_CTL_REG,
|
|
|
|
.readable_reg = sta2x11_apb_soc_regs_readable_reg,
|
|
|
|
.writeable_reg = sta2x11_apb_soc_regs_writeable_reg,
|
2012-11-09 22:19:52 +08:00
|
|
|
};
|
2012-04-12 16:48:44 +08:00
|
|
|
|
2012-11-09 22:19:53 +08:00
|
|
|
static struct regmap_config *
|
|
|
|
sta2x11_mfd_regmap_configs[sta2x11_n_mfd_plat_devs] = {
|
|
|
|
[sta2x11_sctl] = &sta2x11_sctl_regmap_config,
|
|
|
|
[sta2x11_apbreg] = &sta2x11_apbreg_regmap_config,
|
|
|
|
[sta2x11_apb_soc_regs] = &sta2x11_apb_soc_regs_regmap_config,
|
2012-11-09 22:19:59 +08:00
|
|
|
[sta2x11_scr] = &sta2x11_scr_regmap_config,
|
2012-11-09 22:19:52 +08:00
|
|
|
};
|
2012-04-12 16:48:44 +08:00
|
|
|
|
2012-11-09 22:19:59 +08:00
|
|
|
/* Probe for the four platform devices */
|
2012-11-09 22:19:52 +08:00
|
|
|
|
|
|
|
static int sta2x11_mfd_platform_probe(struct platform_device *dev,
|
|
|
|
enum sta2x11_mfd_plat_dev index)
|
2012-04-12 16:48:44 +08:00
|
|
|
{
|
|
|
|
struct pci_dev **pdev;
|
|
|
|
struct sta2x11_mfd *mfd;
|
|
|
|
struct resource *res;
|
2012-11-09 22:19:52 +08:00
|
|
|
const char *name = sta2x11_mfd_names[index];
|
2012-11-09 22:19:53 +08:00
|
|
|
struct regmap_config *regmap_config = sta2x11_mfd_regmap_configs[index];
|
2012-04-12 16:48:44 +08:00
|
|
|
|
2013-07-30 16:10:05 +08:00
|
|
|
pdev = dev_get_platdata(&dev->dev);
|
2012-04-12 16:48:44 +08:00
|
|
|
mfd = sta2x11_mfd_find(*pdev);
|
|
|
|
if (!mfd)
|
|
|
|
return -ENODEV;
|
2012-11-09 22:19:53 +08:00
|
|
|
if (!regmap_config)
|
|
|
|
return -ENODEV;
|
2012-04-12 16:48:44 +08:00
|
|
|
|
|
|
|
res = platform_get_resource(dev, IORESOURCE_MEM, 0);
|
|
|
|
if (!res)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
2012-11-09 22:19:52 +08:00
|
|
|
if (!request_mem_region(res->start, resource_size(res), name))
|
2012-04-12 16:48:44 +08:00
|
|
|
return -EBUSY;
|
|
|
|
|
2012-11-09 22:19:52 +08:00
|
|
|
mfd->regs[index] = ioremap(res->start, resource_size(res));
|
|
|
|
if (!mfd->regs[index]) {
|
2012-04-12 16:48:44 +08:00
|
|
|
release_mem_region(res->start, resource_size(res));
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
2012-11-09 22:19:53 +08:00
|
|
|
regmap_config->lock_arg = &mfd->lock;
|
|
|
|
/*
|
|
|
|
No caching, registers could be reached both via regmap and via
|
|
|
|
void __iomem *
|
|
|
|
*/
|
|
|
|
regmap_config->cache_type = REGCACHE_NONE;
|
|
|
|
mfd->regmap[index] = devm_regmap_init_mmio(&dev->dev, mfd->regs[index],
|
|
|
|
regmap_config);
|
2013-12-07 14:03:00 +08:00
|
|
|
WARN_ON(IS_ERR(mfd->regmap[index]));
|
2012-04-12 16:48:44 +08:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-11-09 22:19:52 +08:00
|
|
|
static int sta2x11_sctl_probe(struct platform_device *dev)
|
|
|
|
{
|
|
|
|
return sta2x11_mfd_platform_probe(dev, sta2x11_sctl);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int sta2x11_apbreg_probe(struct platform_device *dev)
|
|
|
|
{
|
|
|
|
return sta2x11_mfd_platform_probe(dev, sta2x11_apbreg);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int sta2x11_apb_soc_regs_probe(struct platform_device *dev)
|
|
|
|
{
|
|
|
|
return sta2x11_mfd_platform_probe(dev, sta2x11_apb_soc_regs);
|
|
|
|
}
|
|
|
|
|
2012-11-09 22:19:59 +08:00
|
|
|
static int sta2x11_scr_probe(struct platform_device *dev)
|
|
|
|
{
|
|
|
|
return sta2x11_mfd_platform_probe(dev, sta2x11_scr);
|
|
|
|
}
|
|
|
|
|
2012-11-09 22:19:52 +08:00
|
|
|
/* The three platform drivers */
|
2012-04-12 16:48:44 +08:00
|
|
|
static struct platform_driver sta2x11_sctl_platform_driver = {
|
|
|
|
.driver = {
|
2012-11-09 22:19:55 +08:00
|
|
|
.name = STA2X11_MFD_SCTL_NAME,
|
2012-04-12 16:48:44 +08:00
|
|
|
},
|
|
|
|
.probe = sta2x11_sctl_probe,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct platform_driver sta2x11_platform_driver = {
|
|
|
|
.driver = {
|
2012-11-09 22:19:55 +08:00
|
|
|
.name = STA2X11_MFD_APBREG_NAME,
|
2012-04-12 16:48:44 +08:00
|
|
|
},
|
|
|
|
.probe = sta2x11_apbreg_probe,
|
|
|
|
};
|
|
|
|
|
2012-11-09 22:19:52 +08:00
|
|
|
static struct platform_driver sta2x11_apb_soc_regs_platform_driver = {
|
|
|
|
.driver = {
|
2012-11-09 22:19:55 +08:00
|
|
|
.name = STA2X11_MFD_APB_SOC_REGS_NAME,
|
2012-11-09 22:19:52 +08:00
|
|
|
},
|
|
|
|
.probe = sta2x11_apb_soc_regs_probe,
|
|
|
|
};
|
|
|
|
|
2012-11-09 22:19:59 +08:00
|
|
|
static struct platform_driver sta2x11_scr_platform_driver = {
|
|
|
|
.driver = {
|
|
|
|
.name = STA2X11_MFD_SCR_NAME,
|
|
|
|
},
|
|
|
|
.probe = sta2x11_scr_probe,
|
|
|
|
};
|
|
|
|
|
2015-12-03 00:28:11 +08:00
|
|
|
static struct platform_driver * const drivers[] = {
|
|
|
|
&sta2x11_platform_driver,
|
|
|
|
&sta2x11_sctl_platform_driver,
|
|
|
|
&sta2x11_apb_soc_regs_platform_driver,
|
|
|
|
&sta2x11_scr_platform_driver,
|
|
|
|
};
|
|
|
|
|
|
|
|
static int __init sta2x11_drivers_init(void)
|
2012-11-09 22:19:59 +08:00
|
|
|
{
|
2015-12-03 00:28:11 +08:00
|
|
|
return platform_register_drivers(drivers, ARRAY_SIZE(drivers));
|
2012-11-09 22:19:59 +08:00
|
|
|
}
|
|
|
|
|
2012-04-12 16:48:44 +08:00
|
|
|
/*
|
2012-11-09 22:19:52 +08:00
|
|
|
* What follows are the PCI devices that host the above pdevs.
|
2012-04-12 16:48:44 +08:00
|
|
|
* Each logic block is 4kB and they are all consecutive: we use this info.
|
|
|
|
*/
|
|
|
|
|
2012-11-09 22:19:52 +08:00
|
|
|
/* Mfd 0 device */
|
|
|
|
|
|
|
|
/* Mfd 0, Bar 0 */
|
|
|
|
enum mfd0_bar0_cells {
|
2012-04-12 16:48:44 +08:00
|
|
|
STA2X11_GPIO_0 = 0,
|
|
|
|
STA2X11_GPIO_1,
|
|
|
|
STA2X11_GPIO_2,
|
|
|
|
STA2X11_GPIO_3,
|
|
|
|
STA2X11_SCTL,
|
|
|
|
STA2X11_SCR,
|
|
|
|
STA2X11_TIME,
|
|
|
|
};
|
2012-11-09 22:19:52 +08:00
|
|
|
/* Mfd 0 , Bar 1 */
|
|
|
|
enum mfd0_bar1_cells {
|
2012-04-12 16:48:44 +08:00
|
|
|
STA2X11_APBREG = 0,
|
|
|
|
};
|
|
|
|
#define CELL_4K(_name, _cell) { \
|
|
|
|
.name = _name, \
|
|
|
|
.start = _cell * 4096, .end = _cell * 4096 + 4095, \
|
|
|
|
.flags = IORESOURCE_MEM, \
|
|
|
|
}
|
|
|
|
|
2012-11-20 02:25:09 +08:00
|
|
|
static const struct resource gpio_resources[] = {
|
2012-04-12 16:48:44 +08:00
|
|
|
{
|
2012-11-09 22:19:55 +08:00
|
|
|
/* 4 consecutive cells, 1 driver */
|
|
|
|
.name = STA2X11_MFD_GPIO_NAME,
|
2012-04-12 16:48:44 +08:00
|
|
|
.start = 0,
|
|
|
|
.end = (4 * 4096) - 1,
|
|
|
|
.flags = IORESOURCE_MEM,
|
|
|
|
}
|
|
|
|
};
|
2012-11-20 02:25:09 +08:00
|
|
|
static const struct resource sctl_resources[] = {
|
2012-11-09 22:19:55 +08:00
|
|
|
CELL_4K(STA2X11_MFD_SCTL_NAME, STA2X11_SCTL),
|
2012-04-12 16:48:44 +08:00
|
|
|
};
|
2012-11-20 02:25:09 +08:00
|
|
|
static const struct resource scr_resources[] = {
|
2012-11-09 22:19:55 +08:00
|
|
|
CELL_4K(STA2X11_MFD_SCR_NAME, STA2X11_SCR),
|
2012-04-12 16:48:44 +08:00
|
|
|
};
|
2012-11-20 02:25:09 +08:00
|
|
|
static const struct resource time_resources[] = {
|
2012-11-09 22:19:55 +08:00
|
|
|
CELL_4K(STA2X11_MFD_TIME_NAME, STA2X11_TIME),
|
2012-04-12 16:48:44 +08:00
|
|
|
};
|
|
|
|
|
2012-11-20 02:25:09 +08:00
|
|
|
static const struct resource apbreg_resources[] = {
|
2012-11-09 22:19:55 +08:00
|
|
|
CELL_4K(STA2X11_MFD_APBREG_NAME, STA2X11_APBREG),
|
2012-04-12 16:48:44 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#define DEV(_name, _r) \
|
|
|
|
{ .name = _name, .num_resources = ARRAY_SIZE(_r), .resources = _r, }
|
|
|
|
|
This is the MFD patch set for the 3.8 merge window.
We have several new drivers, most of the time coming with their sub devices
drivers:
- Austria Microsystem's AS3711
- Nano River's viperboard
- TI's TPS80031, AM335x TS/ADC,
- Realtek's MMC/memstick card reader
- Nokia's retu
We also got some notable cleanups and improvements:
- tps6586x got converted to IRQ domains.
- tps65910 and tps65090 moved to the regmap IRQ API.
- STMPE is now Device Tree aware.
- A general twl6040 and twl-core cleanup, with moves to the regmap I/O and IRQ
APIs and a conversion to the recently added PWM framework.
- sta2x11 gained regmap support.
Then the rest is mostly tiny cleanups and fixes, among which we have Mark's
wm5xxx and wm8xxx patchset.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
iQIcBAABAgAGBQJQznPnAAoJEIqAPN1PVmxKuA8P/0nOJduXFM1c0Gy+DD5DnJnG
cXzzeSTV8iO3a3sHIye43QPJ5V2YUR5uxLTUEOo/G7my/MoZ/azeNidkUD3qLVlm
wVIq35lcS8dWTZaY7nlpBcWc6e39UB0sEueuJNxyhOv5lnMKdi2tAow5f4vIRQnd
Q67/EbrgqdltcOpGmVuCdQcvphvWgy+K65jzbJG5zXs7hGX13Q+M5RnYhx76kc8f
TDd0APZ71n5/RyISFSBSu2vfl2kES6o47aMgqqXMEHri6d3puAaXM0rFoMzXg/4G
eBdxndN25H7rW7xvt9tuUod2rn1AO7tif5d7jal3Cfj61y3iqKY30yb3OzS9XQXH
9WZ2qDst11zvzQivxIkMGvfRXRfncNLWR4DrBSqVfSbYV2uQj2eS8C6ONwKVMXsQ
5tjNp91PFqN19sWQjIjSMcrNswxgpvdQ9mqFTyOGmISbqrpPSTi+MuO8r9+xTfUF
PnzUX2nVOW/i9NcI7uotjzh8jiw6t8XMVHhkehiSYR9hzCb6MaPsFPN4jWq9XA2m
1htCHylNpHqHQ3Mup7Is6j0Li1ahdwfm4lbrgiVEA4t4Mqs5E/Ka+3V8laNAKylW
PfCP/VmnJYzmgVTK/qobFNeKzRqR0i4WTL6T7oAxGL87Q4TJaqKpEkXWne8UXV+Q
yIbN0fmWfCveCetM+vaf
=F790
-----END PGP SIGNATURE-----
Merge tag 'mfd-3.8-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6
Pull MFS update from Samuel Ortiz:
"This is the MFD patch set for the 3.8 merge window.
We have several new drivers, most of the time coming with their sub
devices drivers:
- Austria Microsystem's AS3711
- Nano River's viperboard
- TI's TPS80031, AM335x TS/ADC,
- Realtek's MMC/memstick card reader
- Nokia's retu
We also got some notable cleanups and improvements:
- tps6586x got converted to IRQ domains.
- tps65910 and tps65090 moved to the regmap IRQ API.
- STMPE is now Device Tree aware.
- A general twl6040 and twl-core cleanup, with moves to the regmap
I/O and IRQ APIs and a conversion to the recently added PWM
framework.
- sta2x11 gained regmap support.
Then the rest is mostly tiny cleanups and fixes, among which we have
Mark's wm5xxx and wm8xxx patchset."
Far amount of annoying but largely trivial conflicts. Many due to
__devinit/exit removal, others due to one or two of the new drivers also
having come in through another tree.
* tag 'mfd-3.8-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6: (119 commits)
mfd: tps6507x: Convert to devm_kzalloc
mfd: stmpe: Update DT support for stmpe driver
mfd: wm5102: Add readback of DSP status 3 register
mfd: arizona: Log if we fail to create the primary IRQ domain
mfd: tps80031: MFD_TPS80031 needs to select REGMAP_IRQ
mfd: tps80031: Add terminating entry for tps80031_id_table
mfd: sta2x11: Fix potential NULL pointer dereference in __sta2x11_mfd_mask()
mfd: wm5102: Add tuning for revision B
mfd: arizona: Defer patch initialistation until after first device boot
mfd: tps65910: Fix wrong ack_base register
mfd: tps65910: Remove unused data
mfd: stmpe: Get rid of irq_invert_polarity
mfd: ab8500-core: Fix invalid free of devm_ allocated data
mfd: wm5102: Mark DSP memory regions as volatile
mfd: wm5102: Correct default for LDO1_CONTROL_2
mfd: arizona: Register haptics devices
mfd: wm8994: Make current device behaviour the default
mfd: tps65090: MFD_TPS65090 needs to select REGMAP_IRQ
mfd: Fix stmpe.c build when OF is not enabled
mfd: jz4740-adc: Use devm_kzalloc
...
2012-12-17 10:55:20 +08:00
|
|
|
static struct mfd_cell sta2x11_mfd0_bar0[] = {
|
2012-11-09 22:19:55 +08:00
|
|
|
/* offset 0: we add pdata later */
|
|
|
|
DEV(STA2X11_MFD_GPIO_NAME, gpio_resources),
|
|
|
|
DEV(STA2X11_MFD_SCTL_NAME, sctl_resources),
|
|
|
|
DEV(STA2X11_MFD_SCR_NAME, scr_resources),
|
|
|
|
DEV(STA2X11_MFD_TIME_NAME, time_resources),
|
2012-04-12 16:48:44 +08:00
|
|
|
};
|
|
|
|
|
This is the MFD patch set for the 3.8 merge window.
We have several new drivers, most of the time coming with their sub devices
drivers:
- Austria Microsystem's AS3711
- Nano River's viperboard
- TI's TPS80031, AM335x TS/ADC,
- Realtek's MMC/memstick card reader
- Nokia's retu
We also got some notable cleanups and improvements:
- tps6586x got converted to IRQ domains.
- tps65910 and tps65090 moved to the regmap IRQ API.
- STMPE is now Device Tree aware.
- A general twl6040 and twl-core cleanup, with moves to the regmap I/O and IRQ
APIs and a conversion to the recently added PWM framework.
- sta2x11 gained regmap support.
Then the rest is mostly tiny cleanups and fixes, among which we have Mark's
wm5xxx and wm8xxx patchset.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
iQIcBAABAgAGBQJQznPnAAoJEIqAPN1PVmxKuA8P/0nOJduXFM1c0Gy+DD5DnJnG
cXzzeSTV8iO3a3sHIye43QPJ5V2YUR5uxLTUEOo/G7my/MoZ/azeNidkUD3qLVlm
wVIq35lcS8dWTZaY7nlpBcWc6e39UB0sEueuJNxyhOv5lnMKdi2tAow5f4vIRQnd
Q67/EbrgqdltcOpGmVuCdQcvphvWgy+K65jzbJG5zXs7hGX13Q+M5RnYhx76kc8f
TDd0APZ71n5/RyISFSBSu2vfl2kES6o47aMgqqXMEHri6d3puAaXM0rFoMzXg/4G
eBdxndN25H7rW7xvt9tuUod2rn1AO7tif5d7jal3Cfj61y3iqKY30yb3OzS9XQXH
9WZ2qDst11zvzQivxIkMGvfRXRfncNLWR4DrBSqVfSbYV2uQj2eS8C6ONwKVMXsQ
5tjNp91PFqN19sWQjIjSMcrNswxgpvdQ9mqFTyOGmISbqrpPSTi+MuO8r9+xTfUF
PnzUX2nVOW/i9NcI7uotjzh8jiw6t8XMVHhkehiSYR9hzCb6MaPsFPN4jWq9XA2m
1htCHylNpHqHQ3Mup7Is6j0Li1ahdwfm4lbrgiVEA4t4Mqs5E/Ka+3V8laNAKylW
PfCP/VmnJYzmgVTK/qobFNeKzRqR0i4WTL6T7oAxGL87Q4TJaqKpEkXWne8UXV+Q
yIbN0fmWfCveCetM+vaf
=F790
-----END PGP SIGNATURE-----
Merge tag 'mfd-3.8-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6
Pull MFS update from Samuel Ortiz:
"This is the MFD patch set for the 3.8 merge window.
We have several new drivers, most of the time coming with their sub
devices drivers:
- Austria Microsystem's AS3711
- Nano River's viperboard
- TI's TPS80031, AM335x TS/ADC,
- Realtek's MMC/memstick card reader
- Nokia's retu
We also got some notable cleanups and improvements:
- tps6586x got converted to IRQ domains.
- tps65910 and tps65090 moved to the regmap IRQ API.
- STMPE is now Device Tree aware.
- A general twl6040 and twl-core cleanup, with moves to the regmap
I/O and IRQ APIs and a conversion to the recently added PWM
framework.
- sta2x11 gained regmap support.
Then the rest is mostly tiny cleanups and fixes, among which we have
Mark's wm5xxx and wm8xxx patchset."
Far amount of annoying but largely trivial conflicts. Many due to
__devinit/exit removal, others due to one or two of the new drivers also
having come in through another tree.
* tag 'mfd-3.8-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6: (119 commits)
mfd: tps6507x: Convert to devm_kzalloc
mfd: stmpe: Update DT support for stmpe driver
mfd: wm5102: Add readback of DSP status 3 register
mfd: arizona: Log if we fail to create the primary IRQ domain
mfd: tps80031: MFD_TPS80031 needs to select REGMAP_IRQ
mfd: tps80031: Add terminating entry for tps80031_id_table
mfd: sta2x11: Fix potential NULL pointer dereference in __sta2x11_mfd_mask()
mfd: wm5102: Add tuning for revision B
mfd: arizona: Defer patch initialistation until after first device boot
mfd: tps65910: Fix wrong ack_base register
mfd: tps65910: Remove unused data
mfd: stmpe: Get rid of irq_invert_polarity
mfd: ab8500-core: Fix invalid free of devm_ allocated data
mfd: wm5102: Mark DSP memory regions as volatile
mfd: wm5102: Correct default for LDO1_CONTROL_2
mfd: arizona: Register haptics devices
mfd: wm8994: Make current device behaviour the default
mfd: tps65090: MFD_TPS65090 needs to select REGMAP_IRQ
mfd: Fix stmpe.c build when OF is not enabled
mfd: jz4740-adc: Use devm_kzalloc
...
2012-12-17 10:55:20 +08:00
|
|
|
static struct mfd_cell sta2x11_mfd0_bar1[] = {
|
2012-11-09 22:19:55 +08:00
|
|
|
DEV(STA2X11_MFD_APBREG_NAME, apbreg_resources),
|
2012-04-12 16:48:44 +08:00
|
|
|
};
|
|
|
|
|
2012-11-09 22:19:52 +08:00
|
|
|
/* Mfd 1 devices */
|
|
|
|
|
|
|
|
/* Mfd 1, Bar 0 */
|
|
|
|
enum mfd1_bar0_cells {
|
|
|
|
STA2X11_VIC = 0,
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Mfd 1, Bar 1 */
|
|
|
|
enum mfd1_bar1_cells {
|
|
|
|
STA2X11_APB_SOC_REGS = 0,
|
|
|
|
};
|
|
|
|
|
2012-12-22 07:03:15 +08:00
|
|
|
static const struct resource vic_resources[] = {
|
2012-11-09 22:19:55 +08:00
|
|
|
CELL_4K(STA2X11_MFD_VIC_NAME, STA2X11_VIC),
|
2012-11-09 22:19:52 +08:00
|
|
|
};
|
|
|
|
|
2012-12-22 07:03:15 +08:00
|
|
|
static const struct resource apb_soc_regs_resources[] = {
|
2012-11-09 22:19:55 +08:00
|
|
|
CELL_4K(STA2X11_MFD_APB_SOC_REGS_NAME, STA2X11_APB_SOC_REGS),
|
2012-11-09 22:19:52 +08:00
|
|
|
};
|
|
|
|
|
2012-12-22 07:03:15 +08:00
|
|
|
static struct mfd_cell sta2x11_mfd1_bar0[] = {
|
2012-11-09 22:19:55 +08:00
|
|
|
DEV(STA2X11_MFD_VIC_NAME, vic_resources),
|
2012-11-09 22:19:52 +08:00
|
|
|
};
|
|
|
|
|
2012-12-22 07:03:15 +08:00
|
|
|
static struct mfd_cell sta2x11_mfd1_bar1[] = {
|
2012-11-09 22:19:55 +08:00
|
|
|
DEV(STA2X11_MFD_APB_SOC_REGS_NAME, apb_soc_regs_resources),
|
2012-11-09 22:19:52 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2012-04-12 16:48:44 +08:00
|
|
|
static int sta2x11_mfd_suspend(struct pci_dev *pdev, pm_message_t state)
|
|
|
|
{
|
|
|
|
pci_save_state(pdev);
|
|
|
|
pci_disable_device(pdev);
|
|
|
|
pci_set_power_state(pdev, pci_choose_state(pdev, state));
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int sta2x11_mfd_resume(struct pci_dev *pdev)
|
|
|
|
{
|
|
|
|
int err;
|
|
|
|
|
2014-01-03 07:40:29 +08:00
|
|
|
pci_set_power_state(pdev, PCI_D0);
|
2012-04-12 16:48:44 +08:00
|
|
|
err = pci_enable_device(pdev);
|
|
|
|
if (err)
|
|
|
|
return err;
|
|
|
|
pci_restore_state(pdev);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-11-09 22:19:52 +08:00
|
|
|
struct sta2x11_mfd_bar_setup_data {
|
|
|
|
struct mfd_cell *cells;
|
|
|
|
int ncells;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct sta2x11_mfd_setup_data {
|
|
|
|
struct sta2x11_mfd_bar_setup_data bars[2];
|
|
|
|
};
|
|
|
|
|
|
|
|
#define STA2X11_MFD0 0
|
|
|
|
#define STA2X11_MFD1 1
|
|
|
|
|
|
|
|
static struct sta2x11_mfd_setup_data mfd_setup_data[] = {
|
|
|
|
/* Mfd 0: gpio, sctl, scr, timers / apbregs */
|
|
|
|
[STA2X11_MFD0] = {
|
|
|
|
.bars = {
|
|
|
|
[0] = {
|
|
|
|
.cells = sta2x11_mfd0_bar0,
|
|
|
|
.ncells = ARRAY_SIZE(sta2x11_mfd0_bar0),
|
|
|
|
},
|
|
|
|
[1] = {
|
|
|
|
.cells = sta2x11_mfd0_bar1,
|
|
|
|
.ncells = ARRAY_SIZE(sta2x11_mfd0_bar1),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
/* Mfd 1: vic / apb-soc-regs */
|
|
|
|
[STA2X11_MFD1] = {
|
|
|
|
.bars = {
|
|
|
|
[0] = {
|
|
|
|
.cells = sta2x11_mfd1_bar0,
|
|
|
|
.ncells = ARRAY_SIZE(sta2x11_mfd1_bar0),
|
|
|
|
},
|
|
|
|
[1] = {
|
|
|
|
.cells = sta2x11_mfd1_bar1,
|
|
|
|
.ncells = ARRAY_SIZE(sta2x11_mfd1_bar1),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
This is the MFD patch set for the 3.8 merge window.
We have several new drivers, most of the time coming with their sub devices
drivers:
- Austria Microsystem's AS3711
- Nano River's viperboard
- TI's TPS80031, AM335x TS/ADC,
- Realtek's MMC/memstick card reader
- Nokia's retu
We also got some notable cleanups and improvements:
- tps6586x got converted to IRQ domains.
- tps65910 and tps65090 moved to the regmap IRQ API.
- STMPE is now Device Tree aware.
- A general twl6040 and twl-core cleanup, with moves to the regmap I/O and IRQ
APIs and a conversion to the recently added PWM framework.
- sta2x11 gained regmap support.
Then the rest is mostly tiny cleanups and fixes, among which we have Mark's
wm5xxx and wm8xxx patchset.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
iQIcBAABAgAGBQJQznPnAAoJEIqAPN1PVmxKuA8P/0nOJduXFM1c0Gy+DD5DnJnG
cXzzeSTV8iO3a3sHIye43QPJ5V2YUR5uxLTUEOo/G7my/MoZ/azeNidkUD3qLVlm
wVIq35lcS8dWTZaY7nlpBcWc6e39UB0sEueuJNxyhOv5lnMKdi2tAow5f4vIRQnd
Q67/EbrgqdltcOpGmVuCdQcvphvWgy+K65jzbJG5zXs7hGX13Q+M5RnYhx76kc8f
TDd0APZ71n5/RyISFSBSu2vfl2kES6o47aMgqqXMEHri6d3puAaXM0rFoMzXg/4G
eBdxndN25H7rW7xvt9tuUod2rn1AO7tif5d7jal3Cfj61y3iqKY30yb3OzS9XQXH
9WZ2qDst11zvzQivxIkMGvfRXRfncNLWR4DrBSqVfSbYV2uQj2eS8C6ONwKVMXsQ
5tjNp91PFqN19sWQjIjSMcrNswxgpvdQ9mqFTyOGmISbqrpPSTi+MuO8r9+xTfUF
PnzUX2nVOW/i9NcI7uotjzh8jiw6t8XMVHhkehiSYR9hzCb6MaPsFPN4jWq9XA2m
1htCHylNpHqHQ3Mup7Is6j0Li1ahdwfm4lbrgiVEA4t4Mqs5E/Ka+3V8laNAKylW
PfCP/VmnJYzmgVTK/qobFNeKzRqR0i4WTL6T7oAxGL87Q4TJaqKpEkXWne8UXV+Q
yIbN0fmWfCveCetM+vaf
=F790
-----END PGP SIGNATURE-----
Merge tag 'mfd-3.8-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6
Pull MFS update from Samuel Ortiz:
"This is the MFD patch set for the 3.8 merge window.
We have several new drivers, most of the time coming with their sub
devices drivers:
- Austria Microsystem's AS3711
- Nano River's viperboard
- TI's TPS80031, AM335x TS/ADC,
- Realtek's MMC/memstick card reader
- Nokia's retu
We also got some notable cleanups and improvements:
- tps6586x got converted to IRQ domains.
- tps65910 and tps65090 moved to the regmap IRQ API.
- STMPE is now Device Tree aware.
- A general twl6040 and twl-core cleanup, with moves to the regmap
I/O and IRQ APIs and a conversion to the recently added PWM
framework.
- sta2x11 gained regmap support.
Then the rest is mostly tiny cleanups and fixes, among which we have
Mark's wm5xxx and wm8xxx patchset."
Far amount of annoying but largely trivial conflicts. Many due to
__devinit/exit removal, others due to one or two of the new drivers also
having come in through another tree.
* tag 'mfd-3.8-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6: (119 commits)
mfd: tps6507x: Convert to devm_kzalloc
mfd: stmpe: Update DT support for stmpe driver
mfd: wm5102: Add readback of DSP status 3 register
mfd: arizona: Log if we fail to create the primary IRQ domain
mfd: tps80031: MFD_TPS80031 needs to select REGMAP_IRQ
mfd: tps80031: Add terminating entry for tps80031_id_table
mfd: sta2x11: Fix potential NULL pointer dereference in __sta2x11_mfd_mask()
mfd: wm5102: Add tuning for revision B
mfd: arizona: Defer patch initialistation until after first device boot
mfd: tps65910: Fix wrong ack_base register
mfd: tps65910: Remove unused data
mfd: stmpe: Get rid of irq_invert_polarity
mfd: ab8500-core: Fix invalid free of devm_ allocated data
mfd: wm5102: Mark DSP memory regions as volatile
mfd: wm5102: Correct default for LDO1_CONTROL_2
mfd: arizona: Register haptics devices
mfd: wm8994: Make current device behaviour the default
mfd: tps65090: MFD_TPS65090 needs to select REGMAP_IRQ
mfd: Fix stmpe.c build when OF is not enabled
mfd: jz4740-adc: Use devm_kzalloc
...
2012-12-17 10:55:20 +08:00
|
|
|
static void sta2x11_mfd_setup(struct pci_dev *pdev,
|
|
|
|
struct sta2x11_mfd_setup_data *sd)
|
2012-11-09 22:19:52 +08:00
|
|
|
{
|
|
|
|
int i, j;
|
|
|
|
for (i = 0; i < ARRAY_SIZE(sd->bars); i++)
|
|
|
|
for (j = 0; j < sd->bars[i].ncells; j++) {
|
|
|
|
sd->bars[i].cells[j].pdata_size = sizeof(pdev);
|
|
|
|
sd->bars[i].cells[j].platform_data = &pdev;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-11-20 02:23:04 +08:00
|
|
|
static int sta2x11_mfd_probe(struct pci_dev *pdev,
|
This is the MFD patch set for the 3.8 merge window.
We have several new drivers, most of the time coming with their sub devices
drivers:
- Austria Microsystem's AS3711
- Nano River's viperboard
- TI's TPS80031, AM335x TS/ADC,
- Realtek's MMC/memstick card reader
- Nokia's retu
We also got some notable cleanups and improvements:
- tps6586x got converted to IRQ domains.
- tps65910 and tps65090 moved to the regmap IRQ API.
- STMPE is now Device Tree aware.
- A general twl6040 and twl-core cleanup, with moves to the regmap I/O and IRQ
APIs and a conversion to the recently added PWM framework.
- sta2x11 gained regmap support.
Then the rest is mostly tiny cleanups and fixes, among which we have Mark's
wm5xxx and wm8xxx patchset.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
iQIcBAABAgAGBQJQznPnAAoJEIqAPN1PVmxKuA8P/0nOJduXFM1c0Gy+DD5DnJnG
cXzzeSTV8iO3a3sHIye43QPJ5V2YUR5uxLTUEOo/G7my/MoZ/azeNidkUD3qLVlm
wVIq35lcS8dWTZaY7nlpBcWc6e39UB0sEueuJNxyhOv5lnMKdi2tAow5f4vIRQnd
Q67/EbrgqdltcOpGmVuCdQcvphvWgy+K65jzbJG5zXs7hGX13Q+M5RnYhx76kc8f
TDd0APZ71n5/RyISFSBSu2vfl2kES6o47aMgqqXMEHri6d3puAaXM0rFoMzXg/4G
eBdxndN25H7rW7xvt9tuUod2rn1AO7tif5d7jal3Cfj61y3iqKY30yb3OzS9XQXH
9WZ2qDst11zvzQivxIkMGvfRXRfncNLWR4DrBSqVfSbYV2uQj2eS8C6ONwKVMXsQ
5tjNp91PFqN19sWQjIjSMcrNswxgpvdQ9mqFTyOGmISbqrpPSTi+MuO8r9+xTfUF
PnzUX2nVOW/i9NcI7uotjzh8jiw6t8XMVHhkehiSYR9hzCb6MaPsFPN4jWq9XA2m
1htCHylNpHqHQ3Mup7Is6j0Li1ahdwfm4lbrgiVEA4t4Mqs5E/Ka+3V8laNAKylW
PfCP/VmnJYzmgVTK/qobFNeKzRqR0i4WTL6T7oAxGL87Q4TJaqKpEkXWne8UXV+Q
yIbN0fmWfCveCetM+vaf
=F790
-----END PGP SIGNATURE-----
Merge tag 'mfd-3.8-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6
Pull MFS update from Samuel Ortiz:
"This is the MFD patch set for the 3.8 merge window.
We have several new drivers, most of the time coming with their sub
devices drivers:
- Austria Microsystem's AS3711
- Nano River's viperboard
- TI's TPS80031, AM335x TS/ADC,
- Realtek's MMC/memstick card reader
- Nokia's retu
We also got some notable cleanups and improvements:
- tps6586x got converted to IRQ domains.
- tps65910 and tps65090 moved to the regmap IRQ API.
- STMPE is now Device Tree aware.
- A general twl6040 and twl-core cleanup, with moves to the regmap
I/O and IRQ APIs and a conversion to the recently added PWM
framework.
- sta2x11 gained regmap support.
Then the rest is mostly tiny cleanups and fixes, among which we have
Mark's wm5xxx and wm8xxx patchset."
Far amount of annoying but largely trivial conflicts. Many due to
__devinit/exit removal, others due to one or two of the new drivers also
having come in through another tree.
* tag 'mfd-3.8-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6: (119 commits)
mfd: tps6507x: Convert to devm_kzalloc
mfd: stmpe: Update DT support for stmpe driver
mfd: wm5102: Add readback of DSP status 3 register
mfd: arizona: Log if we fail to create the primary IRQ domain
mfd: tps80031: MFD_TPS80031 needs to select REGMAP_IRQ
mfd: tps80031: Add terminating entry for tps80031_id_table
mfd: sta2x11: Fix potential NULL pointer dereference in __sta2x11_mfd_mask()
mfd: wm5102: Add tuning for revision B
mfd: arizona: Defer patch initialistation until after first device boot
mfd: tps65910: Fix wrong ack_base register
mfd: tps65910: Remove unused data
mfd: stmpe: Get rid of irq_invert_polarity
mfd: ab8500-core: Fix invalid free of devm_ allocated data
mfd: wm5102: Mark DSP memory regions as volatile
mfd: wm5102: Correct default for LDO1_CONTROL_2
mfd: arizona: Register haptics devices
mfd: wm8994: Make current device behaviour the default
mfd: tps65090: MFD_TPS65090 needs to select REGMAP_IRQ
mfd: Fix stmpe.c build when OF is not enabled
mfd: jz4740-adc: Use devm_kzalloc
...
2012-12-17 10:55:20 +08:00
|
|
|
const struct pci_device_id *pci_id)
|
2012-04-12 16:48:44 +08:00
|
|
|
{
|
|
|
|
int err, i;
|
2012-11-09 22:19:52 +08:00
|
|
|
struct sta2x11_mfd_setup_data *setup_data;
|
2012-04-12 16:48:44 +08:00
|
|
|
|
|
|
|
dev_info(&pdev->dev, "%s\n", __func__);
|
|
|
|
|
|
|
|
err = pci_enable_device(pdev);
|
|
|
|
if (err) {
|
|
|
|
dev_err(&pdev->dev, "Can't enable device.\n");
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
err = pci_enable_msi(pdev);
|
|
|
|
if (err)
|
|
|
|
dev_info(&pdev->dev, "Enable msi failed\n");
|
|
|
|
|
2012-11-09 22:19:52 +08:00
|
|
|
setup_data = pci_id->device == PCI_DEVICE_ID_STMICRO_GPIO ?
|
|
|
|
&mfd_setup_data[STA2X11_MFD0] :
|
|
|
|
&mfd_setup_data[STA2X11_MFD1];
|
2012-04-12 16:48:44 +08:00
|
|
|
|
|
|
|
/* platform data is the pci device for all of them */
|
2012-11-09 22:19:52 +08:00
|
|
|
sta2x11_mfd_setup(pdev, setup_data);
|
2012-04-12 16:48:44 +08:00
|
|
|
|
|
|
|
/* Record this pdev before mfd_add_devices: their probe looks for it */
|
2012-11-09 22:19:56 +08:00
|
|
|
if (!sta2x11_mfd_find(pdev))
|
|
|
|
sta2x11_mfd_add(pdev, GFP_ATOMIC);
|
2012-04-12 16:48:44 +08:00
|
|
|
|
2012-11-09 22:19:52 +08:00
|
|
|
/* Just 2 bars for all mfd's at present */
|
|
|
|
for (i = 0; i < 2; i++) {
|
|
|
|
err = mfd_add_devices(&pdev->dev, -1,
|
|
|
|
setup_data->bars[i].cells,
|
|
|
|
setup_data->bars[i].ncells,
|
|
|
|
&pdev->resource[i],
|
|
|
|
0, NULL);
|
|
|
|
if (err) {
|
|
|
|
dev_err(&pdev->dev,
|
|
|
|
"mfd_add_devices[%d] failed: %d\n", i, err);
|
|
|
|
goto err_disable;
|
|
|
|
}
|
2012-04-12 16:48:44 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
err_disable:
|
|
|
|
mfd_remove_devices(&pdev->dev);
|
|
|
|
pci_disable_device(pdev);
|
|
|
|
pci_disable_msi(pdev);
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
2013-12-03 07:15:39 +08:00
|
|
|
static const struct pci_device_id sta2x11_mfd_tbl[] = {
|
2012-04-12 16:48:44 +08:00
|
|
|
{PCI_DEVICE(PCI_VENDOR_ID_STMICRO, PCI_DEVICE_ID_STMICRO_GPIO)},
|
2012-11-09 22:19:52 +08:00
|
|
|
{PCI_DEVICE(PCI_VENDOR_ID_STMICRO, PCI_DEVICE_ID_STMICRO_VIC)},
|
2012-04-12 16:48:44 +08:00
|
|
|
{0,},
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct pci_driver sta2x11_mfd_driver = {
|
|
|
|
.name = "sta2x11-mfd",
|
|
|
|
.id_table = sta2x11_mfd_tbl,
|
|
|
|
.probe = sta2x11_mfd_probe,
|
|
|
|
.suspend = sta2x11_mfd_suspend,
|
|
|
|
.resume = sta2x11_mfd_resume,
|
|
|
|
};
|
|
|
|
|
|
|
|
static int __init sta2x11_mfd_init(void)
|
|
|
|
{
|
|
|
|
pr_info("%s\n", __func__);
|
|
|
|
return pci_register_driver(&sta2x11_mfd_driver);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* All of this must be ready before "normal" devices like MMCI appear.
|
|
|
|
* But MFD (the pci device) can't be too early. The following choice
|
|
|
|
* prepares platform drivers very early and probe the PCI device later,
|
|
|
|
* but before other PCI devices.
|
|
|
|
*/
|
2015-12-03 00:28:11 +08:00
|
|
|
subsys_initcall(sta2x11_drivers_init);
|
2012-04-12 16:48:44 +08:00
|
|
|
rootfs_initcall(sta2x11_mfd_init);
|
|
|
|
|
|
|
|
MODULE_LICENSE("GPL v2");
|
|
|
|
MODULE_AUTHOR("Wind River");
|
|
|
|
MODULE_DESCRIPTION("STA2x11 mfd for GPIO, SCTL and APBREG");
|
|
|
|
MODULE_DEVICE_TABLE(pci, sta2x11_mfd_tbl);
|