All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] nios2: add gpio based status led driver
@ 2010-03-27  4:54 Thomas Chou
  2010-04-20 13:19 ` Scott McNutt
  2010-04-21  0:45 ` [U-Boot] [PATCH v2] misc: " Thomas Chou
  0 siblings, 2 replies; 49+ messages in thread
From: Thomas Chou @ 2010-03-27  4:54 UTC (permalink / raw)
  To: u-boot

This patch adds a gpio based status led driver. The led mask
is used to specify the gpio pin.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
---
 board/altera/common/gpioled.c |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)
 create mode 100644 board/altera/common/gpioled.c

diff --git a/board/altera/common/gpioled.c b/board/altera/common/gpioled.c
new file mode 100644
index 0000000..9a51fae
--- /dev/null
+++ b/board/altera/common/gpioled.c
@@ -0,0 +1,30 @@
+/*
+ * Status LED driver based on gpio
+ *
+ * Copyright (C) 2010 Thomas Chou <thomas@wytron.com.tw>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <common.h>
+#include <status_led.h>
+#include <asm/gpio.h>
+
+/* assume led is active low */
+
+void __led_init(led_id_t mask, int state)
+{
+	gpio_direction_output(mask, (state == STATUS_LED_ON) ? 0 : 1);
+}
+
+void __led_set(led_id_t mask, int state)
+{
+	gpio_set_value(mask, (state == STATUS_LED_ON) ? 0 : 1);
+}
+
+void __led_toggle(led_id_t mask)
+{
+	gpio_set_value(mask, !gpio_get_value (mask));
+}
-- 
1.6.6.1

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

* [U-Boot] [PATCH] nios2: add gpio based status led driver
  2010-03-27  4:54 [U-Boot] [PATCH] nios2: add gpio based status led driver Thomas Chou
@ 2010-04-20 13:19 ` Scott McNutt
  2010-04-20 15:05   ` Thomas Chou
  2010-04-21  0:45 ` [U-Boot] [PATCH v2] misc: " Thomas Chou
  1 sibling, 1 reply; 49+ messages in thread
From: Scott McNutt @ 2010-04-20 13:19 UTC (permalink / raw)
  To: u-boot

Thomas,

Thomas Chou wrote:
> This patch adds a gpio based status led driver. The led mask
> is used to specify the gpio pin.
> 
> Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
> ---
>  board/altera/common/gpioled.c |   30 ++++++++++++++++++++++++++++++
>  1 files changed, 30 insertions(+), 0 deletions(-)
>  create mode 100644 board/altera/common/gpioled.c
> 
> diff --git a/board/altera/common/gpioled.c b/board/altera/common/gpioled.c
> new file mode 100644
> index 0000000..9a51fae
> --- /dev/null
> +++ b/board/altera/common/gpioled.c
> @@ -0,0 +1,30 @@
> +/*
> + * Status LED driver based on gpio
> + *
> + * Copyright (C) 2010 Thomas Chou <thomas@wytron.com.tw>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +
> +#include <common.h>
> +#include <status_led.h>
> +#include <asm/gpio.h>
> +
> +/* assume led is active low */
> +
> +void __led_init(led_id_t mask, int state)
> +{
> +	gpio_direction_output(mask, (state == STATUS_LED_ON) ? 0 : 1);

The direction register only exists when the PIO core hardware
is configured in bidirectional mode.

> +void __led_set(led_id_t mask, int state)
> +{
> +	gpio_set_value(mask, (state == STATUS_LED_ON) ? 0 : 1);
> +}
> +
> +void __led_toggle(led_id_t mask)
> +{
> +	gpio_set_value(mask, !gpio_get_value (mask));
> +}

If the PIO core hardware is configured in output-only mode,
reading from data returns an undefined value.

As I recall, the older designs configured the LED PIO ports
as output only ... which is why board/altera/common/epled.c
was coded in such a manner.

Regards,
--Scott

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

* [U-Boot] [PATCH] nios2: add gpio based status led driver
  2010-04-20 13:19 ` Scott McNutt
@ 2010-04-20 15:05   ` Thomas Chou
  2010-04-20 16:19     ` Scott McNutt
  0 siblings, 1 reply; 49+ messages in thread
From: Thomas Chou @ 2010-04-20 15:05 UTC (permalink / raw)
  To: u-boot

On 04/20/2010 09:19 PM, Scott McNutt wrote:
>> +void __led_init(led_id_t mask, int state)
>> +{
>> +    gpio_direction_output(mask, (state == STATUS_LED_ON) ? 0 : 1);
>
>
> The direction register only exists when the PIO core hardware
> is configured in bidirectional mode.

> If the PIO core hardware is configured in output-only mode,
> reading from data returns an undefined value.
>
> As I recall, the older designs configured the LED PIO ports
> as output only ... which is why board/altera/common/epled.c
> was coded in such a manner.
>
Hi Scott,

This is not for Altera PIO interface. I followed the gpio interface of 
Linux, linux-2.6/Documentation/gpio.txt, and created a trivial bit 
addressing gpio core, which uses fewer LE and doesn't required interrupt 
disabled to write a bit. With this core, all output pins are 
bidirectional and can be read. I used it to access i2c, one-wire, leds, 
buttons and nand flash busy flag in nios2 linux. I didn't add irq 
support, because input layer of linux can do debounce. Please look at 
http://nioswiki.com/GPIO.

Best regards,
Thomas

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

* [U-Boot] [PATCH] nios2: add gpio based status led driver
  2010-04-20 15:05   ` Thomas Chou
@ 2010-04-20 16:19     ` Scott McNutt
  2010-04-21  0:33       ` Thomas Chou
  0 siblings, 1 reply; 49+ messages in thread
From: Scott McNutt @ 2010-04-20 16:19 UTC (permalink / raw)
  To: u-boot

Thomas Chou wrote:
> On 04/20/2010 09:19 PM, Scott McNutt wrote:
>>> +void __led_init(led_id_t mask, int state)
>>> +{
>>> +    gpio_direction_output(mask, (state == STATUS_LED_ON) ? 0 : 1);
>>
>>
>> The direction register only exists when the PIO core hardware
>> is configured in bidirectional mode.
> 
>> If the PIO core hardware is configured in output-only mode,
>> reading from data returns an undefined value.
>>
>> As I recall, the older designs configured the LED PIO ports
>> as output only ... which is why board/altera/common/epled.c
>> was coded in such a manner.
>>
> Hi Scott,
> 
> This is not for Altera PIO interface. I followed the gpio interface of 
> Linux, linux-2.6/Documentation/gpio.txt, and created a trivial bit 
> addressing gpio core,

I don't think the Altera board tree is an appropriate place for
code that supports custom logic blocks. If an Altera distribution
provided a design that included this custom block in one of their
board designs then it would probably be fine.

I'm not sure where this should go ... maybe in the driver tree?

Regards,
--Scott

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

* [U-Boot] [PATCH] nios2: add gpio based status led driver
  2010-04-20 16:19     ` Scott McNutt
@ 2010-04-21  0:33       ` Thomas Chou
  0 siblings, 0 replies; 49+ messages in thread
From: Thomas Chou @ 2010-04-21  0:33 UTC (permalink / raw)
  To: u-boot

On 04/21/2010 12:19 AM, Scott McNutt wrote:
>
> I don't think the Altera board tree is an appropriate place for
> code that supports custom logic blocks. If an Altera distribution
> provided a design that included this custom block in one of their
> board designs then it would probably be fine.
>
> I'm not sure where this should go ... maybe in the driver tree?
>
Hi Scott,

Thanks. I will move it to drivers/misc.

Cheers,
Thomas

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

* [U-Boot] [PATCH v2] misc: add gpio based status led driver
  2010-03-27  4:54 [U-Boot] [PATCH] nios2: add gpio based status led driver Thomas Chou
  2010-04-20 13:19 ` Scott McNutt
@ 2010-04-21  0:45 ` Thomas Chou
  2010-04-24 19:23   ` Wolfgang Denk
                     ` (2 more replies)
  1 sibling, 3 replies; 49+ messages in thread
From: Thomas Chou @ 2010-04-21  0:45 UTC (permalink / raw)
  To: u-boot

This patch adds a status led driver followed the GPIO access
conventions of Linux. The led mask is used to specify the gpio pin.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
---
Moved to drivers/misc.

 drivers/misc/Makefile   |    1 +
 drivers/misc/gpio_led.c |   30 ++++++++++++++++++++++++++++++
 2 files changed, 31 insertions(+), 0 deletions(-)
 create mode 100644 drivers/misc/gpio_led.c

diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index f6df60f..55ff17f 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -28,6 +28,7 @@ LIB	:= $(obj)libmisc.a
 COBJS-$(CONFIG_ALI152X) += ali512x.o
 COBJS-$(CONFIG_DS4510)  += ds4510.o
 COBJS-$(CONFIG_FSL_LAW) += fsl_law.o
+COBJS-$(CONFIG_GPIO_LED) += gpio_led.o
 COBJS-$(CONFIG_NS87308) += ns87308.o
 COBJS-$(CONFIG_STATUS_LED) += status_led.o
 COBJS-$(CONFIG_TWL4030_LED) += twl4030_led.o
diff --git a/drivers/misc/gpio_led.c b/drivers/misc/gpio_led.c
new file mode 100644
index 0000000..eff1433
--- /dev/null
+++ b/drivers/misc/gpio_led.c
@@ -0,0 +1,30 @@
+/*
+ * Status LED driver based on GPIO access conventions of Linux
+ *
+ * Copyright (C) 2010 Thomas Chou <thomas@wytron.com.tw>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <common.h>
+#include <status_led.h>
+#include <asm/gpio.h>
+
+/* assume led is active low */
+
+void __led_init(led_id_t mask, int state)
+{
+	gpio_direction_output(mask, (state == STATUS_LED_ON) ? 0 : 1);
+}
+
+void __led_set(led_id_t mask, int state)
+{
+	gpio_set_value(mask, (state == STATUS_LED_ON) ? 0 : 1);
+}
+
+void __led_toggle(led_id_t mask)
+{
+	gpio_set_value(mask, !gpio_get_value (mask));
+}
-- 
1.6.6.1

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

* [U-Boot] [PATCH v2] misc: add gpio based status led driver
  2010-04-21  0:45 ` [U-Boot] [PATCH v2] misc: " Thomas Chou
@ 2010-04-24 19:23   ` Wolfgang Denk
  2010-04-24 22:07     ` Thomas Chou
  2010-04-27  3:29   ` [U-Boot] [PATCH] nios2: add epcs, gpio led and mmc_spi to nios2-generic Thomas Chou
  2010-06-09  4:27   ` [U-Boot] [PATCH v2] misc: add gpio based status led driver Mike Frysinger
  2 siblings, 1 reply; 49+ messages in thread
From: Wolfgang Denk @ 2010-04-24 19:23 UTC (permalink / raw)
  To: u-boot

Dear Thomas Chou,

In message <1271810712-16238-1-git-send-email-thomas@wytron.com.tw> you wrote:
> This patch adds a status led driver followed the GPIO access
> conventions of Linux. The led mask is used to specify the gpio pin.
> 
> Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
> ---
> Moved to drivers/misc.

Which boards are the users of this code?

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Conceptual integrity in turn dictates that the  design  must  proceed
from  one  mind,  or  from  a  very small number of agreeing resonant
minds.               - Frederick Brooks Jr., "The Mythical Man Month" 

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

* [U-Boot] [PATCH v2] misc: add gpio based status led driver
  2010-04-24 19:23   ` Wolfgang Denk
@ 2010-04-24 22:07     ` Thomas Chou
  2010-04-24 22:32       ` Wolfgang Denk
  0 siblings, 1 reply; 49+ messages in thread
From: Thomas Chou @ 2010-04-24 22:07 UTC (permalink / raw)
  To: u-boot

On 04/25/2010 03:23 AM, Wolfgang Denk wrote:
> Dear Thomas Chou,
>
> In message<1271810712-16238-1-git-send-email-thomas@wytron.com.tw>  you wrote:
>    
>> This patch adds a status led driver followed the GPIO access
>> conventions of Linux. The led mask is used to specify the gpio pin.
>>
>> Signed-off-by: Thomas Chou<thomas@wytron.com.tw>
>> ---
>> Moved to drivers/misc.
>>      
> Which boards are the users of this code?
>
> Best regards,
>
> Wolfgang Denk
>
>    
Hi Wolfgang,

It is used in the example designs of Altera NEEK and DE2 boards, which I 
provided for nios2 linux/uclinux on nios wiki. They are used by many 
nios2 users.

It may be used by other boards which support the GPIO access conventions 
of Linux. Though the GPIO access is not unified in u-boot currently, I 
think it should be the right direction to follow the conventions of Linux.

Best regards,
Thomas

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

* [U-Boot] [PATCH v2] misc: add gpio based status led driver
  2010-04-24 22:07     ` Thomas Chou
@ 2010-04-24 22:32       ` Wolfgang Denk
  2010-04-24 22:59         ` Thomas Chou
  0 siblings, 1 reply; 49+ messages in thread
From: Wolfgang Denk @ 2010-04-24 22:32 UTC (permalink / raw)
  To: u-boot

Dear Thomas Chou,

In message <4BD36BAE.2060903@wytron.com.tw> you wrote:
>
> >> This patch adds a status led driver followed the GPIO access
> >> conventions of Linux. The led mask is used to specify the gpio pin.
> >>
> >> Signed-off-by: Thomas Chou<thomas@wytron.com.tw>
> >> ---
> >> Moved to drivers/misc.
> >>      
> > Which boards are the users of this code?
...

> It is used in the example designs of Altera NEEK and DE2 boards, which I 
> provided for nios2 linux/uclinux on nios wiki. They are used by many 
> nios2 users.
> 
> It may be used by other boards which support the GPIO access conventions 
> of Linux. Though the GPIO access is not unified in u-boot currently, I 
> think it should be the right direction to follow the conventions of Linux.

I mean, which board in U-Boot uses this code? I didn't find any.

The convention is not to add unused code. If there are no real users
for this, the patch should be delayed until a board gets added that
actually uses it.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
You are an excellent tactician, Captain. You let your second in  com-
mand attack while you sit and watch for weakness.
	-- Khan Noonian Singh, "Space Seed", stardate 3141.9

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

* [U-Boot] [PATCH v2] misc: add gpio based status led driver
  2010-04-24 22:32       ` Wolfgang Denk
@ 2010-04-24 22:59         ` Thomas Chou
  2010-04-25  0:48           ` Scott McNutt
  2010-04-25 18:14           ` Wolfgang Denk
  0 siblings, 2 replies; 49+ messages in thread
From: Thomas Chou @ 2010-04-24 22:59 UTC (permalink / raw)
  To: u-boot

On 04/25/2010 06:32 AM, Wolfgang Denk wrote:
>
> I mean, which board in U-Boot uses this code? I didn't find any.
>
> The convention is not to add unused code. If there are no real users
> for this, the patch should be delayed until a board gets added that
> actually uses it.
>
>    
Hi Wolfgang,

These nios2 boards are now supported with the nios2-generic board 
approach, like that of microblaze-generic, instead of adding every nios2 
board to u-boot mainline. The nios2-generic board patch was applied to 
Scott's next branch.

The gpio led can be enabled with the following added to the board config 
file.

/*
  * STATUS LED
  */
#define CONFIG_STATUS_LED        /* Enable status driver */
#define CONFIG_GPIO_LED        /* Enable gpio led driver */

#define STATUS_LED_BIT            2    /* Bit-2 on GPIO */
#define STATUS_LED_STATE        1    /* Blinking */
#define STATUS_LED_PERIOD    (500 / CONFIG_SYS_NIOS_TMRMS) /* 500 msec */

Cheers,
Thomas

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

* [U-Boot] [PATCH v2] misc: add gpio based status led driver
  2010-04-24 22:59         ` Thomas Chou
@ 2010-04-25  0:48           ` Scott McNutt
  2010-04-25 18:15             ` Wolfgang Denk
  2010-04-25 18:14           ` Wolfgang Denk
  1 sibling, 1 reply; 49+ messages in thread
From: Scott McNutt @ 2010-04-25  0:48 UTC (permalink / raw)
  To: u-boot

Hi Wolfgang,

Thomas Chou wrote:
> On 04/25/2010 06:32 AM, Wolfgang Denk wrote:
>>
>> I mean, which board in U-Boot uses this code? I didn't find any.

I think the most accurate answer is both "all" and "none" ... and
I'm not trying to be funny or disrespectful in any way. It's just
so very easy to replace peripherals with these FPGA based systems.

>> The convention is not to add unused code. If there are no real users
>> for this, the patch should be delayed until a board gets added that
>> actually uses it.
>>
My understanding is that the nios2 linux folks make use of the
peripheral that this driver supports. However, the peripheral is
not a standard Altera peripheral. In any case, it can essentially
be used on any nios2 board as a replacement for the stock PIO
peripheral.

> These nios2 boards are now supported with the nios2-generic board 
> approach, like that of microblaze-generic, instead of adding every nios2 
> board to u-boot mainline. The nios2-generic board patch was applied to 
> Scott's next branch.

Correct. I asked Thomas to remove this peripheral from the Altera
board tree because it was not associated with a _standard_ Altera
peripheral. That is, anyone using the default configurations
from Altera will never use this driver.

However, the nios2 linux folks are very likely to use it (as a
replacement). And, when they build u-boot, it will probably be
configured using the nios2-generic board. So this isn't a rabbit
in the hat ... the code will used. It's just not directly tied
to a particular PCB from a traditional point of view.

Regards,
--Scott

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

* [U-Boot] [PATCH v2] misc: add gpio based status led driver
  2010-04-24 22:59         ` Thomas Chou
  2010-04-25  0:48           ` Scott McNutt
@ 2010-04-25 18:14           ` Wolfgang Denk
  2010-04-28  3:51             ` Thomas Chou
                               ` (7 more replies)
  1 sibling, 8 replies; 49+ messages in thread
From: Wolfgang Denk @ 2010-04-25 18:14 UTC (permalink / raw)
  To: u-boot

Dear Thomas Chou,

In message <4BD377C9.6010809@wytron.com.tw> you wrote:
>
> > The convention is not to add unused code. If there are no real users
> > for this, the patch should be delayed until a board gets added that
> > actually uses it.
> 
> These nios2 boards are now supported with the nios2-generic board 
> approach, like that of microblaze-generic, instead of adding every nios2 
> board to u-boot mainline. The nios2-generic board patch was applied to 
> Scott's next branch.
> 
> The gpio led can be enabled with the following added to the board config 
> file.

As long as no board actually uses this code we should put that patch
on hold. Please resubmit it as part of the patch series that adds the
first board that uses this code.  Thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
It's all Klatchian to me.
        - Terry Pratchett & Stephen Briggs, _The Discworld Companion_

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

* [U-Boot] [PATCH v2] misc: add gpio based status led driver
  2010-04-25  0:48           ` Scott McNutt
@ 2010-04-25 18:15             ` Wolfgang Denk
  0 siblings, 0 replies; 49+ messages in thread
From: Wolfgang Denk @ 2010-04-25 18:15 UTC (permalink / raw)
  To: u-boot

Dear Scott McNutt,

In message <4BD39170.2040502@psyent.com> you wrote:
> 
> >> I mean, which board in U-Boot uses this code? I didn't find any.
> 
> I think the most accurate answer is both "all" and "none" ... and
> I'm not trying to be funny or disrespectful in any way. It's just
> so very easy to replace peripherals with these FPGA based systems.

Yes, but the current number of actual users so far is zero.

> However, the nios2 linux folks are very likely to use it (as a
> replacement). And, when they build u-boot, it will probably be
> configured using the nios2-generic board. So this isn't a rabbit
> in the hat ... the code will used. It's just not directly tied
> to a particular PCB from a traditional point of view.

OK. Let's add the code when there is a user for it.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The use of COBOL cripples the mind; its teaching  should,  therefore,
be regarded as a criminal offense.                   - E. W. Dijkstra

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

* [U-Boot] [PATCH] nios2: add epcs, gpio led and mmc_spi to nios2-generic
  2010-04-21  0:45 ` [U-Boot] [PATCH v2] misc: " Thomas Chou
  2010-04-24 19:23   ` Wolfgang Denk
@ 2010-04-27  3:29   ` Thomas Chou
  2010-04-28  3:08     ` [U-Boot] [PATCH v2] " Thomas Chou
  2010-06-09  4:27   ` [U-Boot] [PATCH v2] misc: add gpio based status led driver Mike Frysinger
  2 siblings, 1 reply; 49+ messages in thread
From: Thomas Chou @ 2010-04-27  3:29 UTC (permalink / raw)
  To: u-boot

Since Wolfgang requests that new driver should be used with a
board, these peripherals are added to the nios2-generic board.

It will exercise drivers in these outstanding patches,
04/17 [PATCH v4] nios2: add gpio support
04/21 [PATCH v2] misc: add gpio based status led driver
04/27 [PATCH v8] spi: add altera spi controller support
04/27 [PATCH v3] mmc: add generic mmc spi driver

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
---
 board/altera/nios2-generic/custom_fpga.h   |   29 ++++++++++++++++++++++++++++
 board/altera/nios2-generic/nios2-generic.c |   13 ++++++++++++
 include/configs/nios2-generic.h            |    9 ++++++-
 3 files changed, 49 insertions(+), 2 deletions(-)

diff --git a/board/altera/nios2-generic/custom_fpga.h b/board/altera/nios2-generic/custom_fpga.h
index 761f605..4e51ea3 100644
--- a/board/altera/nios2-generic/custom_fpga.h
+++ b/board/altera/nios2-generic/custom_fpga.h
@@ -63,4 +63,33 @@
 /* sysid.control_slave is a altera_avalon_sysid */
 #define CONFIG_SYS_SYSID_BASE 0x821208b8
 
+/* epcs_controller.epcs_control_port is a altera_avalon_epcs_flash_controller */
+#define CONFIG_SYS_SPI_BASE 0x82100200
+#define CONFIG_ALTERA_SPI
+#define CONFIG_CMD_SPI
+#define CONFIG_CMD_SF
+#define CONFIG_SF_DEFAULT_SPEED 30000000
+#define CONFIG_SPI_FLASH
+#define CONFIG_SPI_FLASH_STMICRO
+
+/* gpio_0.avalon_slave_0 is a gpio */
+#define CONFIG_SYS_GPIO_BASE 0x82120900
+
+/* mmc_spi.spi_control_port is a altera_avalon_spi */
+#define MMC_SPI_BASE 0x82120940
+#define CONFIG_SYS_ALTERA_SPI_LIST { CONFIG_SYS_SPI_BASE, MMC_SPI_BASE }
+#define CONFIG_ALTERA_SPI
+#define CONFIG_CMD_SPI
+#define CONFIG_CMD_MMC
+#define CONFIG_MMC
+#define CONFIG_GENERIC_MMC
+#define CONFIG_CMD_MMC_SPI
+#define CONFIG_MMC_SPI
+#define CONFIG_MMC_SPI_BUS 1
+#define CONFIG_MMC_SPI_CS 0
+#define CONFIG_MMC_SPI_SPEED 30000000
+#define CONFIG_MMC_SPI_MODE SPI_MODE_3
+#define CONFIG_CMD_FAT
+#define CONFIG_DOS_PARTITION
+
 #endif /* _CUSTOM_FPGA_H_ */
diff --git a/board/altera/nios2-generic/nios2-generic.c b/board/altera/nios2-generic/nios2-generic.c
index 89848cf..f19fb1a 100644
--- a/board/altera/nios2-generic/nios2-generic.c
+++ b/board/altera/nios2-generic/nios2-generic.c
@@ -24,6 +24,7 @@
 
 #include <common.h>
 #include <netdev.h>
+#include <mmc_spi.h>
 
 void text_base_hook(void); /* nop hook for text_base.S */
 
@@ -66,3 +67,15 @@ int board_eth_init(bd_t *bis)
 	return rc;
 }
 #endif
+
+#ifdef CONFIG_GENERIC_MMC
+int board_mmc_init(bd_t *bis)
+{
+	int rc = 0;
+#ifdef CONFIG_MMC_SPI
+	rc = mmc_spi_init(CONFIG_MMC_SPI_BUS, CONFIG_MMC_SPI_CS,
+			  CONFIG_MMC_SPI_SPEED, CONFIG_MMC_SPI_MODE);
+#endif
+	return rc;
+}
+#endif
diff --git a/include/configs/nios2-generic.h b/include/configs/nios2-generic.h
index e83e1e3..3716275 100644
--- a/include/configs/nios2-generic.h
+++ b/include/configs/nios2-generic.h
@@ -63,6 +63,7 @@
  * STATUS LED
  */
 #define CONFIG_STATUS_LED		/* Enable status driver */
+#undef  CONFIG_GPIO_LED		/* Enable GPIO LED driver */
 #define CONFIG_EPLED			/* Enable LED PIO driver */
 #define CONFIG_SYS_LEDPIO_ADDR		LED_PIO_BASE
 
@@ -108,7 +109,7 @@
 #define CONFIG_ENV_SIZE		0x10000	/* 64k, 1 sector */
 #define CONFIG_ENV_OVERWRITE		/* Serial change Ok	*/
 #define CONFIG_ENV_ADDR		((CONFIG_SYS_RESET_ADDR + \
-					  CONFIG_SYS_MONITOR_LEN) | \
+					  0x40000) | \
 					 CONFIG_SYS_FLASH_BASE)
 
 /*
@@ -119,7 +120,11 @@
  *	-The stack is placed below global data (&grows down).
  */
 #define CONFIG_MONITOR_IS_IN_RAM
-#define CONFIG_SYS_MONITOR_LEN		0x40000	/* Reserve 256k */
+#if defined(CONFIG_CMD_FAT)
+# define CONFIG_SYS_MONITOR_LEN	0x80000	/* Reserve 512k */
+#else
+# define CONFIG_SYS_MONITOR_LEN	0x40000	/* Reserve 256k */
+#endif
 #define CONFIG_SYS_MONITOR_BASE	(CONFIG_SYS_SDRAM_BASE + \
 					 CONFIG_SYS_SDRAM_SIZE - \
 					 CONFIG_SYS_MONITOR_LEN)
-- 
1.6.6.1

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

* [U-Boot] [PATCH v2] nios2: add epcs, gpio led and mmc_spi to nios2-generic
  2010-04-27  3:29   ` [U-Boot] [PATCH] nios2: add epcs, gpio led and mmc_spi to nios2-generic Thomas Chou
@ 2010-04-28  3:08     ` Thomas Chou
  0 siblings, 0 replies; 49+ messages in thread
From: Thomas Chou @ 2010-04-28  3:08 UTC (permalink / raw)
  To: u-boot

Since Wolfgang requests that new driver should be used with a
board, these peripherals are added to the nios2-generic board.

It will exercise drivers in these outstanding patches,
04/17 [PATCH v4] nios2: add gpio support
04/21 [PATCH v2] misc: add gpio based status led driver
04/28 [PATCH v9] spi: add altera spi controller support
04/28 [PATCH v4] mmc: add generic mmc spi driver

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
---
v2 remove mmc_spi_init() from nios2-generic.c.

 board/altera/nios2-generic/custom_fpga.h |   29 +++++++++++++++++++++++++++++
 include/configs/nios2-generic.h          |    9 +++++++--
 2 files changed, 36 insertions(+), 2 deletions(-)

diff --git a/board/altera/nios2-generic/custom_fpga.h b/board/altera/nios2-generic/custom_fpga.h
index 761f605..4e51ea3 100644
--- a/board/altera/nios2-generic/custom_fpga.h
+++ b/board/altera/nios2-generic/custom_fpga.h
@@ -63,4 +63,33 @@
 /* sysid.control_slave is a altera_avalon_sysid */
 #define CONFIG_SYS_SYSID_BASE 0x821208b8
 
+/* epcs_controller.epcs_control_port is a altera_avalon_epcs_flash_controller */
+#define CONFIG_SYS_SPI_BASE 0x82100200
+#define CONFIG_ALTERA_SPI
+#define CONFIG_CMD_SPI
+#define CONFIG_CMD_SF
+#define CONFIG_SF_DEFAULT_SPEED 30000000
+#define CONFIG_SPI_FLASH
+#define CONFIG_SPI_FLASH_STMICRO
+
+/* gpio_0.avalon_slave_0 is a gpio */
+#define CONFIG_SYS_GPIO_BASE 0x82120900
+
+/* mmc_spi.spi_control_port is a altera_avalon_spi */
+#define MMC_SPI_BASE 0x82120940
+#define CONFIG_SYS_ALTERA_SPI_LIST { CONFIG_SYS_SPI_BASE, MMC_SPI_BASE }
+#define CONFIG_ALTERA_SPI
+#define CONFIG_CMD_SPI
+#define CONFIG_CMD_MMC
+#define CONFIG_MMC
+#define CONFIG_GENERIC_MMC
+#define CONFIG_CMD_MMC_SPI
+#define CONFIG_MMC_SPI
+#define CONFIG_MMC_SPI_BUS 1
+#define CONFIG_MMC_SPI_CS 0
+#define CONFIG_MMC_SPI_SPEED 30000000
+#define CONFIG_MMC_SPI_MODE SPI_MODE_3
+#define CONFIG_CMD_FAT
+#define CONFIG_DOS_PARTITION
+
 #endif /* _CUSTOM_FPGA_H_ */
diff --git a/include/configs/nios2-generic.h b/include/configs/nios2-generic.h
index e83e1e3..3716275 100644
--- a/include/configs/nios2-generic.h
+++ b/include/configs/nios2-generic.h
@@ -63,6 +63,7 @@
  * STATUS LED
  */
 #define CONFIG_STATUS_LED		/* Enable status driver */
+#undef  CONFIG_GPIO_LED		/* Enable GPIO LED driver */
 #define CONFIG_EPLED			/* Enable LED PIO driver */
 #define CONFIG_SYS_LEDPIO_ADDR		LED_PIO_BASE
 
@@ -108,7 +109,7 @@
 #define CONFIG_ENV_SIZE		0x10000	/* 64k, 1 sector */
 #define CONFIG_ENV_OVERWRITE		/* Serial change Ok	*/
 #define CONFIG_ENV_ADDR		((CONFIG_SYS_RESET_ADDR + \
-					  CONFIG_SYS_MONITOR_LEN) | \
+					  0x40000) | \
 					 CONFIG_SYS_FLASH_BASE)
 
 /*
@@ -119,7 +120,11 @@
  *	-The stack is placed below global data (&grows down).
  */
 #define CONFIG_MONITOR_IS_IN_RAM
-#define CONFIG_SYS_MONITOR_LEN		0x40000	/* Reserve 256k */
+#if defined(CONFIG_CMD_FAT)
+# define CONFIG_SYS_MONITOR_LEN	0x80000	/* Reserve 512k */
+#else
+# define CONFIG_SYS_MONITOR_LEN	0x40000	/* Reserve 256k */
+#endif
 #define CONFIG_SYS_MONITOR_BASE	(CONFIG_SYS_SDRAM_BASE + \
 					 CONFIG_SYS_SDRAM_SIZE - \
 					 CONFIG_SYS_MONITOR_LEN)
-- 
1.6.6.1

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

* [U-Boot] [PATCH v2] misc: add gpio based status led driver
  2010-04-25 18:14           ` Wolfgang Denk
@ 2010-04-28  3:51             ` Thomas Chou
  2010-05-04 22:30               ` Wolfgang Denk
  2010-04-30  3:34             ` [U-Boot] [PATCH 0/6] add gpio_led and altera_spi drivers Thomas Chou
                               ` (6 subsequent siblings)
  7 siblings, 1 reply; 49+ messages in thread
From: Thomas Chou @ 2010-04-28  3:51 UTC (permalink / raw)
  To: u-boot

On 04/26/2010 02:14 AM, Wolfgang Denk wrote:
> As long as no board actually uses this code we should put that patch
> on hold. Please resubmit it as part of the patch series that adds the
> first board that uses this code.  Thanks.
>
>    
Hi Wolfgang,

I sent a patch to enable some peripherals on the nios2-generic board.

04/28 [PATCH v2] nios2: add epcs, gpio led and mmc_spi to nios2-generic

This patch should be applied after the other outstanding patches. Please let me know if this is all right?

Best regards,
Thomas

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

* [U-Boot] [PATCH 0/6] add gpio_led and altera_spi drivers
  2010-04-25 18:14           ` Wolfgang Denk
  2010-04-28  3:51             ` Thomas Chou
@ 2010-04-30  3:34             ` Thomas Chou
  2010-04-30  3:34             ` [U-Boot] [PATCH 1/6 v4] nios2: add gpio support Thomas Chou
                               ` (5 subsequent siblings)
  7 siblings, 0 replies; 49+ messages in thread
From: Thomas Chou @ 2010-04-30  3:34 UTC (permalink / raw)
  To: u-boot

This patch series add gpio_led and altera_spi support for the nios2-generic
board, which is based on the Altera EP1C20 board. It enables status LED and
SPI flash access on this board. It includes the outstanding patches to
complete the support.

Best regards,
Thomas

Thomas Chou (6):
  nios2: add gpio support
  misc: add gpio based status led driver
  nios2: add gpio support to nios2-generic board
  spi: add altera spi controller support
  spi_flash: support old STMicro parts with RES
  nios2: add spi flash support to nios2-generic board

 arch/nios2/include/asm/gpio.h            |   52 ++++++++++
 board/altera/nios2-generic/Makefile      |    1 +
 board/altera/nios2-generic/custom_fpga.h |   10 ++
 board/altera/nios2-generic/gpio.c        |   55 ++++++++++
 drivers/misc/Makefile                    |    1 +
 drivers/misc/gpio_led.c                  |   30 ++++++
 drivers/mtd/spi/spi_flash.c              |    1 +
 drivers/mtd/spi/stmicro.c                |   21 ++++
 drivers/spi/Makefile                     |    1 +
 drivers/spi/altera_spi.c                 |  165 ++++++++++++++++++++++++++++++
 include/configs/nios2-generic.h          |    6 +-
 11 files changed, 340 insertions(+), 3 deletions(-)
 create mode 100644 arch/nios2/include/asm/gpio.h
 create mode 100644 board/altera/nios2-generic/gpio.c
 create mode 100644 drivers/misc/gpio_led.c
 create mode 100644 drivers/spi/altera_spi.c

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

* [U-Boot] [PATCH 1/6 v4] nios2: add gpio support
  2010-04-25 18:14           ` Wolfgang Denk
  2010-04-28  3:51             ` Thomas Chou
  2010-04-30  3:34             ` [U-Boot] [PATCH 0/6] add gpio_led and altera_spi drivers Thomas Chou
@ 2010-04-30  3:34             ` Thomas Chou
  2010-05-21 14:39               ` [U-Boot] [Nios2-dev] " Ian Abbott
  2010-05-25 19:39               ` [U-Boot] " Scott McNutt
  2010-04-30  3:34             ` [U-Boot] [PATCH 2/6 v2] misc: add gpio based status led driver Thomas Chou
                               ` (4 subsequent siblings)
  7 siblings, 2 replies; 49+ messages in thread
From: Thomas Chou @ 2010-04-30  3:34 UTC (permalink / raw)
  To: u-boot

This patch adds driver for a trivial gpio core, which is described
in http://nioswiki.com/GPIO. It is used for gpio led and nand flash
interface in u-boot.

When CONFIG_SYS_GPIO_BASE is not defined, board may provide
its own driver.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
---
v4: remove () from gpio when it is not in a macro.
v3: arch dir reorganized.

 arch/nios2/include/asm/gpio.h |   52 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 52 insertions(+), 0 deletions(-)
 create mode 100644 arch/nios2/include/asm/gpio.h

diff --git a/arch/nios2/include/asm/gpio.h b/arch/nios2/include/asm/gpio.h
new file mode 100644
index 0000000..76c425e
--- /dev/null
+++ b/arch/nios2/include/asm/gpio.h
@@ -0,0 +1,52 @@
+/*
+ * nios2 gpio driver
+ *
+ * This gpio core is described in http://nioswiki.com/GPIO
+ * bit[0] data
+ * bit[1] output enable
+ *
+ * when CONFIG_SYS_GPIO_BASE is not defined, board may provide
+ * its own driver.
+ *
+ * Copyright (C) 2010 Thomas Chou <thomas@wytron.com.tw>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef _ASM_NIOS2_GPIO_H_
+#define _ASM_NIOS2_GPIO_H_
+
+#ifdef CONFIG_SYS_GPIO_BASE
+#include <asm/io.h>
+
+static inline int gpio_direction_input(unsigned gpio)
+{
+	writel(1, CONFIG_SYS_GPIO_BASE + (gpio << 2));
+	return 0;
+}
+
+static inline int gpio_direction_output(unsigned gpio, int value)
+{
+	writel(value ? 3 : 2, CONFIG_SYS_GPIO_BASE + (gpio << 2));
+	return 0;
+}
+
+static inline int gpio_get_value(unsigned gpio)
+{
+	return readl(CONFIG_SYS_GPIO_BASE + (gpio << 2));
+}
+
+static inline void gpio_set_value(unsigned gpio, int value)
+{
+	writel(value ? 3 : 2, CONFIG_SYS_GPIO_BASE + (gpio << 2));
+}
+#else
+extern int gpio_direction_input(unsigned gpio);
+extern int gpio_direction_output(unsigned gpio, int value);
+extern int gpio_get_value(unsigned gpio);
+extern void gpio_set_value(unsigned gpio, int value);
+#endif /* CONFIG_SYS_GPIO_BASE */
+
+#endif /* _ASM_NIOS2_GPIO_H_ */
-- 
1.6.6.1

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

* [U-Boot] [PATCH 2/6 v2] misc: add gpio based status led driver
  2010-04-25 18:14           ` Wolfgang Denk
                               ` (2 preceding siblings ...)
  2010-04-30  3:34             ` [U-Boot] [PATCH 1/6 v4] nios2: add gpio support Thomas Chou
@ 2010-04-30  3:34             ` Thomas Chou
  2010-05-21 14:40               ` [U-Boot] [Nios2-dev] " Ian Abbott
  2010-05-25 19:39               ` [U-Boot] " Scott McNutt
  2010-04-30  3:34             ` [U-Boot] [PATCH 3/6 v3] nios2: add gpio support to nios2-generic board Thomas Chou
                               ` (3 subsequent siblings)
  7 siblings, 2 replies; 49+ messages in thread
From: Thomas Chou @ 2010-04-30  3:34 UTC (permalink / raw)
  To: u-boot

This patch adds a status led driver followed the GPIO access
conventions of Linux. The led mask is used to specify the gpio pin.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
---
v2: moved to drivers/misc.

 drivers/misc/Makefile   |    1 +
 drivers/misc/gpio_led.c |   30 ++++++++++++++++++++++++++++++
 2 files changed, 31 insertions(+), 0 deletions(-)
 create mode 100644 drivers/misc/gpio_led.c

diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index f6df60f..55ff17f 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -28,6 +28,7 @@ LIB	:= $(obj)libmisc.a
 COBJS-$(CONFIG_ALI152X) += ali512x.o
 COBJS-$(CONFIG_DS4510)  += ds4510.o
 COBJS-$(CONFIG_FSL_LAW) += fsl_law.o
+COBJS-$(CONFIG_GPIO_LED) += gpio_led.o
 COBJS-$(CONFIG_NS87308) += ns87308.o
 COBJS-$(CONFIG_STATUS_LED) += status_led.o
 COBJS-$(CONFIG_TWL4030_LED) += twl4030_led.o
diff --git a/drivers/misc/gpio_led.c b/drivers/misc/gpio_led.c
new file mode 100644
index 0000000..acd6a90
--- /dev/null
+++ b/drivers/misc/gpio_led.c
@@ -0,0 +1,30 @@
+/*
+ * Status LED driver based on GPIO access conventions of Linux
+ *
+ * Copyright (C) 2010 Thomas Chou <thomas@wytron.com.tw>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <common.h>
+#include <status_led.h>
+#include <asm/gpio.h>
+
+/* assume led is active low */
+
+void __led_init(led_id_t mask, int state)
+{
+	gpio_direction_output(mask, (state == STATUS_LED_ON) ? 0 : 1);
+}
+
+void __led_set(led_id_t mask, int state)
+{
+	gpio_set_value(mask, (state == STATUS_LED_ON) ? 0 : 1);
+}
+
+void __led_toggle(led_id_t mask)
+{
+	gpio_set_value(mask, !gpio_get_value(mask));
+}
-- 
1.6.6.1

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

* [U-Boot] [PATCH 3/6 v3] nios2: add gpio support to nios2-generic board
  2010-04-25 18:14           ` Wolfgang Denk
                               ` (3 preceding siblings ...)
  2010-04-30  3:34             ` [U-Boot] [PATCH 2/6 v2] misc: add gpio based status led driver Thomas Chou
@ 2010-04-30  3:34             ` Thomas Chou
  2010-04-30 14:24               ` Scott McNutt
                                 ` (2 more replies)
  2010-04-30  3:34             ` [U-Boot] [PATCH 4/6 v10] spi: add altera spi controller support Thomas Chou
                               ` (2 subsequent siblings)
  7 siblings, 3 replies; 49+ messages in thread
From: Thomas Chou @ 2010-04-30  3:34 UTC (permalink / raw)
  To: u-boot

This patch adds gpio support of Altera PIO component to the
nios2-generic board. Though it drives only gpio_led at the
moment, it supports bidirectional port to control bit-banging
I2C, NAND flash busy status or button switches, etc.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
---
v3: split patches for gpio and spi, based gpio on altera pio core.
v2: remove mmc_spi_init()

 board/altera/nios2-generic/Makefile |    1 +
 board/altera/nios2-generic/gpio.c   |   55 +++++++++++++++++++++++++++++++++++
 include/configs/nios2-generic.h     |    6 ++--
 3 files changed, 59 insertions(+), 3 deletions(-)
 create mode 100644 board/altera/nios2-generic/gpio.c

diff --git a/board/altera/nios2-generic/Makefile b/board/altera/nios2-generic/Makefile
index 6780872..d1fca70 100644
--- a/board/altera/nios2-generic/Makefile
+++ b/board/altera/nios2-generic/Makefile
@@ -32,6 +32,7 @@ LIB	= $(obj)lib$(BOARD).a
 COBJS-y	:= $(BOARD).o
 COBJS-$(CONFIG_CMD_IDE) += ../common/cfide.o
 COBJS-$(CONFIG_EPLED) += ../common/epled.o
+COBJS-$(CONFIG_GPIO) += gpio.o
 COBJS-$(CONFIG_SEVENSEG) += ../common/sevenseg.o
 
 SOBJS-y	:= text_base.o
diff --git a/board/altera/nios2-generic/gpio.c b/board/altera/nios2-generic/gpio.c
new file mode 100644
index 0000000..6c9c6c2
--- /dev/null
+++ b/board/altera/nios2-generic/gpio.c
@@ -0,0 +1,55 @@
+/*
+ * board gpio driver
+ *
+ * Copyright (C) 2010 Thomas Chou <thomas@wytron.com.tw>
+ * Licensed under the GPL-2 or later.
+ */
+#include <common.h>
+#include <asm/io.h>
+
+#ifndef CONFIG_SYS_GPIO_BASE
+
+#define ALTERA_PIO_BASE LED_PIO_BASE
+#define ALTERA_PIO_DATA (ALTERA_PIO_BASE + 0)
+#define ALTERA_PIO_DIR (ALTERA_PIO_BASE + 4)
+static u32 pio_data_reg;
+static u32 pio_dir_reg;
+
+int gpio_direction_input(unsigned gpio)
+{
+	u32 mask = 1 << gpio;
+	writel(pio_dir_reg &= ~mask, ALTERA_PIO_DIR);
+	return 0;
+}
+
+int gpio_direction_output(unsigned gpio, int value)
+{
+	u32 mask = 1 << gpio;
+	if (value)
+		pio_data_reg |= mask;
+	else
+		pio_data_reg &= ~mask;
+	writel(pio_data_reg, ALTERA_PIO_DATA);
+	writel(pio_dir_reg |= mask, ALTERA_PIO_DIR);
+	return 0;
+}
+
+int gpio_get_value(unsigned gpio)
+{
+	u32 mask = 1 << gpio;
+	if (pio_dir_reg & mask)
+		return (pio_data_reg & mask) ? 1 : 0;
+	else
+		return (readl(ALTERA_PIO_DATA) & mask) ? 1 : 0;
+}
+
+void gpio_set_value(unsigned gpio, int value)
+{
+	u32 mask = 1 << gpio;
+	if (value)
+		pio_data_reg |= mask;
+	else
+		pio_data_reg &= ~mask;
+	writel(pio_data_reg, ALTERA_PIO_DATA);
+}
+#endif
diff --git a/include/configs/nios2-generic.h b/include/configs/nios2-generic.h
index e83e1e3..e4bf57b 100644
--- a/include/configs/nios2-generic.h
+++ b/include/configs/nios2-generic.h
@@ -63,10 +63,10 @@
  * STATUS LED
  */
 #define CONFIG_STATUS_LED		/* Enable status driver */
-#define CONFIG_EPLED			/* Enable LED PIO driver */
-#define CONFIG_SYS_LEDPIO_ADDR		LED_PIO_BASE
+#define CONFIG_GPIO_LED		/* Enable GPIO LED driver */
+#define CONFIG_GPIO			/* Enable GPIO driver */
 
-#define STATUS_LED_BIT			1	/* Bit-0 on PIO */
+#define STATUS_LED_BIT			0	/* Bit-0 on GPIO */
 #define STATUS_LED_STATE		1	/* Blinking */
 #define STATUS_LED_PERIOD	(500 / CONFIG_SYS_NIOS_TMRMS) /* 500 msec */
 
-- 
1.6.6.1

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

* [U-Boot] [PATCH 4/6 v10] spi: add altera spi controller support
  2010-04-25 18:14           ` Wolfgang Denk
                               ` (4 preceding siblings ...)
  2010-04-30  3:34             ` [U-Boot] [PATCH 3/6 v3] nios2: add gpio support to nios2-generic board Thomas Chou
@ 2010-04-30  3:34             ` Thomas Chou
  2010-05-21 14:43               ` [U-Boot] [Nios2-dev] " Ian Abbott
  2010-05-25 19:40               ` [U-Boot] " Scott McNutt
  2010-04-30  3:34             ` [U-Boot] [PATCH 5/6 v2] spi_flash: support old STMicro parts with RES Thomas Chou
  2010-04-30  3:34             ` [U-Boot] [PATCH 6/6 v3] nios2: add spi flash support to nios2-generic board Thomas Chou
  7 siblings, 2 replies; 49+ messages in thread
From: Thomas Chou @ 2010-04-30  3:34 UTC (permalink / raw)
  To: u-boot

This patch adds the driver of altera spi controller, which is
used as epcs/spi flash controller. It also works with mmc_spi
driver.

This driver support more than one spi bus, with base list declared
#define CONFIG_SYS_ALTERA_SPI_LIST { BASE_0,BASE_1,... }

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
---
v10 remove bus check in setup slave, as spi_cs_is_valid() did it.
v9 check bus in spi_cs_is_valid().
v8 fix cs activate timing.
v7 add cs activate deactive to work with legacy spi_mmc driver.
v6 wrong patch, same as v5.
v5 tabify.

 drivers/spi/Makefile     |    1 +
 drivers/spi/altera_spi.c |  165 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 166 insertions(+), 0 deletions(-)
 create mode 100644 drivers/spi/altera_spi.c

diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
index f112ed0..dfcbb8b 100644
--- a/drivers/spi/Makefile
+++ b/drivers/spi/Makefile
@@ -25,6 +25,7 @@ include $(TOPDIR)/config.mk
 
 LIB	:= $(obj)libspi.a
 
+COBJS-$(CONFIG_ALTERA_SPI) += altera_spi.o
 COBJS-$(CONFIG_ATMEL_DATAFLASH_SPI) += atmel_dataflash_spi.o
 COBJS-$(CONFIG_ATMEL_SPI) += atmel_spi.o
 COBJS-$(CONFIG_BFIN_SPI) += bfin_spi.o
diff --git a/drivers/spi/altera_spi.c b/drivers/spi/altera_spi.c
new file mode 100644
index 0000000..918b223
--- /dev/null
+++ b/drivers/spi/altera_spi.c
@@ -0,0 +1,165 @@
+/*
+ * Altera SPI driver
+ *
+ * based on bfin_spi.c
+ * Copyright (c) 2005-2008 Analog Devices Inc.
+ * Copyright (C) 2010 Thomas Chou <thomas@wytron.com.tw>
+ *
+ * Licensed under the GPL-2 or later.
+ */
+#include <common.h>
+#include <asm/io.h>
+#include <malloc.h>
+#include <spi.h>
+
+#define ALTERA_SPI_RXDATA	0
+#define ALTERA_SPI_TXDATA	4
+#define ALTERA_SPI_STATUS	8
+#define ALTERA_SPI_CONTROL	12
+#define ALTERA_SPI_SLAVE_SEL	20
+
+#define ALTERA_SPI_STATUS_ROE_MSK	(0x8)
+#define ALTERA_SPI_STATUS_TOE_MSK	(0x10)
+#define ALTERA_SPI_STATUS_TMT_MSK	(0x20)
+#define ALTERA_SPI_STATUS_TRDY_MSK	(0x40)
+#define ALTERA_SPI_STATUS_RRDY_MSK	(0x80)
+#define ALTERA_SPI_STATUS_E_MSK	(0x100)
+
+#define ALTERA_SPI_CONTROL_IROE_MSK	(0x8)
+#define ALTERA_SPI_CONTROL_ITOE_MSK	(0x10)
+#define ALTERA_SPI_CONTROL_ITRDY_MSK	(0x40)
+#define ALTERA_SPI_CONTROL_IRRDY_MSK	(0x80)
+#define ALTERA_SPI_CONTROL_IE_MSK	(0x100)
+#define ALTERA_SPI_CONTROL_SSO_MSK	(0x400)
+
+#ifndef CONFIG_SYS_ALTERA_SPI_LIST
+#define CONFIG_SYS_ALTERA_SPI_LIST { CONFIG_SYS_SPI_BASE }
+#endif
+
+static ulong altera_spi_base_list[] = CONFIG_SYS_ALTERA_SPI_LIST;
+
+struct altera_spi_slave {
+	struct spi_slave slave;
+	ulong base;
+};
+#define to_altera_spi_slave(s) container_of(s, struct altera_spi_slave, slave)
+
+__attribute__((weak))
+int spi_cs_is_valid(unsigned int bus, unsigned int cs)
+{
+	return bus < ARRAY_SIZE(altera_spi_base_list) && cs < 32;
+}
+
+__attribute__((weak))
+void spi_cs_activate(struct spi_slave *slave)
+{
+	struct altera_spi_slave *altspi = to_altera_spi_slave(slave);
+	writel(1 << slave->cs, altspi->base + ALTERA_SPI_SLAVE_SEL);
+	writel(ALTERA_SPI_CONTROL_SSO_MSK, altspi->base + ALTERA_SPI_CONTROL);
+}
+
+__attribute__((weak))
+void spi_cs_deactivate(struct spi_slave *slave)
+{
+	struct altera_spi_slave *altspi = to_altera_spi_slave(slave);
+	writel(0, altspi->base + ALTERA_SPI_CONTROL);
+	writel(0, altspi->base + ALTERA_SPI_SLAVE_SEL);
+}
+
+void spi_init(void)
+{
+}
+
+struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
+				  unsigned int max_hz, unsigned int mode)
+{
+	struct altera_spi_slave *altspi;
+
+	if (!spi_cs_is_valid(bus, cs))
+		return NULL;
+
+	altspi = malloc(sizeof(*altspi));
+	if (!altspi)
+		return NULL;
+
+	altspi->slave.bus = bus;
+	altspi->slave.cs = cs;
+	altspi->base = altera_spi_base_list[bus];
+	debug("%s: bus:%i cs:%i base:%lx\n", __func__,
+		bus, cs, altspi->base);
+
+	return &altspi->slave;
+}
+
+void spi_free_slave(struct spi_slave *slave)
+{
+	struct altera_spi_slave *altspi = to_altera_spi_slave(slave);
+	free(altspi);
+}
+
+int spi_claim_bus(struct spi_slave *slave)
+{
+	struct altera_spi_slave *altspi = to_altera_spi_slave(slave);
+
+	debug("%s: bus:%i cs:%i\n", __func__, slave->bus, slave->cs);
+	writel(0, altspi->base + ALTERA_SPI_CONTROL);
+	writel(0, altspi->base + ALTERA_SPI_SLAVE_SEL);
+	return 0;
+}
+
+void spi_release_bus(struct spi_slave *slave)
+{
+	struct altera_spi_slave *altspi = to_altera_spi_slave(slave);
+
+	debug("%s: bus:%i cs:%i\n", __func__, slave->bus, slave->cs);
+	writel(0, altspi->base + ALTERA_SPI_SLAVE_SEL);
+}
+
+#ifndef CONFIG_ALTERA_SPI_IDLE_VAL
+# define CONFIG_ALTERA_SPI_IDLE_VAL 0xff
+#endif
+
+int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout,
+	     void *din, unsigned long flags)
+{
+	struct altera_spi_slave *altspi = to_altera_spi_slave(slave);
+	/* assume spi core configured to do 8 bit transfers */
+	uint bytes = bitlen / 8;
+	const uchar *txp = dout;
+	uchar *rxp = din;
+
+	debug("%s: bus:%i cs:%i bitlen:%i bytes:%i flags:%lx\n", __func__,
+		slave->bus, slave->cs, bitlen, bytes, flags);
+	if (bitlen == 0)
+		goto done;
+
+	if (bitlen % 8) {
+		flags |= SPI_XFER_END;
+		goto done;
+	}
+
+	/* empty read buffer */
+	if (readl(altspi->base + ALTERA_SPI_STATUS) &
+	    ALTERA_SPI_STATUS_RRDY_MSK)
+		readl(altspi->base + ALTERA_SPI_RXDATA);
+	if (flags & SPI_XFER_BEGIN)
+		spi_cs_activate(slave);
+
+	while (bytes--) {
+		uchar d = txp ? *txp++ : CONFIG_ALTERA_SPI_IDLE_VAL;
+		debug("%s: tx:%x ", __func__, d);
+		writel(d, altspi->base + ALTERA_SPI_TXDATA);
+		while (!(readl(altspi->base + ALTERA_SPI_STATUS) &
+			 ALTERA_SPI_STATUS_RRDY_MSK))
+			;
+		d = readl(altspi->base + ALTERA_SPI_RXDATA);
+		if (rxp)
+			*rxp++ = d;
+		debug("rx:%x\n", d);
+	}
+ done:
+	if (flags & SPI_XFER_END)
+		spi_cs_deactivate(slave);
+
+	return 0;
+}
-- 
1.6.6.1

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

* [U-Boot] [PATCH 5/6 v2] spi_flash: support old STMicro parts with RES
  2010-04-25 18:14           ` Wolfgang Denk
                               ` (5 preceding siblings ...)
  2010-04-30  3:34             ` [U-Boot] [PATCH 4/6 v10] spi: add altera spi controller support Thomas Chou
@ 2010-04-30  3:34             ` Thomas Chou
  2010-04-30 12:48               ` Mike Frysinger
  2010-04-30 13:11               ` [U-Boot] [PATCH 5/6 v3] " Thomas Chou
  2010-04-30  3:34             ` [U-Boot] [PATCH 6/6 v3] nios2: add spi flash support to nios2-generic board Thomas Chou
  7 siblings, 2 replies; 49+ messages in thread
From: Thomas Chou @ 2010-04-30  3:34 UTC (permalink / raw)
  To: u-boot

Some old STMicro parts do not support JEDEC ID (0x9f). This patch
uses RES (0xab) to get Electronic ID and translates it to JEDEC ID.
This is needed to support the SPI flash chip on Altera EP1C20 board.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
---
v2: move the logic to stmicro's probe function.

 drivers/mtd/spi/spi_flash.c |    1 +
 drivers/mtd/spi/stmicro.c   |   21 +++++++++++++++++++++
 2 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
index 612f819..c8e4bdd 100644
--- a/drivers/mtd/spi/spi_flash.c
+++ b/drivers/mtd/spi/spi_flash.c
@@ -147,6 +147,7 @@ struct spi_flash *spi_flash_probe(unsigned int bus, unsigned int cs,
 #endif
 #ifdef CONFIG_SPI_FLASH_STMICRO
 	case 0x20:
+	case 0xff:
 		flash = spi_flash_probe_stmicro(spi, idcode);
 		break;
 #endif
diff --git a/drivers/mtd/spi/stmicro.c b/drivers/mtd/spi/stmicro.c
index ae0d047..21e9b00 100644
--- a/drivers/mtd/spi/stmicro.c
+++ b/drivers/mtd/spi/stmicro.c
@@ -46,6 +46,7 @@
 #define CMD_M25PXX_DP		0xb9	/* Deep Power-down */
 #define CMD_M25PXX_RES		0xab	/* Release from DP, and Read Signature */
 
+#define STM_ID_M25P10		0x11
 #define STM_ID_M25P16		0x15
 #define STM_ID_M25P20		0x12
 #define STM_ID_M25P32		0x16
@@ -78,6 +79,13 @@ static inline struct stmicro_spi_flash *to_stmicro_spi_flash(struct spi_flash
 
 static const struct stmicro_spi_flash_params stmicro_spi_flash_table[] = {
 	{
+		.idcode1 = STM_ID_M25P10,
+		.page_size = 256,
+		.pages_per_sector = 128,
+		.nr_sectors = 4,
+		.name = "M25P10",
+	},
+	{
 		.idcode1 = STM_ID_M25P16,
 		.page_size = 256,
 		.pages_per_sector = 256,
@@ -316,6 +324,19 @@ struct spi_flash *spi_flash_probe_stmicro(struct spi_slave *spi, u8 * idcode)
 	struct stmicro_spi_flash *stm;
 	unsigned int i;
 
+	if (idcode[0] == 0xff) {
+		i = spi_flash_cmd(spi, CMD_M25PXX_RES,
+				  idcode, 4);
+		if (i)
+			return NULL;
+		if ((idcode[3] & 0xf0) == 0x10) {
+			idcode[0] = 0x20;
+			idcode[1] = 0x20;
+			idcode[2] = idcode[3] + 1;
+		} else
+			return NULL;
+	}
+
 	for (i = 0; i < ARRAY_SIZE(stmicro_spi_flash_table); i++) {
 		params = &stmicro_spi_flash_table[i];
 		if (params->idcode1 == idcode[2]) {
-- 
1.6.6.1

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

* [U-Boot] [PATCH 6/6 v3] nios2: add spi flash support to nios2-generic board
  2010-04-25 18:14           ` Wolfgang Denk
                               ` (6 preceding siblings ...)
  2010-04-30  3:34             ` [U-Boot] [PATCH 5/6 v2] spi_flash: support old STMicro parts with RES Thomas Chou
@ 2010-04-30  3:34             ` Thomas Chou
  2010-05-21 14:44               ` [U-Boot] [Nios2-dev] " Ian Abbott
  2010-05-25 19:52               ` [U-Boot] " Scott McNutt
  7 siblings, 2 replies; 49+ messages in thread
From: Thomas Chou @ 2010-04-30  3:34 UTC (permalink / raw)
  To: u-boot

This patch enables the altera_spi and spi_flash drivers for the
nios2-generic board. It allows access to the EPCS/SPI flash on
the Altera EP1C20 board.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
---
v3: split patches for gpio and spi.
v2: remove mmc_spi_init()

 board/altera/nios2-generic/custom_fpga.h |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/board/altera/nios2-generic/custom_fpga.h b/board/altera/nios2-generic/custom_fpga.h
index 761f605..a11add5 100644
--- a/board/altera/nios2-generic/custom_fpga.h
+++ b/board/altera/nios2-generic/custom_fpga.h
@@ -35,6 +35,16 @@
 #define CONFIG_SMC91111
 #define CONFIG_SMC_USE_32_BIT
 
+/* epcs_controller.epcs_control_port is a altera_avalon_epcs_flash_controller */
+#define EPCS_CONTROLLER_REG_BASE 0x82100200
+#define CONFIG_SYS_ALTERA_SPI_LIST { EPCS_CONTROLLER_REG_BASE }
+#define CONFIG_ALTERA_SPI
+#define CONFIG_CMD_SPI
+#define CONFIG_CMD_SF
+#define CONFIG_SF_DEFAULT_SPEED 30000000
+#define CONFIG_SPI_FLASH
+#define CONFIG_SPI_FLASH_STMICRO
+
 /* jtag_uart.avalon_jtag_slave is a altera_avalon_jtag_uart */
 #define CONFIG_SYS_JTAG_UART_BASE 0x821208b0
 
-- 
1.6.6.1

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

* [U-Boot] [PATCH 5/6 v2] spi_flash: support old STMicro parts with RES
  2010-04-30  3:34             ` [U-Boot] [PATCH 5/6 v2] spi_flash: support old STMicro parts with RES Thomas Chou
@ 2010-04-30 12:48               ` Mike Frysinger
  2010-04-30 13:15                 ` Thomas Chou
  2010-04-30 13:11               ` [U-Boot] [PATCH 5/6 v3] " Thomas Chou
  1 sibling, 1 reply; 49+ messages in thread
From: Mike Frysinger @ 2010-04-30 12:48 UTC (permalink / raw)
  To: u-boot

On Thursday 29 April 2010 23:34:17 Thomas Chou wrote:
> --- a/drivers/mtd/spi/spi_flash.c
> +++ b/drivers/mtd/spi/spi_flash.c
> @@ -147,6 +147,7 @@ struct spi_flash *spi_flash_probe(unsigned int bus,
> unsigned int cs, #endif
>  #ifdef CONFIG_SPI_FLASH_STMICRO
>  	case 0x20:
> +	case 0xff:
>  		flash = spi_flash_probe_stmicro(spi, idcode);
>  		break;
>  #endif

hrm, this kind of sucks, but i guess for now it's fine.  stick a comment in 
there about why we're sending the normal error byte to the stmicro function.
	/* Let the stmicro func handle non-JEDEC ids */
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20100430/c3f1e88b/attachment.pgp 

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

* [U-Boot] [PATCH 5/6 v3] spi_flash: support old STMicro parts with RES
  2010-04-30  3:34             ` [U-Boot] [PATCH 5/6 v2] spi_flash: support old STMicro parts with RES Thomas Chou
  2010-04-30 12:48               ` Mike Frysinger
@ 2010-04-30 13:11               ` Thomas Chou
  2010-04-30 13:25                 ` Mike Frysinger
  2010-05-05  7:21                 ` Mike Frysinger
  1 sibling, 2 replies; 49+ messages in thread
From: Thomas Chou @ 2010-04-30 13:11 UTC (permalink / raw)
  To: u-boot

Some old STMicro parts do not support JEDEC ID (0x9f). This patch
uses RES (0xab) to get Electronic ID and translates it to JEDEC ID.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
---
v3: add comment as Mike suggested for 0xff id switch.
v2: move the logic to stmicro's probe function

 drivers/mtd/spi/spi_flash.c |    1 +
 drivers/mtd/spi/stmicro.c   |   21 +++++++++++++++++++++
 2 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
index 612f819..c8e4bdd 100644
--- a/drivers/mtd/spi/spi_flash.c
+++ b/drivers/mtd/spi/spi_flash.c
@@ -147,6 +147,7 @@ struct spi_flash *spi_flash_probe(unsigned int bus, unsigned int cs,
 #endif
 #ifdef CONFIG_SPI_FLASH_STMICRO
 	case 0x20:
+	case 0xff: /* Let the stmicro func handle non-JEDEC ids */
 		flash = spi_flash_probe_stmicro(spi, idcode);
 		break;
 #endif
diff --git a/drivers/mtd/spi/stmicro.c b/drivers/mtd/spi/stmicro.c
index ae0d047..21e9b00 100644
--- a/drivers/mtd/spi/stmicro.c
+++ b/drivers/mtd/spi/stmicro.c
@@ -46,6 +46,7 @@
 #define CMD_M25PXX_DP		0xb9	/* Deep Power-down */
 #define CMD_M25PXX_RES		0xab	/* Release from DP, and Read Signature */
 
+#define STM_ID_M25P10		0x11
 #define STM_ID_M25P16		0x15
 #define STM_ID_M25P20		0x12
 #define STM_ID_M25P32		0x16
@@ -78,6 +79,13 @@ static inline struct stmicro_spi_flash *to_stmicro_spi_flash(struct spi_flash
 
 static const struct stmicro_spi_flash_params stmicro_spi_flash_table[] = {
 	{
+		.idcode1 = STM_ID_M25P10,
+		.page_size = 256,
+		.pages_per_sector = 128,
+		.nr_sectors = 4,
+		.name = "M25P10",
+	},
+	{
 		.idcode1 = STM_ID_M25P16,
 		.page_size = 256,
 		.pages_per_sector = 256,
@@ -316,6 +324,19 @@ struct spi_flash *spi_flash_probe_stmicro(struct spi_slave *spi, u8 * idcode)
 	struct stmicro_spi_flash *stm;
 	unsigned int i;
 
+	if (idcode[0] == 0xff) {
+		i = spi_flash_cmd(spi, CMD_M25PXX_RES,
+				  idcode, 4);
+		if (i)
+			return NULL;
+		if ((idcode[3] & 0xf0) == 0x10) {
+			idcode[0] = 0x20;
+			idcode[1] = 0x20;
+			idcode[2] = idcode[3] + 1;
+		} else
+			return NULL;
+	}
+
 	for (i = 0; i < ARRAY_SIZE(stmicro_spi_flash_table); i++) {
 		params = &stmicro_spi_flash_table[i];
 		if (params->idcode1 == idcode[2]) {
-- 
1.6.6.1

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

* [U-Boot] [PATCH 5/6 v2] spi_flash: support old STMicro parts with RES
  2010-04-30 12:48               ` Mike Frysinger
@ 2010-04-30 13:15                 ` Thomas Chou
  0 siblings, 0 replies; 49+ messages in thread
From: Thomas Chou @ 2010-04-30 13:15 UTC (permalink / raw)
  To: u-boot

On 04/30/2010 08:48 PM, Mike Frysinger wrote:
> On Thursday 29 April 2010 23:34:17 Thomas Chou wrote:
>    
>> --- a/drivers/mtd/spi/spi_flash.c
>> +++ b/drivers/mtd/spi/spi_flash.c
>> @@ -147,6 +147,7 @@ struct spi_flash *spi_flash_probe(unsigned int bus,
>> unsigned int cs, #endif
>>   #ifdef CONFIG_SPI_FLASH_STMICRO
>>   	case 0x20:
>> +	case 0xff:
>>   		flash = spi_flash_probe_stmicro(spi, idcode);
>>   		break;
>>   #endif
>>      
> hrm, this kind of sucks, but i guess for now it's fine.  stick a comment in
> there about why we're sending the normal error byte to the stmicro function.
> 	/* Let the stmicro func handle non-JEDEC ids */
> -mike
>    
Hi Mike,

I added the comment. Thank you very much.

Best regards,
Thomas

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

* [U-Boot] [PATCH 5/6 v3] spi_flash: support old STMicro parts with RES
  2010-04-30 13:11               ` [U-Boot] [PATCH 5/6 v3] " Thomas Chou
@ 2010-04-30 13:25                 ` Mike Frysinger
  2010-05-05  7:21                 ` Mike Frysinger
  1 sibling, 0 replies; 49+ messages in thread
From: Mike Frysinger @ 2010-04-30 13:25 UTC (permalink / raw)
  To: u-boot

On Friday 30 April 2010 09:11:20 Thomas Chou wrote:
> Some old STMicro parts do not support JEDEC ID (0x9f). This patch
> uses RES (0xab) to get Electronic ID and translates it to JEDEC ID.
> 
> Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

Acked-by: Mike Frysinger <vapier@gentoo.org>

if we want to do non-jedec stuff in other parts, we can worry about 
refactoring this code then
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20100430/094fe126/attachment.pgp 

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

* [U-Boot] [PATCH 3/6 v3] nios2: add gpio support to nios2-generic board
  2010-04-30  3:34             ` [U-Boot] [PATCH 3/6 v3] nios2: add gpio support to nios2-generic board Thomas Chou
@ 2010-04-30 14:24               ` Scott McNutt
  2010-04-30 15:21                 ` Thomas Chou
  2010-05-21 14:41               ` [U-Boot] [Nios2-dev] " Ian Abbott
  2010-05-25 19:40               ` [U-Boot] " Scott McNutt
  2 siblings, 1 reply; 49+ messages in thread
From: Scott McNutt @ 2010-04-30 14:24 UTC (permalink / raw)
  To: u-boot

Thomas Chou wrote:
> This patch adds gpio support of Altera PIO component to the
> nios2-generic board. Though it drives only gpio_led at the
> moment, it supports bidirectional port to control bit-banging
> I2C, NAND flash busy status or button switches, etc.
> 
> Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
> ---
> v3: split patches for gpio and spi, based gpio on altera pio core.
> v2: remove mmc_spi_init()
> 
>  board/altera/nios2-generic/Makefile |    1 +
>  board/altera/nios2-generic/gpio.c   |   55 +++++++++++++++++++++++++++++++++++
>  include/configs/nios2-generic.h     |    6 ++--
>  3 files changed, 59 insertions(+), 3 deletions(-)
>  create mode 100644 board/altera/nios2-generic/gpio.c
> 
> diff --git a/board/altera/nios2-generic/Makefile b/board/altera/nios2-generic/Makefile
> index 6780872..d1fca70 100644
> --- a/board/altera/nios2-generic/Makefile
> +++ b/board/altera/nios2-generic/Makefile
> @@ -32,6 +32,7 @@ LIB	= $(obj)lib$(BOARD).a
>  COBJS-y	:= $(BOARD).o
>  COBJS-$(CONFIG_CMD_IDE) += ../common/cfide.o
>  COBJS-$(CONFIG_EPLED) += ../common/epled.o
> +COBJS-$(CONFIG_GPIO) += gpio.o
>  COBJS-$(CONFIG_SEVENSEG) += ../common/sevenseg.o

This will build a u-boot image that will not work with any
of the standard configurations ... correct? ... since the
GPIO component is custom (not supplied by the vendor)?

--Scott

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

* [U-Boot] [PATCH 3/6 v3] nios2: add gpio support to nios2-generic board
  2010-04-30 14:24               ` Scott McNutt
@ 2010-04-30 15:21                 ` Thomas Chou
  2010-04-30 15:35                   ` Scott McNutt
  0 siblings, 1 reply; 49+ messages in thread
From: Thomas Chou @ 2010-04-30 15:21 UTC (permalink / raw)
  To: u-boot

On 04/30/2010 10:24 PM, Scott McNutt wrote:
> Thomas Chou wrote:
>> This patch adds gpio support of Altera PIO component to the
>> nios2-generic board. Though it drives only gpio_led at the
>> moment, it supports bidirectional port to control bit-banging
>> I2C, NAND flash busy status or button switches, etc.
>>
>> Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
>> ---
>> v3: split patches for gpio and spi, based gpio on altera pio core.
>> v2: remove mmc_spi_init()
>>
>>  board/altera/nios2-generic/Makefile |    1 +
>>  board/altera/nios2-generic/gpio.c   |   55 
>> +++++++++++++++++++++++++++++++++++
>>  include/configs/nios2-generic.h     |    6 ++--
>>  3 files changed, 59 insertions(+), 3 deletions(-)
>>  create mode 100644 board/altera/nios2-generic/gpio.c
>>
>> diff --git a/board/altera/nios2-generic/Makefile 
>> b/board/altera/nios2-generic/Makefile
>> index 6780872..d1fca70 100644
>> --- a/board/altera/nios2-generic/Makefile
>> +++ b/board/altera/nios2-generic/Makefile
>> @@ -32,6 +32,7 @@ LIB    = $(obj)lib$(BOARD).a
>>  COBJS-y    := $(BOARD).o
>>  COBJS-$(CONFIG_CMD_IDE) += ../common/cfide.o
>>  COBJS-$(CONFIG_EPLED) += ../common/epled.o
>> +COBJS-$(CONFIG_GPIO) += gpio.o
>>  COBJS-$(CONFIG_SEVENSEG) += ../common/sevenseg.o
>
> This will build a u-boot image that will not work with any
> of the standard configurations ... correct? ... since the
> GPIO component is custom (not supplied by the vendor)?
>
Hi Scott,

The board gpio.c driver works on Altera PIO component. It will behave 
exactly the same as the epled driver. I have tested it on EP1C20 an 
EP2C35 board with standard configuration. I believe it will work with 
the standard configuration on EP1S10 and EP1S40. I don't want to break 
anything.

It was actually the first gpio driver I wrote for nios2-linux before the 
custom gpio core.

Best regards,
Thomas

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

* [U-Boot] [PATCH 3/6 v3] nios2: add gpio support to nios2-generic board
  2010-04-30 15:21                 ` Thomas Chou
@ 2010-04-30 15:35                   ` Scott McNutt
  0 siblings, 0 replies; 49+ messages in thread
From: Scott McNutt @ 2010-04-30 15:35 UTC (permalink / raw)
  To: u-boot

Thomas Chou wrote:
> On 04/30/2010 10:24 PM, Scott McNutt wrote:
>> Thomas Chou wrote:
>>> This patch adds gpio support of Altera PIO component to the
>>> nios2-generic board. Though it drives only gpio_led at the
>>> moment, it supports bidirectional port to control bit-banging
>>> I2C, NAND flash busy status or button switches, etc.
>>>
>>> Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
>>> ---
>>> v3: split patches for gpio and spi, based gpio on altera pio core.
>>> v2: remove mmc_spi_init()
>>>
>>>  board/altera/nios2-generic/Makefile |    1 +
>>>  board/altera/nios2-generic/gpio.c   |   55 
>>> +++++++++++++++++++++++++++++++++++
>>>  include/configs/nios2-generic.h     |    6 ++--
>>>  3 files changed, 59 insertions(+), 3 deletions(-)
>>>  create mode 100644 board/altera/nios2-generic/gpio.c
>>>
>>> diff --git a/board/altera/nios2-generic/Makefile 
>>> b/board/altera/nios2-generic/Makefile
>>> index 6780872..d1fca70 100644
>>> --- a/board/altera/nios2-generic/Makefile
>>> +++ b/board/altera/nios2-generic/Makefile
>>> @@ -32,6 +32,7 @@ LIB    = $(obj)lib$(BOARD).a
>>>  COBJS-y    := $(BOARD).o
>>>  COBJS-$(CONFIG_CMD_IDE) += ../common/cfide.o
>>>  COBJS-$(CONFIG_EPLED) += ../common/epled.o
>>> +COBJS-$(CONFIG_GPIO) += gpio.o
>>>  COBJS-$(CONFIG_SEVENSEG) += ../common/sevenseg.o
>>
>> This will build a u-boot image that will not work with any
>> of the standard configurations ... correct? ... since the
>> GPIO component is custom (not supplied by the vendor)?
>>
> Hi Scott,
> 
> The board gpio.c driver works on Altera PIO component. It will behave 
> exactly the same as the epled driver. I have tested it on EP1C20 an 
> EP2C35 board with standard configuration. I believe it will work with 
> the standard configuration on EP1S10 and EP1S40. I don't want to break 
> anything.

Ok. I'll try to test over the weekend as well.

Thanks,
--Scott

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

* [U-Boot] [PATCH v2] misc: add gpio based status led driver
  2010-04-28  3:51             ` Thomas Chou
@ 2010-05-04 22:30               ` Wolfgang Denk
  2010-05-04 22:53                 ` Scott McNutt
  2010-05-05  0:09                 ` Thomas Chou
  0 siblings, 2 replies; 49+ messages in thread
From: Wolfgang Denk @ 2010-05-04 22:30 UTC (permalink / raw)
  To: u-boot

Dear Thomas Chou,

In message <4BD7B0B3.3010007@wytron.com.tw> you wrote:
>
> I sent a patch to enable some peripherals on the nios2-generic board.
> 
> 04/28 [PATCH v2] nios2: add epcs, gpio led and mmc_spi to nios2-generic
> 
> This patch should be applied after the other outstanding patches. Please let me know if this is all right?

I don't understand how this is supposed to work? How can you enable a
feature that has not been added yet? Will this not cause build errors?

I guess to make sure the code remains bisectable both should be done
in a single step?

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
You humans have that emotional need  to  express  gratitude.  "You're
welcome," I believe, is the correct response.
	-- Spock, "Bread and Circuses", stardate 4041.2

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

* [U-Boot] [PATCH v2] misc: add gpio based status led driver
  2010-05-04 22:30               ` Wolfgang Denk
@ 2010-05-04 22:53                 ` Scott McNutt
  2010-05-05  0:09                 ` Thomas Chou
  1 sibling, 0 replies; 49+ messages in thread
From: Scott McNutt @ 2010-05-04 22:53 UTC (permalink / raw)
  To: u-boot

Dear Wolfgang,

Wolfgang Denk wrote:
> Dear Thomas Chou,
> 
> In message <4BD7B0B3.3010007@wytron.com.tw> you wrote:
>> I sent a patch to enable some peripherals on the nios2-generic board.
>>
>> 04/28 [PATCH v2] nios2: add epcs, gpio led and mmc_spi to nios2-generic
>>
>> This patch should be applied after the other outstanding patches. Please let me know if this is all right?
> 
> I don't understand how this is supposed to work? How can you enable a
> feature that has not been added yet? Will this not cause build errors?

It can't. I won't. It will.

> I guess to make sure the code remains bisectable both should be done
> in a single step?

I have a few patches pending in such a state -- they will not be
added until the prerequisites are met.

I'd be glad to push the various prerequisite patches into a test
branch ... but I've be far too busy.

Regards,
--Scott

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

* [U-Boot] [PATCH v2] misc: add gpio based status led driver
  2010-05-04 22:30               ` Wolfgang Denk
  2010-05-04 22:53                 ` Scott McNutt
@ 2010-05-05  0:09                 ` Thomas Chou
  1 sibling, 0 replies; 49+ messages in thread
From: Thomas Chou @ 2010-05-05  0:09 UTC (permalink / raw)
  To: u-boot

On 05/05/2010 06:30 AM, Wolfgang Denk wrote:
> Dear Thomas Chou,
>
> In message<4BD7B0B3.3010007@wytron.com.tw>  you wrote:
>    
>> I sent a patch to enable some peripherals on the nios2-generic board.
>>
>> 04/28 [PATCH v2] nios2: add epcs, gpio led and mmc_spi to nios2-generic
>>
>> This patch should be applied after the other outstanding patches. Please let me know if this is all right?
>>      
> I don't understand how this is supposed to work? How can you enable a
> feature that has not been added yet? Will this not cause build errors?
>
> I guess to make sure the code remains bisectable both should be done
> in a single step?
>
> Best regards,
>
> Wolfgang Denk
>
>    
Hi Wolfgang and Scott,

Please disregard the v2 patch on 04/28. I have resubmit the patch series 
in a way that they can be applied one-by-one without breaking others. I 
have tested the build on Altera dev boards using standard configuration.

04/30 [PATCH 0/6] add gpio_led and altera_spi drivers
   nios2: add gpio support
   misc: add gpio based status led driver
   nios2: add gpio support to nios2-generic board
   spi: add altera spi controller support
   spi_flash: support old STMicro parts with RES, v3 acked by Mike Frysinger.
   nios2: add spi flash support to nios2-generic board

Best regards,
Thomas

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

* [U-Boot] [PATCH 5/6 v3] spi_flash: support old STMicro parts with RES
  2010-04-30 13:11               ` [U-Boot] [PATCH 5/6 v3] " Thomas Chou
  2010-04-30 13:25                 ` Mike Frysinger
@ 2010-05-05  7:21                 ` Mike Frysinger
  2010-05-05  7:34                   ` Thomas Chou
  2010-05-05 19:57                   ` Wolfgang Denk
  1 sibling, 2 replies; 49+ messages in thread
From: Mike Frysinger @ 2010-05-05  7:21 UTC (permalink / raw)
  To: u-boot

ive merged this into my sf branch and will push out next merge window if 
Wolfgang doesnt pick it up before that
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20100505/9e5d6405/attachment.pgp 

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

* [U-Boot] [PATCH 5/6 v3] spi_flash: support old STMicro parts with RES
  2010-05-05  7:21                 ` Mike Frysinger
@ 2010-05-05  7:34                   ` Thomas Chou
  2010-05-05 19:57                   ` Wolfgang Denk
  1 sibling, 0 replies; 49+ messages in thread
From: Thomas Chou @ 2010-05-05  7:34 UTC (permalink / raw)
  To: u-boot

On 05/05/2010 03:21 PM, Mike Frysinger wrote:
> ive merged this into my sf branch and will push out next merge window if
> Wolfgang doesnt pick it up before that
> -mike
>    
Hi Mike,

You are so nice. Thanks again.

Best regards,
Thomas

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

* [U-Boot] [PATCH 5/6 v3] spi_flash: support old STMicro parts with RES
  2010-05-05  7:21                 ` Mike Frysinger
  2010-05-05  7:34                   ` Thomas Chou
@ 2010-05-05 19:57                   ` Wolfgang Denk
  2010-05-05 21:40                     ` Mike Frysinger
  2010-05-06  0:20                     ` Thomas Chou
  1 sibling, 2 replies; 49+ messages in thread
From: Wolfgang Denk @ 2010-05-05 19:57 UTC (permalink / raw)
  To: u-boot

Dear Mike Frysinger,

In message <201005050321.49140.vapier@gentoo.org> you wrote:
>
> ive merged this into my sf branch and will push out next merge window if 
> Wolfgang doesnt pick it up before that

Just let me know what you (and Thomas) prefer, and what exactly
(which patch[es] from this series) the "it" is that should be picked
up (or not).

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Gods don't like people not doing much work. People  who  aren't  busy
all the time might start to _think_.  - Terry Pratchett, _Small Gods_

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

* [U-Boot] [PATCH 5/6 v3] spi_flash: support old STMicro parts with RES
  2010-05-05 19:57                   ` Wolfgang Denk
@ 2010-05-05 21:40                     ` Mike Frysinger
  2010-05-06  0:20                     ` Thomas Chou
  1 sibling, 0 replies; 49+ messages in thread
From: Mike Frysinger @ 2010-05-05 21:40 UTC (permalink / raw)
  To: u-boot

On Wednesday 05 May 2010 15:57:29 Wolfgang Denk wrote:
> Mike Frysinger wrote:
> > ive merged this into my sf branch and will push out next merge window if
> > Wolfgang doesnt pick it up before that
> 
> Just let me know what you (and Thomas) prefer

doesnt matter to me whether you pull my branch now or after the merge window:
	git://git.denx.de/u-boot-blackfin.git sf

> and what exactly (which patch[es] from this series) the "it" is that should
> be picked up (or not).

there is only one patch in this thread ...

referring to all the patches in my branch, none are "bugfixes" persay which is 
why i didnt know if you wanted to let them sit until next merge window.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20100505/3714b67e/attachment.pgp 

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

* [U-Boot] [PATCH 5/6 v3] spi_flash: support old STMicro parts with RES
  2010-05-05 19:57                   ` Wolfgang Denk
  2010-05-05 21:40                     ` Mike Frysinger
@ 2010-05-06  0:20                     ` Thomas Chou
  1 sibling, 0 replies; 49+ messages in thread
From: Thomas Chou @ 2010-05-06  0:20 UTC (permalink / raw)
  To: u-boot

Dear Wolfgang,

On 05/06/2010 03:57 AM, Wolfgang Denk wrote:
> Dear Mike Frysinger,
>
> In message<201005050321.49140.vapier@gentoo.org>  you wrote:
>    
>> ive merged this into my sf branch and will push out next merge window if
>> Wolfgang doesnt pick it up before that
>>      
> Just let me know what you (and Thomas) prefer, and what exactly
> (which patch[es] from this series) the "it" is that should be picked
> up (or not).
>
>    
These patches were submitted within this merge window. I just 
resubmitted the outstanding patches in a series as you suggested. It 
would be nice if you can merge them in this release. The current u-boot 
supports only very old, obsolete Altera dev boards, most newer boards 
are not supported. I hope we can work together to let these patches 
merged, so that most Altera's dev boards can be supported.

The drivers for gpio, altera_spi, spi_flash and mmc_spi are important as 
Altera includes them in their example design.

Best regards,
Thomas

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

* [U-Boot] [Nios2-dev] [PATCH 1/6 v4] nios2: add gpio support
  2010-04-30  3:34             ` [U-Boot] [PATCH 1/6 v4] nios2: add gpio support Thomas Chou
@ 2010-05-21 14:39               ` Ian Abbott
  2010-05-25 19:39               ` [U-Boot] " Scott McNutt
  1 sibling, 0 replies; 49+ messages in thread
From: Ian Abbott @ 2010-05-21 14:39 UTC (permalink / raw)
  To: u-boot

On 30/04/10 04:34, Thomas Chou wrote:
> This patch adds driver for a trivial gpio core, which is described
> in http://nioswiki.com/GPIO. It is used for gpio led and nand flash
> interface in u-boot.
> 
> When CONFIG_SYS_GPIO_BASE is not defined, board may provide
> its own driver.
> 
> Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

Tested with LED on Altera 2C35 development board.

Tested-by: Ian Abbott <abbotti@mev.co.uk>

-- 
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti@mev.co.uk>        )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587         )=-

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

* [U-Boot] [Nios2-dev] [PATCH 2/6 v2] misc: add gpio based status led driver
  2010-04-30  3:34             ` [U-Boot] [PATCH 2/6 v2] misc: add gpio based status led driver Thomas Chou
@ 2010-05-21 14:40               ` Ian Abbott
  2010-05-25 19:39               ` [U-Boot] " Scott McNutt
  1 sibling, 0 replies; 49+ messages in thread
From: Ian Abbott @ 2010-05-21 14:40 UTC (permalink / raw)
  To: u-boot

On 30/04/10 04:34, Thomas Chou wrote:
> This patch adds a status led driver followed the GPIO access
> conventions of Linux. The led mask is used to specify the gpio pin.
> 
> Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

Tested on Altera 2C35 development board.

Tested-by: Ian Abbott <abbotti@mev.co.uk>

-- 
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti@mev.co.uk>        )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587         )=-

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

* [U-Boot] [Nios2-dev] [PATCH 3/6 v3] nios2: add gpio support to nios2-generic board
  2010-04-30  3:34             ` [U-Boot] [PATCH 3/6 v3] nios2: add gpio support to nios2-generic board Thomas Chou
  2010-04-30 14:24               ` Scott McNutt
@ 2010-05-21 14:41               ` Ian Abbott
  2010-05-25 19:40               ` [U-Boot] " Scott McNutt
  2 siblings, 0 replies; 49+ messages in thread
From: Ian Abbott @ 2010-05-21 14:41 UTC (permalink / raw)
  To: u-boot

On 30/04/10 04:34, Thomas Chou wrote:
> This patch adds gpio support of Altera PIO component to the
> nios2-generic board. Though it drives only gpio_led at the
> moment, it supports bidirectional port to control bit-banging
> I2C, NAND flash busy status or button switches, etc.
> 
> Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

Tested with LED on Altera 2C35 development board.

Tested-by: Ian Abbott <abbotti@mev.co.uk>

-- 
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti@mev.co.uk>        )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587         )=-

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

* [U-Boot] [Nios2-dev] [PATCH 4/6 v10] spi: add altera spi controller support
  2010-04-30  3:34             ` [U-Boot] [PATCH 4/6 v10] spi: add altera spi controller support Thomas Chou
@ 2010-05-21 14:43               ` Ian Abbott
  2010-05-25 19:40               ` [U-Boot] " Scott McNutt
  1 sibling, 0 replies; 49+ messages in thread
From: Ian Abbott @ 2010-05-21 14:43 UTC (permalink / raw)
  To: u-boot

On 30/04/10 04:34, Thomas Chou wrote:
> This patch adds the driver of altera spi controller, which is
> used as epcs/spi flash controller. It also works with mmc_spi
> driver.
> 
> This driver support more than one spi bus, with base list declared
> #define CONFIG_SYS_ALTERA_SPI_LIST { BASE_0,BASE_1,... }
> 
> Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

Tested with EPCS64N flash chip on Altera 2C35 development board.

Tested-by: Ian Abbott <abbotti@mev.co.uk>

-- 
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti@mev.co.uk>        )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587         )=-

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

* [U-Boot] [Nios2-dev] [PATCH 6/6 v3] nios2: add spi flash support to nios2-generic board
  2010-04-30  3:34             ` [U-Boot] [PATCH 6/6 v3] nios2: add spi flash support to nios2-generic board Thomas Chou
@ 2010-05-21 14:44               ` Ian Abbott
  2010-05-25 19:52               ` [U-Boot] " Scott McNutt
  1 sibling, 0 replies; 49+ messages in thread
From: Ian Abbott @ 2010-05-21 14:44 UTC (permalink / raw)
  To: u-boot

On 30/04/10 04:34, Thomas Chou wrote:
> This patch enables the altera_spi and spi_flash drivers for the
> nios2-generic board. It allows access to the EPCS/SPI flash on
> the Altera EP1C20 board.
> 
> Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

Tested with EPCS64N flash chip on Altera 2C35 development board.

Tested-by: Ian Abbott <abbotti@mev.co.uk>

-- 
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti@mev.co.uk>        )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587         )=-

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

* [U-Boot] [PATCH 1/6 v4] nios2: add gpio support
  2010-04-30  3:34             ` [U-Boot] [PATCH 1/6 v4] nios2: add gpio support Thomas Chou
  2010-05-21 14:39               ` [U-Boot] [Nios2-dev] " Ian Abbott
@ 2010-05-25 19:39               ` Scott McNutt
  1 sibling, 0 replies; 49+ messages in thread
From: Scott McNutt @ 2010-05-25 19:39 UTC (permalink / raw)
  To: u-boot

Applied to:

   git://git.denx.de/u-boot-nios.git next

Thanks,
--Scott

Thomas Chou wrote:
> This patch adds driver for a trivial gpio core, which is described
> in http://nioswiki.com/GPIO. It is used for gpio led and nand flash
> interface in u-boot.
> 
> When CONFIG_SYS_GPIO_BASE is not defined, board may provide
> its own driver.
> 
> Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
> ---
> v4: remove () from gpio when it is not in a macro.
> v3: arch dir reorganized.
> 
>  arch/nios2/include/asm/gpio.h |   52 +++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 52 insertions(+), 0 deletions(-)
>  create mode 100644 arch/nios2/include/asm/gpio.h
> 
> diff --git a/arch/nios2/include/asm/gpio.h b/arch/nios2/include/asm/gpio.h
> new file mode 100644
> index 0000000..76c425e
> --- /dev/null
> +++ b/arch/nios2/include/asm/gpio.h
> @@ -0,0 +1,52 @@
> +/*
> + * nios2 gpio driver
> + *
> + * This gpio core is described in http://nioswiki.com/GPIO
> + * bit[0] data
> + * bit[1] output enable
> + *
> + * when CONFIG_SYS_GPIO_BASE is not defined, board may provide
> + * its own driver.
> + *
> + * Copyright (C) 2010 Thomas Chou <thomas@wytron.com.tw>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +
> +#ifndef _ASM_NIOS2_GPIO_H_
> +#define _ASM_NIOS2_GPIO_H_
> +
> +#ifdef CONFIG_SYS_GPIO_BASE
> +#include <asm/io.h>
> +
> +static inline int gpio_direction_input(unsigned gpio)
> +{
> +	writel(1, CONFIG_SYS_GPIO_BASE + (gpio << 2));
> +	return 0;
> +}
> +
> +static inline int gpio_direction_output(unsigned gpio, int value)
> +{
> +	writel(value ? 3 : 2, CONFIG_SYS_GPIO_BASE + (gpio << 2));
> +	return 0;
> +}
> +
> +static inline int gpio_get_value(unsigned gpio)
> +{
> +	return readl(CONFIG_SYS_GPIO_BASE + (gpio << 2));
> +}
> +
> +static inline void gpio_set_value(unsigned gpio, int value)
> +{
> +	writel(value ? 3 : 2, CONFIG_SYS_GPIO_BASE + (gpio << 2));
> +}
> +#else
> +extern int gpio_direction_input(unsigned gpio);
> +extern int gpio_direction_output(unsigned gpio, int value);
> +extern int gpio_get_value(unsigned gpio);
> +extern void gpio_set_value(unsigned gpio, int value);
> +#endif /* CONFIG_SYS_GPIO_BASE */
> +
> +#endif /* _ASM_NIOS2_GPIO_H_ */

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

* [U-Boot] [PATCH 2/6 v2] misc: add gpio based status led driver
  2010-04-30  3:34             ` [U-Boot] [PATCH 2/6 v2] misc: add gpio based status led driver Thomas Chou
  2010-05-21 14:40               ` [U-Boot] [Nios2-dev] " Ian Abbott
@ 2010-05-25 19:39               ` Scott McNutt
  1 sibling, 0 replies; 49+ messages in thread
From: Scott McNutt @ 2010-05-25 19:39 UTC (permalink / raw)
  To: u-boot

Applied to:

   git://git.denx.de/u-boot-nios.git next

Thanks,
--Scott


Thomas Chou wrote:
> This patch adds a status led driver followed the GPIO access
> conventions of Linux. The led mask is used to specify the gpio pin.
> 
> Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
> ---
> v2: moved to drivers/misc.
> 
>  drivers/misc/Makefile   |    1 +
>  drivers/misc/gpio_led.c |   30 ++++++++++++++++++++++++++++++
>  2 files changed, 31 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/misc/gpio_led.c
> 
> diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
> index f6df60f..55ff17f 100644
> --- a/drivers/misc/Makefile
> +++ b/drivers/misc/Makefile
> @@ -28,6 +28,7 @@ LIB	:= $(obj)libmisc.a
>  COBJS-$(CONFIG_ALI152X) += ali512x.o
>  COBJS-$(CONFIG_DS4510)  += ds4510.o
>  COBJS-$(CONFIG_FSL_LAW) += fsl_law.o
> +COBJS-$(CONFIG_GPIO_LED) += gpio_led.o
>  COBJS-$(CONFIG_NS87308) += ns87308.o
>  COBJS-$(CONFIG_STATUS_LED) += status_led.o
>  COBJS-$(CONFIG_TWL4030_LED) += twl4030_led.o
> diff --git a/drivers/misc/gpio_led.c b/drivers/misc/gpio_led.c
> new file mode 100644
> index 0000000..acd6a90
> --- /dev/null
> +++ b/drivers/misc/gpio_led.c
> @@ -0,0 +1,30 @@
> +/*
> + * Status LED driver based on GPIO access conventions of Linux
> + *
> + * Copyright (C) 2010 Thomas Chou <thomas@wytron.com.tw>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +
> +#include <common.h>
> +#include <status_led.h>
> +#include <asm/gpio.h>
> +
> +/* assume led is active low */
> +
> +void __led_init(led_id_t mask, int state)
> +{
> +	gpio_direction_output(mask, (state == STATUS_LED_ON) ? 0 : 1);
> +}
> +
> +void __led_set(led_id_t mask, int state)
> +{
> +	gpio_set_value(mask, (state == STATUS_LED_ON) ? 0 : 1);
> +}
> +
> +void __led_toggle(led_id_t mask)
> +{
> +	gpio_set_value(mask, !gpio_get_value(mask));
> +}

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

* [U-Boot] [PATCH 3/6 v3] nios2: add gpio support to nios2-generic board
  2010-04-30  3:34             ` [U-Boot] [PATCH 3/6 v3] nios2: add gpio support to nios2-generic board Thomas Chou
  2010-04-30 14:24               ` Scott McNutt
  2010-05-21 14:41               ` [U-Boot] [Nios2-dev] " Ian Abbott
@ 2010-05-25 19:40               ` Scott McNutt
  2 siblings, 0 replies; 49+ messages in thread
From: Scott McNutt @ 2010-05-25 19:40 UTC (permalink / raw)
  To: u-boot

Applied to:

   git://git.denx.de/u-boot-nios.git next

Thanks,
--Scott


Thomas Chou wrote:
> This patch adds gpio support of Altera PIO component to the
> nios2-generic board. Though it drives only gpio_led at the
> moment, it supports bidirectional port to control bit-banging
> I2C, NAND flash busy status or button switches, etc.
> 
> Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
> ---
> v3: split patches for gpio and spi, based gpio on altera pio core.
> v2: remove mmc_spi_init()
> 
>  board/altera/nios2-generic/Makefile |    1 +
>  board/altera/nios2-generic/gpio.c   |   55 +++++++++++++++++++++++++++++++++++
>  include/configs/nios2-generic.h     |    6 ++--
>  3 files changed, 59 insertions(+), 3 deletions(-)
>  create mode 100644 board/altera/nios2-generic/gpio.c
> 
> diff --git a/board/altera/nios2-generic/Makefile b/board/altera/nios2-generic/Makefile
> index 6780872..d1fca70 100644
> --- a/board/altera/nios2-generic/Makefile
> +++ b/board/altera/nios2-generic/Makefile
> @@ -32,6 +32,7 @@ LIB	= $(obj)lib$(BOARD).a
>  COBJS-y	:= $(BOARD).o
>  COBJS-$(CONFIG_CMD_IDE) += ../common/cfide.o
>  COBJS-$(CONFIG_EPLED) += ../common/epled.o
> +COBJS-$(CONFIG_GPIO) += gpio.o
>  COBJS-$(CONFIG_SEVENSEG) += ../common/sevenseg.o
>  
>  SOBJS-y	:= text_base.o
> diff --git a/board/altera/nios2-generic/gpio.c b/board/altera/nios2-generic/gpio.c
> new file mode 100644
> index 0000000..6c9c6c2
> --- /dev/null
> +++ b/board/altera/nios2-generic/gpio.c
> @@ -0,0 +1,55 @@
> +/*
> + * board gpio driver
> + *
> + * Copyright (C) 2010 Thomas Chou <thomas@wytron.com.tw>
> + * Licensed under the GPL-2 or later.
> + */
> +#include <common.h>
> +#include <asm/io.h>
> +
> +#ifndef CONFIG_SYS_GPIO_BASE
> +
> +#define ALTERA_PIO_BASE LED_PIO_BASE
> +#define ALTERA_PIO_DATA (ALTERA_PIO_BASE + 0)
> +#define ALTERA_PIO_DIR (ALTERA_PIO_BASE + 4)
> +static u32 pio_data_reg;
> +static u32 pio_dir_reg;
> +
> +int gpio_direction_input(unsigned gpio)
> +{
> +	u32 mask = 1 << gpio;
> +	writel(pio_dir_reg &= ~mask, ALTERA_PIO_DIR);
> +	return 0;
> +}
> +
> +int gpio_direction_output(unsigned gpio, int value)
> +{
> +	u32 mask = 1 << gpio;
> +	if (value)
> +		pio_data_reg |= mask;
> +	else
> +		pio_data_reg &= ~mask;
> +	writel(pio_data_reg, ALTERA_PIO_DATA);
> +	writel(pio_dir_reg |= mask, ALTERA_PIO_DIR);
> +	return 0;
> +}
> +
> +int gpio_get_value(unsigned gpio)
> +{
> +	u32 mask = 1 << gpio;
> +	if (pio_dir_reg & mask)
> +		return (pio_data_reg & mask) ? 1 : 0;
> +	else
> +		return (readl(ALTERA_PIO_DATA) & mask) ? 1 : 0;
> +}
> +
> +void gpio_set_value(unsigned gpio, int value)
> +{
> +	u32 mask = 1 << gpio;
> +	if (value)
> +		pio_data_reg |= mask;
> +	else
> +		pio_data_reg &= ~mask;
> +	writel(pio_data_reg, ALTERA_PIO_DATA);
> +}
> +#endif
> diff --git a/include/configs/nios2-generic.h b/include/configs/nios2-generic.h
> index e83e1e3..e4bf57b 100644
> --- a/include/configs/nios2-generic.h
> +++ b/include/configs/nios2-generic.h
> @@ -63,10 +63,10 @@
>   * STATUS LED
>   */
>  #define CONFIG_STATUS_LED		/* Enable status driver */
> -#define CONFIG_EPLED			/* Enable LED PIO driver */
> -#define CONFIG_SYS_LEDPIO_ADDR		LED_PIO_BASE
> +#define CONFIG_GPIO_LED		/* Enable GPIO LED driver */
> +#define CONFIG_GPIO			/* Enable GPIO driver */
>  
> -#define STATUS_LED_BIT			1	/* Bit-0 on PIO */
> +#define STATUS_LED_BIT			0	/* Bit-0 on GPIO */
>  #define STATUS_LED_STATE		1	/* Blinking */
>  #define STATUS_LED_PERIOD	(500 / CONFIG_SYS_NIOS_TMRMS) /* 500 msec */
>  

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

* [U-Boot] [PATCH 4/6 v10] spi: add altera spi controller support
  2010-04-30  3:34             ` [U-Boot] [PATCH 4/6 v10] spi: add altera spi controller support Thomas Chou
  2010-05-21 14:43               ` [U-Boot] [Nios2-dev] " Ian Abbott
@ 2010-05-25 19:40               ` Scott McNutt
  1 sibling, 0 replies; 49+ messages in thread
From: Scott McNutt @ 2010-05-25 19:40 UTC (permalink / raw)
  To: u-boot

Applied to:

   git://git.denx.de/u-boot-nios.git next

Thanks,
--Scott


Thomas Chou wrote:
> This patch adds the driver of altera spi controller, which is
> used as epcs/spi flash controller. It also works with mmc_spi
> driver.
> 
> This driver support more than one spi bus, with base list declared
> #define CONFIG_SYS_ALTERA_SPI_LIST { BASE_0,BASE_1,... }
> 
> Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
> ---
> v10 remove bus check in setup slave, as spi_cs_is_valid() did it.
> v9 check bus in spi_cs_is_valid().
> v8 fix cs activate timing.
> v7 add cs activate deactive to work with legacy spi_mmc driver.
> v6 wrong patch, same as v5.
> v5 tabify.
> 
>  drivers/spi/Makefile     |    1 +
>  drivers/spi/altera_spi.c |  165 ++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 166 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/spi/altera_spi.c
> 
> diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
> index f112ed0..dfcbb8b 100644
> --- a/drivers/spi/Makefile
> +++ b/drivers/spi/Makefile
> @@ -25,6 +25,7 @@ include $(TOPDIR)/config.mk
>  
>  LIB	:= $(obj)libspi.a
>  
> +COBJS-$(CONFIG_ALTERA_SPI) += altera_spi.o
>  COBJS-$(CONFIG_ATMEL_DATAFLASH_SPI) += atmel_dataflash_spi.o
>  COBJS-$(CONFIG_ATMEL_SPI) += atmel_spi.o
>  COBJS-$(CONFIG_BFIN_SPI) += bfin_spi.o
> diff --git a/drivers/spi/altera_spi.c b/drivers/spi/altera_spi.c
> new file mode 100644
> index 0000000..918b223
> --- /dev/null
> +++ b/drivers/spi/altera_spi.c
> @@ -0,0 +1,165 @@
> +/*
> + * Altera SPI driver
> + *
> + * based on bfin_spi.c
> + * Copyright (c) 2005-2008 Analog Devices Inc.
> + * Copyright (C) 2010 Thomas Chou <thomas@wytron.com.tw>
> + *
> + * Licensed under the GPL-2 or later.
> + */
> +#include <common.h>
> +#include <asm/io.h>
> +#include <malloc.h>
> +#include <spi.h>
> +
> +#define ALTERA_SPI_RXDATA	0
> +#define ALTERA_SPI_TXDATA	4
> +#define ALTERA_SPI_STATUS	8
> +#define ALTERA_SPI_CONTROL	12
> +#define ALTERA_SPI_SLAVE_SEL	20
> +
> +#define ALTERA_SPI_STATUS_ROE_MSK	(0x8)
> +#define ALTERA_SPI_STATUS_TOE_MSK	(0x10)
> +#define ALTERA_SPI_STATUS_TMT_MSK	(0x20)
> +#define ALTERA_SPI_STATUS_TRDY_MSK	(0x40)
> +#define ALTERA_SPI_STATUS_RRDY_MSK	(0x80)
> +#define ALTERA_SPI_STATUS_E_MSK	(0x100)
> +
> +#define ALTERA_SPI_CONTROL_IROE_MSK	(0x8)
> +#define ALTERA_SPI_CONTROL_ITOE_MSK	(0x10)
> +#define ALTERA_SPI_CONTROL_ITRDY_MSK	(0x40)
> +#define ALTERA_SPI_CONTROL_IRRDY_MSK	(0x80)
> +#define ALTERA_SPI_CONTROL_IE_MSK	(0x100)
> +#define ALTERA_SPI_CONTROL_SSO_MSK	(0x400)
> +
> +#ifndef CONFIG_SYS_ALTERA_SPI_LIST
> +#define CONFIG_SYS_ALTERA_SPI_LIST { CONFIG_SYS_SPI_BASE }
> +#endif
> +
> +static ulong altera_spi_base_list[] = CONFIG_SYS_ALTERA_SPI_LIST;
> +
> +struct altera_spi_slave {
> +	struct spi_slave slave;
> +	ulong base;
> +};
> +#define to_altera_spi_slave(s) container_of(s, struct altera_spi_slave, slave)
> +
> +__attribute__((weak))
> +int spi_cs_is_valid(unsigned int bus, unsigned int cs)
> +{
> +	return bus < ARRAY_SIZE(altera_spi_base_list) && cs < 32;
> +}
> +
> +__attribute__((weak))
> +void spi_cs_activate(struct spi_slave *slave)
> +{
> +	struct altera_spi_slave *altspi = to_altera_spi_slave(slave);
> +	writel(1 << slave->cs, altspi->base + ALTERA_SPI_SLAVE_SEL);
> +	writel(ALTERA_SPI_CONTROL_SSO_MSK, altspi->base + ALTERA_SPI_CONTROL);
> +}
> +
> +__attribute__((weak))
> +void spi_cs_deactivate(struct spi_slave *slave)
> +{
> +	struct altera_spi_slave *altspi = to_altera_spi_slave(slave);
> +	writel(0, altspi->base + ALTERA_SPI_CONTROL);
> +	writel(0, altspi->base + ALTERA_SPI_SLAVE_SEL);
> +}
> +
> +void spi_init(void)
> +{
> +}
> +
> +struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
> +				  unsigned int max_hz, unsigned int mode)
> +{
> +	struct altera_spi_slave *altspi;
> +
> +	if (!spi_cs_is_valid(bus, cs))
> +		return NULL;
> +
> +	altspi = malloc(sizeof(*altspi));
> +	if (!altspi)
> +		return NULL;
> +
> +	altspi->slave.bus = bus;
> +	altspi->slave.cs = cs;
> +	altspi->base = altera_spi_base_list[bus];
> +	debug("%s: bus:%i cs:%i base:%lx\n", __func__,
> +		bus, cs, altspi->base);
> +
> +	return &altspi->slave;
> +}
> +
> +void spi_free_slave(struct spi_slave *slave)
> +{
> +	struct altera_spi_slave *altspi = to_altera_spi_slave(slave);
> +	free(altspi);
> +}
> +
> +int spi_claim_bus(struct spi_slave *slave)
> +{
> +	struct altera_spi_slave *altspi = to_altera_spi_slave(slave);
> +
> +	debug("%s: bus:%i cs:%i\n", __func__, slave->bus, slave->cs);
> +	writel(0, altspi->base + ALTERA_SPI_CONTROL);
> +	writel(0, altspi->base + ALTERA_SPI_SLAVE_SEL);
> +	return 0;
> +}
> +
> +void spi_release_bus(struct spi_slave *slave)
> +{
> +	struct altera_spi_slave *altspi = to_altera_spi_slave(slave);
> +
> +	debug("%s: bus:%i cs:%i\n", __func__, slave->bus, slave->cs);
> +	writel(0, altspi->base + ALTERA_SPI_SLAVE_SEL);
> +}
> +
> +#ifndef CONFIG_ALTERA_SPI_IDLE_VAL
> +# define CONFIG_ALTERA_SPI_IDLE_VAL 0xff
> +#endif
> +
> +int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout,
> +	     void *din, unsigned long flags)
> +{
> +	struct altera_spi_slave *altspi = to_altera_spi_slave(slave);
> +	/* assume spi core configured to do 8 bit transfers */
> +	uint bytes = bitlen / 8;
> +	const uchar *txp = dout;
> +	uchar *rxp = din;
> +
> +	debug("%s: bus:%i cs:%i bitlen:%i bytes:%i flags:%lx\n", __func__,
> +		slave->bus, slave->cs, bitlen, bytes, flags);
> +	if (bitlen == 0)
> +		goto done;
> +
> +	if (bitlen % 8) {
> +		flags |= SPI_XFER_END;
> +		goto done;
> +	}
> +
> +	/* empty read buffer */
> +	if (readl(altspi->base + ALTERA_SPI_STATUS) &
> +	    ALTERA_SPI_STATUS_RRDY_MSK)
> +		readl(altspi->base + ALTERA_SPI_RXDATA);
> +	if (flags & SPI_XFER_BEGIN)
> +		spi_cs_activate(slave);
> +
> +	while (bytes--) {
> +		uchar d = txp ? *txp++ : CONFIG_ALTERA_SPI_IDLE_VAL;
> +		debug("%s: tx:%x ", __func__, d);
> +		writel(d, altspi->base + ALTERA_SPI_TXDATA);
> +		while (!(readl(altspi->base + ALTERA_SPI_STATUS) &
> +			 ALTERA_SPI_STATUS_RRDY_MSK))
> +			;
> +		d = readl(altspi->base + ALTERA_SPI_RXDATA);
> +		if (rxp)
> +			*rxp++ = d;
> +		debug("rx:%x\n", d);
> +	}
> + done:
> +	if (flags & SPI_XFER_END)
> +		spi_cs_deactivate(slave);
> +
> +	return 0;
> +}

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

* [U-Boot] [PATCH 6/6 v3] nios2: add spi flash support to nios2-generic board
  2010-04-30  3:34             ` [U-Boot] [PATCH 6/6 v3] nios2: add spi flash support to nios2-generic board Thomas Chou
  2010-05-21 14:44               ` [U-Boot] [Nios2-dev] " Ian Abbott
@ 2010-05-25 19:52               ` Scott McNutt
  1 sibling, 0 replies; 49+ messages in thread
From: Scott McNutt @ 2010-05-25 19:52 UTC (permalink / raw)
  To: u-boot

Thomas,

I applied this to:
    git://git.denx.de/u-boot-nios.git testing

after merging with Mike's 'sf' branch at:
    git://git.denx.de/u-boot-blackfin

so we can pickup:
     [PATCH 5/6 v3] spi_flash: support old STMicro parts with RES

I'll merge once Mike's changes are available upstream. In the
meantime, the nios testing branch has the entire patch series
available.

Regards,
--Scott

Thomas Chou wrote:
> This patch enables the altera_spi and spi_flash drivers for the
> nios2-generic board. It allows access to the EPCS/SPI flash on
> the Altera EP1C20 board.
> 
> Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
> ---
> v3: split patches for gpio and spi.
> v2: remove mmc_spi_init()
> 
>  board/altera/nios2-generic/custom_fpga.h |   10 ++++++++++
>  1 files changed, 10 insertions(+), 0 deletions(-)
> 
> diff --git a/board/altera/nios2-generic/custom_fpga.h b/board/altera/nios2-generic/custom_fpga.h
> index 761f605..a11add5 100644
> --- a/board/altera/nios2-generic/custom_fpga.h
> +++ b/board/altera/nios2-generic/custom_fpga.h
> @@ -35,6 +35,16 @@
>  #define CONFIG_SMC91111
>  #define CONFIG_SMC_USE_32_BIT
>  
> +/* epcs_controller.epcs_control_port is a altera_avalon_epcs_flash_controller */
> +#define EPCS_CONTROLLER_REG_BASE 0x82100200
> +#define CONFIG_SYS_ALTERA_SPI_LIST { EPCS_CONTROLLER_REG_BASE }
> +#define CONFIG_ALTERA_SPI
> +#define CONFIG_CMD_SPI
> +#define CONFIG_CMD_SF
> +#define CONFIG_SF_DEFAULT_SPEED 30000000
> +#define CONFIG_SPI_FLASH
> +#define CONFIG_SPI_FLASH_STMICRO
> +
>  /* jtag_uart.avalon_jtag_slave is a altera_avalon_jtag_uart */
>  #define CONFIG_SYS_JTAG_UART_BASE 0x821208b0
>  

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

* [U-Boot] [PATCH v2] misc: add gpio based status led driver
  2010-04-21  0:45 ` [U-Boot] [PATCH v2] misc: " Thomas Chou
  2010-04-24 19:23   ` Wolfgang Denk
  2010-04-27  3:29   ` [U-Boot] [PATCH] nios2: add epcs, gpio led and mmc_spi to nios2-generic Thomas Chou
@ 2010-06-09  4:27   ` Mike Frysinger
  2 siblings, 0 replies; 49+ messages in thread
From: Mike Frysinger @ 2010-06-09  4:27 UTC (permalink / raw)
  To: u-boot

On Tuesday, April 20, 2010 20:45:12 Thomas Chou wrote:
> +void __led_init(led_id_t mask, int state)
> +{
> +	gpio_direction_output(mask, (state == STATUS_LED_ON) ? 0 : 1);
> +}
> +
> +void __led_set(led_id_t mask, int state)
> +{
> +	gpio_set_value(mask, (state == STATUS_LED_ON) ? 0 : 1);
> +}

are these checks correct ?  "on" means a value of "1" with GPIO lines, but 
here you're setting the value to 0 when the state is "on".  so perhaps they 
should both read:
	..., state == STATUS_LED_ON);

> +void __led_toggle(led_id_t mask)
> +{
> +	gpio_set_value(mask, !gpio_get_value (mask));
> +}

no space before the (mask)
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20100609/1745ab67/attachment.pgp 

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

end of thread, other threads:[~2010-06-09  4:27 UTC | newest]

Thread overview: 49+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-27  4:54 [U-Boot] [PATCH] nios2: add gpio based status led driver Thomas Chou
2010-04-20 13:19 ` Scott McNutt
2010-04-20 15:05   ` Thomas Chou
2010-04-20 16:19     ` Scott McNutt
2010-04-21  0:33       ` Thomas Chou
2010-04-21  0:45 ` [U-Boot] [PATCH v2] misc: " Thomas Chou
2010-04-24 19:23   ` Wolfgang Denk
2010-04-24 22:07     ` Thomas Chou
2010-04-24 22:32       ` Wolfgang Denk
2010-04-24 22:59         ` Thomas Chou
2010-04-25  0:48           ` Scott McNutt
2010-04-25 18:15             ` Wolfgang Denk
2010-04-25 18:14           ` Wolfgang Denk
2010-04-28  3:51             ` Thomas Chou
2010-05-04 22:30               ` Wolfgang Denk
2010-05-04 22:53                 ` Scott McNutt
2010-05-05  0:09                 ` Thomas Chou
2010-04-30  3:34             ` [U-Boot] [PATCH 0/6] add gpio_led and altera_spi drivers Thomas Chou
2010-04-30  3:34             ` [U-Boot] [PATCH 1/6 v4] nios2: add gpio support Thomas Chou
2010-05-21 14:39               ` [U-Boot] [Nios2-dev] " Ian Abbott
2010-05-25 19:39               ` [U-Boot] " Scott McNutt
2010-04-30  3:34             ` [U-Boot] [PATCH 2/6 v2] misc: add gpio based status led driver Thomas Chou
2010-05-21 14:40               ` [U-Boot] [Nios2-dev] " Ian Abbott
2010-05-25 19:39               ` [U-Boot] " Scott McNutt
2010-04-30  3:34             ` [U-Boot] [PATCH 3/6 v3] nios2: add gpio support to nios2-generic board Thomas Chou
2010-04-30 14:24               ` Scott McNutt
2010-04-30 15:21                 ` Thomas Chou
2010-04-30 15:35                   ` Scott McNutt
2010-05-21 14:41               ` [U-Boot] [Nios2-dev] " Ian Abbott
2010-05-25 19:40               ` [U-Boot] " Scott McNutt
2010-04-30  3:34             ` [U-Boot] [PATCH 4/6 v10] spi: add altera spi controller support Thomas Chou
2010-05-21 14:43               ` [U-Boot] [Nios2-dev] " Ian Abbott
2010-05-25 19:40               ` [U-Boot] " Scott McNutt
2010-04-30  3:34             ` [U-Boot] [PATCH 5/6 v2] spi_flash: support old STMicro parts with RES Thomas Chou
2010-04-30 12:48               ` Mike Frysinger
2010-04-30 13:15                 ` Thomas Chou
2010-04-30 13:11               ` [U-Boot] [PATCH 5/6 v3] " Thomas Chou
2010-04-30 13:25                 ` Mike Frysinger
2010-05-05  7:21                 ` Mike Frysinger
2010-05-05  7:34                   ` Thomas Chou
2010-05-05 19:57                   ` Wolfgang Denk
2010-05-05 21:40                     ` Mike Frysinger
2010-05-06  0:20                     ` Thomas Chou
2010-04-30  3:34             ` [U-Boot] [PATCH 6/6 v3] nios2: add spi flash support to nios2-generic board Thomas Chou
2010-05-21 14:44               ` [U-Boot] [Nios2-dev] " Ian Abbott
2010-05-25 19:52               ` [U-Boot] " Scott McNutt
2010-04-27  3:29   ` [U-Boot] [PATCH] nios2: add epcs, gpio led and mmc_spi to nios2-generic Thomas Chou
2010-04-28  3:08     ` [U-Boot] [PATCH v2] " Thomas Chou
2010-06-09  4:27   ` [U-Boot] [PATCH v2] misc: add gpio based status led driver Mike Frysinger

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.