Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] ppc32: Make the UARTs on MPC824x individual platform devices

The UARTs on the MPC824x are unique devices and really shouldn't be thought
of as a DUART. In addition, if both UARTs are in use we need to configure
the part to enable the 2nd UART since the pins for the UARTs are
multiplexed. Adds support to run the 824x Sandpoint with both UARTs if
desired.

Signed-off-by: Matt McClintock <msm@freescale.com>
Signed-off-by: Kumar Gala <kumar.gala@freescale.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Kumar Gala and committed by
Linus Torvalds
13e886c3 d054b5ac

+64 -20
+7
arch/ppc/Kconfig
··· 878 878 bool "Enable MPC10x store gathering" 879 879 depends on MPC10X_BRIDGE 880 880 881 + config SANDPOINT_ENABLE_UART1 882 + bool "Enable DUART mode on Sandpoint" 883 + depends on SANDPOINT 884 + help 885 + If this option is enabled then the MPC824x processor will run 886 + in DUART mode instead of UART mode. 887 + 881 888 config CPC710_DATA_GATHERING 882 889 bool "Enable CPC710 data gathering" 883 890 depends on K2
+1 -1
arch/ppc/configs/sandpoint_defconfig
··· 437 437 # 438 438 CONFIG_SERIAL_8250=y 439 439 CONFIG_SERIAL_8250_CONSOLE=y 440 - CONFIG_SERIAL_8250_NR_UARTS=2 440 + CONFIG_SERIAL_8250_NR_UARTS=4 441 441 # CONFIG_SERIAL_8250_EXTENDED is not set 442 442 443 443 #
+11 -8
arch/ppc/platforms/sandpoint.c
··· 311 311 { 312 312 bd_t *bp = (bd_t *)__res; 313 313 struct plat_serial8250_port *pdata; 314 - pdata = (struct plat_serial8250_port *) ppc_sys_get_pdata(MPC10X_DUART); 315 314 315 + pdata = (struct plat_serial8250_port *) ppc_sys_get_pdata(MPC10X_UART0); 316 316 if (pdata) 317 317 { 318 318 pdata[0].uartclk = bp->bi_busfreq; 319 - pdata[0].membase = ioremap(pdata[0].mapbase, 0x100); 320 - 321 - /* this disables the 2nd serial port on the DUART 322 - * since the sandpoint does not have it connected */ 323 - pdata[1].uartclk = 0; 324 - pdata[1].irq = 0; 325 - pdata[1].mapbase = 0; 326 319 } 320 + 321 + #ifdef CONFIG_SANDPOINT_ENABLE_UART1 322 + pdata = (struct plat_serial8250_port *) ppc_sys_get_pdata(MPC10X_UART1); 323 + if (pdata) 324 + { 325 + pdata[0].uartclk = bp->bi_busfreq; 326 + } 327 + #else 328 + ppc_sys_device_remove(MPC10X_UART1); 329 + #endif 327 330 } 328 331 329 332 printk(KERN_INFO "Motorola SPS Sandpoint Test Platform\n");
+43 -10
arch/ppc/syslib/mpc10x_common.c
··· 45 45 #define MPC10X_DMA0_IRQ (EPIC_IRQ_BASE + 1 + NUM_8259_INTERRUPTS) 46 46 #define MPC10X_DMA1_IRQ (EPIC_IRQ_BASE + 2 + NUM_8259_INTERRUPTS) 47 47 #define MPC10X_UART0_IRQ (EPIC_IRQ_BASE + 4 + NUM_8259_INTERRUPTS) 48 + #define MPC10X_UART1_IRQ (EPIC_IRQ_BASE + 5 + NUM_8259_INTERRUPTS) 48 49 #else 49 50 #define MPC10X_I2C_IRQ -1 50 51 #define MPC10X_DMA0_IRQ -1 51 52 #define MPC10X_DMA1_IRQ -1 52 53 #define MPC10X_UART0_IRQ -1 54 + #define MPC10X_UART1_IRQ -1 53 55 #endif 54 56 55 57 static struct fsl_i2c_platform_data mpc10x_i2c_pdata = { 56 58 .device_flags = 0, 57 59 }; 58 60 59 - static struct plat_serial8250_port serial_platform_data[] = { 61 + static struct plat_serial8250_port serial_plat_uart0[] = { 60 62 [0] = { 61 63 .mapbase = 0x4500, 62 64 .iotype = UPIO_MEM, 63 65 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, 64 66 }, 65 - [1] = { 67 + { }, 68 + }; 69 + static struct plat_serial8250_port serial_plat_uart1[] = { 70 + [0] = { 66 71 .mapbase = 0x4600, 67 72 .iotype = UPIO_MEM, 68 73 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, ··· 138 133 }, 139 134 }, 140 135 }, 141 - [MPC10X_DUART] = { 136 + [MPC10X_UART0] = { 142 137 .name = "serial8250", 143 138 .id = 0, 144 - .dev.platform_data = serial_platform_data, 139 + .dev.platform_data = serial_plat_uart0, 145 140 }, 141 + [MPC10X_UART1] = { 142 + .name = "serial8250", 143 + .id = 1, 144 + .dev.platform_data = serial_plat_uart1, 145 + }, 146 + 146 147 }; 147 148 148 149 /* We use the PCI ID to match on */ ··· 158 147 .ppc_sys_name = "8245", 159 148 .mask = 0xFFFFFFFF, 160 149 .value = MPC10X_BRIDGE_8245, 161 - .num_devices = 4, 150 + .num_devices = 5, 162 151 .device_list = (enum ppc_sys_devices[]) 163 152 { 164 - MPC10X_IIC1, MPC10X_DMA0, MPC10X_DMA1, MPC10X_DUART, 153 + MPC10X_IIC1, MPC10X_DMA0, MPC10X_DMA1, MPC10X_UART0, MPC10X_UART1, 165 154 }, 166 155 }, 167 156 { ··· 190 179 .value = 0x00000000, 191 180 }, 192 181 }; 182 + 183 + /* 184 + * mach_mpc10x_fixup: This function enables DUART mode if it detects 185 + * if it detects two UARTS in the platform device entries. 186 + */ 187 + static int __init mach_mpc10x_fixup(struct platform_device *pdev) 188 + { 189 + if (strncmp (pdev->name, "serial8250", 10) == 0 && pdev->id == 1) 190 + writeb(readb(serial_plat_uart1[0].membase + 0x11) | 0x1, 191 + serial_plat_uart1[0].membase + 0x11); 192 + return 0; 193 + } 194 + 195 + static int __init mach_mpc10x_init(void) 196 + { 197 + ppc_sys_device_fixup = mach_mpc10x_fixup; 198 + return 0; 199 + } 200 + postcore_initcall(mach_mpc10x_init); 193 201 194 202 /* Set resources to match bridge memory map */ 195 203 void __init ··· 249 219 ppc_md.progress("mpc10x:exit1", 0x100); 250 220 } 251 221 } 222 + 252 223 /* 253 224 * Do some initialization and put the EUMB registers at the specified address 254 225 * (also map the EPIC registers into virtual space--OpenPIC_Addr will be set). ··· 442 411 ppc_sys_platform_devices[MPC10X_DMA1].resource[1].start = MPC10X_DMA1_IRQ; 443 412 ppc_sys_platform_devices[MPC10X_DMA1].resource[1].end = MPC10X_DMA1_IRQ; 444 413 445 - serial_platform_data[0].mapbase += phys_eumb_base; 446 - serial_platform_data[0].irq = MPC10X_UART0_IRQ; 414 + serial_plat_uart0[0].mapbase += phys_eumb_base; 415 + serial_plat_uart0[0].irq = MPC10X_UART0_IRQ; 416 + serial_plat_uart0[0].membase = ioremap(serial_plat_uart0[0].mapbase, 0x100); 447 417 448 - serial_platform_data[1].mapbase += phys_eumb_base; 449 - serial_platform_data[1].irq = MPC10X_UART0_IRQ + 1; 418 + serial_plat_uart1[0].mapbase += phys_eumb_base; 419 + serial_plat_uart1[0].irq = MPC10X_UART1_IRQ; 420 + serial_plat_uart1[0].membase = ioremap(serial_plat_uart1[0].mapbase, 0x100); 450 421 451 422 /* 452 423 * 8240 erratum 26, 8241/8245 erratum 29, 107 erratum 23: speculative
+2 -1
include/asm-ppc/mpc10x.h
··· 163 163 MPC10X_IIC1, 164 164 MPC10X_DMA0, 165 165 MPC10X_DMA1, 166 - MPC10X_DUART, 166 + MPC10X_UART0, 167 + MPC10X_UART1, 167 168 }; 168 169 169 170 int mpc10x_bridge_init(struct pci_controller *hose,