* [PATCH 0/3] Alchemy: platform updates
@ 2009-03-29 9:26 Manuel Lauss
2009-03-29 9:27 ` [PATCH 1/3] Alchemy: get rid of common/platform.c Manuel Lauss
2009-03-29 11:35 ` [PATCH 0/3] Alchemy: platform updates Sergei Shtylyov
0 siblings, 2 replies; 16+ messages in thread
From: Manuel Lauss @ 2009-03-29 9:26 UTC (permalink / raw)
To: Linux-MIPS; +Cc: Manuel Lauss
Hello!
Patch overview:
#1: eliminate alchemy/common/platform.c. Add platform device
registration to all boards instead.
I realize this is a lot of (needless) code duplication at first,
but it seems a lot cleaner to me if each board registered the
devices it needs/wants.
#2: platform au1xxx-rtc device for all devboards with 32kHz crystal.
#3: eliminate the alchemy-flash MTD map driver; add physmap-flash
platform devices to each devboard.
I have 4 more patches which convert a few drivers to platform_devices
(irda and au1000-ac97c alsa) which (in part) depend on these.
Compile-tested on all boards touched by these patches; run-tested on
the DB1200 only. If anyone has access to the other boards, please test
and report bugs to me!
Thanks!
Manuel Lauss
---
Manuel Lauss (3):
Alchemy: get rid of common/platform.c
Alchemy: add RTC device to devboards
Alchemy: convert to physmap flash
arch/mips/alchemy/common/Makefile | 4 +-
arch/mips/alchemy/common/platform.c | 369 -------------------------
arch/mips/alchemy/devboards/db1x00/Makefile | 2 +-
arch/mips/alchemy/devboards/db1x00/platform.c | 247 +++++++++++++++++
arch/mips/alchemy/devboards/pb1000/Makefile | 2 +-
arch/mips/alchemy/devboards/pb1000/platform.c | 144 ++++++++++
arch/mips/alchemy/devboards/pb1100/Makefile | 2 +-
arch/mips/alchemy/devboards/pb1100/platform.c | 171 ++++++++++++
arch/mips/alchemy/devboards/pb1200/platform.c | 249 +++++++++++++++++-
arch/mips/alchemy/devboards/pb1500/Makefile | 2 +-
arch/mips/alchemy/devboards/pb1500/platform.c | 142 ++++++++++
arch/mips/alchemy/devboards/pb1550/Makefile | 2 +-
arch/mips/alchemy/devboards/pb1550/platform.c | 160 +++++++++++
arch/mips/alchemy/mtx-1/platform.c | 64 +++++
arch/mips/alchemy/xxs1500/Makefile | 3 +-
arch/mips/alchemy/xxs1500/platform.c | 87 ++++++
drivers/mtd/maps/Kconfig | 6 -
drivers/mtd/maps/Makefile | 1 -
drivers/mtd/maps/alchemy-flash.c | 166 -----------
19 files changed, 1272 insertions(+), 551 deletions(-)
delete mode 100644 arch/mips/alchemy/common/platform.c
create mode 100644 arch/mips/alchemy/devboards/db1x00/platform.c
create mode 100644 arch/mips/alchemy/devboards/pb1000/platform.c
create mode 100644 arch/mips/alchemy/devboards/pb1100/platform.c
create mode 100644 arch/mips/alchemy/devboards/pb1500/platform.c
create mode 100644 arch/mips/alchemy/devboards/pb1550/platform.c
create mode 100644 arch/mips/alchemy/xxs1500/platform.c
delete mode 100644 drivers/mtd/maps/alchemy-flash.c
^ permalink raw reply [flat|nested] 16+ messages in thread* [PATCH 1/3] Alchemy: get rid of common/platform.c 2009-03-29 9:26 [PATCH 0/3] Alchemy: platform updates Manuel Lauss @ 2009-03-29 9:27 ` Manuel Lauss 2009-03-29 9:27 ` [PATCH 2/3] Alchemy: add RTC device to devboards Manuel Lauss ` (2 more replies) 2009-03-29 11:35 ` [PATCH 0/3] Alchemy: platform updates Sergei Shtylyov 1 sibling, 3 replies; 16+ messages in thread From: Manuel Lauss @ 2009-03-29 9:27 UTC (permalink / raw) To: Linux-MIPS; +Cc: Manuel Lauss Move device registration out of common/platform.c into the individual boards' platform.c files. Every board should register the devices it wants to use (i.e. on one of my Au1200 systems UART1 is unused [pinmux problems] and its functionality is provided by an external device. This also results in a completely useless ttyS1 entry; I want this entry gone without having to add a lot more #ifdef <platform> lines to common/platform.c). Signed-off-by: Manuel Lauss <mano@roarinelk.homelinux.net> --- arch/mips/alchemy/common/Makefile | 4 +- arch/mips/alchemy/common/platform.c | 369 ------------------------- arch/mips/alchemy/devboards/db1x00/Makefile | 2 +- arch/mips/alchemy/devboards/db1x00/platform.c | 165 +++++++++++ arch/mips/alchemy/devboards/pb1000/Makefile | 2 +- arch/mips/alchemy/devboards/pb1000/platform.c | 90 ++++++ arch/mips/alchemy/devboards/pb1100/Makefile | 2 +- arch/mips/alchemy/devboards/pb1100/platform.c | 116 ++++++++ arch/mips/alchemy/devboards/pb1200/platform.c | 190 +++++++++++++- arch/mips/alchemy/devboards/pb1500/Makefile | 2 +- arch/mips/alchemy/devboards/pb1500/platform.c | 88 ++++++ arch/mips/alchemy/devboards/pb1550/Makefile | 2 +- arch/mips/alchemy/devboards/pb1550/platform.c | 106 +++++++ arch/mips/alchemy/mtx-1/platform.c | 64 +++++ arch/mips/alchemy/xxs1500/Makefile | 3 +- arch/mips/alchemy/xxs1500/platform.c | 87 ++++++ 16 files changed, 914 insertions(+), 378 deletions(-) delete mode 100644 arch/mips/alchemy/common/platform.c create mode 100644 arch/mips/alchemy/devboards/db1x00/platform.c create mode 100644 arch/mips/alchemy/devboards/pb1000/platform.c create mode 100644 arch/mips/alchemy/devboards/pb1100/platform.c create mode 100644 arch/mips/alchemy/devboards/pb1500/platform.c create mode 100644 arch/mips/alchemy/devboards/pb1550/platform.c create mode 100644 arch/mips/alchemy/xxs1500/platform.c diff --git a/arch/mips/alchemy/common/Makefile b/arch/mips/alchemy/common/Makefile index d50d476..962612c 100644 --- a/arch/mips/alchemy/common/Makefile +++ b/arch/mips/alchemy/common/Makefile @@ -6,8 +6,8 @@ # obj-y += prom.o irq.o puts.o time.o reset.o \ - clocks.o platform.o power.o setup.o \ - sleeper.o dma.o dbdma.o gpio.o + clocks.o power.o setup.o sleeper.o \ + dma.o dbdma.o gpio.o obj-$(CONFIG_PCI) += pci.o diff --git a/arch/mips/alchemy/common/platform.c b/arch/mips/alchemy/common/platform.c deleted file mode 100644 index 5c76c64..0000000 --- a/arch/mips/alchemy/common/platform.c +++ /dev/null @@ -1,369 +0,0 @@ -/* - * Platform device support for Au1x00 SoCs. - * - * Copyright 2004, Matt Porter <mporter@kernel.crashing.org> - * - * (C) Copyright Embedded Alley Solutions, Inc 2005 - * Author: Pantelis Antoniou <pantelis@embeddedalley.com> - * - * This file is licensed under the terms of the GNU General Public - * License version 2. This program is licensed "as is" without any - * warranty of any kind, whether express or implied. - */ - -#include <linux/dma-mapping.h> -#include <linux/platform_device.h> -#include <linux/serial_8250.h> -#include <linux/init.h> - -#include <asm/mach-au1x00/au1xxx.h> -#include <asm/mach-au1x00/au1xxx_dbdma.h> -#include <asm/mach-au1x00/au1100_mmc.h> - -#define PORT(_base, _irq) \ - { \ - .iobase = _base, \ - .membase = (void __iomem *)_base,\ - .mapbase = CPHYSADDR(_base), \ - .irq = _irq, \ - .regshift = 2, \ - .iotype = UPIO_AU, \ - .flags = UPF_SKIP_TEST \ - } - -static struct plat_serial8250_port au1x00_uart_data[] = { -#if defined(CONFIG_SERIAL_8250_AU1X00) -#if defined(CONFIG_SOC_AU1000) - PORT(UART0_ADDR, AU1000_UART0_INT), - PORT(UART1_ADDR, AU1000_UART1_INT), - PORT(UART2_ADDR, AU1000_UART2_INT), - PORT(UART3_ADDR, AU1000_UART3_INT), -#elif defined(CONFIG_SOC_AU1500) - PORT(UART0_ADDR, AU1500_UART0_INT), - PORT(UART3_ADDR, AU1500_UART3_INT), -#elif defined(CONFIG_SOC_AU1100) - PORT(UART0_ADDR, AU1100_UART0_INT), - PORT(UART1_ADDR, AU1100_UART1_INT), - PORT(UART3_ADDR, AU1100_UART3_INT), -#elif defined(CONFIG_SOC_AU1550) - PORT(UART0_ADDR, AU1550_UART0_INT), - PORT(UART1_ADDR, AU1550_UART1_INT), - PORT(UART3_ADDR, AU1550_UART3_INT), -#elif defined(CONFIG_SOC_AU1200) - PORT(UART0_ADDR, AU1200_UART0_INT), - PORT(UART1_ADDR, AU1200_UART1_INT), -#endif -#endif /* CONFIG_SERIAL_8250_AU1X00 */ - { }, -}; - -static struct platform_device au1xx0_uart_device = { - .name = "serial8250", - .id = PLAT8250_DEV_AU1X00, - .dev = { - .platform_data = au1x00_uart_data, - }, -}; - -/* OHCI (USB full speed host controller) */ -static struct resource au1xxx_usb_ohci_resources[] = { - [0] = { - .start = USB_OHCI_BASE, - .end = USB_OHCI_BASE + USB_OHCI_LEN - 1, - .flags = IORESOURCE_MEM, - }, - [1] = { - .start = AU1000_USB_HOST_INT, - .end = AU1000_USB_HOST_INT, - .flags = IORESOURCE_IRQ, - }, -}; - -/* The dmamask must be set for OHCI to work */ -static u64 ohci_dmamask = DMA_32BIT_MASK; - -static struct platform_device au1xxx_usb_ohci_device = { - .name = "au1xxx-ohci", - .id = 0, - .dev = { - .dma_mask = &ohci_dmamask, - .coherent_dma_mask = DMA_32BIT_MASK, - }, - .num_resources = ARRAY_SIZE(au1xxx_usb_ohci_resources), - .resource = au1xxx_usb_ohci_resources, -}; - -/*** AU1100 LCD controller ***/ - -#ifdef CONFIG_FB_AU1100 -static struct resource au1100_lcd_resources[] = { - [0] = { - .start = LCD_PHYS_ADDR, - .end = LCD_PHYS_ADDR + 0x800 - 1, - .flags = IORESOURCE_MEM, - }, - [1] = { - .start = AU1100_LCD_INT, - .end = AU1100_LCD_INT, - .flags = IORESOURCE_IRQ, - } -}; - -static u64 au1100_lcd_dmamask = DMA_32BIT_MASK; - -static struct platform_device au1100_lcd_device = { - .name = "au1100-lcd", - .id = 0, - .dev = { - .dma_mask = &au1100_lcd_dmamask, - .coherent_dma_mask = DMA_32BIT_MASK, - }, - .num_resources = ARRAY_SIZE(au1100_lcd_resources), - .resource = au1100_lcd_resources, -}; -#endif - -#ifdef CONFIG_SOC_AU1200 -/* EHCI (USB high speed host controller) */ -static struct resource au1xxx_usb_ehci_resources[] = { - [0] = { - .start = USB_EHCI_BASE, - .end = USB_EHCI_BASE + USB_EHCI_LEN - 1, - .flags = IORESOURCE_MEM, - }, - [1] = { - .start = AU1000_USB_HOST_INT, - .end = AU1000_USB_HOST_INT, - .flags = IORESOURCE_IRQ, - }, -}; - -static u64 ehci_dmamask = DMA_32BIT_MASK; - -static struct platform_device au1xxx_usb_ehci_device = { - .name = "au1xxx-ehci", - .id = 0, - .dev = { - .dma_mask = &ehci_dmamask, - .coherent_dma_mask = DMA_32BIT_MASK, - }, - .num_resources = ARRAY_SIZE(au1xxx_usb_ehci_resources), - .resource = au1xxx_usb_ehci_resources, -}; - -/* Au1200 UDC (USB gadget controller) */ -static struct resource au1xxx_usb_gdt_resources[] = { - [0] = { - .start = USB_UDC_BASE, - .end = USB_UDC_BASE + USB_UDC_LEN - 1, - .flags = IORESOURCE_MEM, - }, - [1] = { - .start = AU1200_USB_INT, - .end = AU1200_USB_INT, - .flags = IORESOURCE_IRQ, - }, -}; - -static u64 udc_dmamask = DMA_32BIT_MASK; - -static struct platform_device au1xxx_usb_gdt_device = { - .name = "au1xxx-udc", - .id = 0, - .dev = { - .dma_mask = &udc_dmamask, - .coherent_dma_mask = DMA_32BIT_MASK, - }, - .num_resources = ARRAY_SIZE(au1xxx_usb_gdt_resources), - .resource = au1xxx_usb_gdt_resources, -}; - -/* Au1200 UOC (USB OTG controller) */ -static struct resource au1xxx_usb_otg_resources[] = { - [0] = { - .start = USB_UOC_BASE, - .end = USB_UOC_BASE + USB_UOC_LEN - 1, - .flags = IORESOURCE_MEM, - }, - [1] = { - .start = AU1200_USB_INT, - .end = AU1200_USB_INT, - .flags = IORESOURCE_IRQ, - }, -}; - -static u64 uoc_dmamask = DMA_32BIT_MASK; - -static struct platform_device au1xxx_usb_otg_device = { - .name = "au1xxx-uoc", - .id = 0, - .dev = { - .dma_mask = &uoc_dmamask, - .coherent_dma_mask = DMA_32BIT_MASK, - }, - .num_resources = ARRAY_SIZE(au1xxx_usb_otg_resources), - .resource = au1xxx_usb_otg_resources, -}; - -static struct resource au1200_lcd_resources[] = { - [0] = { - .start = LCD_PHYS_ADDR, - .end = LCD_PHYS_ADDR + 0x800 - 1, - .flags = IORESOURCE_MEM, - }, - [1] = { - .start = AU1200_LCD_INT, - .end = AU1200_LCD_INT, - .flags = IORESOURCE_IRQ, - } -}; - -static u64 au1200_lcd_dmamask = DMA_32BIT_MASK; - -static struct platform_device au1200_lcd_device = { - .name = "au1200-lcd", - .id = 0, - .dev = { - .dma_mask = &au1200_lcd_dmamask, - .coherent_dma_mask = DMA_32BIT_MASK, - }, - .num_resources = ARRAY_SIZE(au1200_lcd_resources), - .resource = au1200_lcd_resources, -}; - -static u64 au1xxx_mmc_dmamask = DMA_32BIT_MASK; - -extern struct au1xmmc_platform_data au1xmmc_platdata[2]; - -static struct resource au1200_mmc0_resources[] = { - [0] = { - .start = SD0_PHYS_ADDR, - .end = SD0_PHYS_ADDR + 0x7ffff, - .flags = IORESOURCE_MEM, - }, - [1] = { - .start = AU1200_SD_INT, - .end = AU1200_SD_INT, - .flags = IORESOURCE_IRQ, - }, - [2] = { - .start = DSCR_CMD0_SDMS_TX0, - .end = DSCR_CMD0_SDMS_TX0, - .flags = IORESOURCE_DMA, - }, - [3] = { - .start = DSCR_CMD0_SDMS_RX0, - .end = DSCR_CMD0_SDMS_RX0, - .flags = IORESOURCE_DMA, - } -}; - -static struct platform_device au1200_mmc0_device = { - .name = "au1xxx-mmc", - .id = 0, - .dev = { - .dma_mask = &au1xxx_mmc_dmamask, - .coherent_dma_mask = DMA_32BIT_MASK, - .platform_data = &au1xmmc_platdata[0], - }, - .num_resources = ARRAY_SIZE(au1200_mmc0_resources), - .resource = au1200_mmc0_resources, -}; - -#ifndef CONFIG_MIPS_DB1200 -static struct resource au1200_mmc1_resources[] = { - [0] = { - .start = SD1_PHYS_ADDR, - .end = SD1_PHYS_ADDR + 0x7ffff, - .flags = IORESOURCE_MEM, - }, - [1] = { - .start = AU1200_SD_INT, - .end = AU1200_SD_INT, - .flags = IORESOURCE_IRQ, - }, - [2] = { - .start = DSCR_CMD0_SDMS_TX1, - .end = DSCR_CMD0_SDMS_TX1, - .flags = IORESOURCE_DMA, - }, - [3] = { - .start = DSCR_CMD0_SDMS_RX1, - .end = DSCR_CMD0_SDMS_RX1, - .flags = IORESOURCE_DMA, - } -}; - -static struct platform_device au1200_mmc1_device = { - .name = "au1xxx-mmc", - .id = 1, - .dev = { - .dma_mask = &au1xxx_mmc_dmamask, - .coherent_dma_mask = DMA_32BIT_MASK, - .platform_data = &au1xmmc_platdata[1], - }, - .num_resources = ARRAY_SIZE(au1200_mmc1_resources), - .resource = au1200_mmc1_resources, -}; -#endif /* #ifndef CONFIG_MIPS_DB1200 */ -#endif /* #ifdef CONFIG_SOC_AU1200 */ - -static struct platform_device au1x00_pcmcia_device = { - .name = "au1x00-pcmcia", - .id = 0, -}; - -/* All Alchemy demoboards with I2C have this #define in their headers */ -#ifdef SMBUS_PSC_BASE -static struct resource pbdb_smbus_resources[] = { - { - .start = CPHYSADDR(SMBUS_PSC_BASE), - .end = CPHYSADDR(SMBUS_PSC_BASE + 0xfffff), - .flags = IORESOURCE_MEM, - }, -}; - -static struct platform_device pbdb_smbus_device = { - .name = "au1xpsc_smbus", - .id = 0, /* bus number */ - .num_resources = ARRAY_SIZE(pbdb_smbus_resources), - .resource = pbdb_smbus_resources, -}; -#endif - -static struct platform_device *au1xxx_platform_devices[] __initdata = { - &au1xx0_uart_device, - &au1xxx_usb_ohci_device, - &au1x00_pcmcia_device, -#ifdef CONFIG_FB_AU1100 - &au1100_lcd_device, -#endif -#ifdef CONFIG_SOC_AU1200 - &au1xxx_usb_ehci_device, - &au1xxx_usb_gdt_device, - &au1xxx_usb_otg_device, - &au1200_lcd_device, - &au1200_mmc0_device, -#ifndef CONFIG_MIPS_DB1200 - &au1200_mmc1_device, -#endif -#endif -#ifdef SMBUS_PSC_BASE - &pbdb_smbus_device, -#endif -}; - -static int __init au1xxx_platform_init(void) -{ - unsigned int uartclk = get_au1x00_uart_baud_base() * 16; - int i; - - /* Fill up uartclk. */ - for (i = 0; au1x00_uart_data[i].flags; i++) - au1x00_uart_data[i].uartclk = uartclk; - - return platform_add_devices(au1xxx_platform_devices, - ARRAY_SIZE(au1xxx_platform_devices)); -} - -arch_initcall(au1xxx_platform_init); diff --git a/arch/mips/alchemy/devboards/db1x00/Makefile b/arch/mips/alchemy/devboards/db1x00/Makefile index 432241a..532a214 100644 --- a/arch/mips/alchemy/devboards/db1x00/Makefile +++ b/arch/mips/alchemy/devboards/db1x00/Makefile @@ -5,4 +5,4 @@ # Makefile for the Alchemy Semiconductor DBAu1xx0 boards. # -obj-y := board_setup.o irqmap.o +obj-y := board_setup.o irqmap.o platform.o diff --git a/arch/mips/alchemy/devboards/db1x00/platform.c b/arch/mips/alchemy/devboards/db1x00/platform.c new file mode 100644 index 0000000..49d6e5c --- /dev/null +++ b/arch/mips/alchemy/devboards/db1x00/platform.c @@ -0,0 +1,165 @@ +/* + * Platform device support for Au1x00 SoCs. + * + * Copyright 2004, Matt Porter <mporter@kernel.crashing.org> + * + * (C) Copyright Embedded Alley Solutions, Inc 2005 + * Author: Pantelis Antoniou <pantelis@embeddedalley.com> + * + * This file is licensed under the terms of the GNU General Public + * License version 2. This program is licensed "as is" without any + * warranty of any kind, whether express or implied. + */ + +#include <linux/dma-mapping.h> +#include <linux/platform_device.h> +#include <linux/serial_8250.h> +#include <linux/init.h> + +#include <asm/mach-au1x00/au1xxx.h> + +#define PORT(_base, _irq) \ + { \ + .iobase = _base, \ + .mapbase = _base, \ + .irq = _irq, \ + .regshift = 2, \ + .iotype = UPIO_AU, \ + .flags = UPF_SKIP_TEST | UPF_IOREMAP \ + } + +static struct plat_serial8250_port au1x00_uart_data[] = { +#if defined(CONFIG_SOC_AU1000) + PORT(UART0_PHYS_ADDR, AU1000_UART0_INT), + PORT(UART1_PHYS_ADDR, AU1000_UART1_INT), + PORT(UART2_PHYS_ADDR, AU1000_UART2_INT), + PORT(UART3_PHYS_ADDR, AU1000_UART3_INT), +#elif defined(CONFIG_SOC_AU1500) + PORT(UART0_PHYS_ADDR, AU1500_UART0_INT), + PORT(UART3_PHYS_ADDR, AU1500_UART3_INT), +#elif defined(CONFIG_SOC_AU1100) + PORT(UART0_PHYS_ADDR, AU1100_UART0_INT), + PORT(UART1_PHYS_ADDR, AU1100_UART1_INT), + PORT(UART3_PHYS_ADDR, AU1100_UART3_INT), +#elif defined(CONFIG_SOC_AU1550) + PORT(UART0_PHYS_ADDR, AU1550_UART0_INT), + PORT(UART1_PHYS_ADDR, AU1550_UART1_INT), + PORT(UART3_PHYS_ADDR, AU1550_UART3_INT), +#endif + { }, +}; + +static struct platform_device au1xx0_uart_device = { + .name = "serial8250", + .id = PLAT8250_DEV_AU1X00, + .dev = { + .platform_data = au1x00_uart_data, + }, +}; + +/* OHCI (USB full speed host controller) */ +static struct resource au1xxx_usb_ohci_resources[] = { + [0] = { + .start = USB_OHCI_BASE, + .end = USB_OHCI_BASE + USB_OHCI_LEN - 1, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = AU1000_USB_HOST_INT, + .end = AU1000_USB_HOST_INT, + .flags = IORESOURCE_IRQ, + }, +}; + +/* The dmamask must be set for OHCI to work */ +static u64 ohci_dmamask = DMA_32BIT_MASK; + +static struct platform_device au1xxx_usb_ohci_device = { + .name = "au1xxx-ohci", + .id = 0, + .dev = { + .dma_mask = &ohci_dmamask, + .coherent_dma_mask = DMA_32BIT_MASK, + }, + .num_resources = ARRAY_SIZE(au1xxx_usb_ohci_resources), + .resource = au1xxx_usb_ohci_resources, +}; + +/*** AU1100 LCD controller ***/ + +#ifdef CONFIG_FB_AU1100 +static struct resource au1100_lcd_resources[] = { + [0] = { + .start = LCD_PHYS_ADDR, + .end = LCD_PHYS_ADDR + 0x800 - 1, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = AU1100_LCD_INT, + .end = AU1100_LCD_INT, + .flags = IORESOURCE_IRQ, + } +}; + +static u64 au1100_lcd_dmamask = DMA_32BIT_MASK; + +static struct platform_device au1100_lcd_device = { + .name = "au1100-lcd", + .id = 0, + .dev = { + .dma_mask = &au1100_lcd_dmamask, + .coherent_dma_mask = DMA_32BIT_MASK, + }, + .num_resources = ARRAY_SIZE(au1100_lcd_resources), + .resource = au1100_lcd_resources, +}; +#endif + +static struct platform_device au1x00_pcmcia_device = { + .name = "au1x00-pcmcia", + .id = 0, +}; + +#ifdef SMBUS_PSC_BASE /* Db1550 */ +static struct resource pbdb_smbus_resources[] = { + { + .start = CPHYSADDR(SMBUS_PSC_BASE), + .end = CPHYSADDR(SMBUS_PSC_BASE + 0xfffff), + .flags = IORESOURCE_MEM, + }, +}; + +static struct platform_device pbdb_smbus_device = { + .name = "au1xpsc_smbus", + .id = 0, /* bus number */ + .num_resources = ARRAY_SIZE(pbdb_smbus_resources), + .resource = pbdb_smbus_resources, +}; +#endif + +static struct platform_device *au1xxx_platform_devices[] __initdata = { + &au1xx0_uart_device, + &au1xxx_usb_ohci_device, + &au1x00_pcmcia_device, +#ifdef CONFIG_FB_AU1100 + &au1100_lcd_device, +#endif +#ifdef SMBUS_PSC_BASE + &pbdb_smbus_device, +#endif +}; + +static int __init au1xxx_platform_init(void) +{ + unsigned int uartclk = get_au1x00_uart_baud_base() * 16; + int i; + + /* Fill up uartclk. */ + for (i = 0; au1x00_uart_data[i].flags; i++) + au1x00_uart_data[i].uartclk = uartclk; + + return platform_add_devices(au1xxx_platform_devices, + ARRAY_SIZE(au1xxx_platform_devices)); +} + +arch_initcall(au1xxx_platform_init); diff --git a/arch/mips/alchemy/devboards/pb1000/Makefile b/arch/mips/alchemy/devboards/pb1000/Makefile index 97c6615..38d11bb 100644 --- a/arch/mips/alchemy/devboards/pb1000/Makefile +++ b/arch/mips/alchemy/devboards/pb1000/Makefile @@ -5,4 +5,4 @@ # Makefile for the Alchemy Semiconductor Pb1000 board. # -obj-y := board_setup.o +obj-y := board_setup.o platform.o diff --git a/arch/mips/alchemy/devboards/pb1000/platform.c b/arch/mips/alchemy/devboards/pb1000/platform.c new file mode 100644 index 0000000..0661a49 --- /dev/null +++ b/arch/mips/alchemy/devboards/pb1000/platform.c @@ -0,0 +1,90 @@ +/* + * pb1000 platform device registration. + */ + +#include <linux/dma-mapping.h> +#include <linux/init.h> +#include <linux/platform_device.h> +#include <linux/serial_8250.h> + +#include <asm/mach-au1x00/au1000.h> + +#define PORT(_base, _irq) \ + { \ + .iobase = _base, \ + .mapbase = _base, \ + .irq = _irq, \ + .regshift = 2, \ + .iotype = UPIO_AU, \ + .flags = UPF_SKIP_TEST | UPF_IOREMAP \ + } + +static struct plat_serial8250_port pb1000_uart_data[] = { + PORT(UART0_PHYS_ADDR, AU1000_UART0_INT), + PORT(UART1_PHYS_ADDR, AU1000_UART1_INT), + PORT(UART2_PHYS_ADDR, AU1000_UART2_INT), + PORT(UART3_PHYS_ADDR, AU1000_UART3_INT), + {}, +}; + +static struct platform_device pb1000_uart_device = { + .name = "serial8250", + .id = PLAT8250_DEV_AU1X00, + .dev = { + .platform_data = pb1000_uart_data, + }, +}; + +/* OHCI (USB full speed host controller) */ +static struct resource au1xxx_usb_ohci_resources[] = { + [0] = { + .start = USB_OHCI_BASE, + .end = USB_OHCI_BASE + USB_OHCI_LEN - 1, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = AU1000_USB_HOST_INT, + .end = AU1000_USB_HOST_INT, + .flags = IORESOURCE_IRQ, + }, +}; + +/* The dmamask must be set for OHCI to work */ +static u64 ohci_dmamask = DMA_32BIT_MASK; + +static struct platform_device au1xxx_usb_ohci_device = { + .name = "au1xxx-ohci", + .id = 0, + .dev = { + .dma_mask = &ohci_dmamask, + .coherent_dma_mask = DMA_32BIT_MASK, + }, + .num_resources = ARRAY_SIZE(au1xxx_usb_ohci_resources), + .resource = au1xxx_usb_ohci_resources, +}; + +static struct platform_device pb1000_pcmcia_device = { + .name = "au1x00-pcmcia", + .id = 0, +}; + +static struct platform_device *pb1000_devices[] = { + &pb1000_uart_device, + &au1xxx_usb_ohci_device, + &pb1000_pcmcia_device, +}; + +static int __init pb1000_platform_init(void) +{ + unsigned int uartclk = get_au1x00_uart_baud_base() * 16; + int i; + + /* Fill up uartclk. */ + for (i = 0; pb1000_uart_data[i].flags; i++) + pb1000_uart_data[i].uartclk = uartclk; + + return platform_add_devices(pb1000_devices, + ARRAY_SIZE(pb1000_devices)); +} + +arch_initcall(pb1000_platform_init); diff --git a/arch/mips/alchemy/devboards/pb1100/Makefile b/arch/mips/alchemy/devboards/pb1100/Makefile index c586dd7..7e3756c 100644 --- a/arch/mips/alchemy/devboards/pb1100/Makefile +++ b/arch/mips/alchemy/devboards/pb1100/Makefile @@ -5,4 +5,4 @@ # Makefile for the Alchemy Semiconductor Pb1100 board. # -obj-y := board_setup.o +obj-y := board_setup.o platform.o diff --git a/arch/mips/alchemy/devboards/pb1100/platform.c b/arch/mips/alchemy/devboards/pb1100/platform.c new file mode 100644 index 0000000..276db5a --- /dev/null +++ b/arch/mips/alchemy/devboards/pb1100/platform.c @@ -0,0 +1,116 @@ +/* + * pb1100 platform device registration. + */ + +#include <linux/dma-mapping.h> +#include <linux/init.h> +#include <linux/platform_device.h> +#include <linux/serial_8250.h> + +#include <asm/mach-au1x00/au1000.h> + +#define PORT(_base, _irq) \ + { \ + .iobase = _base, \ + .mapbase = _base, \ + .irq = _irq, \ + .regshift = 2, \ + .iotype = UPIO_AU, \ + .flags = UPF_SKIP_TEST | UPF_IOREMAP \ + } + +static struct plat_serial8250_port pb1100_uart_data[] = { + PORT(UART0_PHYS_ADDR, AU1100_UART0_INT), + PORT(UART1_PHYS_ADDR, AU1100_UART1_INT), + PORT(UART3_PHYS_ADDR, AU1100_UART3_INT), + {}, +}; + +static struct platform_device pb1100_uart_device = { + .name = "serial8250", + .id = PLAT8250_DEV_AU1X00, + .dev = { + .platform_data = pb1100_uart_data, + }, +}; + +/* OHCI (USB full speed host controller) */ +static struct resource au1xxx_usb_ohci_resources[] = { + [0] = { + .start = USB_OHCI_BASE, + .end = USB_OHCI_BASE + USB_OHCI_LEN - 1, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = AU1000_USB_HOST_INT, + .end = AU1000_USB_HOST_INT, + .flags = IORESOURCE_IRQ, + }, +}; + +/* The dmamask must be set for OHCI to work */ +static u64 ohci_dmamask = DMA_32BIT_MASK; + +static struct platform_device au1xxx_usb_ohci_device = { + .name = "au1xxx-ohci", + .id = 0, + .dev = { + .dma_mask = &ohci_dmamask, + .coherent_dma_mask = DMA_32BIT_MASK, + }, + .num_resources = ARRAY_SIZE(au1xxx_usb_ohci_resources), + .resource = au1xxx_usb_ohci_resources, +}; + +static struct platform_device pb1100_pcmcia_device = { + .name = "au1x00-pcmcia", + .id = 0, +}; + +static struct resource au1100_lcd_resources[] = { + [0] = { + .start = LCD_PHYS_ADDR, + .end = LCD_PHYS_ADDR + 0x800 - 1, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = AU1100_LCD_INT, + .end = AU1100_LCD_INT, + .flags = IORESOURCE_IRQ, + } +}; + +static u64 au1100_lcd_dmamask = DMA_32BIT_MASK; + +static struct platform_device au1100_lcd_device = { + .name = "au1100-lcd", + .id = 0, + .dev = { + .dma_mask = &au1100_lcd_dmamask, + .coherent_dma_mask = DMA_32BIT_MASK, + }, + .num_resources = ARRAY_SIZE(au1100_lcd_resources), + .resource = au1100_lcd_resources, +}; + +static struct platform_device *pb1100_devices[] = { + &pb1100_uart_device, + &au1xxx_usb_ohci_device, + &pb1100_pcmcia_device, + &au1100_lcd_device, +}; + +static int __init pb1100_platform_init(void) +{ + unsigned int uartclk = get_au1x00_uart_baud_base() * 16; + int i; + + /* Fill up uartclk. */ + for (i = 0; pb1100_uart_data[i].flags; i++) + pb1100_uart_data[i].uartclk = uartclk; + + return platform_add_devices(pb1100_devices, + ARRAY_SIZE(pb1100_devices)); +} + +arch_initcall(pb1100_platform_init); diff --git a/arch/mips/alchemy/devboards/pb1200/platform.c b/arch/mips/alchemy/devboards/pb1200/platform.c index 9530329..ff446a5 100644 --- a/arch/mips/alchemy/devboards/pb1200/platform.c +++ b/arch/mips/alchemy/devboards/pb1200/platform.c @@ -22,12 +22,38 @@ #include <linux/init.h> #include <linux/leds.h> #include <linux/platform_device.h> +#include <linux/serial_8250.h> +#include <asm/mach-au1x00/au1000.h> #include <asm/mach-au1x00/au1xxx.h> #include <asm/mach-au1x00/au1100_mmc.h> static int mmc_activity; +#define PORT(_base, _irq) \ + { \ + .iobase = _base, \ + .mapbase = _base, \ + .irq = _irq, \ + .regshift = 2, \ + .iotype = UPIO_AU, \ + .flags = UPF_SKIP_TEST | UPF_IOREMAP \ + } + +static struct plat_serial8250_port au1200_uart_data[] = { + PORT(UART0_PHYS_ADDR, AU1200_UART0_INT), + PORT(UART1_PHYS_ADDR, AU1200_UART1_INT), + { }, +}; + +static struct platform_device au1200_uart_device = { + .name = "serial8250", + .id = PLAT8250_DEV_AU1X00, + .dev = { + .platform_data = au1200_uart_data, + }, +}; + static void pb1200mmc0_set_power(void *mmc_host, int state) { if (state) @@ -152,13 +178,175 @@ static struct platform_device smc91c111_device = { .resource = smc91c111_resources }; +static struct resource au1xxx_usb_ohci_resources[] = { + [0] = { + .start = USB_OHCI_BASE, + .end = USB_OHCI_BASE + USB_OHCI_LEN - 1, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = AU1000_USB_HOST_INT, + .end = AU1000_USB_HOST_INT, + .flags = IORESOURCE_IRQ, + }, +}; + +/* The dmamask must be set for OHCI to work */ +static u64 ohci_dmamask = DMA_32BIT_MASK; + +static struct platform_device au1xxx_usb_ohci_device = { + .name = "au1xxx-ohci", + .id = 0, + .dev = { + .dma_mask = &ohci_dmamask, + .coherent_dma_mask = DMA_32BIT_MASK, + }, + .num_resources = ARRAY_SIZE(au1xxx_usb_ohci_resources), + .resource = au1xxx_usb_ohci_resources, +}; + +static struct resource au1xxx_usb_ehci_resources[] = { + [0] = { + .start = USB_EHCI_BASE, + .end = USB_EHCI_BASE + USB_EHCI_LEN - 1, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = AU1000_USB_HOST_INT, + .end = AU1000_USB_HOST_INT, + .flags = IORESOURCE_IRQ, + }, +}; + +static u64 ehci_dmamask = DMA_32BIT_MASK; + +static struct platform_device au1xxx_usb_ehci_device = { + .name = "au1xxx-ehci", + .id = 0, + .dev = { + .dma_mask = &ehci_dmamask, + .coherent_dma_mask = DMA_32BIT_MASK, + }, + .num_resources = ARRAY_SIZE(au1xxx_usb_ehci_resources), + .resource = au1xxx_usb_ehci_resources, +}; + +/* Au1200 UDC (USB gadget controller) */ +static struct resource au1xxx_usb_gdt_resources[] = { + [0] = { + .start = USB_UDC_BASE, + .end = USB_UDC_BASE + USB_UDC_LEN - 1, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = AU1200_USB_INT, + .end = AU1200_USB_INT, + .flags = IORESOURCE_IRQ, + }, +}; + +static u64 udc_dmamask = DMA_32BIT_MASK; + +static struct platform_device au1xxx_usb_gdt_device = { + .name = "au1xxx-udc", + .id = 0, + .dev = { + .dma_mask = &udc_dmamask, + .coherent_dma_mask = DMA_32BIT_MASK, + }, + .num_resources = ARRAY_SIZE(au1xxx_usb_gdt_resources), + .resource = au1xxx_usb_gdt_resources, +}; + +/* Au1200 UOC (USB OTG controller) */ +static struct resource au1xxx_usb_otg_resources[] = { + [0] = { + .start = USB_UOC_BASE, + .end = USB_UOC_BASE + USB_UOC_LEN - 1, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = AU1200_USB_INT, + .end = AU1200_USB_INT, + .flags = IORESOURCE_IRQ, + }, +}; + +static u64 uoc_dmamask = DMA_32BIT_MASK; + +static struct platform_device au1xxx_usb_otg_device = { + .name = "au1xxx-uoc", + .id = 0, + .dev = { + .dma_mask = &uoc_dmamask, + .coherent_dma_mask = DMA_32BIT_MASK, + }, + .num_resources = ARRAY_SIZE(au1xxx_usb_otg_resources), + .resource = au1xxx_usb_otg_resources, +}; + +static struct resource au1200_lcd_resources[] = { + [0] = { + .start = LCD_PHYS_ADDR, + .end = LCD_PHYS_ADDR + 0x800 - 1, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = AU1200_LCD_INT, + .end = AU1200_LCD_INT, + .flags = IORESOURCE_IRQ, + } +}; + +static u64 au1200_lcd_dmamask = DMA_32BIT_MASK; + +static struct platform_device au1200_lcd_device = { + .name = "au1200-lcd", + .id = 0, + .dev = { + .dma_mask = &au1200_lcd_dmamask, + .coherent_dma_mask = DMA_32BIT_MASK, + }, + .num_resources = ARRAY_SIZE(au1200_lcd_resources), + .resource = au1200_lcd_resources, +}; + +static struct resource pb1200_smbus_resources[] = { + { + .start = CPHYSADDR(SMBUS_PSC_BASE), + .end = CPHYSADDR(SMBUS_PSC_BASE + 0xfffff), + .flags = IORESOURCE_MEM, + }, +}; + +static struct platform_device pb1200_smbus_device = { + .name = "au1xpsc_smbus", + .id = 0, /* bus number */ + .num_resources = ARRAY_SIZE(pb1200_smbus_resources), + .resource = pb1200_smbus_resources, +}; + static struct platform_device *board_platform_devices[] __initdata = { + &au1200_uart_device, &ide_device, - &smc91c111_device + &smc91c111_device, + &au1xxx_usb_ohci_device, + &au1xxx_usb_ehci_device, + &au1xxx_usb_gdt_device, + &au1xxx_usb_otg_device, + &au1200_lcd_device, + &pb1200_smbus_device, }; static int __init board_register_devices(void) { + unsigned int uartclk = get_au1x00_uart_baud_base() * 16; + int i; + + /* Fill up uartclk. */ + for (i = 0; au1200_uart_data[i].flags; i++) + au1200_uart_data[i].uartclk = uartclk; + return platform_add_devices(board_platform_devices, ARRAY_SIZE(board_platform_devices)); } diff --git a/arch/mips/alchemy/devboards/pb1500/Makefile b/arch/mips/alchemy/devboards/pb1500/Makefile index 173b419..e83b151 100644 --- a/arch/mips/alchemy/devboards/pb1500/Makefile +++ b/arch/mips/alchemy/devboards/pb1500/Makefile @@ -5,4 +5,4 @@ # Makefile for the Alchemy Semiconductor Pb1500 board. # -obj-y := board_setup.o +obj-y := board_setup.o platform.o diff --git a/arch/mips/alchemy/devboards/pb1500/platform.c b/arch/mips/alchemy/devboards/pb1500/platform.c new file mode 100644 index 0000000..5c68d68 --- /dev/null +++ b/arch/mips/alchemy/devboards/pb1500/platform.c @@ -0,0 +1,88 @@ +/* + * pb1500 platform device registration. + */ + +#include <linux/dma-mapping.h> +#include <linux/init.h> +#include <linux/platform_device.h> +#include <linux/serial_8250.h> + +#include <asm/mach-au1x00/au1000.h> + +#define PORT(_base, _irq) \ + { \ + .iobase = _base, \ + .mapbase = _base, \ + .irq = _irq, \ + .regshift = 2, \ + .iotype = UPIO_AU, \ + .flags = UPF_SKIP_TEST | UPF_IOREMAP \ + } + +static struct plat_serial8250_port pb1500_uart_data[] = { + PORT(UART0_PHYS_ADDR, AU1500_UART0_INT), + PORT(UART3_PHYS_ADDR, AU1500_UART3_INT), + {}, +}; + +static struct platform_device pb1500_uart_device = { + .name = "serial8250", + .id = PLAT8250_DEV_AU1X00, + .dev = { + .platform_data = pb1500_uart_data, + }, +}; + +/* OHCI (USB full speed host controller) */ +static struct resource au1xxx_usb_ohci_resources[] = { + [0] = { + .start = USB_OHCI_BASE, + .end = USB_OHCI_BASE + USB_OHCI_LEN - 1, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = AU1000_USB_HOST_INT, + .end = AU1000_USB_HOST_INT, + .flags = IORESOURCE_IRQ, + }, +}; + +/* The dmamask must be set for OHCI to work */ +static u64 ohci_dmamask = DMA_32BIT_MASK; + +static struct platform_device au1xxx_usb_ohci_device = { + .name = "au1xxx-ohci", + .id = 0, + .dev = { + .dma_mask = &ohci_dmamask, + .coherent_dma_mask = DMA_32BIT_MASK, + }, + .num_resources = ARRAY_SIZE(au1xxx_usb_ohci_resources), + .resource = au1xxx_usb_ohci_resources, +}; + +static struct platform_device pb1500_pcmcia_device = { + .name = "au1x00-pcmcia", + .id = 0, +}; + +static struct platform_device *pb1500_devices[] = { + &pb1500_uart_device, + &au1xxx_usb_ohci_device, + &pb1500_pcmcia_device, +}; + +static int __init pb1500_platform_init(void) +{ + unsigned int uartclk = get_au1x00_uart_baud_base() * 16; + int i; + + /* Fill up uartclk. */ + for (i = 0; pb1500_uart_data[i].flags; i++) + pb1500_uart_data[i].uartclk = uartclk; + + return platform_add_devices(pb1500_devices, + ARRAY_SIZE(pb1500_devices)); +} + +arch_initcall(pb1500_platform_init); diff --git a/arch/mips/alchemy/devboards/pb1550/Makefile b/arch/mips/alchemy/devboards/pb1550/Makefile index cff95bc..9661b6e 100644 --- a/arch/mips/alchemy/devboards/pb1550/Makefile +++ b/arch/mips/alchemy/devboards/pb1550/Makefile @@ -5,4 +5,4 @@ # Makefile for the Alchemy Semiconductor Pb1550 board. # -obj-y := board_setup.o +obj-y := board_setup.o platform.o diff --git a/arch/mips/alchemy/devboards/pb1550/platform.c b/arch/mips/alchemy/devboards/pb1550/platform.c new file mode 100644 index 0000000..f653193 --- /dev/null +++ b/arch/mips/alchemy/devboards/pb1550/platform.c @@ -0,0 +1,106 @@ +/* + * pb1550 platform device registration. + */ + +#include <linux/dma-mapping.h> +#include <linux/init.h> +#include <linux/platform_device.h> +#include <linux/serial_8250.h> + +#include <asm/mach-au1x00/au1000.h> +#include <asm/mach-pb1x00/pb1550.h> + +#define PORT(_base, _irq) \ + { \ + .iobase = _base, \ + .mapbase = _base, \ + .irq = _irq, \ + .regshift = 2, \ + .iotype = UPIO_AU, \ + .flags = UPF_SKIP_TEST | UPF_IOREMAP \ + } + +static struct plat_serial8250_port pb1550_uart_data[] = { + PORT(UART0_PHYS_ADDR, AU1550_UART0_INT), + PORT(UART1_PHYS_ADDR, AU1550_UART1_INT), + PORT(UART3_PHYS_ADDR, AU1550_UART3_INT), + {}, +}; + +static struct platform_device pb1550_uart_device = { + .name = "serial8250", + .id = PLAT8250_DEV_AU1X00, + .dev = { + .platform_data = pb1550_uart_data, + }, +}; + +/* OHCI (USB full speed host controller) */ +static struct resource au1xxx_usb_ohci_resources[] = { + [0] = { + .start = USB_OHCI_BASE, + .end = USB_OHCI_BASE + USB_OHCI_LEN - 1, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = AU1000_USB_HOST_INT, + .end = AU1000_USB_HOST_INT, + .flags = IORESOURCE_IRQ, + }, +}; + +/* The dmamask must be set for OHCI to work */ +static u64 ohci_dmamask = DMA_32BIT_MASK; + +static struct platform_device au1xxx_usb_ohci_device = { + .name = "au1xxx-ohci", + .id = 0, + .dev = { + .dma_mask = &ohci_dmamask, + .coherent_dma_mask = DMA_32BIT_MASK, + }, + .num_resources = ARRAY_SIZE(au1xxx_usb_ohci_resources), + .resource = au1xxx_usb_ohci_resources, +}; + +static struct platform_device pb1550_pcmcia_device = { + .name = "au1x00-pcmcia", + .id = 0, +}; + +static struct resource pb1550_smbus_resources[] = { + { + .start = CPHYSADDR(SMBUS_PSC_BASE), + .end = CPHYSADDR(SMBUS_PSC_BASE + 0xfffff), + .flags = IORESOURCE_MEM, + }, +}; + +static struct platform_device pb1550_smbus_device = { + .name = "au1xpsc_smbus", + .id = 0, /* bus number */ + .num_resources = ARRAY_SIZE(pb1550_smbus_resources), + .resource = pb1550_smbus_resources, +}; + +static struct platform_device *pb1550_devices[] = { + &pb1550_uart_device, + &au1xxx_usb_ohci_device, + &pb1550_pcmcia_device, + &pb1550_smbus_device, +}; + +static int __init pb1550_platform_init(void) +{ + unsigned int uartclk = get_au1x00_uart_baud_base() * 16; + int i; + + /* Fill up uartclk. */ + for (i = 0; pb1550_uart_data[i].flags; i++) + pb1550_uart_data[i].uartclk = uartclk; + + return platform_add_devices(pb1550_devices, + ARRAY_SIZE(pb1550_devices)); +} + +arch_initcall(pb1550_platform_init); diff --git a/arch/mips/alchemy/mtx-1/platform.c b/arch/mips/alchemy/mtx-1/platform.c index 8b5914d..da1f72b 100644 --- a/arch/mips/alchemy/mtx-1/platform.c +++ b/arch/mips/alchemy/mtx-1/platform.c @@ -18,6 +18,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include <linux/dma-mapping.h> #include <linux/init.h> #include <linux/platform_device.h> #include <linux/leds.h> @@ -26,8 +27,11 @@ #include <linux/input.h> #include <linux/mtd/partitions.h> #include <linux/mtd/physmap.h> +#include <linux/serial_8250.h> #include <mtd/mtd-abi.h> +#include <asm/mach-au1x00/au1xxx.h> + static struct gpio_keys_button mtx1_gpio_button[] = { { .gpio = 207, @@ -133,15 +137,75 @@ static struct platform_device mtx1_mtd = { .resource = &mtx1_mtd_resource, }; +#define PORT(_base, _irq) \ + { \ + .iobase = _base, \ + .mapbase = _base, \ + .irq = _irq, \ + .regshift = 2, \ + .iotype = UPIO_AU, \ + .flags = UPF_SKIP_TEST | UPF_IOREMAP \ + } + +static struct plat_serial8250_port mtx1_uart_data[] = { + PORT(UART0_PHYS_ADDR, AU1500_UART0_INT), + PORT(UART3_PHYS_ADDR, AU1500_UART3_INT), + { }, +}; + +static struct platform_device mtx1_uarts = { + .name = "serial8250", + .id = PLAT8250_DEV_AU1X00, + .dev = { + .platform_data = mtx1_uart_data, + }, +}; + +static struct resource au1xxx_usb_ohci_resources[] = { + [0] = { + .start = USB_OHCI_BASE, + .end = USB_OHCI_BASE + USB_OHCI_LEN - 1, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = AU1000_USB_HOST_INT, + .end = AU1000_USB_HOST_INT, + .flags = IORESOURCE_IRQ, + }, +}; + +/* The dmamask must be set for OHCI to work */ +static u64 ohci_dmamask = DMA_32BIT_MASK; + +static struct platform_device au1xxx_usb_ohci_device = { + .name = "au1xxx-ohci", + .id = 0, + .dev = { + .dma_mask = &ohci_dmamask, + .coherent_dma_mask = DMA_32BIT_MASK, + }, + .num_resources = ARRAY_SIZE(au1xxx_usb_ohci_resources), + .resource = au1xxx_usb_ohci_resources, +}; + static struct __initdata platform_device * mtx1_devs[] = { + &mtx1_uarts, &mtx1_gpio_leds, &mtx1_wdt, &mtx1_button, &mtx1_mtd, + &au1xxx_usb_ohci_device, }; static int __init mtx1_register_devices(void) { + unsigned int uartclk = get_au1x00_uart_baud_base() * 16; + int i; + + /* Fill up uartclk. */ + for (i = 0; au1x00_uart_data[i].flags; i++) + au1x00_uart_data[i].uartclk = uartclk; + gpio_direction_input(207); return platform_add_devices(mtx1_devs, ARRAY_SIZE(mtx1_devs)); } diff --git a/arch/mips/alchemy/xxs1500/Makefile b/arch/mips/alchemy/xxs1500/Makefile index db3c526..95aa487 100644 --- a/arch/mips/alchemy/xxs1500/Makefile +++ b/arch/mips/alchemy/xxs1500/Makefile @@ -5,4 +5,5 @@ # Makefile for MyCable XXS1500 board. # -lib-y := init.o board_setup.o irqmap.o +lib-y := init.o board_setup.o irqmap.o platform.o + diff --git a/arch/mips/alchemy/xxs1500/platform.c b/arch/mips/alchemy/xxs1500/platform.c new file mode 100644 index 0000000..52f94e7 --- /dev/null +++ b/arch/mips/alchemy/xxs1500/platform.c @@ -0,0 +1,87 @@ +/* + * xxs1500 platform device registration + */ + +#include <linux/init.h> +#include <linux/platform_device.h> +#include <linux/serial_8250.h> + +#include <asm/mach-au1x00/au1000.h> + +#define PORT(_base, _irq) \ + { \ + .iobase = _base, \ + .mapbase = _base, \ + .irq = _irq, \ + .regshift = 2, \ + .iotype = UPIO_AU, \ + .flags = UPF_SKIP_TEST | UPF_IOREMAP \ + } + +static struct plat_serial8250_port xxs1500_uart_data[] = { + PORT(UART0_PHYS_ADDR, AU1500_UART0_INT), + PORT(UART3_PHYS_ADDR, AU1500_UART3_INT), + { }, +}; + +static struct platform_device xxs1500_uart_device = { + .name = "serial8250", + .id = PLAT8250_DEV_AU1X00, + .dev = { + .platform_data = xxs1500_uart_data, + }, +}; + +/* OHCI (USB full speed host controller) */ +static struct resource au1xxx_usb_ohci_resources[] = { + [0] = { + .start = USB_OHCI_BASE, + .end = USB_OHCI_BASE + USB_OHCI_LEN - 1, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = AU1000_USB_HOST_INT, + .end = AU1000_USB_HOST_INT, + .flags = IORESOURCE_IRQ, + }, +}; + +/* The dmamask must be set for OHCI to work */ +static u64 ohci_dmamask = DMA_32BIT_MASK; + +static struct platform_device au1xxx_usb_ohci_device = { + .name = "au1xxx-ohci", + .id = 0, + .dev = { + .dma_mask = &ohci_dmamask, + .coherent_dma_mask = DMA_32BIT_MASK, + }, + .num_resources = ARRAY_SIZE(au1xxx_usb_ohci_resources), + .resource = au1xxx_usb_ohci_resources, +}; + +static struct platform_device xxs1500_pcmcia_device = { + .name = "au1x00-pcmcia", + .id = 0, +}; + +static struct platform_device *xxs1500_devices[] = { + &xxs1500_uart_device, + &au1xxx_usb_ohci_device, + &xxs1500_pcmcia_device, +}; + +static int __init xxs1500_platform_init(void) +{ + unsigned int uartclk = get_au1x00_uart_baud_base() * 16; + int i; + + /* Fill up uartclk. */ + for (i = 0; xxs1500_uart_data[i].flags; i++) + xxs1500_uart_data[i].uartclk = uartclk; + + return platform_add_devices(xxs1500_devices, + ARRAY_SIZE(xxs1500_devices)); +} + +arch_initcall(xxs1500_platform_init); -- 1.6.2 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 2/3] Alchemy: add RTC device to devboards 2009-03-29 9:27 ` [PATCH 1/3] Alchemy: get rid of common/platform.c Manuel Lauss @ 2009-03-29 9:27 ` Manuel Lauss 2009-03-29 9:27 ` [PATCH 3/3] Alchemy: convert to physmap flash Manuel Lauss 2009-03-29 11:36 ` [PATCH 1/3] Alchemy: get rid of common/platform.c Sergei Shtylyov 2009-03-29 11:37 ` Sergei Shtylyov 2 siblings, 1 reply; 16+ messages in thread From: Manuel Lauss @ 2009-03-29 9:27 UTC (permalink / raw) To: Linux-MIPS; +Cc: Manuel Lauss Add a platform_device for on-chip RTC (32kHz counter0) on all devboards Signed-off-by: Manuel Lauss <mano@roarinelk.homelinux.net> --- Tested on the DB1200 only; according to their schematics, all other devboards do have a 32.768kHz crystal too and this patch should work. arch/mips/alchemy/devboards/db1x00/platform.c | 6 ++++++ arch/mips/alchemy/devboards/pb1000/platform.c | 6 ++++++ arch/mips/alchemy/devboards/pb1100/platform.c | 6 ++++++ arch/mips/alchemy/devboards/pb1200/platform.c | 6 ++++++ arch/mips/alchemy/devboards/pb1500/platform.c | 6 ++++++ arch/mips/alchemy/devboards/pb1550/platform.c | 6 ++++++ 6 files changed, 36 insertions(+), 0 deletions(-) diff --git a/arch/mips/alchemy/devboards/db1x00/platform.c b/arch/mips/alchemy/devboards/db1x00/platform.c index 49d6e5c..a6fb6bd 100644 --- a/arch/mips/alchemy/devboards/db1x00/platform.c +++ b/arch/mips/alchemy/devboards/db1x00/platform.c @@ -137,6 +137,11 @@ static struct platform_device pbdb_smbus_device = { }; #endif +static struct platform_device au1xxx_rtc_device = { + .name = "rtc-au1xxx", + .id = -1, +}; + static struct platform_device *au1xxx_platform_devices[] __initdata = { &au1xx0_uart_device, &au1xxx_usb_ohci_device, @@ -147,6 +152,7 @@ static struct platform_device *au1xxx_platform_devices[] __initdata = { #ifdef SMBUS_PSC_BASE &pbdb_smbus_device, #endif + &au1xxx_rtc_device, }; static int __init au1xxx_platform_init(void) diff --git a/arch/mips/alchemy/devboards/pb1000/platform.c b/arch/mips/alchemy/devboards/pb1000/platform.c index 0661a49..9f42f4c 100644 --- a/arch/mips/alchemy/devboards/pb1000/platform.c +++ b/arch/mips/alchemy/devboards/pb1000/platform.c @@ -68,10 +68,16 @@ static struct platform_device pb1000_pcmcia_device = { .id = 0, }; +static struct platform_device au1xxx_rtc_device = { + .name = "rtc-au1xxx", + .id = -1, +}; + static struct platform_device *pb1000_devices[] = { &pb1000_uart_device, &au1xxx_usb_ohci_device, &pb1000_pcmcia_device, + &au1xxx_rtc_device, }; static int __init pb1000_platform_init(void) diff --git a/arch/mips/alchemy/devboards/pb1100/platform.c b/arch/mips/alchemy/devboards/pb1100/platform.c index 276db5a..42759f9 100644 --- a/arch/mips/alchemy/devboards/pb1100/platform.c +++ b/arch/mips/alchemy/devboards/pb1100/platform.c @@ -93,11 +93,17 @@ static struct platform_device au1100_lcd_device = { .resource = au1100_lcd_resources, }; +static struct platform_device au1xxx_rtc_device = { + .name = "rtc-au1xxx", + .id = -1, +}; + static struct platform_device *pb1100_devices[] = { &pb1100_uart_device, &au1xxx_usb_ohci_device, &pb1100_pcmcia_device, &au1100_lcd_device, + &au1xxx_rtc_device, }; static int __init pb1100_platform_init(void) diff --git a/arch/mips/alchemy/devboards/pb1200/platform.c b/arch/mips/alchemy/devboards/pb1200/platform.c index ff446a5..f32391e 100644 --- a/arch/mips/alchemy/devboards/pb1200/platform.c +++ b/arch/mips/alchemy/devboards/pb1200/platform.c @@ -326,6 +326,11 @@ static struct platform_device pb1200_smbus_device = { .resource = pb1200_smbus_resources, }; +static struct platform_device au1xxx_rtc_device = { + .name = "rtc-au1xxx", + .id = -1, +}; + static struct platform_device *board_platform_devices[] __initdata = { &au1200_uart_device, &ide_device, @@ -336,6 +341,7 @@ static struct platform_device *board_platform_devices[] __initdata = { &au1xxx_usb_otg_device, &au1200_lcd_device, &pb1200_smbus_device, + &au1xxx_rtc_device, }; static int __init board_register_devices(void) diff --git a/arch/mips/alchemy/devboards/pb1500/platform.c b/arch/mips/alchemy/devboards/pb1500/platform.c index 5c68d68..affb3e1 100644 --- a/arch/mips/alchemy/devboards/pb1500/platform.c +++ b/arch/mips/alchemy/devboards/pb1500/platform.c @@ -66,10 +66,16 @@ static struct platform_device pb1500_pcmcia_device = { .id = 0, }; +static struct platform_device au1xxx_rtc_device = { + .name = "rtc-au1xxx", + .id = -1, +}; + static struct platform_device *pb1500_devices[] = { &pb1500_uart_device, &au1xxx_usb_ohci_device, &pb1500_pcmcia_device, + &au1xxx_rtc_device, }; static int __init pb1500_platform_init(void) diff --git a/arch/mips/alchemy/devboards/pb1550/platform.c b/arch/mips/alchemy/devboards/pb1550/platform.c index f653193..717ff02 100644 --- a/arch/mips/alchemy/devboards/pb1550/platform.c +++ b/arch/mips/alchemy/devboards/pb1550/platform.c @@ -83,11 +83,17 @@ static struct platform_device pb1550_smbus_device = { .resource = pb1550_smbus_resources, }; +static struct platform_device au1xxx_rtc_device = { + .name = "rtc-au1xxx", + .id = -1, +}; + static struct platform_device *pb1550_devices[] = { &pb1550_uart_device, &au1xxx_usb_ohci_device, &pb1550_pcmcia_device, &pb1550_smbus_device, + &au1xxx_rtc_device, }; static int __init pb1550_platform_init(void) -- 1.6.2 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 3/3] Alchemy: convert to physmap flash 2009-03-29 9:27 ` [PATCH 2/3] Alchemy: add RTC device to devboards Manuel Lauss @ 2009-03-29 9:27 ` Manuel Lauss 2009-04-06 7:57 ` Florian Fainelli 0 siblings, 1 reply; 16+ messages in thread From: Manuel Lauss @ 2009-03-29 9:27 UTC (permalink / raw) To: Linux-MIPS; +Cc: Manuel Lauss, Linux-MTD Add physmap-flash support to all Alchemy devboards and get rid of the alchemy-flash.c MTD map driver. Cc: Linux-MTD <linux-mtd@lists.infradead.org> Signed-off-by: Manuel Lauss <mano@roarinelk.homelinux.net> --- arch/mips/alchemy/devboards/db1x00/platform.c | 76 +++++++++++ arch/mips/alchemy/devboards/pb1000/platform.c | 48 +++++++ arch/mips/alchemy/devboards/pb1100/platform.c | 49 +++++++ arch/mips/alchemy/devboards/pb1200/platform.c | 53 ++++++++ arch/mips/alchemy/devboards/pb1500/platform.c | 48 +++++++ arch/mips/alchemy/devboards/pb1550/platform.c | 48 +++++++ drivers/mtd/maps/Kconfig | 6 - drivers/mtd/maps/Makefile | 1 - drivers/mtd/maps/alchemy-flash.c | 166 ------------------------- 9 files changed, 322 insertions(+), 173 deletions(-) delete mode 100644 drivers/mtd/maps/alchemy-flash.c diff --git a/arch/mips/alchemy/devboards/db1x00/platform.c b/arch/mips/alchemy/devboards/db1x00/platform.c index a6fb6bd..edb910f 100644 --- a/arch/mips/alchemy/devboards/db1x00/platform.c +++ b/arch/mips/alchemy/devboards/db1x00/platform.c @@ -15,9 +15,84 @@ #include <linux/platform_device.h> #include <linux/serial_8250.h> #include <linux/init.h> +#include <linux/mtd/mtd.h> +#include <linux/mtd/partitions.h> +#include <linux/mtd/physmap.h> #include <asm/mach-au1x00/au1xxx.h> +#ifdef CONFIG_MIPS_BOSPORUS +#define BOARD_FLASH_SIZE 0x01000000 /* 16MB */ +#define BOARD_FLASH_WIDTH 2 /* 16-bits */ +#endif + +#ifdef CONFIG_MIPS_MIRAGE +#define BOARD_FLASH_SIZE 0x04000000 /* 64MB */ +#define BOARD_FLASH_WIDTH 4 /* 32-bits */ +#endif + +#ifdef CONFIG_MIPS_DB1000 +#define BOARD_FLASH_SIZE 0x02000000 /* 32MB */ +#define BOARD_FLASH_WIDTH 4 /* 32-bits */ +#endif + +#ifdef CONFIG_MIPS_DB1500 +#define BOARD_FLASH_SIZE 0x02000000 /* 32MB */ +#define BOARD_FLASH_WIDTH 4 /* 32-bits */ +#endif + +#ifdef CONFIG_MIPS_DB1100 +#define BOARD_FLASH_SIZE 0x02000000 /* 32MB */ +#define BOARD_FLASH_WIDTH 4 /* 32-bits */ +#endif + +#ifdef CONFIG_MIPS_DB1550 +#define BOARD_FLASH_SIZE 0x08000000 /* 128MB */ +#define BOARD_FLASH_WIDTH 4 /* 32-bits */ +#endif + + +static struct mtd_partition db1x_nor_partitions[] = { + { + .name = "User FS", + .size = BOARD_FLASH_SIZE - 0x00400000, + .offset = 0x0000000 + },{ + .name = "YAMON", + .size = 0x0100000, + .offset = MTDPART_OFS_APPEND, + .mask_flags = MTD_WRITEABLE + },{ + .name = "raw kernel", + .size = (0x300000 - 0x40000), /* last 256KB is yamon env */ + .offset = MTDPART_OFS_APPEND, + } +}; + +static struct physmap_flash_data db1x_nor_data = { + .width = BOARD_FLASH_WIDTH, + .nr_parts = ARRAY_SIZE(db1x_nor_partitions), + .parts = &db1x_nor_partitions[0], +}; + +static struct resource db1x_nor_res[] = { + [0] = { + .start = 0x20000000 - BOARD_FLASH_SIZE, + .end = 0x1fffffff, + .flags = IORESOURCE_MEM, + }, +}; + +static struct platform_device db1x_nor_device = { + .name = "physmap-flash", + .id = -1, + .dev = { + .platform_data = &db1x_nor_data, + }, + .resource = db1x_nor_res, + .num_resources = ARRAY_SIZE(db1x_nor_res), +}; + #define PORT(_base, _irq) \ { \ .iobase = _base, \ @@ -153,6 +228,7 @@ static struct platform_device *au1xxx_platform_devices[] __initdata = { &pbdb_smbus_device, #endif &au1xxx_rtc_device, + &db1x_nor_device, }; static int __init au1xxx_platform_init(void) diff --git a/arch/mips/alchemy/devboards/pb1000/platform.c b/arch/mips/alchemy/devboards/pb1000/platform.c index 9f42f4c..fc51e05 100644 --- a/arch/mips/alchemy/devboards/pb1000/platform.c +++ b/arch/mips/alchemy/devboards/pb1000/platform.c @@ -6,9 +6,56 @@ #include <linux/init.h> #include <linux/platform_device.h> #include <linux/serial_8250.h> +#include <linux/mtd/mtd.h> +#include <linux/mtd/partitions.h> +#include <linux/mtd/physmap.h> #include <asm/mach-au1x00/au1000.h> +#define PB1000_FLASH_SIZE 0x00800000 /* 8MB */ +#define PB1000_FLASH_WIDTH 4 /* 32-bits */ + +static struct mtd_partition pb1000_nor_partitions[] = { + { + .name = "User FS", + .size = PB1000_FLASH_SIZE - 0x00400000, + .offset = 0x0000000 + },{ + .name = "YAMON", + .size = 0x0100000, + .offset = MTDPART_OFS_APPEND, + .mask_flags = MTD_WRITEABLE + },{ + .name = "raw kernel", + .size = (0x300000 - 0x40000), /* last 256KB is yamon env */ + .offset = MTDPART_OFS_APPEND, + } +}; + +static struct physmap_flash_data pb1000_nor_data = { + .width = PB1000_FLASH_WIDTH, + .nr_parts = ARRAY_SIZE(pb1000_nor_partitions), + .parts = &pb1000_nor_partitions[0], +}; + +static struct resource pb1000_nor_res[] = { + [0] = { + .start = 0x20000000 - PB1000_FLASH_SIZE, + .end = 0x1fffffff, + .flags = IORESOURCE_MEM, + }, +}; + +static struct platform_device pb1000_nor_device = { + .name = "physmap-flash", + .id = -1, + .dev = { + .platform_data = &pb1000_nor_data, + }, + .resource = pb1000_nor_res, + .num_resources = ARRAY_SIZE(pb1000_nor_res), +}; + #define PORT(_base, _irq) \ { \ .iobase = _base, \ @@ -78,6 +125,7 @@ static struct platform_device *pb1000_devices[] = { &au1xxx_usb_ohci_device, &pb1000_pcmcia_device, &au1xxx_rtc_device, + &pb1000_nor_device, }; static int __init pb1000_platform_init(void) diff --git a/arch/mips/alchemy/devboards/pb1100/platform.c b/arch/mips/alchemy/devboards/pb1100/platform.c index 42759f9..9616f58 100644 --- a/arch/mips/alchemy/devboards/pb1100/platform.c +++ b/arch/mips/alchemy/devboards/pb1100/platform.c @@ -6,9 +6,57 @@ #include <linux/init.h> #include <linux/platform_device.h> #include <linux/serial_8250.h> +#include <linux/mtd/mtd.h> +#include <linux/mtd/partitions.h> +#include <linux/mtd/physmap.h> #include <asm/mach-au1x00/au1000.h> +#define PB1100_FLASH_SIZE 0x04000000 /* 64MB */ +#define PB1100_FLASH_WIDTH 4 /* 32-bits */ + +static struct mtd_partition pb1100_nor_partitions[] = { + { + .name = "User FS", + .size = PB1100_FLASH_SIZE - 0x00400000, + .offset = 0x0000000 + },{ + .name = "YAMON", + .size = 0x0100000, + .offset = MTDPART_OFS_APPEND, + .mask_flags = MTD_WRITEABLE + },{ + .name = "raw kernel", + .size = (0x300000 - 0x40000), /* last 256KB is yamon env */ + .offset = MTDPART_OFS_APPEND, + } +}; + +static struct physmap_flash_data pb1100_nor_data = { + .width = PB1100_FLASH_WIDTH, + .nr_parts = ARRAY_SIZE(pb1100_nor_partitions), + .parts = &pb1100_nor_partitions[0], +}; + +static struct resource pb1100_nor_res[] = { + [0] = { + .start = 0x20000000 - PB1100_FLASH_SIZE, + .end = 0x1fffffff, + .flags = IORESOURCE_MEM, + }, +}; + +static struct platform_device pb1100_nor_device = { + .name = "physmap-flash", + .id = -1, + .dev = { + .platform_data = &pb1100_nor_data, + }, + .resource = pb1100_nor_res, + .num_resources = ARRAY_SIZE(pb1100_nor_res), +}; + + #define PORT(_base, _irq) \ { \ .iobase = _base, \ @@ -104,6 +152,7 @@ static struct platform_device *pb1100_devices[] = { &pb1100_pcmcia_device, &au1100_lcd_device, &au1xxx_rtc_device, + &pb1100_nor_device, }; static int __init pb1100_platform_init(void) diff --git a/arch/mips/alchemy/devboards/pb1200/platform.c b/arch/mips/alchemy/devboards/pb1200/platform.c index f32391e..204ae4b 100644 --- a/arch/mips/alchemy/devboards/pb1200/platform.c +++ b/arch/mips/alchemy/devboards/pb1200/platform.c @@ -23,13 +23,65 @@ #include <linux/leds.h> #include <linux/platform_device.h> #include <linux/serial_8250.h> +#include <linux/mtd/mtd.h> +#include <linux/mtd/partitions.h> +#include <linux/mtd/physmap.h> #include <asm/mach-au1x00/au1000.h> #include <asm/mach-au1x00/au1xxx.h> #include <asm/mach-au1x00/au1100_mmc.h> +#if defined(CONFIG_MIPS_PB1200) +#define BOARD_FLASH_SIZE 0x08000000 /* 128MB */ +#elif defined(CONFIG_MIPS_DB1200) +#define BOARD_FLASH_SIZE 0x04000000 /* 64MB */ +#endif + +#define BOARD_FLASH_WIDTH 2 /* 16-bits */ + static int mmc_activity; +static struct mtd_partition pb1200_nor_partitions[] = { + { + .name = "User FS", + .size = BOARD_FLASH_SIZE - 0x00400000, + .offset = 0x0000000 + },{ + .name = "YAMON", + .size = 0x0100000, + .offset = MTDPART_OFS_APPEND, + .mask_flags = MTD_WRITEABLE + },{ + .name = "raw kernel", + .size = (0x300000 - 0x40000), /* last 256KB is yamon env */ + .offset = MTDPART_OFS_APPEND, + } +}; + +static struct physmap_flash_data pb1200_nor_data = { + .width = BOARD_FLASH_WIDTH, + .nr_parts = ARRAY_SIZE(pb1200_nor_partitions), + .parts = &pb1200_nor_partitions[0], +}; + +static struct resource pb1200_nor_res[] = { + [0] = { + .start = 0x20000000 - BOARD_FLASH_SIZE, + .end = 0x1fffffff, + .flags = IORESOURCE_MEM, + }, +}; + +static struct platform_device pb1200_nor_device = { + .name = "physmap-flash", + .id = -1, + .dev = { + .platform_data = &pb1200_nor_data, + }, + .resource = pb1200_nor_res, + .num_resources = ARRAY_SIZE(pb1200_nor_res), +}; + #define PORT(_base, _irq) \ { \ .iobase = _base, \ @@ -342,6 +394,7 @@ static struct platform_device *board_platform_devices[] __initdata = { &au1200_lcd_device, &pb1200_smbus_device, &au1xxx_rtc_device, + &pb1200_nor_device, }; static int __init board_register_devices(void) diff --git a/arch/mips/alchemy/devboards/pb1500/platform.c b/arch/mips/alchemy/devboards/pb1500/platform.c index affb3e1..723a2ff 100644 --- a/arch/mips/alchemy/devboards/pb1500/platform.c +++ b/arch/mips/alchemy/devboards/pb1500/platform.c @@ -6,9 +6,56 @@ #include <linux/init.h> #include <linux/platform_device.h> #include <linux/serial_8250.h> +#include <linux/mtd/mtd.h> +#include <linux/mtd/partitions.h> +#include <linux/mtd/physmap.h> #include <asm/mach-au1x00/au1000.h> +#define PB1500_FLASH_SIZE 0x04000000 /* 64MB */ +#define PB1500_FLASH_WIDTH 4 /* 32-bits */ + +static struct mtd_partition pb1500_nor_partitions[] = { + { + .name = "User FS", + .size = PB1500_FLASH_SIZE - 0x00400000, + .offset = 0x0000000 + },{ + .name = "YAMON", + .size = 0x0100000, + .offset = MTDPART_OFS_APPEND, + .mask_flags = MTD_WRITEABLE + },{ + .name = "raw kernel", + .size = (0x300000 - 0x40000), /* last 256KB is yamon env */ + .offset = MTDPART_OFS_APPEND, + } +}; + +static struct physmap_flash_data pb1500_nor_data = { + .width = PB1500_FLASH_WIDTH, + .nr_parts = ARRAY_SIZE(pb1500_nor_partitions), + .parts = &pb1500_nor_partitions[0], +}; + +static struct resource pb1500_nor_res[] = { + [0] = { + .start = 0x20000000 - PB1500_FLASH_SIZE, + .end = 0x1fffffff, + .flags = IORESOURCE_MEM, + }, +}; + +static struct platform_device pb1500_nor_device = { + .name = "physmap-flash", + .id = -1, + .dev = { + .platform_data = &pb1500_nor_data, + }, + .resource = pb1500_nor_res, + .num_resources = ARRAY_SIZE(pb1500_nor_res), +}; + #define PORT(_base, _irq) \ { \ .iobase = _base, \ @@ -76,6 +123,7 @@ static struct platform_device *pb1500_devices[] = { &au1xxx_usb_ohci_device, &pb1500_pcmcia_device, &au1xxx_rtc_device, + &pb1500_nor_device, }; static int __init pb1500_platform_init(void) diff --git a/arch/mips/alchemy/devboards/pb1550/platform.c b/arch/mips/alchemy/devboards/pb1550/platform.c index 717ff02..3548207 100644 --- a/arch/mips/alchemy/devboards/pb1550/platform.c +++ b/arch/mips/alchemy/devboards/pb1550/platform.c @@ -6,10 +6,57 @@ #include <linux/init.h> #include <linux/platform_device.h> #include <linux/serial_8250.h> +#include <linux/mtd/mtd.h> +#include <linux/mtd/partitions.h> +#include <linux/mtd/physmap.h> #include <asm/mach-au1x00/au1000.h> #include <asm/mach-pb1x00/pb1550.h> +#define PB1550_FLASH_SIZE 0x08000000 /* 128MB */ +#define PB1550_FLASH_WIDTH 4 /* 32-bits */ + +static struct mtd_partition pb1550_nor_partitions[] = { + { + .name = "User FS", + .size = PB1550_FLASH_SIZE - 0x00400000, + .offset = 0x0000000 + },{ + .name = "YAMON", + .size = 0x0100000, + .offset = MTDPART_OFS_APPEND, + .mask_flags = MTD_WRITEABLE + },{ + .name = "raw kernel", + .size = (0x300000 - 0x40000), /* last 256KB is yamon env */ + .offset = MTDPART_OFS_APPEND, + } +}; + +static struct physmap_flash_data pb1550_nor_data = { + .width = PB1550_FLASH_WIDTH, + .nr_parts = ARRAY_SIZE(pb1550_nor_partitions), + .parts = &pb1550_nor_partitions[0], +}; + +static struct resource pb1550_nor_res[] = { + [0] = { + .start = 0x20000000 - PB1550_FLASH_SIZE, + .end = 0x1fffffff, + .flags = IORESOURCE_MEM, + }, +}; + +static struct platform_device pb1550_nor_device = { + .name = "physmap-flash", + .id = -1, + .dev = { + .platform_data = &pb1550_nor_data, + }, + .resource = pb1550_nor_res, + .num_resources = ARRAY_SIZE(pb1550_nor_res), +}; + #define PORT(_base, _irq) \ { \ .iobase = _base, \ @@ -94,6 +141,7 @@ static struct platform_device *pb1550_devices[] = { &pb1550_pcmcia_device, &pb1550_smbus_device, &au1xxx_rtc_device, + &pb1550_nor_device, }; static int __init pb1550_platform_init(void) diff --git a/drivers/mtd/maps/Kconfig b/drivers/mtd/maps/Kconfig index 729f899..36616fd 100644 --- a/drivers/mtd/maps/Kconfig +++ b/drivers/mtd/maps/Kconfig @@ -262,12 +262,6 @@ config MTD_NETtel help Support for flash chips on NETtel/SecureEdge/SnapGear boards. -config MTD_ALCHEMY - tristate "AMD Alchemy Pb1xxx/Db1xxx/RDK MTD support" - depends on SOC_AU1X00 && MTD_PARTITIONS && MTD_CFI - help - Flash memory access on AMD Alchemy Pb/Db/RDK Reference Boards - config MTD_DILNETPC tristate "CFI Flash device mapped on DIL/Net PC" depends on X86 && MTD_CONCAT && MTD_PARTITIONS && MTD_CFI_INTELEXT diff --git a/drivers/mtd/maps/Makefile b/drivers/mtd/maps/Makefile index 26b28a7..9f3d342 100644 --- a/drivers/mtd/maps/Makefile +++ b/drivers/mtd/maps/Makefile @@ -41,7 +41,6 @@ obj-$(CONFIG_MTD_SCx200_DOCFLASH)+= scx200_docflash.o obj-$(CONFIG_MTD_DBOX2) += dbox2-flash.o obj-$(CONFIG_MTD_SOLUTIONENGINE)+= solutionengine.o obj-$(CONFIG_MTD_PCI) += pci.o -obj-$(CONFIG_MTD_ALCHEMY) += alchemy-flash.o obj-$(CONFIG_MTD_AUTCPU12) += autcpu12-nvram.o obj-$(CONFIG_MTD_EDB7312) += edb7312.o obj-$(CONFIG_MTD_IMPA7) += impa7.o diff --git a/drivers/mtd/maps/alchemy-flash.c b/drivers/mtd/maps/alchemy-flash.c deleted file mode 100644 index 845ad4f..0000000 --- a/drivers/mtd/maps/alchemy-flash.c +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Flash memory access on AMD Alchemy evaluation boards - * - * (C) 2003, 2004 Pete Popov <ppopov@embeddedalley.com> - */ - -#include <linux/init.h> -#include <linux/module.h> -#include <linux/types.h> -#include <linux/kernel.h> - -#include <linux/mtd/mtd.h> -#include <linux/mtd/map.h> -#include <linux/mtd/partitions.h> - -#include <asm/io.h> - -#ifdef CONFIG_MIPS_PB1000 -#define BOARD_MAP_NAME "Pb1000 Flash" -#define BOARD_FLASH_SIZE 0x00800000 /* 8MB */ -#define BOARD_FLASH_WIDTH 4 /* 32-bits */ -#endif - -#ifdef CONFIG_MIPS_PB1500 -#define BOARD_MAP_NAME "Pb1500 Flash" -#define BOARD_FLASH_SIZE 0x04000000 /* 64MB */ -#define BOARD_FLASH_WIDTH 4 /* 32-bits */ -#endif - -#ifdef CONFIG_MIPS_PB1100 -#define BOARD_MAP_NAME "Pb1100 Flash" -#define BOARD_FLASH_SIZE 0x04000000 /* 64MB */ -#define BOARD_FLASH_WIDTH 4 /* 32-bits */ -#endif - -#ifdef CONFIG_MIPS_PB1550 -#define BOARD_MAP_NAME "Pb1550 Flash" -#define BOARD_FLASH_SIZE 0x08000000 /* 128MB */ -#define BOARD_FLASH_WIDTH 4 /* 32-bits */ -#endif - -#ifdef CONFIG_MIPS_PB1200 -#define BOARD_MAP_NAME "Pb1200 Flash" -#define BOARD_FLASH_SIZE 0x08000000 /* 128MB */ -#define BOARD_FLASH_WIDTH 2 /* 16-bits */ -#endif - -#ifdef CONFIG_MIPS_DB1000 -#define BOARD_MAP_NAME "Db1000 Flash" -#define BOARD_FLASH_SIZE 0x02000000 /* 32MB */ -#define BOARD_FLASH_WIDTH 4 /* 32-bits */ -#endif - -#ifdef CONFIG_MIPS_DB1500 -#define BOARD_MAP_NAME "Db1500 Flash" -#define BOARD_FLASH_SIZE 0x02000000 /* 32MB */ -#define BOARD_FLASH_WIDTH 4 /* 32-bits */ -#endif - -#ifdef CONFIG_MIPS_DB1100 -#define BOARD_MAP_NAME "Db1100 Flash" -#define BOARD_FLASH_SIZE 0x02000000 /* 32MB */ -#define BOARD_FLASH_WIDTH 4 /* 32-bits */ -#endif - -#ifdef CONFIG_MIPS_DB1550 -#define BOARD_MAP_NAME "Db1550 Flash" -#define BOARD_FLASH_SIZE 0x08000000 /* 128MB */ -#define BOARD_FLASH_WIDTH 4 /* 32-bits */ -#endif - -#ifdef CONFIG_MIPS_DB1200 -#define BOARD_MAP_NAME "Db1200 Flash" -#define BOARD_FLASH_SIZE 0x04000000 /* 64MB */ -#define BOARD_FLASH_WIDTH 2 /* 16-bits */ -#endif - -#ifdef CONFIG_MIPS_BOSPORUS -#define BOARD_MAP_NAME "Bosporus Flash" -#define BOARD_FLASH_SIZE 0x01000000 /* 16MB */ -#define BOARD_FLASH_WIDTH 2 /* 16-bits */ -#endif - -#ifdef CONFIG_MIPS_MIRAGE -#define BOARD_MAP_NAME "Mirage Flash" -#define BOARD_FLASH_SIZE 0x04000000 /* 64MB */ -#define BOARD_FLASH_WIDTH 4 /* 32-bits */ -#define USE_LOCAL_ACCESSORS /* why? */ -#endif - -static struct map_info alchemy_map = { - .name = BOARD_MAP_NAME, -}; - -static struct mtd_partition alchemy_partitions[] = { - { - .name = "User FS", - .size = BOARD_FLASH_SIZE - 0x00400000, - .offset = 0x0000000 - },{ - .name = "YAMON", - .size = 0x0100000, - .offset = MTDPART_OFS_APPEND, - .mask_flags = MTD_WRITEABLE - },{ - .name = "raw kernel", - .size = (0x300000 - 0x40000), /* last 256KB is yamon env */ - .offset = MTDPART_OFS_APPEND, - } -}; - -static struct mtd_info *mymtd; - -static int __init alchemy_mtd_init(void) -{ - struct mtd_partition *parts; - int nb_parts = 0; - unsigned long window_addr; - unsigned long window_size; - - /* Default flash buswidth */ - alchemy_map.bankwidth = BOARD_FLASH_WIDTH; - - window_addr = 0x20000000 - BOARD_FLASH_SIZE; - window_size = BOARD_FLASH_SIZE; - - /* - * Static partition definition selection - */ - parts = alchemy_partitions; - nb_parts = ARRAY_SIZE(alchemy_partitions); - alchemy_map.size = window_size; - - /* - * Now let's probe for the actual flash. Do it here since - * specific machine settings might have been set above. - */ - printk(KERN_NOTICE BOARD_MAP_NAME ": probing %d-bit flash bus\n", - alchemy_map.bankwidth*8); - alchemy_map.virt = ioremap(window_addr, window_size); - mymtd = do_map_probe("cfi_probe", &alchemy_map); - if (!mymtd) { - iounmap(alchemy_map.virt); - return -ENXIO; - } - mymtd->owner = THIS_MODULE; - - add_mtd_partitions(mymtd, parts, nb_parts); - return 0; -} - -static void __exit alchemy_mtd_cleanup(void) -{ - if (mymtd) { - del_mtd_partitions(mymtd); - map_destroy(mymtd); - iounmap(alchemy_map.virt); - } -} - -module_init(alchemy_mtd_init); -module_exit(alchemy_mtd_cleanup); - -MODULE_AUTHOR("Embedded Alley Solutions, Inc"); -MODULE_DESCRIPTION(BOARD_MAP_NAME " MTD driver"); -MODULE_LICENSE("GPL"); -- 1.6.2 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH 3/3] Alchemy: convert to physmap flash 2009-03-29 9:27 ` [PATCH 3/3] Alchemy: convert to physmap flash Manuel Lauss @ 2009-04-06 7:57 ` Florian Fainelli 0 siblings, 0 replies; 16+ messages in thread From: Florian Fainelli @ 2009-04-06 7:57 UTC (permalink / raw) To: Manuel Lauss; +Cc: Linux-MIPS, Linux-MTD Hi Manuel, Le Sunday 29 March 2009 11:27:02 Manuel Lauss, vous avez écrit : > Add physmap-flash support to all Alchemy devboards and get rid of the > alchemy-flash.c MTD map driver. Thanks ! > > Cc: Linux-MTD <linux-mtd@lists.infradead.org> > Signed-off-by: Manuel Lauss <mano@roarinelk.homelinux.net> Acked-by: Florian Fainelli <florian@openwrt.org> -- Best regards, Florian Fainelli Email : florian@openwrt.org http://openwrt.org ------------------------------- ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 1/3] Alchemy: get rid of common/platform.c 2009-03-29 9:27 ` [PATCH 1/3] Alchemy: get rid of common/platform.c Manuel Lauss 2009-03-29 9:27 ` [PATCH 2/3] Alchemy: add RTC device to devboards Manuel Lauss @ 2009-03-29 11:36 ` Sergei Shtylyov 2009-03-29 11:37 ` Sergei Shtylyov 2 siblings, 0 replies; 16+ messages in thread From: Sergei Shtylyov @ 2009-03-29 11:36 UTC (permalink / raw) To: Manuel Lauss; +Cc: Linux-MIPS Hello. Manuel Lauss wrote: > Move device registration out of common/platform.c into the individual > boards' platform.c files. > > Every board should register the devices it wants to use (i.e. on one > of my Au1200 systems UART1 is unused [pinmux problems] and its > functionality is provided by an external device. This also results > in a completely useless ttyS1 entry; I want this entry gone without > having to add a lot more #ifdef <platform> lines to common/platform.c). > No #ifdef's would be needed at all if you check what devices are enabled before registering. > Signed-off-by: Manuel Lauss <mano@roarinelk.homelinux.net> > NAK. WBR. Sergei ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 1/3] Alchemy: get rid of common/platform.c 2009-03-29 9:27 ` [PATCH 1/3] Alchemy: get rid of common/platform.c Manuel Lauss 2009-03-29 9:27 ` [PATCH 2/3] Alchemy: add RTC device to devboards Manuel Lauss 2009-03-29 11:36 ` [PATCH 1/3] Alchemy: get rid of common/platform.c Sergei Shtylyov @ 2009-03-29 11:37 ` Sergei Shtylyov 2 siblings, 0 replies; 16+ messages in thread From: Sergei Shtylyov @ 2009-03-29 11:37 UTC (permalink / raw) To: Manuel Lauss; +Cc: Linux-MIPS Hello. Manuel Lauss wrote: > Move device registration out of common/platform.c into the individual > boards' platform.c files. > > Every board should register the devices it wants to use (i.e. on one > of my Au1200 systems UART1 is unused [pinmux problems] and its > functionality is provided by an external device. This also results > in a completely useless ttyS1 entry; I want this entry gone without > having to add a lot more #ifdef <platform> lines to common/platform.c). > No #ifdef's would be needed at all if you check what devices are enabled before registering. > Signed-off-by: Manuel Lauss <mano@roarinelk.homelinux.net> > NAK. WBR. Sergei ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 0/3] Alchemy: platform updates 2009-03-29 9:26 [PATCH 0/3] Alchemy: platform updates Manuel Lauss 2009-03-29 9:27 ` [PATCH 1/3] Alchemy: get rid of common/platform.c Manuel Lauss @ 2009-03-29 11:35 ` Sergei Shtylyov 2009-03-29 12:38 ` Manuel Lauss 1 sibling, 1 reply; 16+ messages in thread From: Sergei Shtylyov @ 2009-03-29 11:35 UTC (permalink / raw) To: Manuel Lauss; +Cc: Linux-MIPS Hello. Manuel Lauss wrote: > Patch overview: > > #1: eliminate alchemy/common/platform.c. Add platform device > registration to all boards instead. > I'm strongly voting against this, as it causes totally unneeded code duplication. Please don't apply. > I realize this is a lot of (needless) code duplication at first, > but it seems a lot cleaner to me if each board registered the > devices it needs/wants. > No, it's certainly a step backwards. You could make the common code more flexible by checking what devices are enabled and registering them selectively as I have already suggested several months ago. That would be the clean solution unlike your code bloat. WBR, Sergei ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 0/3] Alchemy: platform updates 2009-03-29 11:35 ` [PATCH 0/3] Alchemy: platform updates Sergei Shtylyov @ 2009-03-29 12:38 ` Manuel Lauss 2009-03-29 13:03 ` Sergei Shtylyov 0 siblings, 1 reply; 16+ messages in thread From: Manuel Lauss @ 2009-03-29 12:38 UTC (permalink / raw) To: Sergei Shtylyov; +Cc: Linux-MIPS Hi Sergei, > > Patch overview: > > > > #1: eliminate alchemy/common/platform.c. Add platform device > > registration to all boards instead. > > > > I'm strongly voting against this, as it causes totally unneeded code > duplication. Please don't apply. I know it seems like a lot of unecessary duplication. My reasons for doing this are a) I want to get rid of the various cpu-type specific config symbols, (i.e. I want one kernel binary to run on 2 or more Alchemy boards with different cpu models. There's no technical reason this shouldn't work. The OHCI block for instance has different addresses on pre-Au1200 silicon; the easiest solution to that (for me) is to simply move device registration to the boards that need/want it.) (BTW, what do you think about this? Please tell me now if I ever have a chance to get your approval on this, so I can stop wasting my and everybody else's time as soon as possible). b) the way it is now just seems wrong to me, probably comes from working on SH port where each board registers the devices it needs. I know this is in no way a valid technical justification; but everytime I look at this file something tells me it is just wrong ;) > > I realize this is a lot of (needless) code duplication at first, > > but it seems a lot cleaner to me if each board registered the > > devices it needs/wants. > > > > No, it's certainly a step backwards. You could make the common code > more flexible by checking what devices are enabled and registering them > selectively Please elaborate. Shall I check for a config symbol or if bootloader has enabled the peripherals? The latter is IMO stupid since the bootloader should only load an OS and not preemptively enable every device which might some day be used just because the running OS doesn't know what it wants... Manuel Lauss ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 0/3] Alchemy: platform updates 2009-03-29 12:38 ` Manuel Lauss @ 2009-03-29 13:03 ` Sergei Shtylyov 2009-03-29 15:27 ` Kevin Hickey ` (2 more replies) 0 siblings, 3 replies; 16+ messages in thread From: Sergei Shtylyov @ 2009-03-29 13:03 UTC (permalink / raw) To: Manuel Lauss; +Cc: Linux-MIPS Hello. Manuel Lauss wrote: >>> Patch overview: >>> >>> #1: eliminate alchemy/common/platform.c. Add platform device >>> registration to all boards instead. >>> >>> >> I'm strongly voting against this, as it causes totally unneeded code >> duplication. Please don't apply. >> > > I know it seems like a lot of unecessary duplication. My reasons for > doing this are > > a) I want to get rid of the various cpu-type specific config symbols, > (i.e. I want one kernel binary to run on 2 or more Alchemy boards > with different cpu models. There's no technical reason this > shouldn't work. The OHCI block for instance has different addresses > on pre-Au1200 silicon; the easiest solution to that (for me) is > to simply move device registration to the boards that need/want it.) > Well, then create several files (like arch/mips/alchemy/common/au1200.c) for SoC specific platfrom device sets variations but don't move all platform devices into the board files. This will be a cleaner solution. > (BTW, what do you think about this? Please tell me now if I ever > have a chance to get your approval on this, so I can stop wasting > my and everybody else's time as soon as possible). > Single kernel binary? If it's at all possible, I am all for it. > b) the way it is now just seems wrong to me, probably comes from working > on SH port where each board registers the devices it needs. I know > this is in no way a valid technical justification; but everytime I > look at this file something tells me it is just wrong ;) > Don't listen to the voices in your head. ;-) >>> I realize this is a lot of (needless) code duplication at first, >>> but it seems a lot cleaner to me if each board registered the >>> devices it needs/wants. >>> >> No, it's certainly a step backwards. You could make the common code >> more flexible by checking what devices are enabled and registering them >> selectively >> > > Please elaborate. Shall I check for a config symbol or if bootloader > has enabled the peripherals? The latter is IMO stupid since the > bootloader should only load an OS and not preemptively enable every > device which might some day be used just because the running OS doesn't > know what it wants... > It should check what the board code (or bootloader) has enabled. I remember the board code writes some config registers... > Manuel Lauss > WBR, Sergei ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 0/3] Alchemy: platform updates 2009-03-29 13:03 ` Sergei Shtylyov @ 2009-03-29 15:27 ` Kevin Hickey 2009-03-29 15:52 ` Manuel Lauss 2009-03-29 15:43 ` Manuel Lauss 2009-03-29 20:48 ` Sergei Shtylyov 2 siblings, 1 reply; 16+ messages in thread From: Kevin Hickey @ 2009-03-29 15:27 UTC (permalink / raw) To: Sergei Shtylyov; +Cc: Manuel Lauss, Linux-MIPS On Sun, 2009-03-29 at 17:03 +0400, Sergei Shtylyov wrote: > Single kernel binary? If it's at all possible, I am all for it. On some level, I agree but not at the expense of a larger kernel or longer boot times. Maybe I'm just not following how your implementation works but it seems to me that runtime checks will add to boot time. More importantly it adds to the kernel memory footprint as the tables of constants for multiple CPUs will have to be compiled in. If I'm designing a board with an Au1250 in it, I don't care about the interrupt numbers for Au1100 or Au1500. This problem compounds when we introduce Au1300 - several of its subsystems (like the interrupt controller) are new requiring not only a new table of constants but a new object as well. In the desktop space I can understand this approach, but in the embedded space it seems like an unnecessary resource burden. Please enlighten me :) =Kevin -- Kevin Hickey Alchemy Solutions RMI Corporation khickey@rmicorp.com P: 512.691.8044 ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 0/3] Alchemy: platform updates 2009-03-29 15:27 ` Kevin Hickey @ 2009-03-29 15:52 ` Manuel Lauss 2009-03-30 8:39 ` Florian Fainelli 2009-03-30 16:23 ` Ralf Baechle 0 siblings, 2 replies; 16+ messages in thread From: Manuel Lauss @ 2009-03-29 15:52 UTC (permalink / raw) To: Kevin Hickey; +Cc: Sergei Shtylyov, Linux-MIPS On Sun, 29 Mar 2009 10:27:46 -0500 Kevin Hickey <khickey@rmicorp.com> wrote: > On Sun, 2009-03-29 at 17:03 +0400, Sergei Shtylyov wrote: > > Single kernel binary? If it's at all possible, I am all for it. > > On some level, I agree but not at the expense of a larger kernel or > longer boot times. Maybe I'm just not following how your implementation > works but it seems to me that runtime checks will add to boot time. > More importantly it adds to the kernel memory footprint as the tables of > constants for multiple CPUs will have to be compiled in. If I'm > designing a board with an Au1250 in it, I don't care about the interrupt > numbers for Au1100 or Au1500. This problem compounds when we introduce > Au1300 - several of its subsystems (like the interrupt controller) are > new requiring not only a new table of constants but a new object as > well. In the desktop space I can understand this approach, but in the > embedded space it seems like an unnecessary resource burden. > > Please enlighten me :) You're right, from a single-cpu-board POV it doesn't make sense. However if you have a few boards which mostly differ in the Alchemy chip used (and not much else difference in board support code), I find this to be highly beneficial. If I can have a single binary for the folks testing these boards, all the better! Yes, increased binary size is to be expected, but I don't expect it to be in the megabyte range. I'm primarily doing this for company-internal purposes; I just thought I'd share the final result, maybe someone else might find it useful. Manuel Lauss ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 0/3] Alchemy: platform updates 2009-03-29 15:52 ` Manuel Lauss @ 2009-03-30 8:39 ` Florian Fainelli 2009-03-30 16:23 ` Ralf Baechle 1 sibling, 0 replies; 16+ messages in thread From: Florian Fainelli @ 2009-03-30 8:39 UTC (permalink / raw) To: Manuel Lauss; +Cc: Kevin Hickey, Sergei Shtylyov, Linux-MIPS Hi Manuel, Kevin, Le Sunday 29 March 2009 17:52:43 Manuel Lauss, vous avez écrit : > On Sun, 29 Mar 2009 10:27:46 -0500 > > Kevin Hickey <khickey@rmicorp.com> wrote: > > On Sun, 2009-03-29 at 17:03 +0400, Sergei Shtylyov wrote: > > > Single kernel binary? If it's at all possible, I am all for it. > > > > On some level, I agree but not at the expense of a larger kernel or > > longer boot times. Maybe I'm just not following how your implementation > > works but it seems to me that runtime checks will add to boot time. > > More importantly it adds to the kernel memory footprint as the tables of > > constants for multiple CPUs will have to be compiled in. If I'm > > designing a board with an Au1250 in it, I don't care about the interrupt > > numbers for Au1100 or Au1500. This problem compounds when we introduce > > Au1300 - several of its subsystems (like the interrupt controller) are > > new requiring not only a new table of constants but a new object as > > well. In the desktop space I can understand this approach, but in the > > embedded space it seems like an unnecessary resource burden. > > > > Please enlighten me :) > > You're right, from a single-cpu-board POV it doesn't make sense. > However if you have a few boards which mostly differ in the Alchemy > chip used (and not much else difference in board support code), I find > this to be highly beneficial. If I can have a single binary for the > folks testing these boards, all the better! I definitively agree, from a distribution point of view, that's even better. For instance Maxime did an excellent job with bcm63xx [1] which has both different base addresses for the SoC registers and even different offsets for the same things inside those registers. Resulting kernel is not that slower even though I do not have figures to show. Additionnaly you can still choose which BCM63xx SoC you are compiling for. > > Yes, increased binary size is to be expected, but I don't expect it to > be in the megabyte range. > > I'm primarily doing this for company-internal purposes; I just thought > I'd share the final result, maybe someone else might find it useful. [1] : http://www.linux-mips.org/git?p=linux-bcm63xx.git;a=blob;f=arch/mips/bcm63xx/cpu.c;h=0a403dd07cf48109c904486cc1106d99ce036aad;hb=30c20e2899bbf31069aee0bdc4258c211f7a3d0f -- Best regards, Florian Fainelli Email : florian@openwrt.org http://openwrt.org ------------------------------- ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 0/3] Alchemy: platform updates 2009-03-29 15:52 ` Manuel Lauss 2009-03-30 8:39 ` Florian Fainelli @ 2009-03-30 16:23 ` Ralf Baechle 1 sibling, 0 replies; 16+ messages in thread From: Ralf Baechle @ 2009-03-30 16:23 UTC (permalink / raw) To: Manuel Lauss; +Cc: Kevin Hickey, Sergei Shtylyov, Linux-MIPS On Sun, Mar 29, 2009 at 05:52:43PM +0200, Manuel Lauss wrote: > From: Manuel Lauss <mano@roarinelk.homelinux.net> > Date: Sun, 29 Mar 2009 17:52:43 +0200 > To: Kevin Hickey <khickey@rmicorp.com> > Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>, > Linux-MIPS <linux-mips@linux-mips.org> > Subject: Re: [PATCH 0/3] Alchemy: platform updates > Content-Type: text/plain; charset=US-ASCII > > On Sun, 29 Mar 2009 10:27:46 -0500 > Kevin Hickey <khickey@rmicorp.com> wrote: > > > On Sun, 2009-03-29 at 17:03 +0400, Sergei Shtylyov wrote: > > > Single kernel binary? If it's at all possible, I am all for it. > > > > On some level, I agree but not at the expense of a larger kernel or > > longer boot times. Maybe I'm just not following how your implementation > > works but it seems to me that runtime checks will add to boot time. > > More importantly it adds to the kernel memory footprint as the tables of > > constants for multiple CPUs will have to be compiled in. If I'm > > designing a board with an Au1250 in it, I don't care about the interrupt > > numbers for Au1100 or Au1500. This problem compounds when we introduce > > Au1300 - several of its subsystems (like the interrupt controller) are > > new requiring not only a new table of constants but a new object as > > well. In the desktop space I can understand this approach, but in the > > embedded space it seems like an unnecessary resource burden. > > > > Please enlighten me :) > > You're right, from a single-cpu-board POV it doesn't make sense. > However if you have a few boards which mostly differ in the Alchemy > chip used (and not much else difference in board support code), I find > this to be highly beneficial. If I can have a single binary for the > folks testing these boards, all the better! > > Yes, increased binary size is to be expected, but I don't expect it to > be in the megabyte range. > > I'm primarily doing this for company-internal purposes; I just thought > I'd share the final result, maybe someone else might find it useful. In the past the Alchemy code has frequently suffered from small silly bugs that were affecting only a part of the Alchemy platforms. If code was more generic there would be the additional benefit of improved test coverage without more testing. I frequently see people still optimizing code as if the problem was still squeezing a program into a 2716 EPROM for an 8085. Trading a few bytes or microseconds of startup time for sanity is a really good thing! Ralf ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 0/3] Alchemy: platform updates 2009-03-29 13:03 ` Sergei Shtylyov 2009-03-29 15:27 ` Kevin Hickey @ 2009-03-29 15:43 ` Manuel Lauss 2009-03-29 20:48 ` Sergei Shtylyov 2 siblings, 0 replies; 16+ messages in thread From: Manuel Lauss @ 2009-03-29 15:43 UTC (permalink / raw) To: Sergei Shtylyov; +Cc: Linux-MIPS Hi Sergei, On Sun, 29 Mar 2009 17:03:58 +0400 Sergei Shtylyov <sshtylyov@ru.mvista.com> wrote: > > Please elaborate. Shall I check for a config symbol or if bootloader > > has enabled the peripherals? The latter is IMO stupid since the > > bootloader should only load an OS and not preemptively enable every > > device which might some day be used just because the running OS doesn't > > know what it wants... > > > > It should check what the board code (or bootloader) has enabled. I > remember the board code writes some config registers... I'd rather duplicate simple, known-working code than go around looking whether some other part of the boards software system has set enable bits. (Think of a linux bootloader akin to the simplicity of a QNX IPL which doesn't enable anything but the debug port, if at all) In short, consider these patches withdrawn. Thanks! Manuel Lauss ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 0/3] Alchemy: platform updates 2009-03-29 13:03 ` Sergei Shtylyov 2009-03-29 15:27 ` Kevin Hickey 2009-03-29 15:43 ` Manuel Lauss @ 2009-03-29 20:48 ` Sergei Shtylyov 2 siblings, 0 replies; 16+ messages in thread From: Sergei Shtylyov @ 2009-03-29 20:48 UTC (permalink / raw) To: Manuel Lauss; +Cc: Linux-MIPS Hello, I wrote: >>>> Patch overview: >>>> >>>> #1: eliminate alchemy/common/platform.c. Add platform device >>>> registration to all boards instead. >>>> >>> I'm strongly voting against this, as it causes totally unneeded >>> code duplication. Please don't apply. >> >> I know it seems like a lot of unecessary duplication. My reasons for >> doing this are >> >> a) I want to get rid of the various cpu-type specific config symbols, >> (i.e. I want one kernel binary to run on 2 or more Alchemy boards >> with different cpu models. There's no technical reason this >> shouldn't work. The OHCI block for instance has different addresses >> on pre-Au1200 silicon; the easiest solution to that (for me) is >> to simply move device registration to the boards that need/want >> it.) > > Well, then create several files (like > arch/mips/alchemy/common/au1200.c) for SoC specific platfrom device > sets variations but don't move all platform devices into the board > files. This will be a cleaner solution. Another solution would be "tuning up" the platform device resources depending on the detected SoC type. >> have a chance to get your approval on this, so I can stop wasting >> my and everybody else's time as soon as possible). >> > (BTW, what do you think about this? Please tell me now if I ever > > Single kernel binary? If it's at all possible, I am all for it. That doesn't mean however that SoC type options need to go -- we could allow the user a flexibility (like is curretnly done on ARM DaVinci) of choosing an arbotrary set of supported SoCs, so that he could have the choice to exclude the code for the ones he doesn't need. WBR, Sergei ^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2009-04-06 7:57 UTC | newest] Thread overview: 16+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2009-03-29 9:26 [PATCH 0/3] Alchemy: platform updates Manuel Lauss 2009-03-29 9:27 ` [PATCH 1/3] Alchemy: get rid of common/platform.c Manuel Lauss 2009-03-29 9:27 ` [PATCH 2/3] Alchemy: add RTC device to devboards Manuel Lauss 2009-03-29 9:27 ` [PATCH 3/3] Alchemy: convert to physmap flash Manuel Lauss 2009-04-06 7:57 ` Florian Fainelli 2009-03-29 11:36 ` [PATCH 1/3] Alchemy: get rid of common/platform.c Sergei Shtylyov 2009-03-29 11:37 ` Sergei Shtylyov 2009-03-29 11:35 ` [PATCH 0/3] Alchemy: platform updates Sergei Shtylyov 2009-03-29 12:38 ` Manuel Lauss 2009-03-29 13:03 ` Sergei Shtylyov 2009-03-29 15:27 ` Kevin Hickey 2009-03-29 15:52 ` Manuel Lauss 2009-03-30 8:39 ` Florian Fainelli 2009-03-30 16:23 ` Ralf Baechle 2009-03-29 15:43 ` Manuel Lauss 2009-03-29 20:48 ` Sergei Shtylyov
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.