|
@@ -228,3 +228,151 @@ static struct irq_chip nochip = {
|
|
.irq_mask = nochip_noop,
|
|
.irq_mask = nochip_noop,
|
|
.irq_unmask = nochip_noop,
|
|
.irq_unmask = nochip_noop,
|
|
};
|
|
};
|
|
|
|
+
|
|
|
|
+static struct sa1111_platform_data sa1111_info = {
|
|
|
|
+ .disable_devs = SA1111_DEVID_PS2_MSE,
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+static int neponset_probe(struct platform_device *dev)
|
|
|
|
+{
|
|
|
|
+ struct neponset_drvdata *d;
|
|
|
|
+ struct resource *nep_res, *sa1111_res, *smc91x_res;
|
|
|
|
+ struct resource sa1111_resources[] = {
|
|
|
|
+ DEFINE_RES_MEM(0x40000000, SZ_8K),
|
|
|
|
+ { .flags = IORESOURCE_IRQ },
|
|
|
|
+ };
|
|
|
|
+ struct platform_device_info sa1111_devinfo = {
|
|
|
|
+ .parent = &dev->dev,
|
|
|
|
+ .name = "sa1111",
|
|
|
|
+ .id = 0,
|
|
|
|
+ .res = sa1111_resources,
|
|
|
|
+ .num_res = ARRAY_SIZE(sa1111_resources),
|
|
|
|
+ .data = &sa1111_info,
|
|
|
|
+ .size_data = sizeof(sa1111_info),
|
|
|
|
+ .dma_mask = 0xffffffffUL,
|
|
|
|
+ };
|
|
|
|
+ struct resource smc91x_resources[] = {
|
|
|
|
+ DEFINE_RES_MEM_NAMED(SA1100_CS3_PHYS,
|
|
|
|
+ 0x02000000, "smc91x-regs"),
|
|
|
|
+ DEFINE_RES_MEM_NAMED(SA1100_CS3_PHYS + 0x02000000,
|
|
|
|
+ 0x02000000, "smc91x-attrib"),
|
|
|
|
+ { .flags = IORESOURCE_IRQ },
|
|
|
|
+ };
|
|
|
|
+ struct platform_device_info smc91x_devinfo = {
|
|
|
|
+ .parent = &dev->dev,
|
|
|
|
+ .name = "smc91x",
|
|
|
|
+ .id = 0,
|
|
|
|
+ .res = smc91x_resources,
|
|
|
|
+ .num_res = ARRAY_SIZE(smc91x_resources),
|
|
|
|
+ };
|
|
|
|
+ int ret, irq;
|
|
|
|
+
|
|
|
|
+ if (nep_base)
|
|
|
|
+ return -EBUSY;
|
|
|
|
+
|
|
|
|
+ irq = ret = platform_get_irq(dev, 0);
|
|
|
|
+ if (ret < 0)
|
|
|
|
+ goto err_alloc;
|
|
|
|
+
|
|
|
|
+ nep_res = platform_get_resource(dev, IORESOURCE_MEM, 0);
|
|
|
|
+ smc91x_res = platform_get_resource(dev, IORESOURCE_MEM, 1);
|
|
|
|
+ sa1111_res = platform_get_resource(dev, IORESOURCE_MEM, 2);
|
|
|
|
+ if (!nep_res || !smc91x_res || !sa1111_res) {
|
|
|
|
+ ret = -ENXIO;
|
|
|
|
+ goto err_alloc;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ d = kzalloc(sizeof(*d), GFP_KERNEL);
|
|
|
|
+ if (!d) {
|
|
|
|
+ ret = -ENOMEM;
|
|
|
|
+ goto err_alloc;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ d->base = ioremap(nep_res->start, SZ_4K);
|
|
|
|
+ if (!d->base) {
|
|
|
|
+ ret = -ENOMEM;
|
|
|
|
+ goto err_ioremap;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (readb_relaxed(d->base + WHOAMI) != 0x11) {
|
|
|
|
+ dev_warn(&dev->dev, "Neponset board detected, but wrong ID: %02x\n",
|
|
|
|
+ readb_relaxed(d->base + WHOAMI));
|
|
|
|
+ ret = -ENODEV;
|
|
|
|
+ goto err_id;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ ret = irq_alloc_descs(-1, IRQ_BOARD_START, NEP_IRQ_NR, -1);
|
|
|
|
+ if (ret <= 0) {
|
|
|
|
+ dev_err(&dev->dev, "unable to allocate %u irqs: %d\n",
|
|
|
|
+ NEP_IRQ_NR, ret);
|
|
|
|
+ if (ret == 0)
|
|
|
|
+ ret = -ENOMEM;
|
|
|
|
+ goto err_irq_alloc;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ d->irq_base = ret;
|
|
|
|
+
|
|
|
|
+ irq_set_chip_and_handler(d->irq_base + NEP_IRQ_SMC91X, &nochip,
|
|
|
|
+ handle_simple_irq);
|
|
|
|
+ set_irq_flags(d->irq_base + NEP_IRQ_SMC91X, IRQF_VALID | IRQF_PROBE);
|
|
|
|
+ irq_set_chip_and_handler(d->irq_base + NEP_IRQ_USAR, &nochip,
|
|
|
|
+ handle_simple_irq);
|
|
|
|
+ set_irq_flags(d->irq_base + NEP_IRQ_USAR, IRQF_VALID | IRQF_PROBE);
|
|
|
|
+ irq_set_chip(d->irq_base + NEP_IRQ_SA1111, &nochip);
|
|
|
|
+
|
|
|
|
+ irq_set_irq_type(irq, IRQ_TYPE_EDGE_RISING);
|
|
|
|
+ irq_set_handler_data(irq, d);
|
|
|
|
+ irq_set_chained_handler(irq, neponset_irq_handler);
|
|
|
|
+
|
|
|
|
+ /*
|
|
|
|
+ * We would set IRQ_GPIO25 to be a wake-up IRQ, but unfortunately
|
|
|
|
+ * something on the Neponset activates this IRQ on sleep (eth?)
|
|
|
|
+ */
|
|
|
|
+#if 0
|
|
|
|
+ enable_irq_wake(irq);
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
+ dev_info(&dev->dev, "Neponset daughter board, providing IRQ%u-%u\n",
|
|
|
|
+ d->irq_base, d->irq_base + NEP_IRQ_NR - 1);
|
|
|
|
+ nep_base = d->base;
|
|
|
|
+
|
|
|
|
+ sa1100_register_uart_fns(&neponset_port_fns);
|
|
|
|
+
|
|
|
|
+ /* Ensure that the memory bus request/grant signals are setup */
|
|
|
|
+ sa1110_mb_disable();
|
|
|
|
+
|
|
|
|
+ /* Disable GPIO 0/1 drivers so the buttons work on the Assabet */
|
|
|
|
+ writeb_relaxed(NCR_GP01_OFF, d->base + NCR_0);
|
|
|
|
+
|
|
|
|
+ sa1111_resources[0].parent = sa1111_res;
|
|
|
|
+ sa1111_resources[1].start = d->irq_base + NEP_IRQ_SA1111;
|
|
|
|
+ sa1111_resources[1].end = d->irq_base + NEP_IRQ_SA1111;
|
|
|
|
+ d->sa1111 = platform_device_register_full(&sa1111_devinfo);
|
|
|
|
+
|
|
|
|
+ smc91x_resources[0].parent = smc91x_res;
|
|
|
|
+ smc91x_resources[1].parent = smc91x_res;
|
|
|
|
+ smc91x_resources[2].start = d->irq_base + NEP_IRQ_SMC91X;
|
|
|
|
+ smc91x_resources[2].end = d->irq_base + NEP_IRQ_SMC91X;
|
|
|
|
+ d->smc91x = platform_device_register_full(&smc91x_devinfo);
|
|
|
|
+
|
|
|
|
+ platform_set_drvdata(dev, d);
|
|
|
|
+
|
|
|
|
+ return 0;
|
|
|
|
+
|
|
|
|
+ err_irq_alloc:
|
|
|
|
+ err_id:
|
|
|
|
+ iounmap(d->base);
|
|
|
|
+ err_ioremap:
|
|
|
|
+ kfree(d);
|
|
|
|
+ err_alloc:
|
|
|
|
+ return ret;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static int neponset_remove(struct platform_device *dev)
|
|
|
|
+{
|
|
|
|
+ struct neponset_drvdata *d = platform_get_drvdata(dev);
|
|
|
|
+ int irq = platform_get_irq(dev, 0);
|
|
|
|
+
|
|
|
|
+ if (!IS_ERR(d->sa1111))
|
|
|
|
+ platform_device_unregister(d->sa1111);
|
|
|
|
+ if (!IS_ERR(d->smc91x))
|