linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Board support Pcontrol_G20, hardware revision 2
@ 2011-01-17 17:43 Peter Gsellmann
  2011-01-18 18:56 ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Gsellmann @ 2011-01-17 17:43 UTC (permalink / raw)
  To: linux-arm-kernel

 Backplane timings adjusted
 Addition of specific platform devices and resources
 Leds renamed
 Minor bugfixes

this patch should not influence any other hardware

Signed-off-by: Peter Gsellmann <pgsellmann@portner-elektronik.at>
---
 arch/arm/mach-at91/board-pcontrol-g20.c |  141 ++++++++++++++++++++++++++-----
 1 files changed, 119 insertions(+), 22 deletions(-)

diff --git a/arch/arm/mach-at91/board-pcontrol-g20.c b/arch/arm/mach-at91/board-pcontrol-g20.c
index feb6578..42798af 100644
--- a/arch/arm/mach-at91/board-pcontrol-g20.c
+++ b/arch/arm/mach-at91/board-pcontrol-g20.c
@@ -26,6 +26,10 @@
 #include <linux/gpio.h>
 #include <linux/w1-gpio.h>

+#include <linux/input.h>
+#include <linux/uio_driver.h>
+#include <linux/mtd/plat-ram.h>
+
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>

@@ -60,19 +64,22 @@ static void __init init_irq(void)
 }


-static struct sam9_smc_config __initdata pcontrol_smc_config[2] = { {
-	.ncs_read_setup		= 16,
-	.nrd_setup		= 18,
-	.ncs_write_setup	= 16,
-	.nwe_setup		= 18,
+/*
+ * Bus timings; unit = 7.57ns
+ */
+static struct sam9_smc_config __initdata pcontrol_smc_config[] = { {
+	.ncs_read_setup		= 0,
+	.nrd_setup		= 8,
+	.ncs_write_setup	= 0,
+	.nwe_setup		= 8,

 	.ncs_read_pulse		= 63,
-	.nrd_pulse		= 55,
+	.nrd_pulse		= 45,
 	.ncs_write_pulse	= 63,
-	.nwe_pulse		= 55,
+	.nwe_pulse		= 45,

-	.read_cycle		= 127,
-	.write_cycle		= 127,
+	.read_cycle		= 100,
+	.write_cycle		= 100,

 	.mode			= AT91_SMC_READMODE | AT91_SMC_WRITEMODE
 			| AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_BAT_SELECT
@@ -100,15 +107,105 @@ static struct sam9_smc_config __initdata pcontrol_smc_config[2] = { {
 	.tdf_cycles		= 1,
 } };

+
+static struct resource pcontrol_resources[] = {
+	{
+		.start	= AT91_CHIPSELECT_4,
+		.end	= AT91_CHIPSELECT_4 + SZ_256M - 1,
+		.flags	= IORESOURCE_MEM,
+	}, {
+		.start	= AT91_CHIPSELECT_7,
+		.end	= AT91_CHIPSELECT_7 + SZ_256M - 1,
+		.flags	= IORESOURCE_MEM,
+	}, {
+		.start	= AT91_CHIPSELECT_4,
+		.end	= AT91_CHIPSELECT_4 + 0x800 - 1,
+		.name   = "bus51",
+		.flags	= IORESOURCE_MEM,
+	}, {
+		.start	= AT91_CHIPSELECT_4 + 0x800,
+		.end	= AT91_CHIPSELECT_4 + 0x900 - 1,
+		.name   = "lcd40x16bw",
+		.flags	= IORESOURCE_MEM,
+	}, {
+		.start	= AT91_CHIPSELECT_4 + 0x900,
+		.end	= AT91_CHIPSELECT_4 + 0xa00 - 1,
+		.name   = "kbd6x3+5",
+		.flags	= IORESOURCE_MEM,
+	}, {
+		.start	= AT91_CHIPSELECT_7,
+		.end	= AT91_CHIPSELECT_7 + SZ_512K - 1,
+		.name   = "ferroram",
+		.flags	= IORESOURCE_MEM,
+	}
+};
+
+static struct uio_info uioconfig = {
+		.name = "pcontrol-uio",
+		.version = "1",
+};
+
+struct platdata_mtd_ram mtd_config = {
+		.mapname = "ferro",
+		.bankwidth = 2,
+};
+
+static struct platform_device pcontrol_devices[] = {
+	{
+		.name = "atmel_smc",
+		.id = 4,
+		.resource = &pcontrol_resources[0],
+		.num_resources	= 1,
+	}, {
+		.name = "atmel_smc",
+		.id = 7,
+		.resource = &pcontrol_resources[1],
+		.num_resources	= 1,
+	}, {
+		.name = "uio_pdrv",
+		.id = -1,
+		.resource = &pcontrol_resources[2],
+		.num_resources	= 1,
+		.dev = {
+				.platform_data = &uioconfig,
+		},
+	}, {
+		.name = "mtd-ram",
+		.id = -1,
+		.resource = &pcontrol_resources[5],
+		.num_resources	= 1,
+		.dev = {
+				.platform_data = &mtd_config,
+		},
+	}, {
+		.name = "lcd240x128",
+		.id = -1,
+		.resource = &pcontrol_resources[3],
+		.num_resources	= 2,
+	}
+};
+
 static void __init add_device_pcontrol(void)
 {
+	/* set write protect pin for eeprom 24LC64  D7 */
+	at91_set_GPIO_periph(AT91_PIN_PB24, 1);
+	at91_set_gpio_output(AT91_PIN_PB24, 1);
 	/* configure chip-select 4 (IO compatible to 8051  X4 ) */
 	sam9_smc_configure(4, &pcontrol_smc_config[0]);
+	at91_set_A_periph(AT91_PIN_PC8, 0);
+	platform_device_register(&pcontrol_devices[0]);
+	/* add subdevices */
+	platform_device_register(&pcontrol_devices[2]);
+	platform_device_register(&pcontrol_devices[4]);
+
 	/* configure chip-select 7 (FerroRAM 256KiBx16bit MR2A16A  D4 ) */
 	sam9_smc_configure(7, &pcontrol_smc_config[1]);
+	at91_set_B_periph(AT91_PIN_PC12, 0);
+	platform_device_register(&pcontrol_devices[1]);
+	/* add subdevices */
+	platform_device_register(&pcontrol_devices[3]);
 }

-
 /*
  * USB Host port
  */
@@ -122,7 +219,8 @@ static struct at91_usbh_data __initdata usbh_data = {
  */
 static struct at91_udc_data __initdata pcontrol_g20_udc_data = {
 	.vbus_pin	= AT91_PIN_PA22,	/* Detect +5V bus voltage */
-	.pullup_pin	= AT91_PIN_PA4,		/* K-state, active low */
+	.pullup_pin	= AT91_PIN_PA5,		/* K-state, active low */
+	.pullup_active_low = 1,
 };


@@ -130,7 +228,7 @@ static struct at91_udc_data __initdata pcontrol_g20_udc_data = {
  * MACB Ethernet device
  */
 static struct at91_eth_data __initdata macb_data = {
-	.phy_irq_pin	= AT91_PIN_PA28,
+	.phy_irq_pin	= AT91_PIN_PA26,
 	.is_rmii	= 1,
 };

@@ -151,46 +249,45 @@ static struct i2c_board_info __initdata pcontrol_g20_i2c_devices[] = {
  */
 static struct gpio_led pcontrol_g20_leds[] = {
 	{
-		.name			= "LED1",	/* red  H5 */
+		.name			= "pcontrol:red:H5",
 		.gpio			= AT91_PIN_PB18,
 		.active_low		= 1,
 		.default_trigger	= "none",	/* supervisor */
 	}, {
-		.name			= "LED2",	/* yellow  H7 */
+		.name			= "pcontrol:yellow:H7",
 		.gpio			= AT91_PIN_PB19,
 		.active_low		= 1,
 		.default_trigger	= "mmc0",	/* SD-card activity */
 	}, {
-		.name			= "LED3",	/* green  H2 */
+		.name			= "pcontrol:green:H2",
 		.gpio			= AT91_PIN_PB20,
 		.active_low		= 1,
 		.default_trigger	= "heartbeat",	/* blinky */
 	}, {
-		.name			= "LED4",	/* red  H3 */
+		.name			= "pcontrol:red:H3",
 		.gpio			= AT91_PIN_PC6,
 		.active_low		= 1,
 		.default_trigger	= "none",	/* connection lost */
 	}, {
-		.name			= "LED5",	/* yellow  H6 */
+		.name			= "pcontrol:yellow:H6",
 		.gpio			= AT91_PIN_PC7,
 		.active_low		= 1,
 		.default_trigger	= "none",	/* unsent data */
 	}, {
-		.name			= "LED6",	/* green  H1 */
+		.name			= "pcontrol:green:H1",
 		.gpio			= AT91_PIN_PC9,
 		.active_low		= 1,
 		.default_trigger	= "none",	/* snafu */
 	}
 };

-
 /*
  * SPI devices
  */
-static struct spi_board_info pcontrol_g20_spi_devices[] = {
+static struct spi_board_info __initdata pcontrol_g20_spi_devices[] = {
 	{
 		.modalias	= "spidev",	/* HMI port  X4 */
-		.chip_select	= 1,
+		.chip_select	= 0,
 		.max_speed_hz	= 50 * 1000 * 1000,
 		.bus_num	= 0,
 	}, {
@@ -216,7 +313,7 @@ static void __init pcontrol_g20_board_init(void)
 	at91_gpio_leds(pcontrol_g20_leds,
 		ARRAY_SIZE(pcontrol_g20_leds));
 	/* piggyback  A2 */
-	at91_set_gpio_output(AT91_PIN_PB31, 1);
+	at91_set_A_periph(AT91_PIN_PB30, 0);
 }


--
1.7.2.3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH] Board support Pcontrol_G20, hardware revision 2
  2011-01-17 17:43 [PATCH] Board support Pcontrol_G20, hardware revision 2 Peter Gsellmann
@ 2011-01-18 18:56 ` Jean-Christophe PLAGNIOL-VILLARD
  2011-01-18 21:38   ` Peter Gsellmann
  0 siblings, 1 reply; 5+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-01-18 18:56 UTC (permalink / raw)
  To: linux-arm-kernel

On 18:43 Mon 17 Jan     , Peter Gsellmann wrote:
>  Backplane timings adjusted
>  Addition of specific platform devices and resources
>  Leds renamed
>  Minor bugfixes
I'd prefer to split the patch for bisect
> 
> this patch should not influence any other hardware
> 
> Signed-off-by: Peter Gsellmann <pgsellmann@portner-elektronik.at>
> ---
>  arch/arm/mach-at91/board-pcontrol-g20.c |  141 ++++++++++++++++++++++++++-----
>  1 files changed, 119 insertions(+), 22 deletions(-)
> 
> diff --git a/arch/arm/mach-at91/board-pcontrol-g20.c b/arch/arm/mach-at91/board-pcontrol-g20.c
> index feb6578..42798af 100644
> --- a/arch/arm/mach-at91/board-pcontrol-g20.c
> +++ b/arch/arm/mach-at91/board-pcontrol-g20.c
> @@ -26,6 +26,10 @@
>  #include <linux/gpio.h>
>  #include <linux/w1-gpio.h>
> 
> +#include <linux/input.h>
> +#include <linux/uio_driver.h>
> +#include <linux/mtd/plat-ram.h>
> +
>  #include <asm/mach-types.h>
>  #include <asm/mach/arch.h>
> 
> @@ -60,19 +64,22 @@ static void __init init_irq(void)
>  }
> 
> 
> -static struct sam9_smc_config __initdata pcontrol_smc_config[2] = { {
> -	.ncs_read_setup		= 16,
> -	.nrd_setup		= 18,
> -	.ncs_write_setup	= 16,
> -	.nwe_setup		= 18,
> +/*
> + * Bus timings; unit = 7.57ns
> + */
> +static struct sam9_smc_config __initdata pcontrol_smc_config[] = { {
> +	.ncs_read_setup		= 0,
> +	.nrd_setup		= 8,
> +	.ncs_write_setup	= 0,
> +	.nwe_setup		= 8,
> 
>  	.ncs_read_pulse		= 63,
> -	.nrd_pulse		= 55,
> +	.nrd_pulse		= 45,
>  	.ncs_write_pulse	= 63,
> -	.nwe_pulse		= 55,
> +	.nwe_pulse		= 45,
> 
> -	.read_cycle		= 127,
> -	.write_cycle		= 127,
> +	.read_cycle		= 100,
> +	.write_cycle		= 100,
> 
>  	.mode			= AT91_SMC_READMODE | AT91_SMC_WRITEMODE
>  			| AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_BAT_SELECT
> @@ -100,15 +107,105 @@ static struct sam9_smc_config __initdata pcontrol_smc_config[2] = { {
>  	.tdf_cycles		= 1,
>  } };
> 
> +
> +static struct resource pcontrol_resources[] = {
> +	{
> +		.start	= AT91_CHIPSELECT_4,
> +		.end	= AT91_CHIPSELECT_4 + SZ_256M - 1,
> +		.flags	= IORESOURCE_MEM,
> +	}, {
> +		.start	= AT91_CHIPSELECT_7,
> +		.end	= AT91_CHIPSELECT_7 + SZ_256M - 1,
> +		.flags	= IORESOURCE_MEM,
> +	}, {
> +		.start	= AT91_CHIPSELECT_4,
> +		.end	= AT91_CHIPSELECT_4 + 0x800 - 1,
> +		.name   = "bus51",
> +		.flags	= IORESOURCE_MEM,
> +	}, {
> +		.start	= AT91_CHIPSELECT_4 + 0x800,
> +		.end	= AT91_CHIPSELECT_4 + 0x900 - 1,
> +		.name   = "lcd40x16bw",
> +		.flags	= IORESOURCE_MEM,
> +	}, {
> +		.start	= AT91_CHIPSELECT_4 + 0x900,
> +		.end	= AT91_CHIPSELECT_4 + 0xa00 - 1,
> +		.name   = "kbd6x3+5",
> +		.flags	= IORESOURCE_MEM,
> +	}, {
> +		.start	= AT91_CHIPSELECT_7,
> +		.end	= AT91_CHIPSELECT_7 + SZ_512K - 1,
> +		.name   = "ferroram",
> +		.flags	= IORESOURCE_MEM,
> +	}
export the same memory twice as ressource :(
> +};
> +
Best Regards,
J.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] Board support Pcontrol_G20, hardware revision 2
  2011-01-18 18:56 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2011-01-18 21:38   ` Peter Gsellmann
  2011-01-21 15:48     ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Gsellmann @ 2011-01-18 21:38 UTC (permalink / raw)
  To: linux-arm-kernel

Am Dienstag, 18. Januar 2011, 19:56:57 schrieb Jean-Christophe PLAGNIOL-VILLARD:
> On 18:43 Mon 17 Jan     , Peter Gsellmann wrote:
> >  Backplane timings adjusted
> >  Addition of specific platform devices and resources
> >  Leds renamed
> >  Minor bugfixes
> I'd prefer to split the patch for bisect
Is this really a requirement?
Except for added resources, changes are mostly in values of static structs reflecting
the hardware changes from rev1 to rev2. There is no such thing as hardware rev1.5 so
any mixed version neither works on hardware rev1 nor on rev2.

> > +static struct resource pcontrol_resources[] = {
> > +	{
> > +		.start	= AT91_CHIPSELECT_4,
> > +		.end	= AT91_CHIPSELECT_4 + SZ_256M - 1,
> > +		.flags	= IORESOURCE_MEM,
> > +	}, {
> > +		.start	= AT91_CHIPSELECT_7,
> > +		.end	= AT91_CHIPSELECT_7 + SZ_256M - 1,
> > +		.flags	= IORESOURCE_MEM,
> > +	}, {
> > +		.start	= AT91_CHIPSELECT_4,
> > +		.end	= AT91_CHIPSELECT_4 + 0x800 - 1,
> > +		.name   = "bus51",
> > +		.flags	= IORESOURCE_MEM,
> > +	}, {
> > +		.start	= AT91_CHIPSELECT_4 + 0x800,
> > +		.end	= AT91_CHIPSELECT_4 + 0x900 - 1,
> > +		.name   = "lcd40x16bw",
> > +		.flags	= IORESOURCE_MEM,
> > +	}, {
> > +		.start	= AT91_CHIPSELECT_4 + 0x900,
> > +		.end	= AT91_CHIPSELECT_4 + 0xa00 - 1,
> > +		.name   = "kbd6x3+5",
> > +		.flags	= IORESOURCE_MEM,
> > +	}, {
> > +		.start	= AT91_CHIPSELECT_7,
> > +		.end	= AT91_CHIPSELECT_7 + SZ_512K - 1,
> > +		.name   = "ferroram",
> > +		.flags	= IORESOURCE_MEM,
> > +	}
> export the same memory twice as ressource :(
yes, this is intended:
the first two are main resources(chipselects with size 256MB),
 the others are subresources(real chips with smaller sizes)
 which divide the address space of the chipselects; otherwise
 the driver plat_ram would present the 512K ferroram as 256MB disk.

after loading some of the drivers, /proc/iomem looks like:
50000000-5fffffff : atmel_smc.4
  50000000-500007ff : bus51
  50000800-500008ff : lcd40x16bw
    50000800-500008ff : t6963c
  50000900-500009ff : kbd6x3+5
    50000900-500009ff : polledio-dev
80000000-8fffffff : atmel_smc.7
  80000000-8007ffff : ferroram
    80000000-8007ffff : mtd-ram

which is similar to:
fea00000-feafffff : PCI Bus 0000:01
  feac0000-feadffff : 0000:01:00.0
  feaec000-feaeffff : 0000:01:00.1
    feaec000-feaeffff : ICH HD audio
  feaf0000-feafffff : 0000:01:00.0

on my host-machine and shows the hierarchy slot - card - driver

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] Board support Pcontrol_G20, hardware revision 2
  2011-01-18 21:38   ` Peter Gsellmann
@ 2011-01-21 15:48     ` Jean-Christophe PLAGNIOL-VILLARD
  2011-01-31 13:18       ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 5+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-01-21 15:48 UTC (permalink / raw)
  To: linux-arm-kernel

On 22:38 Tue 18 Jan     , Peter Gsellmann wrote:
> Am Dienstag, 18. Januar 2011, 19:56:57 schrieb Jean-Christophe PLAGNIOL-VILLARD:
> > On 18:43 Mon 17 Jan     , Peter Gsellmann wrote:
> > >  Backplane timings adjusted
> > >  Addition of specific platform devices and resources
> > >  Leds renamed
> > >  Minor bugfixes
> > I'd prefer to split the patch for bisect
> Is this really a requirement?
no a preference

I'd prefer to split at least between bug fix and new features

Best Regards,
J.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] Board support Pcontrol_G20, hardware revision 2
  2011-01-21 15:48     ` Jean-Christophe PLAGNIOL-VILLARD
@ 2011-01-31 13:18       ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 0 replies; 5+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-01-31 13:18 UTC (permalink / raw)
  To: linux-arm-kernel

On 16:48 Fri 21 Jan     , Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 22:38 Tue 18 Jan     , Peter Gsellmann wrote:
> > Am Dienstag, 18. Januar 2011, 19:56:57 schrieb Jean-Christophe PLAGNIOL-VILLARD:
> > > On 18:43 Mon 17 Jan     , Peter Gsellmann wrote:
> > > >  Backplane timings adjusted
> > > >  Addition of specific platform devices and resources
> > > >  Leds renamed
> > > >  Minor bugfixes
> > > I'd prefer to split the patch for bisect
> > Is this really a requirement?
> no a preference
> 
> I'd prefer to split at least between bug fix and new features
Ping

Best Regards,
J.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-01-31 13:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-17 17:43 [PATCH] Board support Pcontrol_G20, hardware revision 2 Peter Gsellmann
2011-01-18 18:56 ` Jean-Christophe PLAGNIOL-VILLARD
2011-01-18 21:38   ` Peter Gsellmann
2011-01-21 15:48     ` Jean-Christophe PLAGNIOL-VILLARD
2011-01-31 13:18       ` Jean-Christophe PLAGNIOL-VILLARD

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).