Skip to content

Commit

Permalink
[ARM] pxa: allow platforms to control which uarts are registered
Browse files Browse the repository at this point in the history
For some platforms, it is inappropriate to register all PXA UARTs.
In some cases, the UARTs may not be used, and in others we may want
to avoid registering the UARTs to allow other drivers (eg, FICP) to
make use of the UART.

In addition, a while back there was a request to be able to pass
platform data to the UART driver.

This patch enables all of this by providing functions platforms can
call to register each individual UART.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Acked-by: Mike Rapoport <mike@compulab.co.il>
Acked-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
  • Loading branch information
Russell King authored and Eric Miao committed Dec 1, 2009
1 parent 7c6ccbf commit cc155c6
Show file tree
Hide file tree
Showing 52 changed files with 230 additions and 14 deletions.
4 changes: 4 additions & 0 deletions arch/arm/mach-pxa/balloon3.c
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,10 @@ static void __init balloon3_init(void)
*/
ARB_CNTRL = ARB_CORE_PARK | 0x234;

pxa_set_ffuart_info(NULL);
pxa_set_btuart_info(NULL);
pxa_set_stuart_info(NULL);

pxa_set_i2c_info(NULL);
if (balloon3_has(BALLOON3_FEATURE_AUDIO))
pxa_set_ac97_info(NULL);
Expand Down
4 changes: 4 additions & 0 deletions arch/arm/mach-pxa/cm-x2xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,10 @@ static inline void cmx2xx_init_ac97(void) {}

static void __init cmx2xx_init(void)
{
pxa_set_ffuart_info(NULL);
pxa_set_btuart_info(NULL);
pxa_set_stuart_info(NULL);

cmx2xx_pm_init();

if (cpu_is_pxa25x())
Expand Down
4 changes: 4 additions & 0 deletions arch/arm/mach-pxa/cm-x300.c
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,10 @@ static void __init cm_x300_init(void)
/* board-processor specific GPIO initialization */
pxa3xx_mfp_config(ARRAY_AND_SIZE(cm_x300_mfp_cfg));

pxa_set_ffuart_info(NULL);
pxa_set_btuart_info(NULL);
pxa_set_stuart_info(NULL);

cm_x300_init_dm9000();
cm_x300_init_lcd();
cm_x300_init_ohci();
Expand Down
3 changes: 3 additions & 0 deletions arch/arm/mach-pxa/colibri-pxa270.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ static struct platform_device *colibri_pxa270_devices[] __initdata = {
static void __init colibri_pxa270_init(void)
{
pxa2xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa270_pin_config));
pxa_set_ffuart_info(NULL);
pxa_set_btuart_info(NULL);
pxa_set_stuart_info(NULL);
platform_add_devices(ARRAY_AND_SIZE(colibri_pxa270_devices));
}

Expand Down
4 changes: 4 additions & 0 deletions arch/arm/mach-pxa/colibri-pxa300.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,10 @@ static inline void colibri_pxa310_init_ac97(void) {}

void __init colibri_pxa300_init(void)
{
pxa_set_ffuart_info(NULL);
pxa_set_btuart_info(NULL);
pxa_set_stuart_info(NULL);

colibri_pxa300_init_eth();
colibri_pxa300_init_ohci();
colibri_pxa3xx_init_nand();
Expand Down
4 changes: 4 additions & 0 deletions arch/arm/mach-pxa/colibri-pxa320.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,10 @@ static void __init colibri_pxa320_init_uart(void)

void __init colibri_pxa320_init(void)
{
pxa_set_ffuart_info(NULL);
pxa_set_btuart_info(NULL);
pxa_set_stuart_info(NULL);

colibri_pxa320_init_eth();
colibri_pxa320_init_ohci();
colibri_pxa3xx_init_nand();
Expand Down
4 changes: 4 additions & 0 deletions arch/arm/mach-pxa/corgi.c
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,10 @@ static void __init corgi_init(void)

pxa2xx_mfp_config(ARRAY_AND_SIZE(corgi_pin_config));

pxa_set_ffuart_info(NULL);
pxa_set_btuart_info(NULL);
pxa_set_stuart_info(NULL);

corgi_init_spi();

pxa_set_udc_info(&udc_info);
Expand Down
3 changes: 3 additions & 0 deletions arch/arm/mach-pxa/csb726.c
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,9 @@ static void __init csb726_init(void)
/* MSC2 = 0x06697ff4; *//* none/SM501 */
MSC2 = (MSC2 & ~0xffff) | 0x7ff4; /* SM501 */

pxa_set_ffuart_info(NULL);
pxa_set_btuart_info(NULL);
pxa_set_stuart_info(NULL);
pxa_set_i2c_info(NULL);
pxa27x_set_i2c_power_info(NULL);
pxa_set_mci_info(&csb726_mci);
Expand Down
25 changes: 24 additions & 1 deletion arch/arm/mach-pxa/devices.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,18 @@ static struct resource pxa_resource_ffuart[] = {
}
};

struct platform_device pxa_device_ffuart= {
struct platform_device pxa_device_ffuart = {
.name = "pxa2xx-uart",
.id = 0,
.resource = pxa_resource_ffuart,
.num_resources = ARRAY_SIZE(pxa_resource_ffuart),
};

void __init pxa_set_ffuart_info(void *info)
{
pxa_register_device(&pxa_device_ffuart, info);
}

static struct resource pxa_resource_btuart[] = {
{
.start = 0x40200000,
Expand All @@ -193,6 +198,11 @@ struct platform_device pxa_device_btuart = {
.num_resources = ARRAY_SIZE(pxa_resource_btuart),
};

void __init pxa_set_btuart_info(void *info)
{
pxa_register_device(&pxa_device_btuart, info);
}

static struct resource pxa_resource_stuart[] = {
{
.start = 0x40700000,
Expand All @@ -212,6 +222,11 @@ struct platform_device pxa_device_stuart = {
.num_resources = ARRAY_SIZE(pxa_resource_stuart),
};

void __init pxa_set_stuart_info(void *info)
{
pxa_register_device(&pxa_device_stuart, info);
}

static struct resource pxa_resource_hwuart[] = {
{
.start = 0x41600000,
Expand All @@ -231,6 +246,14 @@ struct platform_device pxa_device_hwuart = {
.num_resources = ARRAY_SIZE(pxa_resource_hwuart),
};

void __init pxa_set_hwuart_info(void *info)
{
if (cpu_is_pxa255())
pxa_register_device(&pxa_device_hwuart, info);
else
pr_info("UART: Ignoring attempt to register HWUART on non-PXA255 hardware");
}

static struct resource pxai2c_resources[] = {
{
.start = 0x40301680,
Expand Down
3 changes: 3 additions & 0 deletions arch/arm/mach-pxa/e330.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ static struct platform_device *devices[] __initdata = {

static void __init e330_init(void)
{
pxa_set_ffuart_info(NULL);
pxa_set_btuart_info(NULL);
pxa_set_stuart_info(NULL);
eseries_register_clks();
eseries_get_tmio_gpios();
platform_add_devices(devices, ARRAY_SIZE(devices));
Expand Down
3 changes: 3 additions & 0 deletions arch/arm/mach-pxa/e350.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ static struct platform_device *devices[] __initdata = {

static void __init e350_init(void)
{
pxa_set_ffuart_info(NULL);
pxa_set_btuart_info(NULL);
pxa_set_stuart_info(NULL);
eseries_register_clks();
eseries_get_tmio_gpios();
platform_add_devices(devices, ARRAY_SIZE(devices));
Expand Down
3 changes: 3 additions & 0 deletions arch/arm/mach-pxa/e400.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ static struct platform_device *devices[] __initdata = {
static void __init e400_init(void)
{
pxa2xx_mfp_config(ARRAY_AND_SIZE(e400_pin_config));
pxa_set_ffuart_info(NULL);
pxa_set_btuart_info(NULL);
pxa_set_stuart_info(NULL);
/* Fixme - e400 may have a switched clock */
eseries_register_clks();
eseries_get_tmio_gpios();
Expand Down
3 changes: 3 additions & 0 deletions arch/arm/mach-pxa/e740.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,9 @@ static struct platform_device *devices[] __initdata = {
static void __init e740_init(void)
{
pxa2xx_mfp_config(ARRAY_AND_SIZE(e740_pin_config));
pxa_set_ffuart_info(NULL);
pxa_set_btuart_info(NULL);
pxa_set_stuart_info(NULL);
eseries_register_clks();
clk_add_alias("CLK_CK48M", e740_t7l66xb_device.name,
"UDCCLK", &pxa25x_device_udc.dev),
Expand Down
3 changes: 3 additions & 0 deletions arch/arm/mach-pxa/e750.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,9 @@ static struct platform_device *devices[] __initdata = {
static void __init e750_init(void)
{
pxa2xx_mfp_config(ARRAY_AND_SIZE(e750_pin_config));
pxa_set_ffuart_info(NULL);
pxa_set_btuart_info(NULL);
pxa_set_stuart_info(NULL);
clk_add_alias("CLK_CK3P6MI", e750_tc6393xb_device.name,
"GPIO11_CLK", NULL),
eseries_get_tmio_gpios();
Expand Down
3 changes: 3 additions & 0 deletions arch/arm/mach-pxa/e800.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,9 @@ static struct platform_device *devices[] __initdata = {

static void __init e800_init(void)
{
pxa_set_ffuart_info(NULL);
pxa_set_btuart_info(NULL);
pxa_set_stuart_info(NULL);
clk_add_alias("CLK_CK3P6MI", e800_tc6393xb_device.name,
"GPIO11_CLK", NULL),
eseries_get_tmio_gpios();
Expand Down
4 changes: 4 additions & 0 deletions arch/arm/mach-pxa/em-x270.c
Original file line number Diff line number Diff line change
Expand Up @@ -1286,6 +1286,10 @@ static void __init em_x270_init(void)
{
pxa2xx_mfp_config(ARRAY_AND_SIZE(common_pin_config));

pxa_set_ffuart_info(NULL);
pxa_set_btuart_info(NULL);
pxa_set_stuart_info(NULL);

#ifdef CONFIG_PM
pxa27x_set_pwrmode(PWRMODE_DEEPSLEEP);
#endif
Expand Down
24 changes: 24 additions & 0 deletions arch/arm/mach-pxa/ezx.c
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,10 @@ static void __init a780_init(void)
pxa2xx_mfp_config(ARRAY_AND_SIZE(gen1_pin_config));
pxa2xx_mfp_config(ARRAY_AND_SIZE(a780_pin_config));

pxa_set_ffuart_info(NULL);
pxa_set_btuart_info(NULL);
pxa_set_stuart_info(NULL);

pxa_set_i2c_info(NULL);

set_pxa_fb_info(&ezx_fb_info_1);
Expand Down Expand Up @@ -754,6 +758,10 @@ static void __init e680_init(void)
pxa2xx_mfp_config(ARRAY_AND_SIZE(gen1_pin_config));
pxa2xx_mfp_config(ARRAY_AND_SIZE(e680_pin_config));

pxa_set_ffuart_info(NULL);
pxa_set_btuart_info(NULL);
pxa_set_stuart_info(NULL);

pxa_set_i2c_info(NULL);
i2c_register_board_info(0, ARRAY_AND_SIZE(e680_i2c_board_info));

Expand Down Expand Up @@ -816,6 +824,10 @@ static void __init a1200_init(void)
pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config));
pxa2xx_mfp_config(ARRAY_AND_SIZE(a1200_pin_config));

pxa_set_ffuart_info(NULL);
pxa_set_btuart_info(NULL);
pxa_set_stuart_info(NULL);

pxa_set_i2c_info(NULL);
i2c_register_board_info(0, ARRAY_AND_SIZE(a1200_i2c_board_info));

Expand Down Expand Up @@ -874,6 +886,10 @@ static void __init a910_init(void)
pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config));
pxa2xx_mfp_config(ARRAY_AND_SIZE(a910_pin_config));

pxa_set_ffuart_info(NULL);
pxa_set_btuart_info(NULL);
pxa_set_stuart_info(NULL);

pxa_set_i2c_info(NULL);

set_pxa_fb_info(&ezx_fb_info_2);
Expand Down Expand Up @@ -935,6 +951,10 @@ static void __init e6_init(void)
pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config));
pxa2xx_mfp_config(ARRAY_AND_SIZE(e6_pin_config));

pxa_set_ffuart_info(NULL);
pxa_set_btuart_info(NULL);
pxa_set_stuart_info(NULL);

pxa_set_i2c_info(NULL);
i2c_register_board_info(0, ARRAY_AND_SIZE(e6_i2c_board_info));

Expand Down Expand Up @@ -971,6 +991,10 @@ static void __init e2_init(void)
pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config));
pxa2xx_mfp_config(ARRAY_AND_SIZE(e2_pin_config));

pxa_set_ffuart_info(NULL);
pxa_set_btuart_info(NULL);
pxa_set_stuart_info(NULL);

pxa_set_i2c_info(NULL);
i2c_register_board_info(0, ARRAY_AND_SIZE(e2_i2c_board_info));

Expand Down
5 changes: 5 additions & 0 deletions arch/arm/mach-pxa/generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,8 @@ extern struct sysdev_class pxa_irq_sysclass;
extern struct sysdev_class pxa_gpio_sysclass;
extern struct sysdev_class pxa2xx_mfp_sysclass;
extern struct sysdev_class pxa3xx_mfp_sysclass;

void __init pxa_set_ffuart_info(void *info);
void __init pxa_set_btuart_info(void *info);
void __init pxa_set_stuart_info(void *info);
void __init pxa_set_hwuart_info(void *info);
5 changes: 5 additions & 0 deletions arch/arm/mach-pxa/gumstix.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,11 @@ static void __init gumstix_init(void)
{
pxa2xx_mfp_config(ARRAY_AND_SIZE(gumstix_pin_config));

pxa_set_ffuart_info(NULL);
pxa_set_btuart_info(NULL);
pxa_set_stuart_info(NULL);
pxa_set_hwuart_info(NULL);

gumstix_bluetooth_init();
gumstix_udc_init();
gumstix_mmc_init();
Expand Down
3 changes: 3 additions & 0 deletions arch/arm/mach-pxa/h5000.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@ static void __init h5000_init(void)
fix_msc();

pxa2xx_mfp_config(ARRAY_AND_SIZE(h5000_pin_config));
pxa_set_ffuart_info(NULL);
pxa_set_btuart_info(NULL);
pxa_set_stuart_info(NULL);
pxa_set_udc_info(&h5000_udc_mach_info);
platform_add_devices(ARRAY_AND_SIZE(devices));
}
Expand Down
3 changes: 3 additions & 0 deletions arch/arm/mach-pxa/himalaya.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ static void __init himalaya_lcd_init(void)

static void __init himalaya_init(void)
{
pxa_set_ffuart_info(NULL);
pxa_set_btuart_info(NULL);
pxa_set_stuart_info(NULL);
himalaya_lcd_init();
platform_add_devices(devices, ARRAY_SIZE(devices));
}
Expand Down
4 changes: 4 additions & 0 deletions arch/arm/mach-pxa/hx4700.c
Original file line number Diff line number Diff line change
Expand Up @@ -849,6 +849,10 @@ static void __init hx4700_init(void)
pxa2xx_mfp_config(ARRAY_AND_SIZE(hx4700_pin_config));
hx4700_gpio_request(ARRAY_AND_SIZE(global_gpios));

pxa_set_ffuart_info(NULL);
pxa_set_btuart_info(NULL);
pxa_set_stuart_info(NULL);

platform_add_devices(devices, ARRAY_SIZE(devices));

pxa_set_ficp_info(&ficp_info);
Expand Down
3 changes: 3 additions & 0 deletions arch/arm/mach-pxa/idp.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,9 @@ static void __init idp_init(void)
printk("idp_init()\n");

pxa2xx_mfp_config(ARRAY_AND_SIZE(idp_pin_config));
pxa_set_ffuart_info(NULL);
pxa_set_btuart_info(NULL);
pxa_set_stuart_info(NULL);

platform_device_register(&smc91x_device);
//platform_device_register(&mst_audio_device);
Expand Down
6 changes: 5 additions & 1 deletion arch/arm/mach-pxa/imote2.c
Original file line number Diff line number Diff line change
Expand Up @@ -554,8 +554,12 @@ static struct i2c_pxa_platform_data i2c_pdata = {

static void __init imote2_init(void)
{

pxa2xx_mfp_config(ARRAY_AND_SIZE(imote2_pin_config));

pxa_set_ffuart_info(NULL);
pxa_set_btuart_info(NULL);
pxa_set_stuart_info(NULL);

/* SPI chip select directions - all other directions should
* be handled by drivers.*/
gpio_direction_output(37, 0);
Expand Down
4 changes: 4 additions & 0 deletions arch/arm/mach-pxa/littleton.c
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,10 @@ static void __init littleton_init(void)
/* initialize MFP configurations */
pxa3xx_mfp_config(ARRAY_AND_SIZE(littleton_mfp_cfg));

pxa_set_ffuart_info(NULL);
pxa_set_btuart_info(NULL);
pxa_set_stuart_info(NULL);

/*
* Note: we depend bootloader set the correct
* value to MSC register for SMC91x.
Expand Down
4 changes: 4 additions & 0 deletions arch/arm/mach-pxa/lpd270.c
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,10 @@ static void __init lpd270_init(void)
{
pxa2xx_mfp_config(ARRAY_AND_SIZE(lpd270_pin_config));

pxa_set_ffuart_info(NULL);
pxa_set_btuart_info(NULL);
pxa_set_stuart_info(NULL);

lpd270_flash_data[0].width = (BOOT_DEF & 1) ? 2 : 4;
lpd270_flash_data[1].width = 4;

Expand Down
4 changes: 4 additions & 0 deletions arch/arm/mach-pxa/lubbock.c
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,10 @@ static void __init lubbock_init(void)

pxa2xx_mfp_config(ARRAY_AND_SIZE(lubbock_pin_config));

pxa_set_ffuart_info(NULL);
pxa_set_btuart_info(NULL);
pxa_set_stuart_info(NULL);

clk_add_alias("SA1111_CLK", NULL, "GPIO11_CLK", NULL);
pxa_set_udc_info(&udc_info);
set_pxa_fb_info(&sharp_lm8v31);
Expand Down
Loading

0 comments on commit cc155c6

Please sign in to comment.