Loading drivers/mfd/Kconfig +1 −0 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ config HTC_PASIC3 config MFD_TC6393XB bool "Support Toshiba TC6393XB" depends on HAVE_GPIO_LIB select MFD_CORE help Support for Toshiba Mobile IO Controller TC6393XB Loading drivers/mfd/tc6393xb.c +63 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,8 @@ #include <linux/platform_device.h> #include <linux/fb.h> #include <linux/clk.h> #include <linux/mfd/core.h> #include <linux/mfd/tmio.h> #include <linux/mfd/tc6393xb.h> #include <linux/gpio.h> Loading Loading @@ -108,6 +110,59 @@ struct tc6393xb { int irq_base; }; enum { TC6393XB_CELL_NAND, }; /*--------------------------------------------------------------------------*/ static int tc6393xb_nand_enable(struct platform_device *nand) { struct platform_device *dev = to_platform_device(nand->dev.parent); struct tc6393xb *tc6393xb = platform_get_drvdata(dev); unsigned long flags; spin_lock_irqsave(&tc6393xb->lock, flags); /* SMD buffer on */ dev_dbg(&dev->dev, "SMD buffer on\n"); iowrite8(0xff, tc6393xb->scr + SCR_GPI_BCR(1)); spin_unlock_irqrestore(&tc6393xb->lock, flags); return 0; } static struct resource __devinitdata tc6393xb_nand_resources[] = { { .name = TMIO_NAND_CONFIG, .start = 0x0100, .end = 0x01ff, .flags = IORESOURCE_MEM, }, { .name = TMIO_NAND_CONTROL, .start = 0x1000, .end = 0x1007, .flags = IORESOURCE_MEM, }, { .name = TMIO_NAND_IRQ, .start = IRQ_TC6393_NAND, .end = IRQ_TC6393_NAND, .flags = IORESOURCE_IRQ, }, }; static struct mfd_cell __devinitdata tc6393xb_cells[] = { [TC6393XB_CELL_NAND] = { .name = "tmio-nand", .enable = tc6393xb_nand_enable, .num_resources = ARRAY_SIZE(tc6393xb_nand_resources), .resources = tc6393xb_nand_resources, }, }; /*--------------------------------------------------------------------------*/ static int tc6393xb_gpio_get(struct gpio_chip *chip, Loading Loading @@ -410,6 +465,12 @@ static int __devinit tc6393xb_probe(struct platform_device *dev) if (tc6393xb->irq) tc6393xb_attach_irq(dev); tc6393xb_cells[TC6393XB_CELL_NAND].driver_data = tcpd->nand_data; retval = mfd_add_devices(dev, tc6393xb_cells, ARRAY_SIZE(tc6393xb_cells), iomem, tcpd->irq_base); return 0; if (tc6393xb->irq) Loading Loading @@ -440,6 +501,8 @@ static int __devexit tc6393xb_remove(struct platform_device *dev) struct tc6393xb *tc6393xb = platform_get_drvdata(dev); int ret; mfd_remove_devices(dev); if (tc6393xb->irq) tc6393xb_detach_irq(dev); Loading include/linux/mfd/tc6393xb.h +2 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,8 @@ struct tc6393xb_platform_data { int irq_base; /* a base for cascaded irq */ int gpio_base; struct tmio_nand_data *nand_data; }; /* Loading include/linux/mfd/tmio.h 0 → 100644 +17 −0 Original line number Diff line number Diff line #ifndef MFD_TMIO_H #define MFD_TMIO_H /* * data for the NAND controller */ struct tmio_nand_data { struct nand_bbt_descr *badblock_pattern; struct mtd_partition *partition; unsigned int num_partitions; }; #define TMIO_NAND_CONFIG "tmio-nand-config" #define TMIO_NAND_CONTROL "tmio-nand-control" #define TMIO_NAND_IRQ "tmio-nand" #endif Loading
drivers/mfd/Kconfig +1 −0 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ config HTC_PASIC3 config MFD_TC6393XB bool "Support Toshiba TC6393XB" depends on HAVE_GPIO_LIB select MFD_CORE help Support for Toshiba Mobile IO Controller TC6393XB Loading
drivers/mfd/tc6393xb.c +63 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,8 @@ #include <linux/platform_device.h> #include <linux/fb.h> #include <linux/clk.h> #include <linux/mfd/core.h> #include <linux/mfd/tmio.h> #include <linux/mfd/tc6393xb.h> #include <linux/gpio.h> Loading Loading @@ -108,6 +110,59 @@ struct tc6393xb { int irq_base; }; enum { TC6393XB_CELL_NAND, }; /*--------------------------------------------------------------------------*/ static int tc6393xb_nand_enable(struct platform_device *nand) { struct platform_device *dev = to_platform_device(nand->dev.parent); struct tc6393xb *tc6393xb = platform_get_drvdata(dev); unsigned long flags; spin_lock_irqsave(&tc6393xb->lock, flags); /* SMD buffer on */ dev_dbg(&dev->dev, "SMD buffer on\n"); iowrite8(0xff, tc6393xb->scr + SCR_GPI_BCR(1)); spin_unlock_irqrestore(&tc6393xb->lock, flags); return 0; } static struct resource __devinitdata tc6393xb_nand_resources[] = { { .name = TMIO_NAND_CONFIG, .start = 0x0100, .end = 0x01ff, .flags = IORESOURCE_MEM, }, { .name = TMIO_NAND_CONTROL, .start = 0x1000, .end = 0x1007, .flags = IORESOURCE_MEM, }, { .name = TMIO_NAND_IRQ, .start = IRQ_TC6393_NAND, .end = IRQ_TC6393_NAND, .flags = IORESOURCE_IRQ, }, }; static struct mfd_cell __devinitdata tc6393xb_cells[] = { [TC6393XB_CELL_NAND] = { .name = "tmio-nand", .enable = tc6393xb_nand_enable, .num_resources = ARRAY_SIZE(tc6393xb_nand_resources), .resources = tc6393xb_nand_resources, }, }; /*--------------------------------------------------------------------------*/ static int tc6393xb_gpio_get(struct gpio_chip *chip, Loading Loading @@ -410,6 +465,12 @@ static int __devinit tc6393xb_probe(struct platform_device *dev) if (tc6393xb->irq) tc6393xb_attach_irq(dev); tc6393xb_cells[TC6393XB_CELL_NAND].driver_data = tcpd->nand_data; retval = mfd_add_devices(dev, tc6393xb_cells, ARRAY_SIZE(tc6393xb_cells), iomem, tcpd->irq_base); return 0; if (tc6393xb->irq) Loading Loading @@ -440,6 +501,8 @@ static int __devexit tc6393xb_remove(struct platform_device *dev) struct tc6393xb *tc6393xb = platform_get_drvdata(dev); int ret; mfd_remove_devices(dev); if (tc6393xb->irq) tc6393xb_detach_irq(dev); Loading
include/linux/mfd/tc6393xb.h +2 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,8 @@ struct tc6393xb_platform_data { int irq_base; /* a base for cascaded irq */ int gpio_base; struct tmio_nand_data *nand_data; }; /* Loading
include/linux/mfd/tmio.h 0 → 100644 +17 −0 Original line number Diff line number Diff line #ifndef MFD_TMIO_H #define MFD_TMIO_H /* * data for the NAND controller */ struct tmio_nand_data { struct nand_bbt_descr *badblock_pattern; struct mtd_partition *partition; unsigned int num_partitions; }; #define TMIO_NAND_CONFIG "tmio-nand-config" #define TMIO_NAND_CONTROL "tmio-nand-control" #define TMIO_NAND_IRQ "tmio-nand" #endif