Skip to content

Commit

Permalink
Merge tag 'char-misc-3.6-rc1' of git://git.kernel.org/pub/scm/linux/k…
Browse files Browse the repository at this point in the history
…ernel/git/gregkh/char-misc

Pull char/misc patches from Greg Kroah-Hartman:
 "Here's the "big" pull request for 3.6-rc1 for the char/misc drivers.

  It's really just a few updates to the mei driver, plus 4 other tiny
  patches, nothing big at all.

  Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>"

* tag 'char-misc-3.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc:
  mei: use module_pci_driver
  powerpc/BSR: cleanup the error path of bsr_init
  mei: mei_irq_thread_write_handler - line break fix
  mei: streamline the _mei_irq_thread_close/ioctol functions
  mei: introduce mei_data2slots wrapper
  mei: mei_wd_host_init: update the comment
  mei: remove write only wariable wd_due_counter
  mei: mei_device can be const for mei register access functions
  mei: revamp host buffer interface function
  mei: don't query HCSR for host buffer depth
  mei: group wd_interface_reg with watchdog variables within struct mei_device
  mei: mei_irq_thread_write_handler check for overflow
  mei: make mei_write_message more readable
  mei: check for error codes that mei_flow_ctrl_creds retuns
  misc: at25: Parse dt settings
  misc: hpilo: increase number of max supported channels
  mei: mei.txt: minor grammar fixes
  • Loading branch information
Linus Torvalds committed Jul 26, 2012
2 parents fa93669 + 6078188 commit b84382f
Show file tree
Hide file tree
Showing 14 changed files with 242 additions and 259 deletions.
21 changes: 21 additions & 0 deletions Documentation/devicetree/bindings/misc/at25.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Atmel AT25 eeprom

Required properties:
- compatible : "atmel,at25".
- reg : chip select number
- spi-max-frequency : max spi frequency to use

- at25,byte-len : total eeprom size in bytes
- at25,addr-mode : addr-mode flags, as defined in include/linux/spi/eeprom.h
- at25,page-size : size of the eeprom page

Examples:
at25@0 {
compatible = "atmel,at25";
reg = <0>
spi-max-frequency = <5000000>;

at25,byte-len = <0x8000>;
at25,addr-mode = <2>;
at25,page-size = <64>;
};
14 changes: 7 additions & 7 deletions Documentation/misc-devices/mei/mei.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,25 +50,25 @@ Intel MEI Driver
The driver exposes a misc device called /dev/mei.

An application maintains communication with an Intel ME feature while
/dev/mei is open. The binding to a specific features is performed by calling
/dev/mei is open. The binding to a specific feature is performed by calling
MEI_CONNECT_CLIENT_IOCTL, which passes the desired UUID.
The number of instances of an Intel ME feature that can be opened
at the same time depends on the Intel ME feature, but most of the
features allow only a single instance.

The Intel AMT Host Interface (Intel AMTHI) feature supports multiple
simultaneous user applications. Therefore, the Intel MEI driver handles
this internally by maintaining request queues for the applications.
simultaneous user connected applications. The Intel MEI driver
handles this internally by maintaining request queues for the applications.

The driver is oblivious to data that is passed between firmware feature
The driver is transparent to data that are passed between firmware feature
and host application.

Because some of the Intel ME features can change the system
configuration, the driver by default allows only a privileged
user to access it.

A code snippet for an application communicating with
Intel AMTHI client:
A code snippet for an application communicating with Intel AMTHI client:

struct mei_connect_client_data data;
fd = open(MEI_DEVICE);

Expand Down Expand Up @@ -185,7 +185,7 @@ The Intel AMT Watchdog is composed of two parts:
2) Intel MEI driver - connects to the watchdog feature, configures the
watchdog and sends the heartbeats.

The Intel MEI driver uses the kernel watchdog to configure the Intel AMT
The Intel MEI driver uses the kernel watchdog API to configure the Intel AMT
Watchdog and to send heartbeats to it. The default timeout of the
watchdog is 120 seconds.

Expand Down
6 changes: 3 additions & 3 deletions drivers/char/bsr.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,6 @@ static int __init bsr_init(void)
struct device_node *np;
dev_t bsr_dev;
int ret = -ENODEV;
int result;

np = of_find_compatible_node(NULL, NULL, "ibm,bsr");
if (!np)
Expand All @@ -306,13 +305,14 @@ static int __init bsr_init(void)
bsr_class = class_create(THIS_MODULE, "bsr");
if (IS_ERR(bsr_class)) {
printk(KERN_ERR "class_create() failed for bsr_class\n");
ret = PTR_ERR(bsr_class);
goto out_err_1;
}
bsr_class->dev_attrs = bsr_dev_attrs;

result = alloc_chrdev_region(&bsr_dev, 0, BSR_MAX_DEVS, "bsr");
ret = alloc_chrdev_region(&bsr_dev, 0, BSR_MAX_DEVS, "bsr");
bsr_major = MAJOR(bsr_dev);
if (result < 0) {
if (ret < 0) {
printk(KERN_ERR "alloc_chrdev_region() failed for bsr\n");
goto out_err_2;
}
Expand Down
61 changes: 45 additions & 16 deletions drivers/misc/eeprom/at25.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#include <linux/spi/spi.h>
#include <linux/spi/eeprom.h>

#include <linux/of.h>

/*
* NOTE: this is an *EEPROM* driver. The vagaries of product naming
Expand Down Expand Up @@ -305,25 +305,54 @@ static ssize_t at25_mem_write(struct memory_accessor *mem, const char *buf,
static int at25_probe(struct spi_device *spi)
{
struct at25_data *at25 = NULL;
const struct spi_eeprom *chip;
struct spi_eeprom chip;
struct device_node *np = spi->dev.of_node;
int err;
int sr;
int addrlen;

/* Chip description */
chip = spi->dev.platform_data;
if (!chip) {
dev_dbg(&spi->dev, "no chip description\n");
err = -ENODEV;
goto fail;
}
if (!spi->dev.platform_data) {
if (np) {
u32 val;

memset(&chip, 0, sizeof(chip));
strncpy(chip.name, np->name, 10);

err = of_property_read_u32(np, "at25,byte-len", &val);
if (err) {
dev_dbg(&spi->dev, "invalid chip dt description\n");
goto fail;
}
chip.byte_len = val;

err = of_property_read_u32(np, "at25,addr-mode", &val);
if (err) {
dev_dbg(&spi->dev, "invalid chip dt description\n");
goto fail;
}
chip.flags = (u16)val;

err = of_property_read_u32(np, "at25,page-size", &val);
if (err) {
dev_dbg(&spi->dev, "invalid chip dt description\n");
goto fail;
}
chip.page_size = (u16)val;
} else {
dev_dbg(&spi->dev, "no chip description\n");
err = -ENODEV;
goto fail;
}
} else
chip = *(struct spi_eeprom *)spi->dev.platform_data;

/* For now we only support 8/16/24 bit addressing */
if (chip->flags & EE_ADDR1)
if (chip.flags & EE_ADDR1)
addrlen = 1;
else if (chip->flags & EE_ADDR2)
else if (chip.flags & EE_ADDR2)
addrlen = 2;
else if (chip->flags & EE_ADDR3)
else if (chip.flags & EE_ADDR3)
addrlen = 3;
else {
dev_dbg(&spi->dev, "unsupported address type\n");
Expand All @@ -348,7 +377,7 @@ static int at25_probe(struct spi_device *spi)
}

mutex_init(&at25->lock);
at25->chip = *chip;
at25->chip = chip;
at25->spi = spi_dev_get(spi);
dev_set_drvdata(&spi->dev, at25);
at25->addrlen = addrlen;
Expand All @@ -369,7 +398,7 @@ static int at25_probe(struct spi_device *spi)
at25->mem.read = at25_mem_read;

at25->bin.size = at25->chip.byte_len;
if (!(chip->flags & EE_READONLY)) {
if (!(chip.flags & EE_READONLY)) {
at25->bin.write = at25_bin_write;
at25->bin.attr.mode |= S_IWUSR;
at25->mem.write = at25_mem_write;
Expand All @@ -379,16 +408,16 @@ static int at25_probe(struct spi_device *spi)
if (err)
goto fail;

if (chip->setup)
chip->setup(&at25->mem, chip->context);
if (chip.setup)
chip.setup(&at25->mem, chip.context);

dev_info(&spi->dev, "%Zd %s %s eeprom%s, pagesize %u\n",
(at25->bin.size < 1024)
? at25->bin.size
: (at25->bin.size / 1024),
(at25->bin.size < 1024) ? "Byte" : "KByte",
at25->chip.name,
(chip->flags & EE_READONLY) ? " (readonly)" : "",
(chip.flags & EE_READONLY) ? " (readonly)" : "",
at25->chip.page_size);
return 0;
fail:
Expand Down
33 changes: 21 additions & 12 deletions drivers/misc/hpilo.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

static struct class *ilo_class;
static unsigned int ilo_major;
static unsigned int max_ccb = MIN_CCB;
static char ilo_hwdev[MAX_ILO_DEV];

static inline int get_entry_id(int entry)
Expand Down Expand Up @@ -424,7 +425,7 @@ static void ilo_set_reset(struct ilo_hwinfo *hw)
* Mapped memory is zeroed on ilo reset, so set a per ccb flag
* to indicate that this ccb needs to be closed and reopened.
*/
for (slot = 0; slot < MAX_CCB; slot++) {
for (slot = 0; slot < max_ccb; slot++) {
if (!hw->ccb_alloc[slot])
continue;
set_channel_reset(&hw->ccb_alloc[slot]->driver_ccb);
Expand Down Expand Up @@ -535,7 +536,7 @@ static int ilo_close(struct inode *ip, struct file *fp)
struct ilo_hwinfo *hw;
unsigned long flags;

slot = iminor(ip) % MAX_CCB;
slot = iminor(ip) % max_ccb;
hw = container_of(ip->i_cdev, struct ilo_hwinfo, cdev);

spin_lock(&hw->open_lock);
Expand Down Expand Up @@ -566,7 +567,7 @@ static int ilo_open(struct inode *ip, struct file *fp)
struct ilo_hwinfo *hw;
unsigned long flags;

slot = iminor(ip) % MAX_CCB;
slot = iminor(ip) % max_ccb;
hw = container_of(ip->i_cdev, struct ilo_hwinfo, cdev);

/* new ccb allocation */
Expand Down Expand Up @@ -663,7 +664,7 @@ static irqreturn_t ilo_isr(int irq, void *data)
ilo_set_reset(hw);
}

for (i = 0; i < MAX_CCB; i++) {
for (i = 0; i < max_ccb; i++) {
if (!hw->ccb_alloc[i])
continue;
if (pending & (1 << i))
Expand Down Expand Up @@ -697,14 +698,14 @@ static int __devinit ilo_map_device(struct pci_dev *pdev, struct ilo_hwinfo *hw)
}

/* map the adapter shared memory region */
hw->ram_vaddr = pci_iomap(pdev, 2, MAX_CCB * ILOHW_CCB_SZ);
hw->ram_vaddr = pci_iomap(pdev, 2, max_ccb * ILOHW_CCB_SZ);
if (hw->ram_vaddr == NULL) {
dev_err(&pdev->dev, "Error mapping shared mem\n");
goto mmio_free;
}

/* map the doorbell aperture */
hw->db_vaddr = pci_iomap(pdev, 3, MAX_CCB * ONE_DB_SIZE);
hw->db_vaddr = pci_iomap(pdev, 3, max_ccb * ONE_DB_SIZE);
if (hw->db_vaddr == NULL) {
dev_err(&pdev->dev, "Error mapping doorbell\n");
goto ram_free;
Expand All @@ -727,7 +728,7 @@ static void ilo_remove(struct pci_dev *pdev)
clear_device(ilo_hw);

minor = MINOR(ilo_hw->cdev.dev);
for (i = minor; i < minor + MAX_CCB; i++)
for (i = minor; i < minor + max_ccb; i++)
device_destroy(ilo_class, MKDEV(ilo_major, i));

cdev_del(&ilo_hw->cdev);
Expand All @@ -737,7 +738,7 @@ static void ilo_remove(struct pci_dev *pdev)
pci_release_regions(pdev);
pci_disable_device(pdev);
kfree(ilo_hw);
ilo_hwdev[(minor / MAX_CCB)] = 0;
ilo_hwdev[(minor / max_ccb)] = 0;
}

static int __devinit ilo_probe(struct pci_dev *pdev,
Expand All @@ -746,6 +747,11 @@ static int __devinit ilo_probe(struct pci_dev *pdev,
int devnum, minor, start, error;
struct ilo_hwinfo *ilo_hw;

if (max_ccb > MAX_CCB)
max_ccb = MAX_CCB;
else if (max_ccb < MIN_CCB)
max_ccb = MIN_CCB;

/* find a free range for device files */
for (devnum = 0; devnum < MAX_ILO_DEV; devnum++) {
if (ilo_hwdev[devnum] == 0) {
Expand Down Expand Up @@ -795,14 +801,14 @@ static int __devinit ilo_probe(struct pci_dev *pdev,

cdev_init(&ilo_hw->cdev, &ilo_fops);
ilo_hw->cdev.owner = THIS_MODULE;
start = devnum * MAX_CCB;
error = cdev_add(&ilo_hw->cdev, MKDEV(ilo_major, start), MAX_CCB);
start = devnum * max_ccb;
error = cdev_add(&ilo_hw->cdev, MKDEV(ilo_major, start), max_ccb);
if (error) {
dev_err(&pdev->dev, "Could not add cdev\n");
goto remove_isr;
}

for (minor = 0 ; minor < MAX_CCB; minor++) {
for (minor = 0 ; minor < max_ccb; minor++) {
struct device *dev;
dev = device_create(ilo_class, &pdev->dev,
MKDEV(ilo_major, minor), NULL,
Expand Down Expand Up @@ -879,11 +885,14 @@ static void __exit ilo_exit(void)
class_destroy(ilo_class);
}

MODULE_VERSION("1.2");
MODULE_VERSION("1.3");
MODULE_ALIAS(ILO_NAME);
MODULE_DESCRIPTION(ILO_NAME);
MODULE_AUTHOR("David Altobelli <david.altobelli@hp.com>");
MODULE_LICENSE("GPL v2");

module_param(max_ccb, uint, 0444);
MODULE_PARM_DESC(max_ccb, "Maximum number of HP iLO channels to attach (8)");

module_init(ilo_init);
module_exit(ilo_exit);
4 changes: 3 additions & 1 deletion drivers/misc/hpilo.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
#define ILO_NAME "hpilo"

/* max number of open channel control blocks per device, hw limited to 32 */
#define MAX_CCB 8
#define MAX_CCB 24
/* min number of open channel control blocks per device, hw limited to 32 */
#define MIN_CCB 8
/* max number of supported devices */
#define MAX_ILO_DEV 1
/* max number of files */
Expand Down
4 changes: 3 additions & 1 deletion drivers/misc/mei/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ int mei_hw_init(struct mei_device *dev)
if ((dev->host_hw_state & H_IS) == H_IS)
mei_reg_write(dev, H_CSR, dev->host_hw_state);

/* Doesn't change in runtime */
dev->hbuf_depth = (dev->host_hw_state & H_CBD) >> 24;

dev->recvd_msg = false;
dev_dbg(&dev->pdev->dev, "reset in start the mei device.\n");

Expand Down Expand Up @@ -303,7 +306,6 @@ void mei_reset(struct mei_device *dev, int interrupts_enabled)
dev->iamthif_cl.host_client_id);

mei_reset_iamthif_params(dev);
dev->wd_due_counter = 0;
dev->extra_write_index = 0;
}

Expand Down
Loading

0 comments on commit b84382f

Please sign in to comment.