diff options
| -rw-r--r-- | drivers/tty/serial/sh-sci.c | 60 | ||||
| -rw-r--r-- | include/linux/serial_sci.h | 26 |
2 files changed, 34 insertions, 52 deletions
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index 96d26d7f8031..c4111162ec5e 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c | |||
| @@ -58,6 +58,23 @@ | |||
| 58 | 58 | ||
| 59 | #include "sh-sci.h" | 59 | #include "sh-sci.h" |
| 60 | 60 | ||
| 61 | /* Offsets into the sci_port->irqs array */ | ||
| 62 | enum { | ||
| 63 | SCIx_ERI_IRQ, | ||
| 64 | SCIx_RXI_IRQ, | ||
| 65 | SCIx_TXI_IRQ, | ||
| 66 | SCIx_BRI_IRQ, | ||
| 67 | SCIx_NR_IRQS, | ||
| 68 | |||
| 69 | SCIx_MUX_IRQ = SCIx_NR_IRQS, /* special case */ | ||
| 70 | }; | ||
| 71 | |||
| 72 | #define SCIx_IRQ_IS_MUXED(port) \ | ||
| 73 | ((port)->irqs[SCIx_ERI_IRQ] == \ | ||
| 74 | (port)->irqs[SCIx_RXI_IRQ]) || \ | ||
| 75 | ((port)->irqs[SCIx_ERI_IRQ] && \ | ||
| 76 | ((port)->irqs[SCIx_RXI_IRQ] < 0)) | ||
| 77 | |||
| 61 | struct sci_port { | 78 | struct sci_port { |
| 62 | struct uart_port port; | 79 | struct uart_port port; |
| 63 | 80 | ||
| @@ -2094,36 +2111,27 @@ static int sci_init_single(struct platform_device *dev, | |||
| 2094 | port->iotype = UPIO_MEM; | 2111 | port->iotype = UPIO_MEM; |
| 2095 | port->line = index; | 2112 | port->line = index; |
| 2096 | 2113 | ||
| 2097 | if (dev->num_resources) { | 2114 | res = platform_get_resource(dev, IORESOURCE_MEM, 0); |
| 2098 | /* Device has resources, use them. */ | 2115 | if (res == NULL) |
| 2099 | res = platform_get_resource(dev, IORESOURCE_MEM, 0); | 2116 | return -ENOMEM; |
| 2100 | if (res == NULL) | ||
| 2101 | return -ENOMEM; | ||
| 2102 | 2117 | ||
| 2103 | port->mapbase = res->start; | 2118 | port->mapbase = res->start; |
| 2104 | 2119 | ||
| 2105 | for (i = 0; i < ARRAY_SIZE(sci_port->irqs); ++i) | 2120 | for (i = 0; i < ARRAY_SIZE(sci_port->irqs); ++i) |
| 2106 | sci_port->irqs[i] = platform_get_irq(dev, i); | 2121 | sci_port->irqs[i] = platform_get_irq(dev, i); |
| 2107 | 2122 | ||
| 2108 | /* The SCI generates several interrupts. They can be muxed | 2123 | /* The SCI generates several interrupts. They can be muxed together or |
| 2109 | * together or connected to different interrupt lines. In the | 2124 | * connected to different interrupt lines. In the muxed case only one |
| 2110 | * muxed case only one interrupt resource is specified. In the | 2125 | * interrupt resource is specified. In the non-muxed case three or four |
| 2111 | * non-muxed case three or four interrupt resources are | 2126 | * interrupt resources are specified, as the BRI interrupt is optional. |
| 2112 | * specified, as the BRI interrupt is optional. | 2127 | */ |
| 2113 | */ | 2128 | if (sci_port->irqs[0] < 0) |
| 2114 | if (sci_port->irqs[0] < 0) | 2129 | return -ENXIO; |
| 2115 | return -ENXIO; | ||
| 2116 | 2130 | ||
| 2117 | if (sci_port->irqs[1] < 0) { | 2131 | if (sci_port->irqs[1] < 0) { |
| 2118 | sci_port->irqs[1] = sci_port->irqs[0]; | 2132 | sci_port->irqs[1] = sci_port->irqs[0]; |
| 2119 | sci_port->irqs[2] = sci_port->irqs[0]; | 2133 | sci_port->irqs[2] = sci_port->irqs[0]; |
| 2120 | sci_port->irqs[3] = sci_port->irqs[0]; | 2134 | sci_port->irqs[3] = sci_port->irqs[0]; |
| 2121 | } | ||
| 2122 | } else { | ||
| 2123 | /* No resources, use old-style platform data. */ | ||
| 2124 | port->mapbase = p->mapbase; | ||
| 2125 | for (i = 0; i < ARRAY_SIZE(sci_port->irqs); ++i) | ||
| 2126 | sci_port->irqs[i] = p->irqs[i] ? p->irqs[i] : -ENXIO; | ||
| 2127 | } | 2135 | } |
| 2128 | 2136 | ||
| 2129 | if (p->regtype == SCIx_PROBE_REGTYPE) { | 2137 | if (p->regtype == SCIx_PROBE_REGTYPE) { |
diff --git a/include/linux/serial_sci.h b/include/linux/serial_sci.h index fd7f9daa92cc..22b3640c9424 100644 --- a/include/linux/serial_sci.h +++ b/include/linux/serial_sci.h | |||
| @@ -50,17 +50,6 @@ | |||
| 50 | /* HSSRR HSCIF */ | 50 | /* HSSRR HSCIF */ |
| 51 | #define HSCIF_SRE 0x8000 | 51 | #define HSCIF_SRE 0x8000 |
| 52 | 52 | ||
| 53 | /* Offsets into the sci_port->irqs array */ | ||
| 54 | enum { | ||
| 55 | SCIx_ERI_IRQ, | ||
| 56 | SCIx_RXI_IRQ, | ||
| 57 | SCIx_TXI_IRQ, | ||
| 58 | SCIx_BRI_IRQ, | ||
| 59 | SCIx_NR_IRQS, | ||
| 60 | |||
| 61 | SCIx_MUX_IRQ = SCIx_NR_IRQS, /* special case */ | ||
| 62 | }; | ||
| 63 | |||
| 64 | enum { | 53 | enum { |
| 65 | SCIx_PROBE_REGTYPE, | 54 | SCIx_PROBE_REGTYPE, |
| 66 | 55 | ||
| @@ -79,19 +68,6 @@ enum { | |||
| 79 | SCIx_NR_REGTYPES, | 68 | SCIx_NR_REGTYPES, |
| 80 | }; | 69 | }; |
| 81 | 70 | ||
| 82 | #define SCIx_IRQ_MUXED(irq) \ | ||
| 83 | { \ | ||
| 84 | [SCIx_ERI_IRQ] = (irq), \ | ||
| 85 | [SCIx_RXI_IRQ] = (irq), \ | ||
| 86 | [SCIx_TXI_IRQ] = (irq), \ | ||
| 87 | [SCIx_BRI_IRQ] = (irq), \ | ||
| 88 | } | ||
| 89 | |||
| 90 | #define SCIx_IRQ_IS_MUXED(port) \ | ||
| 91 | ((port)->irqs[SCIx_ERI_IRQ] == \ | ||
| 92 | (port)->irqs[SCIx_RXI_IRQ]) || \ | ||
| 93 | ((port)->irqs[SCIx_ERI_IRQ] && \ | ||
| 94 | ((port)->irqs[SCIx_RXI_IRQ] < 0)) | ||
| 95 | /* | 71 | /* |
| 96 | * SCI register subset common for all port types. | 72 | * SCI register subset common for all port types. |
| 97 | * Not all registers will exist on all parts. | 73 | * Not all registers will exist on all parts. |
| @@ -120,8 +96,6 @@ struct plat_sci_port_ops { | |||
| 120 | * Platform device specific platform_data struct | 96 | * Platform device specific platform_data struct |
| 121 | */ | 97 | */ |
| 122 | struct plat_sci_port { | 98 | struct plat_sci_port { |
| 123 | unsigned long mapbase; /* resource base */ | ||
| 124 | unsigned int irqs[SCIx_NR_IRQS]; /* ERI, RXI, TXI, BRI */ | ||
| 125 | unsigned int type; /* SCI / SCIF / IRDA / HSCIF */ | 99 | unsigned int type; /* SCI / SCIF / IRDA / HSCIF */ |
| 126 | upf_t flags; /* UPF_* flags */ | 100 | upf_t flags; /* UPF_* flags */ |
| 127 | unsigned long capabilities; /* Port features/capabilities */ | 101 | unsigned long capabilities; /* Port features/capabilities */ |
