Skip to contentSkip to conversation

at91: fix smartweb board support

PATCH Superseded Heiko Schocher 4 participants 8 messages Jun 22, 2017 – Jul 6, 2017

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover at91: fix smartweb board support

since commit: f8b7fff1d5c5 "serial: atmel_usart: Add clk support" smartweb board comes not up anymore. Fix it.

While at it, fix compiler warning for drivers/usb/gadget/at91_udc.c

Heiko Schocher (2):
drivers, usb, gadget: fix compiler warnings for at91_udc.c atmel, at91: fix smartweb board

 arch/arm/dts/at91sam9260-smartweb.dts |  2 ++
 board/siemens/smartweb/smartweb.c     |  9 ---------
 configs/smartweb_defconfig            |  3 +++
 drivers/usb/gadget/at91_udc.c         | 30 +++---------------------------
 include/configs/smartweb.h            |  3 +++
 5 files changed, 11 insertions(+), 36 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/2 drivers, usb, gadget: fix compiler warnings for at91_udc.c

fix warnings:
drivers/usb/gadget/at91_udc.c:1344:12: warning: 'at91rm9200_udc_init' defined but not used [-Wunused-function] drivers/usb/gadget/at91_udc.c:1379:13: warning: 'at91rm9200_udc_pullup' defined but not used [-Wunused-function] drivers/usb/gadget/at91_udc.c:1476:12: warning: 'at91sam9263_udc_init' defined but not used [-Wunused-function]

---

 drivers/usb/gadget/at91_udc.c | 30 +++---------------------------
 1 file changed, 3 insertions(+), 27 deletions(-)
drivers/usb/gadget/at91_udc.c +3 -27
index 01a5907..85bfbf5 100644
@@ -1341,7 +1341,7 @@ static int at91_stop(struct usb_gadget *gadget)
 
 /*-------------------------------------------------------------------------*/
 
-static int at91rm9200_udc_init(struct at91_udc *udc)
+static __maybe_unused int at91rm9200_udc_init(struct at91_udc *udc)
 {
 	struct at91_ep *ep;
 	int ret;
@@ -1376,7 +1376,8 @@ static int at91rm9200_udc_init(struct at91_udc *udc)
 	return 0;
 }
 
-static void at91rm9200_udc_pullup(struct at91_udc *udc, int is_on)
+static __maybe_unused
+void at91rm9200_udc_pullup(struct at91_udc *udc, int is_on)
 {
 	int active = !udc->board.pullup_active_low;
 
@@ -1473,31 +1474,6 @@ static const struct at91_udc_caps at91sam9261_udc_caps = {
 };
 #endif
 
-static int at91sam9263_udc_init(struct at91_udc *udc)
-{
-	struct at91_ep *ep;
-	int i;
-
-	for (i = 0; i < NUM_ENDPOINTS; i++) {
-		ep = &udc->ep[i];
-
-		switch (i) {
-		case 0:
-		case 1:
-		case 2:
-		case 3:
-			ep->maxpacket = 64;
-			break;
-		case 4:
-		case 5:
-			ep->maxpacket = 256;
-			break;
-		}
-	}
-
-	return 0;
-}
-
 int usb_gadget_handle_interrupts(int index)
 {
 	struct at91_udc *udc = controller;
Signature · 1 line
2.7.4
#2 lore raw

PATCH 1/2 drivers, usb, gadget: fix compiler warnings for at91_udc.c

Hi Heiko,

Quoted 38 lines

fix warnings:
drivers/usb/gadget/at91_udc.c:1344:12: warning: 'at91rm9200_udc_init' defined but not used [-Wunused-function] drivers/usb/gadget/at91_udc.c:1379:13: warning:
'at91rm9200_udc_pullup' defined but not used [-Wunused-function] drivers/usb/gadget/at91_udc.c:1476:12: warning:
'at91sam9263_udc_init' defined but not used [-Wunused-function]

---

 drivers/usb/gadget/at91_udc.c | 30 +++---------------------------
 1 file changed, 3 insertions(+), 27 deletions(-)
(quoted diff) +0 -0

b/drivers/usb/gadget/at91_udc.c index 01a5907..85bfbf5 100644

drivers/usb/gadget/at91_udc.c +3 -2
@@ -1341,7 +1341,7 @@ static int at91_stop(struct usb_gadget *gadget)
 
 /*-------------------------------------------------------------------------*/
 
-static int at91rm9200_udc_init(struct at91_udc *udc)
+static __maybe_unused int at91rm9200_udc_init(struct at91_udc *udc)
 {
 	struct at91_ep *ep;
 	int ret;
@@ -1376,7 +1376,8 @@ static int at91rm9200_udc_init(struct at91_udc
 *udc) return 0;
 }
 
-static void at91rm9200_udc_pullup(struct at91_udc *udc, int is_on)
+static __maybe_unused
+void at91rm9200_udc_pullup(struct at91_udc *udc, int is_on)
 {
 	int active = !udc->board.pullup_active_low;
 

drivers/usb/gadget/at91_udc.c static const struct at91_udc_caps · line 1476

Quoted 4 lines
drivers/usb/gadget/at91_udc.c +0 -1
@@ -1473,31 +1474,6 @@ static const struct at91_udc_caps
 at91sam9261_udc_caps = { };
 #endif
 
-static int at91sam9263_udc_init(struct at91_udc *udc)

I'm a bit puzzled...

For the at91rm9200 related boards it is enough to add __maybe_unused and leave the unused function in the source code.

Hence, I'm wondering why do you remove the function for at91sam9263?

Shouldn't all be removed or have added __maybe_unused ?

Quoted 17 lines
drivers/usb/gadget/at91_udc.c +0 -17
-{
-	struct at91_ep *ep;
-	int i;
-
-	for (i = 0; i < NUM_ENDPOINTS; i++) {
-		ep = &udc->ep[i];
-
-		switch (i) {
-		case 0:
-		case 1:
-		case 2:
-		case 3:
-			ep->maxpacket = 64;
-			break;
-		case 4:
-		case 5:
-			ep->maxpacket = 256;

drivers/usb/gadget/at91_udc.c static const struct at91_udc_caps at91sam9261_udc_caps = { · line 1479

Quoted 10 lines
drivers/usb/gadget/at91_udc.c +0 -7
-			break;
-		}
-	}
-
-	return 0;
-}
-
 int usb_gadget_handle_interrupts(int index)
 {
 	struct at91_udc *udc = controller;

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
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

#3 lore raw

PATCH 1/2 drivers, usb, gadget: fix compiler warnings for at91_udc.c

Hello Lukasz,

Am 23.06.2017 um 14:50 schrieb Lukasz Majewski:

Quoted 47 lines

Hi Heiko,

Quoted 38 lines

fix warnings:
drivers/usb/gadget/at91_udc.c:1344:12: warning: 'at91rm9200_udc_init' defined but not used [-Wunused-function] drivers/usb/gadget/at91_udc.c:1379:13: warning:
'at91rm9200_udc_pullup' defined but not used [-Wunused-function] drivers/usb/gadget/at91_udc.c:1476:12: warning:
'at91sam9263_udc_init' defined but not used [-Wunused-function]

---

  drivers/usb/gadget/at91_udc.c | 30 +++---------------------------
  1 file changed, 3 insertions(+), 27 deletions(-)
(quoted diff) +0 -0

b/drivers/usb/gadget/at91_udc.c index 01a5907..85bfbf5 100644

drivers/usb/gadget/at91_udc.c +3 -2
@@ -1341,7 +1341,7 @@ static int at91_stop(struct usb_gadget *gadget)
 
  /*-------------------------------------------------------------------------*/
 
-static int at91rm9200_udc_init(struct at91_udc *udc)
+static __maybe_unused int at91rm9200_udc_init(struct at91_udc *udc)
  {
  	struct at91_ep *ep;
  	int ret;
@@ -1376,7 +1376,8 @@ static int at91rm9200_udc_init(struct at91_udc
 *udc) return 0;
  }
 
-static void at91rm9200_udc_pullup(struct at91_udc *udc, int is_on)
+static __maybe_unused
+void at91rm9200_udc_pullup(struct at91_udc *udc, int is_on)
  {
  	int active = !udc->board.pullup_active_low;
 

drivers/usb/gadget/at91_udc.c static const struct at91_udc_caps · line 1476

Quoted 4 lines
drivers/usb/gadget/at91_udc.c +0 -1
@@ -1473,31 +1474,6 @@ static const struct at91_udc_caps
 at91sam9261_udc_caps = { };
  #endif
 
-static int at91sam9263_udc_init(struct at91_udc *udc)

I'm a bit puzzled...

Quoted 6 lines

For the at91rm9200 related boards it is enough to add __maybe_unused and leave the unused function in the source code.

Hence, I'm wondering why do you remove the function for at91sam9263?

Shouldn't all be removed or have added __maybe_unused ?

Hmm.. No, it seems there are no users for the at91sam9263_udc_init()

pollux:u-boot hs [master] $ grep -lr at91sam9263_udc_init . ./drivers/usb/gadget/at91_udc.c
pollux:u-boot hs [master] $

And in ./drivers/usb/gadget/at91_udc.c it is only defined, but not used...

bye,
Heiko

Quoted 42 lines
Quoted 18 lines
drivers/usb/gadget/at91_udc.c +0 -17
-{
-	struct at91_ep *ep;
-	int i;
-
-	for (i = 0; i < NUM_ENDPOINTS; i++) {
-		ep = &udc->ep[i];
-
-		switch (i) {
-		case 0:
-		case 1:
-		case 2:
-		case 3:
-			ep->maxpacket = 64;
-			break;
-		case 4:
-		case 5:
-			ep->maxpacket = 256;

drivers/usb/gadget/at91_udc.c static const struct at91_udc_caps at91sam9261_udc_caps = { · line 1479

Quoted 10 lines
drivers/usb/gadget/at91_udc.c +0 -7
-			break;
-		}
-	}
-
-	return 0;
-}
-
  int usb_gadget_handle_interrupts(int index)
  {
  	struct at91_udc *udc = controller;

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
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

Signature · 2 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#4 lore raw

PATCH 1/2 drivers, usb, gadget: fix compiler warnings for at91_udc.c

Quoted 57 lines · Heiko Schocher

Hello Lukasz,

Am 23.06.2017 um 14:50 schrieb Lukasz Majewski:

Quoted 47 lines

Hi Heiko,

Quoted 38 lines

fix warnings:
drivers/usb/gadget/at91_udc.c:1344:12: warning: 'at91rm9200_udc_init' defined but not used [-Wunused-function] drivers/usb/gadget/at91_udc.c:1379:13: warning:
'at91rm9200_udc_pullup' defined but not used [-Wunused-function] drivers/usb/gadget/at91_udc.c:1476:12: warning:
'at91sam9263_udc_init' defined but not used [-Wunused-function]

---

 drivers/usb/gadget/at91_udc.c | 30 +++---------------------------
 1 file changed, 3 insertions(+), 27 deletions(-)
(quoted diff) +0 -0

b/drivers/usb/gadget/at91_udc.c index 01a5907..85bfbf5 100644

drivers/usb/gadget/at91_udc.c +3 -2
@@ -1341,7 +1341,7 @@ static int at91_stop(struct usb_gadget *gadget)
 
 /*-------------------------------------------------------------------------*/
 
-static int at91rm9200_udc_init(struct at91_udc *udc)
+static __maybe_unused int at91rm9200_udc_init(struct at91_udc *udc)
 {
 	struct at91_ep *ep;
 	int ret;
@@ -1376,7 +1376,8 @@ static int at91rm9200_udc_init(struct at91_udc
 *udc) return 0;
 }
 
-static void at91rm9200_udc_pullup(struct at91_udc *udc, int is_on)
+static __maybe_unused
+void at91rm9200_udc_pullup(struct at91_udc *udc, int is_on)
 {
 	int active = !udc->board.pullup_active_low;
 

drivers/usb/gadget/at91_udc.c static const struct at91_udc_caps · line 1476

Quoted 4 lines
drivers/usb/gadget/at91_udc.c +0 -1
@@ -1473,31 +1474,6 @@ static const struct at91_udc_caps
 at91sam9261_udc_caps = { };
 #endif
 
-static int at91sam9263_udc_init(struct at91_udc *udc)

I'm a bit puzzled...

Quoted 6 lines

For the at91rm9200 related boards it is enough to add __maybe_unused and leave the unused function in the source code.

Hence, I'm wondering why do you remove the function for at91sam9263?

Shouldn't all be removed or have added __maybe_unused ?

Quoted 7 lines

Hmm.. No, it seems there are no users for the at91sam9263_udc_init()

pollux:u-boot hs [master] $ grep -lr at91sam9263_udc_init . ./drivers/usb/gadget/at91_udc.c
pollux:u-boot hs [master] $

And in ./drivers/usb/gadget/at91_udc.c it is only defined, but not used...

So in sum, a v2 to drop this now unused code then, yes? Thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170623/36af67ed/attachment.sig>
#5 lore raw

PATCH 1/2 drivers, usb, gadget: fix compiler warnings for at91_udc.c

In reply to Heiko Schocher

Hi Heiko,

Quoted 58 lines

Hello Lukasz,

Am 23.06.2017 um 14:50 schrieb Lukasz Majewski:

Quoted 48 lines

Hi Heiko,

Quoted 39 lines

fix warnings:
drivers/usb/gadget/at91_udc.c:1344:12: warning:
'at91rm9200_udc_init' defined but not used [-Wunused-function] drivers/usb/gadget/at91_udc.c:1379:13: warning:
'at91rm9200_udc_pullup' defined but not used [-Wunused-function] drivers/usb/gadget/at91_udc.c:1476:12: warning:
'at91sam9263_udc_init' defined but not used [-Wunused-function]

---

  drivers/usb/gadget/at91_udc.c | 30 +++---------------------------
  1 file changed, 3 insertions(+), 27 deletions(-)
(quoted diff) +0 -0

b/drivers/usb/gadget/at91_udc.c index 01a5907..85bfbf5 100644

drivers/usb/gadget/at91_udc.c +1 -1
@@ -1341,7 +1341,7 @@ static int at91_stop(struct usb_gadget
 *gadget)
 
  /*-------------------------------------------------------------------------*/
 
-static int at91rm9200_udc_init(struct at91_udc *udc)
+static __maybe_unused int at91rm9200_udc_init(struct at91_udc
 *udc) {
  	struct at91_ep *ep;

int ret;

drivers/usb/gadget/at91_udc.c +2 -1
@@ -1376,7 +1376,8 @@ static int at91rm9200_udc_init(struct
 at91_udc *udc) return 0;
  }
 
-static void at91rm9200_udc_pullup(struct at91_udc *udc, int is_on)
+static __maybe_unused
+void at91rm9200_udc_pullup(struct at91_udc *udc, int is_on)
  {
  	int active = !udc->board.pullup_active_low;
 

drivers/usb/gadget/at91_udc.c static const struct at91_udc_caps · line 1476

Quoted 4 lines
drivers/usb/gadget/at91_udc.c +0 -1
@@ -1473,31 +1474,6 @@ static const struct at91_udc_caps
 at91sam9261_udc_caps = { };
  #endif
 
-static int at91sam9263_udc_init(struct at91_udc *udc)

I'm a bit puzzled...

Quoted 6 lines

For the at91rm9200 related boards it is enough to add __maybe_unused and leave the unused function in the source code.

Hence, I'm wondering why do you remove the function for at91sam9263?

Shouldn't all be removed or have added __maybe_unused ?

Quoted 8 lines

Hmm.. No, it seems there are no users for the at91sam9263_udc_init()

pollux:u-boot hs [master] $ grep -lr at91sam9263_udc_init . ./drivers/usb/gadget/at91_udc.c
pollux:u-boot hs [master] $

And in ./drivers/usb/gadget/at91_udc.c it is only defined, but not used...

Aaaa...... Ok I see.

Quoted 47 lines

bye,
Heiko

Quoted 43 lines
Quoted 18 lines
drivers/usb/gadget/at91_udc.c +0 -17
-{
-	struct at91_ep *ep;
-	int i;
-
-	for (i = 0; i < NUM_ENDPOINTS; i++) {
-		ep = &udc->ep[i];
-
-		switch (i) {
-		case 0:
-		case 1:
-		case 2:
-		case 3:
-			ep->maxpacket = 64;
-			break;
-		case 4:
-		case 5:
-			ep->maxpacket = 256;

drivers/usb/gadget/at91_udc.c static const struct at91_udc_caps at91sam9261_udc_caps = { · line 1479

Quoted 10 lines
drivers/usb/gadget/at91_udc.c +0 -7
-			break;
-		}
-	}
-
-	return 0;
-}
-
  int usb_gadget_handle_interrupts(int index)
  {
  	struct at91_udc *udc = controller;

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk 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

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
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

#6 lore raw

PATCH 2/2 atmel, at91: fix smartweb board

In reply to Heiko Schocher

since commit: f8b7fff1d5c5 "serial: atmel_usart: Add clk support"

smartweb board comes not up anymore. Fix it.

---

 arch/arm/dts/at91sam9260-smartweb.dts | 2 ++
 board/siemens/smartweb/smartweb.c     | 9 ---------
 configs/smartweb_defconfig            | 3 +++
 include/configs/smartweb.h            | 3 +++
 4 files changed, 8 insertions(+), 9 deletions(-)
arch/arm/dts/at91sam9260-smartweb.dts +2 -0
index faed763..e59781b 100644
@@ -18,6 +18,7 @@
 	compatible = "atmel,at91sam9260", "atmel,at91sam9";
 
 	chosen {
+		u-boot,dm-pre-reloc;
 		stdout-path = &dbgu;
 	};
 
@@ -48,6 +49,7 @@
 			};
 
 			dbgu: serial at fffff200 {
+				u-boot,dm-pre-reloc;
 				status = "okay";
 			};
 
board/siemens/smartweb/smartweb.c +0 -9
index 78a7946..718ccc7 100644
@@ -256,12 +256,3 @@ void mem_init(void)
 	sdramc_initialize(ATMEL_BASE_CS1, &setting);
 }
 #endif
-
-static struct atmel_serial_platdata at91sam9260_serial_plat = {
-	.base_addr = ATMEL_BASE_DBGU,
-};
-
-U_BOOT_DEVICE(at91sam9260_serial) = {
-	.name	= "serial_atmel",
-	.platdata = &at91sam9260_serial_plat,
-};
configs/smartweb_defconfig +3 -0
index 48c8781..a769fc5 100644
@@ -7,6 +7,7 @@ CONFIG_TARGET_SMARTWEB=y
 CONFIG_SPL_GPIO_SUPPORT=y
 CONFIG_SPL_LIBCOMMON_SUPPORT=y
 CONFIG_SPL_LIBGENERIC_SUPPORT=y
+CONFIG_SYS_MALLOC_F_LEN=0x2000
 CONFIG_SPL_NAND_SUPPORT=y
 CONFIG_DEFAULT_DEVICE_TREE="at91sam9260-smartweb"
 CONFIG_FIT=y
@@ -33,6 +34,8 @@ CONFIG_CMD_FAT=y
 # CONFIG_DOS_PARTITION is not set
 CONFIG_OF_CONTROL=y
 CONFIG_OF_EMBED=y
+CONFIG_CLK=y
+CONFIG_CLK_AT91=y
 CONFIG_DFU_NAND=y
 # CONFIG_MMC is not set
 CONFIG_USB=y
include/configs/smartweb.h +3 -0
index 1236da7..8400278 100644
@@ -211,6 +211,9 @@
 #define CONFIG_SYS_INIT_SP_ADDR		0x301000
 #define CONFIG_SPL_STACK_R
 #define CONFIG_SPL_STACK_R_ADDR		CONFIG_SYS_TEXT_BASE
+/* we have only 4k sram in SPL, so cut SYS_MALLOC_F_LEN */
+#undef CONFIG_SYS_MALLOC_F_LEN
+#define CONFIG_SYS_MALLOC_F_LEN 0x400
 #else
 /*
  * Initial stack pointer: 4k - GENERATED_GBL_DATA_SIZE in internal SRAM,
Signature · 1 line
2.7.4
#7 lore raw

PATCH 2/2 atmel, at91: fix smartweb board

Quoted 4 lines · Heiko Schocher

since commit: f8b7fff1d5c5 "serial: atmel_usart: Add clk support"

smartweb board comes not up anymore. Fix it.

Quoted 8 lines

---

 arch/arm/dts/at91sam9260-smartweb.dts | 2 ++
 board/siemens/smartweb/smartweb.c     | 9 ---------
 configs/smartweb_defconfig            | 3 +++
 include/configs/smartweb.h            | 3 +++
 4 files changed, 8 insertions(+), 9 deletions(-)