Re: [U-Boot] [PATCH v5 1/7] powerpc: Extract EPAPR_MAGIC constants into processor.h

2012-10-30 Thread Stefan Roese
Hi Tom,

On 10/29/2012 09:55 PM, Tom Rini wrote:
 On Tue, Oct 23, 2012 at 10:28:29AM +0200, Stefan Roese wrote:
 
 By extracting these defines into a header, they can be re-used by other
 C sources as well. This will be done by the SPL framework OS boot
 support.

 Signed-off-by: Stefan Roese s...@denx.de
 
 release.S:354:0: warning: EPAPR_MAGIC redefined [enabled by default]
 .../P2020RDB-PC_36BIT/include2/asm/processor.h:1346:0:
 note: this is the location of the previous definition
 
 Please fix, thanks!

Yes, sorry. Will send a new version soon.

Thanks,
Stefan
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] powerpc/esdhc: force the bus width to 4bit

2012-10-30 Thread Jaehoon Chung
On 10/23/2012 06:50 PM, Marek Vasut wrote:
 Dear Huang Changming-R66093,
 
 Best Regards
 Jerry Huang

 -Original Message-
 From: Marek Vasut [mailto:ma...@denx.de]
 Sent: Tuesday, October 23, 2012 3:24 PM
 To: Huang Changming-R66093
 Cc: u-boot@lists.denx.de; Andy Fleming
 Subject: Re: [PATCH] powerpc/esdhc: force the bus width to 4bit

 Dear chang-ming.hu...@freescale.com,

 From: Jerry Huang chang-ming.hu...@freescale.com

 For the current u-boot codes, only 4bit/1bit SD/SDHC bus width is

 support.

 So for MMC card, we also support 4bit bus width, otherwiase, we will

 get the 12bit bus width, which is not correct:
 Andy ... can you please explain? I don't quite understand the problem, I
 thought we had no problem supporting 8bit mmc (esp. if the controller
 handles that for us mostly).

 Yes, the controller support 8bit MMC.

 FSL ESDHC driver set the host_caps = MMC_MODE_4BIT | MMC_MODE_8BIT;
 But, the current codes for MMC card has been changed to:

 } else {
  width = ((mmc-host_caps  MMC_MODE_MASK_WIDTH_BITS) 
  MMC_MODE_WIDTH_BITS_SHIFT);
  for (; width = 0; width--) {
  

 So for FSL ESDHC, the width = 3, after implement mmc_switch successfully,
 will set the bus to 4 * width. Therefore, I will get the 12bit (4 x 3) bus
 width.
This problem is MMC subsystem's bug.
I think good that will modify the code in mmc.c.
If caps is set to MMC_MODE_4BIT | MMC_MODE_8BIT,
we can see the 12bit support with using mmcinfo command

Best Regards,
Jaehoon Chung


 Below is the old codes (width = 2):
 } else {
 for (width = EXT_CSD_BUS_WIDTH_8; width = 0; width--) {
 [...]
 
 
 Uh, so it's a bug in the MMC subsystem?
 Best regards,
 Marek Vasut
 ___
 U-Boot mailing list
 U-Boot@lists.denx.de
 http://lists.denx.de/mailman/listinfo/u-boot
 

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 1/8] tegra: usb: convert USB_PORTS_MAX to be a define

2012-10-30 Thread Lucas Stach
No point in having this as an enum. Also while at it set it to the real hardware
maximum for both Tegra 2 and Tegra 3. If new Tegra hardware includes more
USB controllers we can always bump the limit then.

Signed-off-by: Lucas Stach d...@lynxeye.de
---
 arch/arm/cpu/armv7/tegra20/usb.c | 4 +---
 1 Datei geändert, 1 Zeile hinzugefügt(+), 3 Zeilen entfernt(-)

diff --git a/arch/arm/cpu/armv7/tegra20/usb.c b/arch/arm/cpu/armv7/tegra20/usb.c
index 1bccf2b..9fd1edc 100644
--- a/arch/arm/cpu/armv7/tegra20/usb.c
+++ b/arch/arm/cpu/armv7/tegra20/usb.c
@@ -43,9 +43,7 @@
#endif
 #endif
 
-enum {
-   USB_PORTS_MAX   = 4,/* Maximum ports we allow */
-};
+#define USB_PORTS_MAX  3   /* Maximum ports we allow */
 
 /* Parameters we need for USB */
 enum {
-- 
1.7.11.7

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 2/8] tegra: usb: make controller init functions more self contained

2012-10-30 Thread Lucas Stach
There is no need to pass around all those parameters. The init functions
are able to easily extract all the needed setup info on their own.

Signed-off-by: Lucas Stach d...@lynxeye.de
---
 arch/arm/cpu/armv7/tegra20/usb.c | 24 
 1 Datei geändert, 12 Zeilen hinzugefügt(+), 12 Zeilen entfernt(-)

diff --git a/arch/arm/cpu/armv7/tegra20/usb.c b/arch/arm/cpu/armv7/tegra20/usb.c
index 9fd1edc..1725cd1 100644
--- a/arch/arm/cpu/armv7/tegra20/usb.c
+++ b/arch/arm/cpu/armv7/tegra20/usb.c
@@ -196,11 +196,12 @@ void usbf_reset_controller(struct fdt_usb *config, struct 
usb_ctlr *usbctlr)
 }
 
 /* set up the UTMI USB controller with the parameters provided */
-static int init_utmi_usb_controller(struct fdt_usb *config,
-   struct usb_ctlr *usbctlr, const u32 timing[])
+static int init_utmi_usb_controller(struct fdt_usb *config)
 {
u32 val;
int loop_count;
+   u32 *timing;
+   struct usb_ctlr *usbctlr = config-reg;
 
clock_enable(config-periph_id);
 
@@ -227,6 +228,8 @@ static int init_utmi_usb_controller(struct fdt_usb *config,
 * PLL Delay CONFIGURATION settings. The following parameters control
 * the bring up of the plls.
 */
+   timing = usb_pll[clock_get_osc_freq()];
+
val = readl(usbctlr-utmip_misc_cfg1);
clrsetbits_le32(val, UTMIP_PLLU_STABLE_COUNT_MASK,
timing[PARAM_STABLE_COUNT]  UTMIP_PLLU_STABLE_COUNT_SHIFT);
@@ -329,12 +332,12 @@ static int init_utmi_usb_controller(struct fdt_usb 
*config,
 #endif
 
 /* set up the ULPI USB controller with the parameters provided */
-static int init_ulpi_usb_controller(struct fdt_usb *config,
-   struct usb_ctlr *usbctlr)
+static int init_ulpi_usb_controller(struct fdt_usb *config)
 {
u32 val;
int loop_count;
struct ulpi_viewport ulpi_vp;
+   struct usb_ctlr *usbctlr = config-reg;
 
/* set up ULPI reference clock on pllp_out4 */
clock_enable(PERIPH_ID_DEV2_OUT);
@@ -406,8 +409,7 @@ static int init_ulpi_usb_controller(struct fdt_usb *config,
return 0;
 }
 #else
-static int init_ulpi_usb_controller(struct fdt_usb *config,
-   struct usb_ctlr *usbctlr)
+static int init_ulpi_usb_controller(struct fdt_usb *config)
 {
printf(No code to set up ULPI controller, please enable
CONFIG_USB_ULPI and CONFIG_USB_ULPI_VIEWPORT);
@@ -428,22 +430,20 @@ static void config_clock(const u32 timing[])
  * @param config   USB port configuration
  * @return 0 if ok, -1 if error (too many ports)
  */
-static int add_port(struct fdt_usb *config, const u32 timing[])
+static int add_port(struct fdt_usb *config)
 {
-   struct usb_ctlr *usbctlr = config-reg;
-
if (port_count == USB_PORTS_MAX) {
printf(tegrausb: Cannot register more than %d ports\n,
  USB_PORTS_MAX);
return -1;
}
 
-   if (config-utmi  init_utmi_usb_controller(config, usbctlr, timing)) {
+   if (config-utmi  init_utmi_usb_controller(config)) {
printf(tegrausb: Cannot init port\n);
return -1;
}
 
-   if (config-ulpi  init_ulpi_usb_controller(config, usbctlr)) {
+   if (config-ulpi  init_ulpi_usb_controller(config)) {
printf(tegrausb: Cannot init port\n);
return -1;
}
@@ -556,7 +556,7 @@ int board_usb_init(const void *blob)
return -1;
}
 
-   if (add_port(config, usb_pll[freq]))
+   if (add_port(config))
return -1;
set_host_mode(config);
}
-- 
1.7.11.7

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 6/8] tegra: usb: various small cleanups

2012-10-30 Thread Lucas Stach
Remove unneeded headers, function prototype and stale comment.

Signed-off-by: Lucas Stach d...@lynxeye.de
---
 arch/arm/cpu/armv7/tegra20/usb.c| 13 +
 arch/arm/include/asm/arch-tegra20/usb.h |  3 ---
 2 Dateien geändert, 1 Zeile hinzugefügt(+), 15 Zeilen entfernt(-)

diff --git a/arch/arm/cpu/armv7/tegra20/usb.c b/arch/arm/cpu/armv7/tegra20/usb.c
index e372b8b..2cc95d2 100644
--- a/arch/arm/cpu/armv7/tegra20/usb.c
+++ b/arch/arm/cpu/armv7/tegra20/usb.c
@@ -25,21 +25,15 @@
 #include asm/io.h
 #include asm-generic/gpio.h
 #include asm/arch/clock.h
-#include asm/arch/gpio.h
-#include asm/arch/pinmux.h
-#include asm/arch/tegra.h
 #include asm/arch/usb.h
 #include usb/ulpi.h
-#include asm/arch-tegra/clk_rst.h
-#include asm/arch-tegra/sys_proto.h
-#include asm/arch-tegra/uart.h
 #include libfdt.h
 #include fdtdec.h
 
 #ifdef CONFIG_USB_ULPI
#ifndef CONFIG_USB_ULPI_VIEWPORT
#error  To use CONFIG_USB_ULPI on Tegra Boards you have to also \
-   define CONFIG_USB_ULPI_VIEWPORT
+   define CONFIG_USB_ULPI_VIEWPORT
#endif
 #endif
 
@@ -188,11 +182,6 @@ void usbf_reset_controller(struct fdt_usb *config, struct 
usb_ctlr *usbctlr)
/* Enable the UTMIP PHY */
if (config-utmi)
setbits_le32(usbctlr-susp_ctrl, UTMIP_PHY_ENB);
-
-   /*
-* TODO: where do we take the USB1 out of reset? The old code would
-* take USB3 out of reset, but not USB1. This code doesn't do either.
-*/
 }
 
 /* set up the UTMI USB controller with the parameters provided */
diff --git a/arch/arm/include/asm/arch-tegra20/usb.h 
b/arch/arm/include/asm/arch-tegra20/usb.h
index fdbd127..b18c850 100644
--- a/arch/arm/include/asm/arch-tegra20/usb.h
+++ b/arch/arm/include/asm/arch-tegra20/usb.h
@@ -243,9 +243,6 @@ struct usb_ctlr {
 #define VBUS_VLD_STS   (1  26)
 
 
-/* Change the USB host port into host mode */
-void usb_set_host_mode(void);
-
 /* Setup USB on the board */
 int board_usb_init(const void *blob);
 
-- 
1.7.11.7

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 3/8] tegra: usb: fold initial pll setup into board_usb_init

2012-10-30 Thread Lucas Stach
The setup is trivial, no need to split this out into a separate function.

Signed-off-by: Lucas Stach d...@lynxeye.de
---
 arch/arm/cpu/armv7/tegra20/usb.c | 15 +--
 1 Datei geändert, 5 Zeilen hinzugefügt(+), 10 Zeilen entfernt(-)

diff --git a/arch/arm/cpu/armv7/tegra20/usb.c b/arch/arm/cpu/armv7/tegra20/usb.c
index 1725cd1..e61bd69 100644
--- a/arch/arm/cpu/armv7/tegra20/usb.c
+++ b/arch/arm/cpu/armv7/tegra20/usb.c
@@ -417,13 +417,6 @@ static int init_ulpi_usb_controller(struct fdt_usb *config)
 }
 #endif
 
-static void config_clock(const u32 timing[])
-{
-   clock_start_pll(CLOCK_ID_USB,
-   timing[PARAM_DIVM], timing[PARAM_DIVN], timing[PARAM_DIVP],
-   timing[PARAM_CPCON], timing[PARAM_LFCON]);
-}
-
 /**
  * Add a new USB port to the list of available ports.
  *
@@ -534,13 +527,15 @@ int board_usb_init(const void *blob)
 {
struct fdt_usb config;
unsigned osc_freq = clock_get_rate(CLOCK_ID_OSC);
-   enum clock_osc_freq freq;
int node_list[USB_PORTS_MAX];
int node, count, i;
+   u32 *timing;
 
/* Set up the USB clocks correctly based on our oscillator frequency */
-   freq = clock_get_osc_freq();
-   config_clock(usb_pll[freq]);
+   timing = usb_pll[clock_get_osc_freq()];
+   clock_start_pll(CLOCK_ID_USB,
+   timing[PARAM_DIVM], timing[PARAM_DIVN], timing[PARAM_DIVP],
+   timing[PARAM_CPCON], timing[PARAM_LFCON]);
 
/* count may return 0 on error */
count = fdtdec_find_aliases_for_id(blob, usb,
-- 
1.7.11.7

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 4/8] tegra: usb: remove unneeded function parameter

2012-10-30 Thread Lucas Stach
Just a dead parameter, never actually used.

Signed-off-by: Lucas Stach d...@lynxeye.de
---
 arch/arm/cpu/armv7/tegra20/usb.c | 6 ++
 1 Datei geändert, 2 Zeilen hinzugefügt(+), 4 Zeilen entfernt(-)

diff --git a/arch/arm/cpu/armv7/tegra20/usb.c b/arch/arm/cpu/armv7/tegra20/usb.c
index e61bd69..cf800b1 100644
--- a/arch/arm/cpu/armv7/tegra20/usb.c
+++ b/arch/arm/cpu/armv7/tegra20/usb.c
@@ -477,8 +477,7 @@ int tegrausb_stop_port(int portnum)
return 0;
 }
 
-int fdt_decode_usb(const void *blob, int node, unsigned osc_frequency_mhz,
-  struct fdt_usb *config)
+int fdt_decode_usb(const void *blob, int node, struct fdt_usb *config)
 {
const char *phy, *mode;
 
@@ -526,7 +525,6 @@ int fdt_decode_usb(const void *blob, int node, unsigned 
osc_frequency_mhz,
 int board_usb_init(const void *blob)
 {
struct fdt_usb config;
-   unsigned osc_freq = clock_get_rate(CLOCK_ID_OSC);
int node_list[USB_PORTS_MAX];
int node, count, i;
u32 *timing;
@@ -545,7 +543,7 @@ int board_usb_init(const void *blob)
node = node_list[i];
if (!node)
continue;
-   if (fdt_decode_usb(blob, node, osc_freq, config)) {
+   if (fdt_decode_usb(blob, node, config)) {
debug(Cannot decode USB node %s\n,
  fdt_get_name(blob, node, NULL));
return -1;
-- 
1.7.11.7

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 5/8] tegra: usb: move controller init into start_port

2012-10-30 Thread Lucas Stach
There is no need to init a USB controller before the upper layers indicate
that they are actually going to use it.

board_usb_init now only parses the device tree and sets up the common pll.

Signed-off-by: Lucas Stach d...@lynxeye.de
---
 arch/arm/cpu/armv7/tegra20/usb.c | 47 +++-
 1 Datei geändert, 18 Zeilen hinzugefügt(+), 29 Zeilen entfernt(-)

diff --git a/arch/arm/cpu/armv7/tegra20/usb.c b/arch/arm/cpu/armv7/tegra20/usb.c
index cf800b1..e372b8b 100644
--- a/arch/arm/cpu/armv7/tegra20/usb.c
+++ b/arch/arm/cpu/armv7/tegra20/usb.c
@@ -417,44 +417,29 @@ static int init_ulpi_usb_controller(struct fdt_usb 
*config)
 }
 #endif
 
-/**
- * Add a new USB port to the list of available ports.
- *
- * @param config   USB port configuration
- * @return 0 if ok, -1 if error (too many ports)
- */
-static int add_port(struct fdt_usb *config)
+int tegrausb_start_port(int portnum, u32 *hccr, u32 *hcor)
 {
-   if (port_count == USB_PORTS_MAX) {
-   printf(tegrausb: Cannot register more than %d ports\n,
- USB_PORTS_MAX);
+   struct fdt_usb *config;
+   struct usb_ctlr *usbctlr;
+
+   if (portnum = port_count)
return -1;
-   }
+
+   config = port[portnum];
 
if (config-utmi  init_utmi_usb_controller(config)) {
-   printf(tegrausb: Cannot init port\n);
+   printf(tegrausb: Cannot init port %d\n, portnum);
return -1;
}
 
if (config-ulpi  init_ulpi_usb_controller(config)) {
-   printf(tegrausb: Cannot init port\n);
+   printf(tegrausb: Cannot init port %d\n, portnum);
return -1;
}
 
-   port[port_count++] = *config;
-
-   return 0;
-}
+   set_host_mode(config);
 
-int tegrausb_start_port(int portnum, u32 *hccr, u32 *hcor)
-{
-   struct usb_ctlr *usbctlr;
-
-   if (portnum = port_count)
-   return -1;
-   set_host_mode(port[portnum]);
-
-   usbctlr = port[portnum].reg;
+   usbctlr = config-reg;
*hccr = (u32)usbctlr-cap_length;
*hcor = (u32)usbctlr-usb_cmd;
return 0;
@@ -539,6 +524,12 @@ int board_usb_init(const void *blob)
count = fdtdec_find_aliases_for_id(blob, usb,
COMPAT_NVIDIA_TEGRA20_USB, node_list, USB_PORTS_MAX);
for (i = 0; i  count; i++) {
+   if (port_count == USB_PORTS_MAX) {
+   printf(tegrausb: Cannot register more than %d ports\n,
+   USB_PORTS_MAX);
+   return -1;
+   }
+
debug(USB %d: , i);
node = node_list[i];
if (!node)
@@ -549,9 +540,7 @@ int board_usb_init(const void *blob)
return -1;
}
 
-   if (add_port(config))
-   return -1;
-   set_host_mode(config);
+   port[port_count++] = config;
}
 
return 0;
-- 
1.7.11.7

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 8/8] tegra: usb: move [start|stop]_port into ehci_hcd_[init|stop]

2012-10-30 Thread Lucas Stach
The ehci_hcd entry points were just calling into the Tegra USB functions. Now
that they are in the same file we can just move over the implementation.

Signed-off-by: Lucas Stach d...@lynxeye.de
---
 arch/arm/include/asm/arch-tegra20/usb.h | 19 ---
 drivers/usb/host/ehci-tegra.c   | 93 +
 2 Dateien geändert, 35 Zeilen hinzugefügt(+), 77 Zeilen entfernt(-)

diff --git a/arch/arm/include/asm/arch-tegra20/usb.h 
b/arch/arm/include/asm/arch-tegra20/usb.h
index b18c850..ef6c089 100644
--- a/arch/arm/include/asm/arch-tegra20/usb.h
+++ b/arch/arm/include/asm/arch-tegra20/usb.h
@@ -246,23 +246,4 @@ struct usb_ctlr {
 /* Setup USB on the board */
 int board_usb_init(const void *blob);
 
-/**
- * Start up the given port number (ports are numbered from 0 on each board).
- * This returns values for the appropriate hccr and hcor addresses to use for
- * USB EHCI operations.
- *
- * @param portnum  port number to start
- * @param hccr returns start address of EHCI HCCR registers
- * @param hcor returns start address of EHCI HCOR registers
- * @return 0 if ok, -1 on error (generally invalid port number)
- */
-int tegrausb_start_port(int portnum, u32 *hccr, u32 *hcor);
-
-/**
- * Stop the current port
- *
- * @return 0 if ok, -1 if no port was active
- */
-int tegrausb_stop_port(int portnum);
-
 #endif /* _TEGRA_USB_H_ */
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
index 3df43a9..5966e2d 100644
--- a/drivers/usb/host/ehci-tegra.c
+++ b/drivers/usb/host/ehci-tegra.c
@@ -426,51 +426,6 @@ static int init_ulpi_usb_controller(struct fdt_usb *config)
 }
 #endif
 
-int tegrausb_start_port(int portnum, u32 *hccr, u32 *hcor)
-{
-   struct fdt_usb *config;
-   struct usb_ctlr *usbctlr;
-
-   if (portnum = port_count)
-   return -1;
-
-   config = port[portnum];
-
-   if (config-utmi  init_utmi_usb_controller(config)) {
-   printf(tegrausb: Cannot init port %d\n, portnum);
-   return -1;
-   }
-
-   if (config-ulpi  init_ulpi_usb_controller(config)) {
-   printf(tegrausb: Cannot init port %d\n, portnum);
-   return -1;
-   }
-
-   set_host_mode(config);
-
-   usbctlr = config-reg;
-   *hccr = (u32)usbctlr-cap_length;
-   *hcor = (u32)usbctlr-usb_cmd;
-   return 0;
-}
-
-int tegrausb_stop_port(int portnum)
-{
-   struct usb_ctlr *usbctlr;
-
-   usbctlr = port[portnum].reg;
-
-   /* Stop controller */
-   writel(0, usbctlr-usb_cmd);
-   udelay(1000);
-
-   /* Initiate controller reset */
-   writel(2, usbctlr-usb_cmd);
-   udelay(1000);
-
-   return 0;
-}
-
 int fdt_decode_usb(const void *blob, int node, struct fdt_usb *config)
 {
const char *phy, *mode;
@@ -556,31 +511,53 @@ int board_usb_init(const void *blob)
 }
 
 /*
- * Create the appropriate control structures to manage
- * a new EHCI host controller.
+ * Initialize the USB controller and return the control structures.
  */
 int ehci_hcd_init(int index, struct ehci_hccr **hccr, struct ehci_hcor **hcor)
 {
-   u32 our_hccr, our_hcor;
+   struct fdt_usb *config;
+   struct usb_ctlr *usbctlr;
 
-   /*
-* Select the first port, as we don't have a way of selecting others
-* yet
-*/
-   if (tegrausb_start_port(index, our_hccr, our_hcor))
+   if (index = port_count)
+   return -1;
+
+   config = port[index];
+
+   if (config-utmi  init_utmi_usb_controller(config)) {
+   printf(tegrausb: Cannot init port %d\n, index);
+   return -1;
+   }
+
+   if (config-ulpi  init_ulpi_usb_controller(config)) {
+   printf(tegrausb: Cannot init port %d\n, index);
return -1;
+   }
+
+   set_host_mode(config);
 
-   *hccr = (struct ehci_hccr *)our_hccr;
-   *hcor = (struct ehci_hcor *)our_hcor;
+   usbctlr = config-reg;
+   *hccr = (struct ehci_hccr *)usbctlr-cap_length;
+   *hcor = (struct ehci_hcor *)usbctlr-usb_cmd;
 
return 0;
 }
 
 /*
- * Destroy the appropriate control structures corresponding
- * the the EHCI host controller.
+ * Bring down the USB controller.
  */
 int ehci_hcd_stop(int index)
 {
-   return tegrausb_stop_port(index);
+   struct usb_ctlr *usbctlr;
+
+   usbctlr = port[index].reg;
+
+   /* Stop controller */
+   writel(0, usbctlr-usb_cmd);
+   udelay(1000);
+
+   /* Initiate controller reset */
+   writel(2, usbctlr-usb_cmd);
+   udelay(1000);
+
+   return 0;
 }
-- 
1.7.11.7

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 7/8] tegra: usb: move implementation into right directory

2012-10-30 Thread Lucas Stach
This moves the Tegra USB implementation into the drivers/usb/host
directory.

Signed-off-by: Lucas Stach d...@lynxeye.de
---
 arch/arm/cpu/armv7/tegra20/Makefile|  2 -
 .../tegra20/usb.c = drivers/usb/host/ehci-tegra.c | 60 --
 2 Dateien geändert, 55 Zeilen hinzugefügt(+), 7 Zeilen entfernt(-)
 rename arch/arm/cpu/armv7/tegra20/usb.c = drivers/usb/host/ehci-tegra.c (92%)

diff --git a/arch/arm/cpu/armv7/tegra20/Makefile 
b/arch/arm/cpu/armv7/tegra20/Makefile
index 09a0314..2c4d5c9 100644
--- a/arch/arm/cpu/armv7/tegra20/Makefile
+++ b/arch/arm/cpu/armv7/tegra20/Makefile
@@ -27,8 +27,6 @@ include $(TOPDIR)/config.mk
 
 LIB=  $(obj)lib$(SOC).o
 
-COBJS-$(CONFIG_USB_EHCI_TEGRA) += usb.o
-
 COBJS  := $(COBJS-y)
 SRCS   := $(COBJS:.o=.c)
 OBJS   := $(addprefix $(obj),$(COBJS))
diff --git a/arch/arm/cpu/armv7/tegra20/usb.c b/drivers/usb/host/ehci-tegra.c
similarity index 92%
rename from arch/arm/cpu/armv7/tegra20/usb.c
rename to drivers/usb/host/ehci-tegra.c
index 2cc95d2..3df43a9 100644
--- a/arch/arm/cpu/armv7/tegra20/usb.c
+++ b/drivers/usb/host/ehci-tegra.c
@@ -1,6 +1,7 @@
 /*
+ * Copyright (c) 2009-2012 NVIDIA Corporation
  * Copyright (c) 2011 The Chromium OS Authors.
- * (C) Copyright 2010,2011 NVIDIA Corporation www.nvidia.com
+ * Copyright (c) 2012 Lucas Stach
  *
  * See file CREDITS for list of people who contributed to this
  * project.
@@ -21,14 +22,16 @@
  * MA 02111-1307 USA
  */
 
-#include common.h
 #include asm/io.h
-#include asm-generic/gpio.h
 #include asm/arch/clock.h
 #include asm/arch/usb.h
-#include usb/ulpi.h
-#include libfdt.h
+#include asm-generic/gpio.h
+#include common.h
 #include fdtdec.h
+#include libfdt.h
+#include usb.h
+#include usb/ulpi.h
+#include ehci.h
 
 #ifdef CONFIG_USB_ULPI
#ifndef CONFIG_USB_ULPI_VIEWPORT
@@ -138,6 +141,23 @@ static const u8 utmip_elastic_limit = 16;
 /* UTMIP High Speed Sync Start Delay */
 static const u8 utmip_hs_sync_start_delay = 9;
 
+/*
+ * A known hardware issue where Connect Status Change bit of PORTSC register
+ * of USB1 controller will be set after Port Reset.
+ * We have to clear it in order for later device enumeration to proceed.
+ * This ehci_powerup_fixup overrides the weak function ehci_powerup_fixup
+ * in ehci-hcd.c.
+ */
+void ehci_powerup_fixup(uint32_t *status_reg, uint32_t *reg)
+{
+   mdelay(50);
+   if (((u32) status_reg  TEGRA_USB_ADDR_MASK) != TEGRA_USB1_BASE)
+   return;
+   /* For EHCI_PS_CSC to be cleared in ehci_hcd.c */
+   if (ehci_readl(status_reg)  EHCI_PS_CSC)
+   *reg |= EHCI_PS_CSC;
+}
+
 /* Put the port into host mode */
 static void set_host_mode(struct fdt_usb *config)
 {
@@ -534,3 +554,33 @@ int board_usb_init(const void *blob)
 
return 0;
 }
+
+/*
+ * Create the appropriate control structures to manage
+ * a new EHCI host controller.
+ */
+int ehci_hcd_init(int index, struct ehci_hccr **hccr, struct ehci_hcor **hcor)
+{
+   u32 our_hccr, our_hcor;
+
+   /*
+* Select the first port, as we don't have a way of selecting others
+* yet
+*/
+   if (tegrausb_start_port(index, our_hccr, our_hcor))
+   return -1;
+
+   *hccr = (struct ehci_hccr *)our_hccr;
+   *hcor = (struct ehci_hcor *)our_hcor;
+
+   return 0;
+}
+
+/*
+ * Destroy the appropriate control structures corresponding
+ * the the EHCI host controller.
+ */
+int ehci_hcd_stop(int index)
+{
+   return tegrausb_stop_port(index);
+}
-- 
1.7.11.7

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 03/22] powerpc/mpc85xx: move debug tlb entry after TLB is in known state

2012-10-30 Thread Prabhakar Kushwaha

On 10/30/2012 07:34 AM, Scott Wood wrote:

Previously, in many if not all configs we were creating overlapping TLB entries
which is illegal.  This caused a crash during boot when moving p2020rdb NAND SPL
into L2 SRAM.

Signed-off-by: Scott Wood scottw...@freescale.com
Cc: Prabhakar Kushwaha prabha...@freescale.com
Cc: Andy Fleming aflem...@freescale.com
--
Prabhakar, please test that debug still works.



During RAMBOOT, both temporary debug TLB entry and execution TLB 
entry is same. So moving temporary debug TLB  entry creation after 
execution TLB entry resizing will make sure of debugging during NAND 
ramboot, SPI and SD boot.


But for NOR   NAND SPL there is a problem because boot-up TLB as 
0xf000 and temporary debug TLB as 0xEFF8. So we require to 
create temporary TLB entry to support early debugging.


I will suggest to split the CONFIG_SYS_PPC_E500_DEBUG_TLB define into 2 
parts.

 1)  For NOR , NAND spl debugging
 2)  For RAMBoot:  After resizing of execution TLB

I made following changes in the patch and tested across P1010RDB for 
NOR, NAND-SPL, NAND Ramboot and SPI boot debugging.


Please note I used only this patch after replacing MINIMAL_SPL  with 
CONFIG_NAND_SPL.


diff --git a/arch/powerpc/cpu/mpc85xx/start.S 
b/arch/powerpc/cpu/mpc85xx/start.S

index ac17f9d..c00db4a 100644
--- a/arch/powerpc/cpu/mpc85xx/start.S
+++ b/arch/powerpc/cpu/mpc85xx/start.S
@@ -282,7 +282,7 @@ l2_disabled:
isync
.endm

-#if defined(CONFIG_SYS_PPC_E500_DEBUG_TLB)  !defined(CONFIG_NAND_SPL)
+#if defined(CONFIG_SYS_PPC_E500_DEBUG_TLB)  !defined(MINIMAL_SPL)
 /*
  * TLB entry for debuggging in AS1
  * Create temporary TLB entry in AS0 to handle debug exception
@@ -309,16 +309,6 @@ l2_disabled:
CONFIG_SYS_MONITOR_BASE, MAS2_I|MAS2_G, \
CONFIG_SYS_PBI_FLASH_WINDOW, MAS3_SX|MAS3_SW|MAS3_SR, \
0, r6
-#else
-/*
- * TLB entry is created for IVPR + IVOR15 to map on valid OP code address
- * because nexti will resize TLB to 4K
- */
-   create_tlb1_entry CONFIG_SYS_PPC_E500_DEBUG_TLB, \
-   0, BOOKE_PAGESZ_256K, \
-   CONFIG_SYS_MONITOR_BASE, MAS2_I, \
-   CONFIG_SYS_MONITOR_BASE, MAS3_SX|MAS3_SW|MAS3_SR, \
-   0, r6
 #endif
 #endif

@@ -520,6 +510,24 @@ nexti: mflrr1  /* R1 = our PC */
msync
tlbwe

+#if defined(CONFIG_SYS_PPC_E500_DEBUG_TLB)  !defined(MINIMAL_SPL)\
+defined(CONFIG_SYS_RAMBOOT)
+/*
+ * TLB entry for debuggging in AS1
+ * Create temporary TLB entry in AS0 to handle debug exception
+ * As on debug exception MSR is cleared i.e. Address space is changed
+ * to 0. A TLB entry (in AS0) is required to handle debug exception 
generated

+ * in AS1.
+ * TLB entry is created for IVPR + IVOR15 to map on valid OP code address
+ * because nexti has resized  execution TLB entry to 4K
+ */
+   create_tlb1_entry CONFIG_SYS_PPC_E500_DEBUG_TLB, \
+   0, BOOKE_PAGESZ_256K, \
+   CONFIG_SYS_MONITOR_BASE  0xfffc, MAS2_I, \
+   CONFIG_SYS_MONITOR_BASE  0xfffc, 
MAS3_SX|MAS3_SW|MAS3_SR, \

+   0, r6
+#endif
+
 /*
  * Clear out any other TLB entries that may exist, to avoid conflicts.
  * Our TLB entry is in r14.
@@ -534,7 +542,7 @@ nexti:  mflrr1  /* R1 = our PC */
li  r3, 0
mtspr   MAS1, r3
 1: cmpwr3, r14
-#if defined(CONFIG_SYS_PPC_E500_DEBUG_TLB)  !defined(CONFIG_NAND_SPL)
+#if defined(CONFIG_SYS_PPC_E500_DEBUG_TLB)  !defined(MINIMAL_SPL)
cmpwi   cr1, r3, CONFIG_SYS_PPC_E500_DEBUG_TLB
crorcr0*4+eq, cr0*4+eq, cr1*4+eq
 #endif

Regards,
Prabhakar


___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v6 1/7] powerpc: Extract EPAPR_MAGIC constants into processor.h

2012-10-30 Thread Stefan Roese
By extracting these defines into a header, they can be re-used by other
C sources as well. This will be done by the SPL framework OS boot
support.

Signed-off-by: Stefan Roese s...@denx.de
---
Changes in v6:
- Fix compile warning: release.S:354:0: warning: EPAPR_MAGIC redefined

 arch/powerpc/cpu/mpc85xx/release.S   | 1 -
 arch/powerpc/include/asm/processor.h | 6 ++
 arch/powerpc/lib/bootm.c | 6 --
 3 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/arch/powerpc/cpu/mpc85xx/release.S 
b/arch/powerpc/cpu/mpc85xx/release.S
index 4ba44a9..d2e94b8 100644
--- a/arch/powerpc/cpu/mpc85xx/release.S
+++ b/arch/powerpc/cpu/mpc85xx/release.S
@@ -351,7 +351,6 @@ __secondary_reset_vector:
.align L1_CACHE_SHIFT
.global __second_half_boot_page
 __second_half_boot_page:
-#define EPAPR_MAGIC0x45504150
 #define ENTRY_ADDR_UPPER   0
 #define ENTRY_ADDR_LOWER   4
 #define ENTRY_R3_UPPER 8
diff --git a/arch/powerpc/include/asm/processor.h 
b/arch/powerpc/include/asm/processor.h
index 7aa3231..19fe250 100644
--- a/arch/powerpc/include/asm/processor.h
+++ b/arch/powerpc/include/asm/processor.h
@@ -1342,4 +1342,10 @@ void _nmask_and_or_msr(unsigned long nmask, unsigned 
long or_val);
 #endif
 #endif /* CONFIG_MACH_SPECIFIC */
 
+#if defined(CONFIG_MPC85xx) || defined(CONFIG_440)
+ #define EPAPR_MAGIC   (0x45504150)
+#else
+ #define EPAPR_MAGIC   (0x65504150)
+#endif
+
 #endif /* __ASM_PPC_PROCESSOR_H */
diff --git a/arch/powerpc/lib/bootm.c b/arch/powerpc/lib/bootm.c
index 53dc4df..e3fee0b 100644
--- a/arch/powerpc/lib/bootm.c
+++ b/arch/powerpc/lib/bootm.c
@@ -87,12 +87,6 @@ static void boot_jump_linux(bootm_headers_t *images)
 *   r8: 0
 *   r9: 0
 */
-#if defined(CONFIG_MPC85xx) || defined(CONFIG_440)
- #define EPAPR_MAGIC   (0x45504150)
-#else
- #define EPAPR_MAGIC   (0x65504150)
-#endif
-
debug (   Booting using OF flat tree...\n);
WATCHDOG_RESET ();
(*kernel) ((bd_t *)of_flat_tree, 0, 0, EPAPR_MAGIC,
-- 
1.8.0

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] cmd_fdt.c: Use %p when printing pointers

2012-10-30 Thread Wolfgang Denk
Dear Tom Rini,

In message 1351558398-6902-1-git-send-email-tr...@ti.com you wrote:
 When putting pointers into a format string use %p to ensure that they
 are printed correctly regardless of bitsize.  This fixes warnings on
 sandbox on 64bit systems.
 
 Cc: Joe Hershberger joe.hershber...@ni.com
 Cc: Gerald Van Baren vanba...@cideas.com
 Signed-off-by: Tom Rini tr...@ti.com
 ---
  common/cmd_fdt.c |6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
 
 diff --git a/common/cmd_fdt.c b/common/cmd_fdt.c
 index a5e2cfc..f9acfc1 100644
 --- a/common/cmd_fdt.c
 +++ b/common/cmd_fdt.c
 @@ -375,7 +375,7 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char * 
 const argv[])
   /* Get address */
   char buf[11];
  
 - sprintf(buf, 0x%08X, (uint32_t)nodep);
 + sprintf(buf, 0x%p, nodep);
   setenv(var, buf);

This may put bogus data (var=0x(null)) into the environment.

I see two approaches to fix this:

1) Handle this locally, say like that:

char buf[11] = { '0', 0, };

if (nodep)
sprintf(buf, 0x%p, nodep);

setenv(var, buf);

   This is the solution with minimal global impact.

2) Fix the root cause: given that we have valid situations where we
   may want to dereference a pointer pointing to address 0x, 
   I wonder if it would not actually be better (i. e. more correct) to
   get rid of the

495 static char *pointer(const char *fmt, char *buf, char *end, void 
*ptr,
496 int field_width, int precision, int flags)
497 {
498 if (!ptr)
499 return string(buf, end, (null), field_width, 
precision,
500   flags);

   special handling in lib/vsprintf.c

   Would anybody shed any tears if we drop this?

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: w...@denx.de
You could end up being oddly sad and full of a strange, diffuse  com-
passion  which would lead you to believe that it might be a good idea
to wipe out the whole human race and start again with amoebas.
 - Terry Pratchett, _Guards! Guards!_
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v6 1/7] powerpc: Extract EPAPR_MAGIC constants into processor.h

2012-10-30 Thread Wolfgang Denk
Dear Stefan Roese,

In message 1351590321-20368-1-git-send-email...@denx.de you wrote:
 By extracting these defines into a header, they can be re-used by other
 C sources as well. This will be done by the SPL framework OS boot
 support.
 
 Signed-off-by: Stefan Roese s...@denx.de
 ---
 Changes in v6:
 - Fix compile warning: release.S:354:0: warning: EPAPR_MAGIC redefined

Please re-read
http://www.denx.de/wiki/view/U-Boot/Patches#Sending_updated_patch_versions

You are supposed to provide a _history_ of changes here, but instead
you describe only the latest change.  This is not how it's suppoosed
to be done.

Also, your submission includes neither any In-reply-to: nor any
References: header, i. e. there is no way to match it to any
previous mail thread.  This is very bad.  How are we supposed to know
what you are actually talking about, or where we would find any of the
previous patches or the other 6 patches of this series?

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: w...@denx.de
Es ist offensichtlich, dass das menschliche Gehirn wie  ein  Computer
funktioniert.  Da  es  keine  dummen Computer gibt, gibt es also auch
keine dummen Menschen. Nur ein paar Leute, die unter DOS laufen.
   -- unbekannt
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v6 1/7] powerpc: Extract EPAPR_MAGIC constants into processor.h

2012-10-30 Thread Stefan Roese
Hi Wolfgang,

On 10/30/2012 11:04 AM, Wolfgang Denk wrote:
 By extracting these defines into a header, they can be re-used by other
 C sources as well. This will be done by the SPL framework OS boot
 support.

 Signed-off-by: Stefan Roese s...@denx.de
 ---
 Changes in v6:
 - Fix compile warning: release.S:354:0: warning: EPAPR_MAGIC redefined
 
 Please re-read
 http://www.denx.de/wiki/view/U-Boot/Patches#Sending_updated_patch_versions
 
 You are supposed to provide a _history_ of changes here, but instead
 you describe only the latest change.  This is not how it's suppoosed
 to be done.

As you know this patch is part of a patch-series. And this is the first
time that this patch has a change. So this summary covers the complete
history for this patch.

 Also, your submission includes neither any In-reply-to: nor any
 References: header, i. e. there is no way to match it to any
 previous mail thread.

Yes, I should have done this. Sorry.

  This is very bad.  How are we supposed to know
 what you are actually talking about, or where we would find any of the
 previous patches or the other 6 patches of this series?

In this version of the patch series, I only made this small change to
this patch 1/7. I wanted to spare the list a resending of the complete
patchset for such a small change.

So what is the recommended way to do this? Is it really
recommended/required to repost the complete patch series upon a small
change in only one patch? No problem, I can do this. patman makes it
very easy. :)

Should I repost the complete series again?

Thanks,
Stefan
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH V2] M68K: eb_cpu5282: general update and enhanced board support

2012-10-30 Thread Jens Scharsig (BuS Elektronik)
From: Jens Scharsig (BuS Elektronik) e...@bus-elektronik.de

- update clock settings for higher perfomance
- change standard baud rate to 115200
- fix flash base address
- remove unused defines
- add I2C support
- switch form board dependent flash to cfi
- remove board dependent flash code
- use sdram bank 0 instead of bank 1 on boot
- enable on board frame buffer instead external
- remove fake mac address form config
- add watchdog support
- add status led support

Signed-off-by: Jens Scharsig (BuS Elektronik) e...@bus-elektronik.de
---
changes since V1: 

remove autodetect video, don't work on all hardware revisions

 board/BuS/eb_cpu5282/Makefile |2 +-
 board/BuS/eb_cpu5282/cfm_flash.c  |  212 ---
 board/BuS/eb_cpu5282/cfm_flash.h  |   40 
 board/BuS/eb_cpu5282/config.mk|   27 ---
 board/BuS/eb_cpu5282/eb_cpu5282.c |  110 +++---
 board/BuS/eb_cpu5282/flash.c  |  415 -
 boards.cfg|2 +-
 include/configs/eb_cpu5282.h  |  102 +
 8 files changed, 146 insertions(+), 764 deletions(-)
 delete mode 100644 board/BuS/eb_cpu5282/cfm_flash.c
 delete mode 100644 board/BuS/eb_cpu5282/cfm_flash.h
 delete mode 100644 board/BuS/eb_cpu5282/config.mk
 delete mode 100644 board/BuS/eb_cpu5282/flash.c

diff --git a/board/BuS/eb_cpu5282/Makefile b/board/BuS/eb_cpu5282/Makefile
index 0f14699..ac860c1 100644
--- a/board/BuS/eb_cpu5282/Makefile
+++ b/board/BuS/eb_cpu5282/Makefile
@@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk
 
 LIB= $(obj)lib$(BOARD).o
 
-COBJS  = $(BOARD).o cfm_flash.o flash.o
+COBJS  = $(BOARD).o
 
 SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS   := $(addprefix $(obj),$(COBJS))
diff --git a/board/BuS/eb_cpu5282/cfm_flash.c b/board/BuS/eb_cpu5282/cfm_flash.c
deleted file mode 100644
index fe03b17..000
--- a/board/BuS/eb_cpu5282/cfm_flash.c
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
- * Basic Flash Driver for Freescale MCF 5281/5282 internal FLASH
- *
- * (C) Copyright 2005 BuS Elektronik GmbH  Co.KG e...@bus-elektonik.de
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include common.h
-#include asm/m5282.h
-#include  cfm_flash.h
-
-#if defined(CONFIG_M5281) || defined(CONFIG_M5282)
-
-#if (CONFIG_SYS_CLK2000)
-   #define CFM_CLK  (((long) CONFIG_SYS_CLK / (40 * 8) + 1) | 0x40)
-#else
-   #define CFM_CLK  ((long) CONFIG_SYS_CLK / 40 + 1)
-#endif
-
-#define cmf_backdoor_address(addr) (((addr)  0x0007) | 0x0400 | \
-(CONFIG_SYS_MBAR  0xC000))
-
-void cfm_flash_print_info (flash_info_t * info)
-{
-   printf (Freescale: );
-   switch (info-flash_id  FLASH_TYPEMASK) {
-   case FREESCALE_ID_MCF5281  FLASH_TYPEMASK:
-   printf (MCF5281 internal FLASH\n);
-   break;
-   case FREESCALE_ID_MCF5282  FLASH_TYPEMASK:
-   printf (MCF5282 internal FLASH\n);
-   break;
-   default:
-   printf (Unknown Chip Type\n);
-   break;
-   }
-}
-
-void cfm_flash_init (flash_info_t * info)
-{
-   int sector;
-   ulong protection;
-   MCFCFM_MCR = 0;
-   MCFCFM_CLKD = CFM_CLK;
-   debug (CFM Clock divider: %ld (%d Hz @ %ld Hz)\n,CFM_CLK,\
-   CONFIG_SYS_CLK / (2* ((CFM_CLK  0x3F)+1) * (1+((CFM_CLK  
0x40)6)*7)),\
-   CONFIG_SYS_CLK);
-   MCFCFM_SACC = 0;
-   MCFCFM_DACC = 0;
-
-   if (MCFCFM_SEC  MCFCFM_SEC_KEYEN)
-   puts(CFM backdoor access is enabled\n);
-   if (MCFCFM_SEC  MCFCFM_SEC_SECSTAT)
-   puts(CFM securety is enabled\n);
-
-   #ifdef CONFIG_M5281
-   info-flash_id = (FREESCALE_MANUFACT  FLASH_VENDMASK) |
-(FREESCALE_ID_MCF5281  FLASH_TYPEMASK);
-   info-size = 256*1024;
-   info-sector_count = 16;
-   #else
-   info-flash_id = (FREESCALE_MANUFACT  FLASH_VENDMASK) |
-(FREESCALE_ID_MCF5282  FLASH_TYPEMASK);
-   info-size = 512*1024;
-   info-sector_count = 32;
-   #endif
-   protection = MCFCFM_PROT;
-   for (sector = 0; sector  info-sector_count; 

Re: [U-Boot] [PATCH 5/8] tegra: usb: move controller init into start_port

2012-10-30 Thread Marek Vasut
Dear Lucas Stach,

 There is no need to init a USB controller before the upper layers indicate
 that they are actually going to use it.
 
 board_usb_init now only parses the device tree and sets up the common pll.
 
 Signed-off-by: Lucas Stach d...@lynxeye.de
 ---
  arch/arm/cpu/armv7/tegra20/usb.c | 47
 +++- 1 Datei geändert, 18 Zeilen
 hinzugefügt(+), 29 Zeilen entfernt(-)
 
 diff --git a/arch/arm/cpu/armv7/tegra20/usb.c
 b/arch/arm/cpu/armv7/tegra20/usb.c index cf800b1..e372b8b 100644
 --- a/arch/arm/cpu/armv7/tegra20/usb.c
 +++ b/arch/arm/cpu/armv7/tegra20/usb.c
 @@ -417,44 +417,29 @@ static int init_ulpi_usb_controller(struct fdt_usb
 *config) }
  #endif
 
 -/**
 - * Add a new USB port to the list of available ports.
 - *
 - * @param config USB port configuration
 - * @return 0 if ok, -1 if error (too many ports)
 - */
 -static int add_port(struct fdt_usb *config)

Fix the comment instead of removing it?

[...]

Best regards,
Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v6 1/7] powerpc: Extract EPAPR_MAGIC constants into processor.h

2012-10-30 Thread Wolfgang Denk
Dear Stefan Roese,

In message 508fa904.4070...@denx.de you wrote:
 
  ---
  Changes in v6:
  - Fix compile warning: release.S:354:0: warning: EPAPR_MAGIC redefined
...
 
 As you know this patch is part of a patch-series. And this is the first
 time that this patch has a change. So this summary covers the complete
 history for this patch.

But exactly this is information which I do not have, and which is not
included in your patch.  As is, I can only intepret this to be version
6 of this specific commit, and I wonder which changes were made in the
previous 5 versions.


 In this version of the patch series, I only made this small change to
 this patch 1/7. I wanted to spare the list a resending of the complete
 patchset for such a small change.
 
 So what is the recommended way to do this? Is it really
 recommended/required to repost the complete patch series upon a small
 change in only one patch? No problem, I can do this. patman makes it
 very easy. :)
 
 Should I repost the complete series again?

No, not at all!


I understand you are using patman for patch management.  So I added
Simon on Cc: to have his oponion, too.

I see two options:

1) Versioning is done on a per-patch base.  In this case, this patch
   should have been submitted as [PATCH v2 1/7], in which case it
   would have been clear to everybody that this is the first and only
   change compared to previous submission(s).

   I don't dare to say most, but at least some people have worked
   like this when submitting patch series (manually) in the past.
   
   I can understand if somebody argues that it is not exactly easy to
   collect the correspondign patches to a series if individual patches
   contain different version numbers.  Correct threading of the
   messages is essential here.

2) Versioning is done on a per-series base.

   One problem here is that it becomes difficult to keep track if
   what is what when only single patches of the series change and get
   reposted - on the other hand it has always been a major PITA when
   people repost whole series after only changing a line of two in on
   of their many patches, so we strongly encourage posting of only the
   changed patches.  Once more, proper threading appears to be
   essential.

   Another problem is what we are running into here: after severl
   versions of the patch series one patch that has been untouches
   previously gets changed.  Now it gets posted as V6, and it's
   impossible to know how many previous versions of this patch might
   have been posted before - one? 2? 3? 4? or 5?

   When the version ID refers to the patch series rather than to the
   individual patch, then I think it is mandatory to take this into
   consideration in the patch history, whih then must refer to all
   versions of the _series_.  In the present case, the patch history
   should have looked like this:

V2: no changes
V3: no changes
V4: no changes
V5: no changes
V6: Fix compile warning: release.S:354:0: warning: EPAPR_MAGIC 
redefined


Is there any clear majority of preferences for patch versioning?
My gut feeling is that more people would like version IDs on a
per-series base, but I would like to see some confirmation for this,
and the we should document such expectations.


It appears that patman is oriented toward using a single version ID
per series.  Simon - would it be possible to automatically add such
no changes information when generating the patches?



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: w...@denx.de
I will also, for an appropriate fee, certify that  your  keyboard  is
object-oriented,  and  that  the bits on your hard disk are template-
compatible.- Jeffrey S. Haemer in 411akr$3...@cygnus.com
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH V4 3/3] fs: add filesystem switch libary, implement ls and fsload commands

2012-10-30 Thread Andreas Bießmann
Dear all,

On 22.10.2012 18:43, Stephen Warren wrote:
 From: Stephen Warren swar...@nvidia.com
 
 Implement ls and fsload commands that act like {fat,ext2}{ls,load},
 and transparently handle either file-system. This scheme could easily be
 extended to other filesystem types; I only didn't do it for zfs because
 I don't have any filesystems of that type to test with.
 
 Replace the implementation of {fat,ext[24]}{ls,load} with this new code
 too.
 
 Signed-off-by: Stephen Warren swar...@nvidia.com

this patch (namely 045fa1e1142552799ad3203e9e0bc22a11e866ea) seems to
break avr32 on runtime. It seems there is a new array introduced (the
fstypes array in fs/fs.c) which do not provide a relocation method
(CONFIG_NEEDS_MANUAL_RELOC). This is currently only a weak assumption,
but has any other requiring manual relocation m86k, mips, nds32m sparc)
also encountered this problem?

 ---

snip

 diff --git a/fs/fs.c b/fs/fs.c
 new file mode 100644
 index 000..23ffa25
 --- /dev/null
 +++ b/fs/fs.c
 @@ -0,0 +1,308 @@

snip

 +
 +static const struct {
 + int fstype;
 + int (*probe)(void);
 +} fstypes[] = {
 + {
 + .fstype = FS_TYPE_FAT,
 + .probe = fs_probe_fat,
 + },
 + {
 + .fstype = FS_TYPE_EXT,
 + .probe = fs_probe_ext,
 + },
 +};

I currently think this should be manually relocated for those arches
which need the manual relocation.

 +
 +int fs_set_blk_dev(const char *ifname, const char *dev_part_str, int fstype)
 +{
 + int part, i;
 +
 + part = get_device_and_partition(ifname, dev_part_str, fs_dev_desc,
 + fs_partition, 1);
 + if (part  0)
 + return -1;
 +
 + for (i = 0; i  ARRAY_SIZE(fstypes); i++) {
 + if ((fstype != FS_TYPE_ANY)  (fstype != fstypes[i].fstype))
 + continue;
 +
 + if (!fstypes[i].probe()) {
 + fs_type = fstypes[i].fstype;
 + return 0;
 + }
 + }
 +
 + printf(** Unrecognized filesystem type **\n);
 + return -1;
 +}

Best regards

Andreas Bießmann
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] analyze/change assembly code

2012-10-30 Thread Gerlando Falauto

Hi all,

we recently to had face some nasty issues, where for some reason two 
(functionally identical) versions of some code behave very differently. 
Namely, one version works and the other doesn't always work.
It was clear from the beginning this was because of HW- (or compiler-) 
related issues.
I thought it would then be useful to have a peek at what the compiler is 
doing behind the scenes, and possibly make some simple changes to the 
code. For instance, inserting some nops here and there, or reordering 
some instructions, may help in tracking down these different behaviors.


I know the easiest way to LOOK at the file is simply to use objdump to 
disassemble an .o file. In the end I somehow managed to tamper with the 
makefiles so to get what I wanted for a given file, by adding a fake new 
.s target with the recipe to build it, and having the .o file depend 
on a .S file (which would be a manual/changed copy of the generated 
.s file) instead of the original .c file.
This is however not linear and nice at all. So I was wondering whether 
there already is a well-established way of having the make process 
create (and keep) assembly files which can be then manually changed.


Does my question make any sense at all? Any ideas?

Thank you,
Gerlando
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v3] fs/fs.c: do_fsload: measure throughput

2012-10-30 Thread Andreas Bießmann
This patch adds time measurement and throughput calculation for all supported
fsload commands.

The output of ext2load changes from

---8---
1830666 bytes read
---8---

to

---8---
1830666 bytes read in 237 ms (7.4 MiB/s)
---8---

Signed-off-by: Andreas Bießmann andreas.de...@googlemail.com
---
since v1:
 * use 'time' instead of 'time_start' as suggested by Wolfgang

since v2:
 * rebase on top of 045fa1e1142552799ad3203e9e0bc22a11e866ea
   Now there is some more overhead in the measurement caused by the respective
   fs-type functions (detect fs-type, eventually do mount and so on).
   Nevertheless I think such a measurement is good for further improvements
   like increasing throughput by whatever measures.

 fs/fs.c |   11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/fs/fs.c b/fs/fs.c
index 23ffa25..9f1cfed 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -246,6 +246,7 @@ int do_fsload(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[],
unsigned long pos;
int len_read;
char buf[12];
+   unsigned long time;
 
if (argc  5)
return CMD_RET_USAGE;
@@ -280,11 +281,19 @@ int do_fsload(cmd_tbl_t *cmdtp, int flag, int argc, char 
* const argv[],
else
pos = 0;
 
+   time = get_timer(0);
len_read = fs_read(filename, addr, pos, bytes);
+   time = get_timer(time);
if (len_read = 0)
return 1;
 
-   printf(%d bytes read\n, len_read);
+   printf(%d bytes read in %lu ms, len_read, time);
+   if (time  0) {
+   puts( ();
+   print_size(len_read / time * 1000, /s);
+   puts());
+   }
+   puts(\n);
 
sprintf(buf, 0x%x, len_read);
setenv(filesize, buf);
-- 
1.7.10.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 5/8] tegra: usb: move controller init into start_port

2012-10-30 Thread Lucas Stach
Hello Marek,

Am Dienstag, den 30.10.2012, 11:59 +0100 schrieb Marek Vasut:
 Dear Lucas Stach,
 
  There is no need to init a USB controller before the upper layers indicate
  that they are actually going to use it.
  
  board_usb_init now only parses the device tree and sets up the common pll.
  
  Signed-off-by: Lucas Stach d...@lynxeye.de
  ---
   arch/arm/cpu/armv7/tegra20/usb.c | 47
  +++- 1 Datei geändert, 18 Zeilen
  hinzugefügt(+), 29 Zeilen entfernt(-)
  
  diff --git a/arch/arm/cpu/armv7/tegra20/usb.c
  b/arch/arm/cpu/armv7/tegra20/usb.c index cf800b1..e372b8b 100644
  --- a/arch/arm/cpu/armv7/tegra20/usb.c
  +++ b/arch/arm/cpu/armv7/tegra20/usb.c
  @@ -417,44 +417,29 @@ static int init_ulpi_usb_controller(struct fdt_usb
  *config) }
   #endif
  
  -/**
  - * Add a new USB port to the list of available ports.
  - *
  - * @param config   USB port configuration
  - * @return 0 if ok, -1 if error (too many ports)
  - */
  -static int add_port(struct fdt_usb *config)
 
 Fix the comment instead of removing it?
 
I don't think that this comment adds any real value. The whole function
which this comment refers to is removed and it's content split between
board_usb_init and ehci_hcd_init, which are self explanatory.

Regards,
Lucas


___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 5/8] tegra: usb: move controller init into start_port

2012-10-30 Thread Marek Vasut
Dear Lucas Stach,

[...]

   -static int add_port(struct fdt_usb *config)
  
  Fix the comment instead of removing it?
 
 I don't think that this comment adds any real value. The whole function
 which this comment refers to is removed and it's content split between
 board_usb_init and ehci_hcd_init, which are self explanatory.

Then add a proper comment please. Call me a docu-nazi, but I'd really love u-
boot nicely and properly documented, please.

[1] http://www.denx.de/wiki/U-Boot/CodingStyle

Best regards,
Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 5/8] tegra: usb: move controller init into start_port

2012-10-30 Thread Lucas Stach
Hi Marek,

Am Dienstag, den 30.10.2012, 13:33 +0100 schrieb Marek Vasut:
 Dear Lucas Stach,
 
 [...]
 
-static int add_port(struct fdt_usb *config)
   
   Fix the comment instead of removing it?
  
  I don't think that this comment adds any real value. The whole function
  which this comment refers to is removed and it's content split between
  board_usb_init and ehci_hcd_init, which are self explanatory.
 
 Then add a proper comment please. Call me a docu-nazi, but I'd really love u-
 boot nicely and properly documented, please.
 
I'm all in favour of adding proper documentation, but I'm opposed to add
it in the middle of this cleanup/movement series.

I'll send a patch on top of this series to add doc, so it doesn't
interfere with the review of this series.

Regards,
Lucas


___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/8] tegra: usb: make controller init functions more self contained

2012-10-30 Thread Simon Glass
Hi Lucas,

On Tue, Oct 30, 2012 at 2:22 AM, Lucas Stach d...@lynxeye.de wrote:
 There is no need to pass around all those parameters. The init functions
 are able to easily extract all the needed setup info on their own.

 Signed-off-by: Lucas Stach d...@lynxeye.de
 ---
  arch/arm/cpu/armv7/tegra20/usb.c | 24 
  1 Datei geändert, 12 Zeilen hinzugefügt(+), 12 Zeilen entfernt(-)

I'm not sure I agree with the premise of this patch.

At the top level it calls clock_get_osc_freq() to get the frequency.
That is then passed to the two places that need it.

It doesn't seem right to me to call clock_get_osc_freq() again in the
lower level function just to avoid a parameter. On ARM at least a few
parameters are a cheap way of passing data around.

It also allows the lower-level functions to deal with what they need
to, rather than all functions having to reference the global state
independently, each one digging down to what it actually needs.

Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/8] tegra: usb: convert USB_PORTS_MAX to be a define

2012-10-30 Thread Simon Glass
Hi Lucas,

On Tue, Oct 30, 2012 at 2:22 AM, Lucas Stach d...@lynxeye.de wrote:
 No point in having this as an enum. Also while at it set it to the real 
 hardware
 maximum for both Tegra 2 and Tegra 3. If new Tegra hardware includes more
 USB controllers we can always bump the limit then.

 Signed-off-by: Lucas Stach d...@lynxeye.de
 ---
  arch/arm/cpu/armv7/tegra20/usb.c | 4 +---
  1 Datei geändert, 1 Zeile hinzugefügt(+), 3 Zeilen entfernt(-)

 diff --git a/arch/arm/cpu/armv7/tegra20/usb.c 
 b/arch/arm/cpu/armv7/tegra20/usb.c
 index 1bccf2b..9fd1edc 100644
 --- a/arch/arm/cpu/armv7/tegra20/usb.c
 +++ b/arch/arm/cpu/armv7/tegra20/usb.c
 @@ -43,9 +43,7 @@
 #endif
  #endif

 -enum {
 -   USB_PORTS_MAX   = 4,/* Maximum ports we allow */
 -};
 +#define USB_PORTS_MAX  3   /* Maximum ports we allow */

That's fine with me if you wan to change it.

I tend to use enums most of the time. It shows up as a symbol in the
debugger, avoids bracketed expressions, side-effects and the like, and
works well when numbering multiple things (automatic increment). It's
also a welcome language feature IMO - use it or lose it :-) But in
this case the benefit is small.


  /* Parameters we need for USB */
  enum {
 --
 1.7.11.7


Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/8] tegra: usb: convert USB_PORTS_MAX to be a define

2012-10-30 Thread Marek Vasut
Dear Simon Glass,

 Hi Lucas,
 
 On Tue, Oct 30, 2012 at 2:22 AM, Lucas Stach d...@lynxeye.de wrote:
  No point in having this as an enum. Also while at it set it to the real
  hardware maximum for both Tegra 2 and Tegra 3. If new Tegra hardware
  includes more USB controllers we can always bump the limit then.
  
  Signed-off-by: Lucas Stach d...@lynxeye.de
  ---
  
   arch/arm/cpu/armv7/tegra20/usb.c | 4 +---
   1 Datei geändert, 1 Zeile hinzugefügt(+), 3 Zeilen entfernt(-)
  
  diff --git a/arch/arm/cpu/armv7/tegra20/usb.c
  b/arch/arm/cpu/armv7/tegra20/usb.c index 1bccf2b..9fd1edc 100644
  --- a/arch/arm/cpu/armv7/tegra20/usb.c
  +++ b/arch/arm/cpu/armv7/tegra20/usb.c
  @@ -43,9 +43,7 @@
  
  #endif
   
   #endif
  
  -enum {
  -   USB_PORTS_MAX   = 4,/* Maximum ports we allow
  */ -};
  +#define USB_PORTS_MAX  3   /* Maximum ports we allow */
 
 That's fine with me if you wan to change it.
 
 I tend to use enums most of the time. It shows up as a symbol in the
 debugger, avoids bracketed expressions, side-effects and the like, and
 works well when numbering multiple things (automatic increment). It's
 also a welcome language feature IMO - use it or lose it :-) But in
 this case the benefit is small.

What about using static const int ?

   /* Parameters we need for USB */
   enum {
  
  --
  1.7.11.7
 
 Regards,
 Simon

Best regards,
Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/8] tegra: usb: make controller init functions more self contained

2012-10-30 Thread Lucas Stach
Hello Simon,

Am Dienstag, den 30.10.2012, 06:03 -0700 schrieb Simon Glass:
 Hi Lucas,
 
 On Tue, Oct 30, 2012 at 2:22 AM, Lucas Stach d...@lynxeye.de wrote:
  There is no need to pass around all those parameters. The init functions
  are able to easily extract all the needed setup info on their own.
 
  Signed-off-by: Lucas Stach d...@lynxeye.de
  ---
   arch/arm/cpu/armv7/tegra20/usb.c | 24 
   1 Datei geändert, 12 Zeilen hinzugefügt(+), 12 Zeilen entfernt(-)
 
 I'm not sure I agree with the premise of this patch.
 
 At the top level it calls clock_get_osc_freq() to get the frequency.
 That is then passed to the two places that need it.
 
 It doesn't seem right to me to call clock_get_osc_freq() again in the
 lower level function just to avoid a parameter. On ARM at least a few
 parameters are a cheap way of passing data around.
 
The intent of this patch is not really to save up on parameters passed,
but to make it possible to later move out the controller initialization
into the ehci_hcd_init function without having to save away this global
state for later use.

We have to init at most 2 controllers where timing matters, so I think
it's the right thing to get the SoC global clock state at those two
occasions to avoid inflating the file global state.

 It also allows the lower-level functions to deal with what they need
 to, rather than all functions having to reference the global state
 independently, each one digging down to what it actually needs.
 
The controller init functions get passed the state only of the one port
they have to initialize. There is no point in extracting things at an
upper level and passing it into the functions, if it's exactly the same
thing that is stored in the port state.

Regards,
Lucas


___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 4/8] tegra: usb: remove unneeded function parameter

2012-10-30 Thread Simon Glass
Hi Lucas,

On Tue, Oct 30, 2012 at 2:22 AM, Lucas Stach d...@lynxeye.de wrote:
 Just a dead parameter, never actually used.

 Signed-off-by: Lucas Stach d...@lynxeye.de

Acked-by: Simon Glass s...@chromium.org

 ---
  arch/arm/cpu/armv7/tegra20/usb.c | 6 ++
  1 Datei geändert, 2 Zeilen hinzugefügt(+), 4 Zeilen entfernt(-)

 diff --git a/arch/arm/cpu/armv7/tegra20/usb.c 
 b/arch/arm/cpu/armv7/tegra20/usb.c
 index e61bd69..cf800b1 100644
 --- a/arch/arm/cpu/armv7/tegra20/usb.c
 +++ b/arch/arm/cpu/armv7/tegra20/usb.c
 @@ -477,8 +477,7 @@ int tegrausb_stop_port(int portnum)
 return 0;
  }

 -int fdt_decode_usb(const void *blob, int node, unsigned osc_frequency_mhz,
 -  struct fdt_usb *config)
 +int fdt_decode_usb(const void *blob, int node, struct fdt_usb *config)
  {
 const char *phy, *mode;

 @@ -526,7 +525,6 @@ int fdt_decode_usb(const void *blob, int node, unsigned 
 osc_frequency_mhz,
  int board_usb_init(const void *blob)
  {
 struct fdt_usb config;
 -   unsigned osc_freq = clock_get_rate(CLOCK_ID_OSC);
 int node_list[USB_PORTS_MAX];
 int node, count, i;
 u32 *timing;
 @@ -545,7 +543,7 @@ int board_usb_init(const void *blob)
 node = node_list[i];
 if (!node)
 continue;
 -   if (fdt_decode_usb(blob, node, osc_freq, config)) {
 +   if (fdt_decode_usb(blob, node, config)) {

I believe there was originally some intent to put the timing data in
the fdt, so that this could be different for each board. Then the fdt
(most likely some common include file) might want to specify different
options for the different oscillator frequencies. However we have
never had to use such a construct. Even if we did then I suspect that
just adding a single timing set to each port would be good enough.

 debug(Cannot decode USB node %s\n,
   fdt_get_name(blob, node, NULL));
 return -1;
 --
 1.7.11.7


Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 3/8] tegra: usb: fold initial pll setup into board_usb_init

2012-10-30 Thread Simon Glass
Hi Lucas,

On Tue, Oct 30, 2012 at 2:22 AM, Lucas Stach d...@lynxeye.de wrote:
 The setup is trivial, no need to split this out into a separate function.

 Signed-off-by: Lucas Stach d...@lynxeye.de
 ---
  arch/arm/cpu/armv7/tegra20/usb.c | 15 +--
  1 Datei geändert, 5 Zeilen hinzugefügt(+), 10 Zeilen entfernt(-)

 diff --git a/arch/arm/cpu/armv7/tegra20/usb.c 
 b/arch/arm/cpu/armv7/tegra20/usb.c
 index 1725cd1..e61bd69 100644
 --- a/arch/arm/cpu/armv7/tegra20/usb.c
 +++ b/arch/arm/cpu/armv7/tegra20/usb.c
 @@ -417,13 +417,6 @@ static int init_ulpi_usb_controller(struct fdt_usb 
 *config)
  }
  #endif

 -static void config_clock(const u32 timing[])
 -{
 -   clock_start_pll(CLOCK_ID_USB,
 -   timing[PARAM_DIVM], timing[PARAM_DIVN], timing[PARAM_DIVP],
 -   timing[PARAM_CPCON], timing[PARAM_LFCON]);
 -}
 -
  /**
   * Add a new USB port to the list of available ports.
   *
 @@ -534,13 +527,15 @@ int board_usb_init(const void *blob)
  {
 struct fdt_usb config;
 unsigned osc_freq = clock_get_rate(CLOCK_ID_OSC);
 -   enum clock_osc_freq freq;
 int node_list[USB_PORTS_MAX];
 int node, count, i;
 +   u32 *timing;

 /* Set up the USB clocks correctly based on our oscillator frequency 
 */
 -   freq = clock_get_osc_freq();
 -   config_clock(usb_pll[freq]);
 +   timing = usb_pll[clock_get_osc_freq()];
 +   clock_start_pll(CLOCK_ID_USB,
 +   timing[PARAM_DIVM], timing[PARAM_DIVN], timing[PARAM_DIVP],
 +   timing[PARAM_CPCON], timing[PARAM_LFCON]);

Sorry I don't see the benefit of this change. The function is there to
handle a clearly-defined task, hiding the detail of clock config
elsewhere. It has no effect on code generated.


 /* count may return 0 on error */
 count = fdtdec_find_aliases_for_id(blob, usb,
 --
 1.7.11.7


Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 5/8] tegra: usb: move controller init into start_port

2012-10-30 Thread Simon Glass
Hi Lucas,

On Tue, Oct 30, 2012 at 2:22 AM, Lucas Stach d...@lynxeye.de wrote:
 There is no need to init a USB controller before the upper layers indicate
 that they are actually going to use it.

 board_usb_init now only parses the device tree and sets up the common pll.

 Signed-off-by: Lucas Stach d...@lynxeye.de
 ---
  arch/arm/cpu/armv7/tegra20/usb.c | 47 
 +++-
  1 Datei geändert, 18 Zeilen hinzugefügt(+), 29 Zeilen entfernt(-)

 diff --git a/arch/arm/cpu/armv7/tegra20/usb.c 
 b/arch/arm/cpu/armv7/tegra20/usb.c
 index cf800b1..e372b8b 100644
 --- a/arch/arm/cpu/armv7/tegra20/usb.c
 +++ b/arch/arm/cpu/armv7/tegra20/usb.c
 @@ -417,44 +417,29 @@ static int init_ulpi_usb_controller(struct fdt_usb 
 *config)
  }
  #endif

 -/**
 - * Add a new USB port to the list of available ports.
 - *
 - * @param config   USB port configuration
 - * @return 0 if ok, -1 if error (too many ports)
 - */
 -static int add_port(struct fdt_usb *config)
 +int tegrausb_start_port(int portnum, u32 *hccr, u32 *hcor)
  {
 -   if (port_count == USB_PORTS_MAX) {
 -   printf(tegrausb: Cannot register more than %d ports\n,
 - USB_PORTS_MAX);
 +   struct fdt_usb *config;
 +   struct usb_ctlr *usbctlr;
 +
 +   if (portnum = port_count)
 return -1;
 -   }
 +
 +   config = port[portnum];

 if (config-utmi  init_utmi_usb_controller(config)) {
 -   printf(tegrausb: Cannot init port\n);
 +   printf(tegrausb: Cannot init port %d\n, portnum);
 return -1;
 }

 if (config-ulpi  init_ulpi_usb_controller(config)) {
 -   printf(tegrausb: Cannot init port\n);
 +   printf(tegrausb: Cannot init port %d\n, portnum);
 return -1;
 }

 -   port[port_count++] = *config;
 -
 -   return 0;
 -}
 +   set_host_mode(config);

This is good, but now I think you will re-init the USB peripheral at
every 'usb start'. Perhaps you should remember whether it has been
inited and only do it the first time?

Regards,
Simon


 -int tegrausb_start_port(int portnum, u32 *hccr, u32 *hcor)
 -{
 -   struct usb_ctlr *usbctlr;
 -
 -   if (portnum = port_count)
 -   return -1;
 -   set_host_mode(port[portnum]);
 -
 -   usbctlr = port[portnum].reg;
 +   usbctlr = config-reg;
 *hccr = (u32)usbctlr-cap_length;
 *hcor = (u32)usbctlr-usb_cmd;
 return 0;
 @@ -539,6 +524,12 @@ int board_usb_init(const void *blob)
 count = fdtdec_find_aliases_for_id(blob, usb,
 COMPAT_NVIDIA_TEGRA20_USB, node_list, USB_PORTS_MAX);
 for (i = 0; i  count; i++) {
 +   if (port_count == USB_PORTS_MAX) {
 +   printf(tegrausb: Cannot register more than %d 
 ports\n,
 +   USB_PORTS_MAX);
 +   return -1;
 +   }
 +
 debug(USB %d: , i);
 node = node_list[i];
 if (!node)
 @@ -549,9 +540,7 @@ int board_usb_init(const void *blob)
 return -1;
 }

 -   if (add_port(config))
 -   return -1;
 -   set_host_mode(config);
 +   port[port_count++] = config;
 }

 return 0;
 --
 1.7.11.7

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 6/8] tegra: usb: various small cleanups

2012-10-30 Thread Simon Glass
Hi Lucas,

On Tue, Oct 30, 2012 at 2:22 AM, Lucas Stach d...@lynxeye.de wrote:
 Remove unneeded headers, function prototype and stale comment.

 Signed-off-by: Lucas Stach d...@lynxeye.de
 ---
  arch/arm/cpu/armv7/tegra20/usb.c| 13 +
  arch/arm/include/asm/arch-tegra20/usb.h |  3 ---
  2 Dateien geändert, 1 Zeile hinzugefügt(+), 15 Zeilen entfernt(-)

 diff --git a/arch/arm/cpu/armv7/tegra20/usb.c 
 b/arch/arm/cpu/armv7/tegra20/usb.c
 index e372b8b..2cc95d2 100644
 --- a/arch/arm/cpu/armv7/tegra20/usb.c
 +++ b/arch/arm/cpu/armv7/tegra20/usb.c
 @@ -25,21 +25,15 @@
  #include asm/io.h
  #include asm-generic/gpio.h
  #include asm/arch/clock.h
 -#include asm/arch/gpio.h
 -#include asm/arch/pinmux.h
 -#include asm/arch/tegra.h
  #include asm/arch/usb.h
  #include usb/ulpi.h
 -#include asm/arch-tegra/clk_rst.h
 -#include asm/arch-tegra/sys_proto.h
 -#include asm/arch-tegra/uart.h
  #include libfdt.h
  #include fdtdec.h

  #ifdef CONFIG_USB_ULPI
 #ifndef CONFIG_USB_ULPI_VIEWPORT
 #error  To use CONFIG_USB_ULPI on Tegra Boards you have to also \
 -   define CONFIG_USB_ULPI_VIEWPORT
 +   define CONFIG_USB_ULPI_VIEWPORT
 #endif
  #endif

 @@ -188,11 +182,6 @@ void usbf_reset_controller(struct fdt_usb *config, 
 struct usb_ctlr *usbctlr)
 /* Enable the UTMIP PHY */
 if (config-utmi)
 setbits_le32(usbctlr-susp_ctrl, UTMIP_PHY_ENB);
 -
 -   /*
 -* TODO: where do we take the USB1 out of reset? The old code would
 -* take USB3 out of reset, but not USB1. This code doesn't do either.
 -*/

How did this get resolved?

  }

  /* set up the UTMI USB controller with the parameters provided */
 diff --git a/arch/arm/include/asm/arch-tegra20/usb.h 
 b/arch/arm/include/asm/arch-tegra20/usb.h
 index fdbd127..b18c850 100644
 --- a/arch/arm/include/asm/arch-tegra20/usb.h
 +++ b/arch/arm/include/asm/arch-tegra20/usb.h
 @@ -243,9 +243,6 @@ struct usb_ctlr {
  #define VBUS_VLD_STS   (1  26)


 -/* Change the USB host port into host mode */
 -void usb_set_host_mode(void);
 -

Everything else looks good.

  /* Setup USB on the board */
  int board_usb_init(const void *blob);

 --
 1.7.11.7


Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 3/8] tegra: usb: fold initial pll setup into board_usb_init

2012-10-30 Thread Lucas Stach
Am Dienstag, den 30.10.2012, 06:23 -0700 schrieb Simon Glass:
 Hi Lucas,
 
 On Tue, Oct 30, 2012 at 2:22 AM, Lucas Stach d...@lynxeye.de wrote:
  The setup is trivial, no need to split this out into a separate function.
 
  Signed-off-by: Lucas Stach d...@lynxeye.de
  ---
   arch/arm/cpu/armv7/tegra20/usb.c | 15 +--
   1 Datei geändert, 5 Zeilen hinzugefügt(+), 10 Zeilen entfernt(-)
 
  diff --git a/arch/arm/cpu/armv7/tegra20/usb.c 
  b/arch/arm/cpu/armv7/tegra20/usb.c
  index 1725cd1..e61bd69 100644
  --- a/arch/arm/cpu/armv7/tegra20/usb.c
  +++ b/arch/arm/cpu/armv7/tegra20/usb.c
  @@ -417,13 +417,6 @@ static int init_ulpi_usb_controller(struct fdt_usb 
  *config)
   }
   #endif
 
  -static void config_clock(const u32 timing[])
  -{
  -   clock_start_pll(CLOCK_ID_USB,
  -   timing[PARAM_DIVM], timing[PARAM_DIVN], timing[PARAM_DIVP],
  -   timing[PARAM_CPCON], timing[PARAM_LFCON]);
  -}
  -
   /**
* Add a new USB port to the list of available ports.
*
  @@ -534,13 +527,15 @@ int board_usb_init(const void *blob)
   {
  struct fdt_usb config;
  unsigned osc_freq = clock_get_rate(CLOCK_ID_OSC);
  -   enum clock_osc_freq freq;
  int node_list[USB_PORTS_MAX];
  int node, count, i;
  +   u32 *timing;
 
  /* Set up the USB clocks correctly based on our oscillator 
  frequency */
  -   freq = clock_get_osc_freq();
  -   config_clock(usb_pll[freq]);
  +   timing = usb_pll[clock_get_osc_freq()];
  +   clock_start_pll(CLOCK_ID_USB,
  +   timing[PARAM_DIVM], timing[PARAM_DIVN], timing[PARAM_DIVP],
  +   timing[PARAM_CPCON], timing[PARAM_LFCON]);
 
 Sorry I don't see the benefit of this change. The function is there to
 handle a clearly-defined task, hiding the detail of clock config
 elsewhere. It has no effect on code generated.
 
It's more of a personal thing, that every time there is a function call
it breaks the flow when reading the code. And IMHO it's not worth the
break if the called function does nothing other than just calling
another function.

If other people also dislike the change I may just drop it, but I would
like to hear some more opinions about this first.

Regards,
Lucas


___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v6 1/7] powerpc: Extract EPAPR_MAGIC constants into processor.h

2012-10-30 Thread Stefan Roese
Hi Wolfgang,

On 10/30/2012 12:05 PM, Wolfgang Denk wrote:
 As you know this patch is part of a patch-series. And this is the first
 time that this patch has a change. So this summary covers the complete
 history for this patch.
 
 But exactly this is information which I do not have, and which is not
 included in your patch.  As is, I can only intepret this to be version
 6 of this specific commit, and I wonder which changes were made in the
 previous 5 versions.

*If* we agree upon a per patch series versioning (see below), then this
would be enough. To only list the changes that have been made to this
patch. Your suggestion from below is even better. To document that no
changes have been made:

V2: no changes
...

I'm pretty sure that Simon (or other people with a bit of python
knowledge) can easily add this to patman.

 In this version of the patch series, I only made this small change to
 this patch 1/7. I wanted to spare the list a resending of the complete
 patchset for such a small change.

 So what is the recommended way to do this? Is it really
 recommended/required to repost the complete patch series upon a small
 change in only one patch? No problem, I can do this. patman makes it
 very easy. :)

 Should I repost the complete series again?
 
 No, not at all!

Okay.

 I understand you are using patman for patch management.  So I added
 Simon on Cc: to have his oponion, too.
 
 I see two options:
 
 1) Versioning is done on a per-patch base.  In this case, this patch
should have been submitted as [PATCH v2 1/7], in which case it
would have been clear to everybody that this is the first and only
change compared to previous submission(s).
 
I don't dare to say most, but at least some people have worked
like this when submitting patch series (manually) in the past.

I can understand if somebody argues that it is not exactly easy to
collect the correspondign patches to a series if individual patches
contain different version numbers.  Correct threading of the
messages is essential here.

Yes, this is my main concern about option a). Very hard to match the
single patches (and its versions) to the patch series version. Without
proper threading. And I personally don't use threading in my mail client
(my problem, I know).

 2) Versioning is done on a per-series base.
 
One problem here is that it becomes difficult to keep track if
what is what when only single patches of the series change and get
reposted - on the other hand it has always been a major PITA when
people repost whole series after only changing a line of two in on
of their many patches, so we strongly encourage posting of only the
changed patches.  Once more, proper threading appears to be
essential.
 
Another problem is what we are running into here: after severl
versions of the patch series one patch that has been untouches
previously gets changed.  Now it gets posted as V6, and it's
impossible to know how many previous versions of this patch might
have been posted before - one? 2? 3? 4? or 5?
 
When the version ID refers to the patch series rather than to the
individual patch, then I think it is mandatory to take this into
consideration in the patch history, whih then must refer to all
versions of the _series_.  In the present case, the patch history
should have looked like this:
 
   V2: no changes
   V3: no changes
   V4: no changes
   V5: no changes
   V6: Fix compile warning: release.S:354:0: warning: EPAPR_MAGIC 
 redefined
 
 
 Is there any clear majority of preferences for patch versioning?
 My gut feeling is that more people would like version IDs on a
 per-series base, but I would like to see some confirmation for this,
 and the we should document such expectations.

As you have already guessed, I'm in favoring the 2nd option, versioning
on a per-series base.

What do other developers have to say? What's the recommended way to do
this in the Linux world? Even if we don't need to do everything in the
same way as done in Linux development, it is much easier to do it in a
similar fashion for users working in both projects (U-Boot  Linux)
regularly.

 It appears that patman is oriented toward using a single version ID
 per series.  Simon - would it be possible to automatically add such
 no changes information when generating the patches?

A little motivation: Simon, you could earn yourself another beer the
next time we meet! ;)

Thanks,
Stefan
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 7/8] tegra: usb: move implementation into right directory

2012-10-30 Thread Simon Glass
Hi Lucas,

On Tue, Oct 30, 2012 at 2:22 AM, Lucas Stach d...@lynxeye.de wrote:
 This moves the Tegra USB implementation into the drivers/usb/host
 directory.

 Signed-off-by: Lucas Stach d...@lynxeye.de
 ---
  arch/arm/cpu/armv7/tegra20/Makefile|  2 -
  .../tegra20/usb.c = drivers/usb/host/ehci-tegra.c | 60 
 --
  2 Dateien geändert, 55 Zeilen hinzugefügt(+), 7 Zeilen entfernt(-)
  rename arch/arm/cpu/armv7/tegra20/usb.c = drivers/usb/host/ehci-tegra.c 
 (92%)

For me this patch did not apply:

Applying: tegra: usb: move implementation into right directory
error: drivers/usb/host/ehci-tegra.c: already exists in index
Patch failed at 0007 tegra: usb: move implementation into right directory
When you have resolved this problem run git am --resolved.
If you would prefer to skip this patch, instead run git am --skip.
To restore the original branch and stop patching run git am --abort.

I tried master and tegra/master.

Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 5/8] tegra: usb: move controller init into start_port

2012-10-30 Thread Lucas Stach
Am Dienstag, den 30.10.2012, 06:27 -0700 schrieb Simon Glass:
 Hi Lucas,
 
 On Tue, Oct 30, 2012 at 2:22 AM, Lucas Stach d...@lynxeye.de wrote:
  There is no need to init a USB controller before the upper layers indicate
  that they are actually going to use it.
 
  board_usb_init now only parses the device tree and sets up the common pll.
 
  Signed-off-by: Lucas Stach d...@lynxeye.de
  ---
   arch/arm/cpu/armv7/tegra20/usb.c | 47 
  +++-
   1 Datei geändert, 18 Zeilen hinzugefügt(+), 29 Zeilen entfernt(-)
 
  diff --git a/arch/arm/cpu/armv7/tegra20/usb.c 
  b/arch/arm/cpu/armv7/tegra20/usb.c
  index cf800b1..e372b8b 100644
  --- a/arch/arm/cpu/armv7/tegra20/usb.c
  +++ b/arch/arm/cpu/armv7/tegra20/usb.c
  @@ -417,44 +417,29 @@ static int init_ulpi_usb_controller(struct fdt_usb 
  *config)
   }
   #endif
 
  -/**
  - * Add a new USB port to the list of available ports.
  - *
  - * @param config   USB port configuration
  - * @return 0 if ok, -1 if error (too many ports)
  - */
  -static int add_port(struct fdt_usb *config)
  +int tegrausb_start_port(int portnum, u32 *hccr, u32 *hcor)
   {
  -   if (port_count == USB_PORTS_MAX) {
  -   printf(tegrausb: Cannot register more than %d ports\n,
  - USB_PORTS_MAX);
  +   struct fdt_usb *config;
  +   struct usb_ctlr *usbctlr;
  +
  +   if (portnum = port_count)
  return -1;
  -   }
  +
  +   config = port[portnum];
 
  if (config-utmi  init_utmi_usb_controller(config)) {
  -   printf(tegrausb: Cannot init port\n);
  +   printf(tegrausb: Cannot init port %d\n, portnum);
  return -1;
  }
 
  if (config-ulpi  init_ulpi_usb_controller(config)) {
  -   printf(tegrausb: Cannot init port\n);
  +   printf(tegrausb: Cannot init port %d\n, portnum);
  return -1;
  }
 
  -   port[port_count++] = *config;
  -
  -   return 0;
  -}
  +   set_host_mode(config);
 
 This is good, but now I think you will re-init the USB peripheral at
 every 'usb start'. Perhaps you should remember whether it has been
 inited and only do it the first time?

I have to look this up, but the upper USB layers should not call those
lowlevel init functions repeatedly unless explicitly asked for it
through a usb reset or the like. If it actually does so it's a bug in
the upper layer and should not be fixed up in the lowlevel functions.

Regards,
Lucas


___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 7/8] tegra: usb: move implementation into right directory

2012-10-30 Thread Lucas Stach
Am Dienstag, den 30.10.2012, 06:33 -0700 schrieb Simon Glass:
 Hi Lucas,
 
 On Tue, Oct 30, 2012 at 2:22 AM, Lucas Stach d...@lynxeye.de wrote:
  This moves the Tegra USB implementation into the drivers/usb/host
  directory.
 
  Signed-off-by: Lucas Stach d...@lynxeye.de
  ---
   arch/arm/cpu/armv7/tegra20/Makefile|  2 -
   .../tegra20/usb.c = drivers/usb/host/ehci-tegra.c | 60 
  --
   2 Dateien geändert, 55 Zeilen hinzugefügt(+), 7 Zeilen entfernt(-)
   rename arch/arm/cpu/armv7/tegra20/usb.c = drivers/usb/host/ehci-tegra.c 
  (92%)
 
 For me this patch did not apply:
 
 Applying: tegra: usb: move implementation into right directory
 error: drivers/usb/host/ehci-tegra.c: already exists in index
 Patch failed at 0007 tegra: usb: move implementation into right directory
 When you have resolved this problem run git am --resolved.
 If you would prefer to skip this patch, instead run git am --skip.
 To restore the original branch and stop patching run git am --abort.
 
 I tried master and tegra/master.

The series based on u-boot-usb/master, as it's supposed to go in through
this tree.

Regards,
Lucas

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 8/8] tegra: usb: move [start|stop]_port into ehci_hcd_[init|stop]

2012-10-30 Thread Simon Glass
Hi,

On Tue, Oct 30, 2012 at 2:22 AM, Lucas Stach d...@lynxeye.de wrote:
 The ehci_hcd entry points were just calling into the Tegra USB functions. Now
 that they are in the same file we can just move over the implementation.


Seems reasonable - the original approach was to put SOC-specific code
into arch/arm/cpu/armv7/tegra.., but I don't see any particular
benefit to that, and it could in fact get quite unwieldy. Since Tegra2
and Tegra3 both use the same USB it doesn't really matter anwyay.

 Signed-off-by: Lucas Stach d...@lynxeye.de
 ---
  arch/arm/include/asm/arch-tegra20/usb.h | 19 ---
  drivers/usb/host/ehci-tegra.c   | 93 
 +
  2 Dateien geändert, 35 Zeilen hinzugefügt(+), 77 Zeilen entfernt(-)

 diff --git a/arch/arm/include/asm/arch-tegra20/usb.h 
 b/arch/arm/include/asm/arch-tegra20/usb.h
 index b18c850..ef6c089 100644
 --- a/arch/arm/include/asm/arch-tegra20/usb.h
 +++ b/arch/arm/include/asm/arch-tegra20/usb.h
 @@ -246,23 +246,4 @@ struct usb_ctlr {
  /* Setup USB on the board */
  int board_usb_init(const void *blob);

 -/**
 - * Start up the given port number (ports are numbered from 0 on each board).
 - * This returns values for the appropriate hccr and hcor addresses to use for
 - * USB EHCI operations.
 - *
 - * @param portnum  port number to start
 - * @param hccr returns start address of EHCI HCCR registers
 - * @param hcor returns start address of EHCI HCOR registers
 - * @return 0 if ok, -1 on error (generally invalid port number)
 - */

But please can we keep this nice comment? I really don't like
uncommented functions.

[snip]

Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/8] tegra: usb: convert USB_PORTS_MAX to be a define

2012-10-30 Thread Simon Glass
Hi Marek,

On Tue, Oct 30, 2012 at 6:11 AM, Marek Vasut ma...@denx.de wrote:
 Dear Simon Glass,

 Hi Lucas,

 On Tue, Oct 30, 2012 at 2:22 AM, Lucas Stach d...@lynxeye.de wrote:
  No point in having this as an enum. Also while at it set it to the real
  hardware maximum for both Tegra 2 and Tegra 3. If new Tegra hardware
  includes more USB controllers we can always bump the limit then.
 
  Signed-off-by: Lucas Stach d...@lynxeye.de
  ---
 
   arch/arm/cpu/armv7/tegra20/usb.c | 4 +---
   1 Datei geändert, 1 Zeile hinzugefügt(+), 3 Zeilen entfernt(-)
 
  diff --git a/arch/arm/cpu/armv7/tegra20/usb.c
  b/arch/arm/cpu/armv7/tegra20/usb.c index 1bccf2b..9fd1edc 100644
  --- a/arch/arm/cpu/armv7/tegra20/usb.c
  +++ b/arch/arm/cpu/armv7/tegra20/usb.c
  @@ -43,9 +43,7 @@
 
  #endif
 
   #endif
 
  -enum {
  -   USB_PORTS_MAX   = 4,/* Maximum ports we allow
  */ -};
  +#define USB_PORTS_MAX  3   /* Maximum ports we allow */

 That's fine with me if you wan to change it.

 I tend to use enums most of the time. It shows up as a symbol in the
 debugger, avoids bracketed expressions, side-effects and the like, and
 works well when numbering multiple things (automatic increment). It's
 also a welcome language feature IMO - use it or lose it :-) But in
 this case the benefit is small.

 What about using static const int ?

That's fine too.

[snip]


 Best regards,
 Marek Vasut

Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 5/8] tegra: usb: move controller init into start_port

2012-10-30 Thread Simon Glass
Hi Lucas,

On Tue, Oct 30, 2012 at 6:37 AM, Lucas Stach d...@lynxeye.de wrote:
 Am Dienstag, den 30.10.2012, 06:27 -0700 schrieb Simon Glass:
 Hi Lucas,

 On Tue, Oct 30, 2012 at 2:22 AM, Lucas Stach d...@lynxeye.de wrote:
  There is no need to init a USB controller before the upper layers indicate
  that they are actually going to use it.
 
  board_usb_init now only parses the device tree and sets up the common pll.
 
  Signed-off-by: Lucas Stach d...@lynxeye.de
  ---
   arch/arm/cpu/armv7/tegra20/usb.c | 47 
  +++-
   1 Datei geändert, 18 Zeilen hinzugefügt(+), 29 Zeilen entfernt(-)
 
  diff --git a/arch/arm/cpu/armv7/tegra20/usb.c 
  b/arch/arm/cpu/armv7/tegra20/usb.c
  index cf800b1..e372b8b 100644
  --- a/arch/arm/cpu/armv7/tegra20/usb.c
  +++ b/arch/arm/cpu/armv7/tegra20/usb.c
  @@ -417,44 +417,29 @@ static int init_ulpi_usb_controller(struct fdt_usb 
  *config)
   }
   #endif
 
  -/**
  - * Add a new USB port to the list of available ports.
  - *
  - * @param config   USB port configuration
  - * @return 0 if ok, -1 if error (too many ports)
  - */
  -static int add_port(struct fdt_usb *config)
  +int tegrausb_start_port(int portnum, u32 *hccr, u32 *hcor)
   {
  -   if (port_count == USB_PORTS_MAX) {
  -   printf(tegrausb: Cannot register more than %d ports\n,
  - USB_PORTS_MAX);
  +   struct fdt_usb *config;
  +   struct usb_ctlr *usbctlr;
  +
  +   if (portnum = port_count)
  return -1;
  -   }
  +
  +   config = port[portnum];
 
  if (config-utmi  init_utmi_usb_controller(config)) {
  -   printf(tegrausb: Cannot init port\n);
  +   printf(tegrausb: Cannot init port %d\n, portnum);
  return -1;
  }
 
  if (config-ulpi  init_ulpi_usb_controller(config)) {
  -   printf(tegrausb: Cannot init port\n);
  +   printf(tegrausb: Cannot init port %d\n, portnum);
  return -1;
  }
 
  -   port[port_count++] = *config;
  -
  -   return 0;
  -}
  +   set_host_mode(config);

 This is good, but now I think you will re-init the USB peripheral at
 every 'usb start'. Perhaps you should remember whether it has been
 inited and only do it the first time?

 I have to look this up, but the upper USB layers should not call those
 lowlevel init functions repeatedly unless explicitly asked for it
 through a usb reset or the like. If it actually does so it's a bug in
 the upper layer and should not be fixed up in the lowlevel functions.

Perhaps, but you have to write your code in the environment that
exists. At present usb_lowlevel_init() is called on every 'usb start'
(and ehci_hcd_init() from that).

Regards,
Simon


 Regards,
 Lucas


___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 7/8] tegra: usb: move implementation into right directory

2012-10-30 Thread Simon Glass
Hi Lucas,

On Tue, Oct 30, 2012 at 6:38 AM, Lucas Stach d...@lynxeye.de wrote:
 Am Dienstag, den 30.10.2012, 06:33 -0700 schrieb Simon Glass:
 Hi Lucas,

 On Tue, Oct 30, 2012 at 2:22 AM, Lucas Stach d...@lynxeye.de wrote:
  This moves the Tegra USB implementation into the drivers/usb/host
  directory.
 
  Signed-off-by: Lucas Stach d...@lynxeye.de
  ---
   arch/arm/cpu/armv7/tegra20/Makefile|  2 -
   .../tegra20/usb.c = drivers/usb/host/ehci-tegra.c | 60 
  --
   2 Dateien geändert, 55 Zeilen hinzugefügt(+), 7 Zeilen entfernt(-)
   rename arch/arm/cpu/armv7/tegra20/usb.c = drivers/usb/host/ehci-tegra.c 
  (92%)

 For me this patch did not apply:

 Applying: tegra: usb: move implementation into right directory
 error: drivers/usb/host/ehci-tegra.c: already exists in index
 Patch failed at 0007 tegra: usb: move implementation into right directory
 When you have resolved this problem run git am --resolved.
 If you would prefer to skip this patch, instead run git am --skip.
 To restore the original branch and stop patching run git am --abort.

 I tried master and tegra/master.

 The series based on u-boot-usb/master, as it's supposed to go in through
 this tree.

OK thanks, I assumed that because tegra: was the first tag it would go
through tegra.

But it doesn't seem to help:

git remote -v |grep upstream-usb
upstream-usbhttp://git.denx.de/u-boot-usb.git (fetch)
upstream-usbhttp://git.denx.de/u-boot-usb.git (push)
git fetch upstream-usb
From http://git.denx.de/u-boot-usb
 * [new branch]  at91sam9x35-ek - upstream-usb/at91sam9x35-ek
 + 5b2e031...0b92a45 cdc-at91   - upstream-usb/cdc-at91  (forced update)
 + 6722fd5...76454b2 master - upstream-usb/master  (forced update)
 * [new branch]  merge_pending - upstream-usb/merge_pending
 + 2c8b43b...01afc4f next   - upstream-usb/next  (forced update)
 * [new branch]  uboot  - upstream-usb/uboot
(try-usb=5cf309: include/ lq out/ tools/ x/) ~/u co -b try-usb2
upstream-usb/master
Branch try-usb2 set up to track remote branch master from upstream-usb.
Switched to a new branch 'try-usb2'
(try-usb2=76454b: include/ lq out/ tools/ x/) ~/u git am
~/Downloads/bundle-3480.mbox
Applying: tegra: usb: convert USB_PORTS_MAX to be a define
Applying: tegra: usb: make controller init functions more self contained
Applying: tegra: usb: fold initial pll setup into board_usb_init
Applying: tegra: usb: remove unneeded function parameter
Applying: tegra: usb: move controller init into start_port
Applying: tegra: usb: various small cleanups
Applying: tegra: usb: move implementation into right directory
error: drivers/usb/host/ehci-tegra.c: already exists in index
Patch failed at 0007 tegra: usb: move implementation into right directory
When you have resolved this problem run git am --resolved.
If you would prefer to skip this patch, instead run git am --skip.
To restore the original branch and stop patching run git am --abort.

Where was the patch that removed drivers/usb/host/ehci-tegra.c?


 Regards,
 Lucas


Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 5/8] tegra: usb: move controller init into start_port

2012-10-30 Thread Lucas Stach
Am Dienstag, den 30.10.2012, 06:48 -0700 schrieb Simon Glass:
 Hi Lucas,
 
 On Tue, Oct 30, 2012 at 6:37 AM, Lucas Stach d...@lynxeye.de wrote:
  Am Dienstag, den 30.10.2012, 06:27 -0700 schrieb Simon Glass:
  Hi Lucas,
 
  On Tue, Oct 30, 2012 at 2:22 AM, Lucas Stach d...@lynxeye.de wrote:
   There is no need to init a USB controller before the upper layers 
   indicate
   that they are actually going to use it.
  
   board_usb_init now only parses the device tree and sets up the common 
   pll.
  
   Signed-off-by: Lucas Stach d...@lynxeye.de
   ---
arch/arm/cpu/armv7/tegra20/usb.c | 47 
   +++-
1 Datei geändert, 18 Zeilen hinzugefügt(+), 29 Zeilen entfernt(-)
  
   diff --git a/arch/arm/cpu/armv7/tegra20/usb.c 
   b/arch/arm/cpu/armv7/tegra20/usb.c
   index cf800b1..e372b8b 100644
   --- a/arch/arm/cpu/armv7/tegra20/usb.c
   +++ b/arch/arm/cpu/armv7/tegra20/usb.c
   @@ -417,44 +417,29 @@ static int init_ulpi_usb_controller(struct fdt_usb 
   *config)
}
#endif
  
   -/**
   - * Add a new USB port to the list of available ports.
   - *
   - * @param config   USB port configuration
   - * @return 0 if ok, -1 if error (too many ports)
   - */
   -static int add_port(struct fdt_usb *config)
   +int tegrausb_start_port(int portnum, u32 *hccr, u32 *hcor)
{
   -   if (port_count == USB_PORTS_MAX) {
   -   printf(tegrausb: Cannot register more than %d ports\n,
   - USB_PORTS_MAX);
   +   struct fdt_usb *config;
   +   struct usb_ctlr *usbctlr;
   +
   +   if (portnum = port_count)
   return -1;
   -   }
   +
   +   config = port[portnum];
  
   if (config-utmi  init_utmi_usb_controller(config)) {
   -   printf(tegrausb: Cannot init port\n);
   +   printf(tegrausb: Cannot init port %d\n, portnum);
   return -1;
   }
  
   if (config-ulpi  init_ulpi_usb_controller(config)) {
   -   printf(tegrausb: Cannot init port\n);
   +   printf(tegrausb: Cannot init port %d\n, portnum);
   return -1;
   }
  
   -   port[port_count++] = *config;
   -
   -   return 0;
   -}
   +   set_host_mode(config);
 
  This is good, but now I think you will re-init the USB peripheral at
  every 'usb start'. Perhaps you should remember whether it has been
  inited and only do it the first time?
 
  I have to look this up, but the upper USB layers should not call those
  lowlevel init functions repeatedly unless explicitly asked for it
  through a usb reset or the like. If it actually does so it's a bug in
  the upper layer and should not be fixed up in the lowlevel functions.
 
 Perhaps, but you have to write your code in the environment that
 exists. At present usb_lowlevel_init() is called on every 'usb start'
 (and ehci_hcd_init() from that).
 
After all this is open source and I would rather spin a patch to fix
this at the right spot if we do the wrong thing, than having to cope
with the bug at a lower level. Even with bug present we are not failing
in any severe way, we are just wasting time bringing up a controller
which is already up.

Regards,
Lucas

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 5/8] tegra: usb: move controller init into start_port

2012-10-30 Thread Simon Glass
Hi Lucas,

On Tue, Oct 30, 2012 at 6:54 AM, Lucas Stach d...@lynxeye.de wrote:
 Am Dienstag, den 30.10.2012, 06:48 -0700 schrieb Simon Glass:
 Hi Lucas,

 On Tue, Oct 30, 2012 at 6:37 AM, Lucas Stach d...@lynxeye.de wrote:
  Am Dienstag, den 30.10.2012, 06:27 -0700 schrieb Simon Glass:
  Hi Lucas,
 
  On Tue, Oct 30, 2012 at 2:22 AM, Lucas Stach d...@lynxeye.de wrote:
   There is no need to init a USB controller before the upper layers 
   indicate
   that they are actually going to use it.
  
   board_usb_init now only parses the device tree and sets up the common 
   pll.
  
   Signed-off-by: Lucas Stach d...@lynxeye.de
   ---
arch/arm/cpu/armv7/tegra20/usb.c | 47 
   +++-
1 Datei geändert, 18 Zeilen hinzugefügt(+), 29 Zeilen entfernt(-)
  
   diff --git a/arch/arm/cpu/armv7/tegra20/usb.c 
   b/arch/arm/cpu/armv7/tegra20/usb.c
   index cf800b1..e372b8b 100644
   --- a/arch/arm/cpu/armv7/tegra20/usb.c
   +++ b/arch/arm/cpu/armv7/tegra20/usb.c
   @@ -417,44 +417,29 @@ static int init_ulpi_usb_controller(struct 
   fdt_usb *config)
}
#endif
  
   -/**
   - * Add a new USB port to the list of available ports.
   - *
   - * @param config   USB port configuration
   - * @return 0 if ok, -1 if error (too many ports)
   - */
   -static int add_port(struct fdt_usb *config)
   +int tegrausb_start_port(int portnum, u32 *hccr, u32 *hcor)
{
   -   if (port_count == USB_PORTS_MAX) {
   -   printf(tegrausb: Cannot register more than %d ports\n,
   - USB_PORTS_MAX);
   +   struct fdt_usb *config;
   +   struct usb_ctlr *usbctlr;
   +
   +   if (portnum = port_count)
   return -1;
   -   }
   +
   +   config = port[portnum];
  
   if (config-utmi  init_utmi_usb_controller(config)) {
   -   printf(tegrausb: Cannot init port\n);
   +   printf(tegrausb: Cannot init port %d\n, portnum);
   return -1;
   }
  
   if (config-ulpi  init_ulpi_usb_controller(config)) {
   -   printf(tegrausb: Cannot init port\n);
   +   printf(tegrausb: Cannot init port %d\n, portnum);
   return -1;
   }
  
   -   port[port_count++] = *config;
   -
   -   return 0;
   -}
   +   set_host_mode(config);
 
  This is good, but now I think you will re-init the USB peripheral at
  every 'usb start'. Perhaps you should remember whether it has been
  inited and only do it the first time?
 
  I have to look this up, but the upper USB layers should not call those
  lowlevel init functions repeatedly unless explicitly asked for it
  through a usb reset or the like. If it actually does so it's a bug in
  the upper layer and should not be fixed up in the lowlevel functions.

 Perhaps, but you have to write your code in the environment that
 exists. At present usb_lowlevel_init() is called on every 'usb start'
 (and ehci_hcd_init() from that).

 After all this is open source and I would rather spin a patch to fix
 this at the right spot if we do the wrong thing, than having to cope
 with the bug at a lower level. Even with bug present we are not failing
 in any severe way, we are just wasting time bringing up a controller
 which is already up.


OK, but perhaps my broader point is that this may in fact be the
intended behaviour of U-Boot. Until you bring this up and submit a
patch to change it, you may not know. I would suggest you change the
patch order here - first send a patch making usb_lowlevel_init() work
the way you want, then a patch to change Tegra to init each time
usb_lowlevel_init() is called.

I'm not sure about the time penalty - I suspect it is small - but why
have any such penalty? Boot time is a key concern (at least for me!).
Plus re-init of already-inited hardware can be problematic.

Or you could fix this for now by remembering what is inited and not
doing it again - just another flag in struct fdt_usb. It is good that
you don't init USB until needed, and that would solve the problem in
the interim, until you get usb_lowlevel_init() changed. Ultimately
with the device model we may be able to go further and not even do the
fdt decode until needed.

Regards,
Simon

 Regards,
 Lucas

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 7/8] tegra: usb: move implementation into right directory

2012-10-30 Thread Lucas Stach
Am Dienstag, den 30.10.2012, 06:53 -0700 schrieb Simon Glass:
 Hi Lucas,
 
 On Tue, Oct 30, 2012 at 6:38 AM, Lucas Stach d...@lynxeye.de wrote:
  Am Dienstag, den 30.10.2012, 06:33 -0700 schrieb Simon Glass:
  Hi Lucas,
 
  On Tue, Oct 30, 2012 at 2:22 AM, Lucas Stach d...@lynxeye.de wrote:
   This moves the Tegra USB implementation into the drivers/usb/host
   directory.
  
   Signed-off-by: Lucas Stach d...@lynxeye.de
   ---
arch/arm/cpu/armv7/tegra20/Makefile|  2 -
.../tegra20/usb.c = drivers/usb/host/ehci-tegra.c | 60 
   --
2 Dateien geändert, 55 Zeilen hinzugefügt(+), 7 Zeilen entfernt(-)
rename arch/arm/cpu/armv7/tegra20/usb.c = 
   drivers/usb/host/ehci-tegra.c (92%)
 
  For me this patch did not apply:
 
  Applying: tegra: usb: move implementation into right directory
  error: drivers/usb/host/ehci-tegra.c: already exists in index
  Patch failed at 0007 tegra: usb: move implementation into right directory
  When you have resolved this problem run git am --resolved.
  If you would prefer to skip this patch, instead run git am --skip.
  To restore the original branch and stop patching run git am --abort.
 
  I tried master and tegra/master.
 
  The series based on u-boot-usb/master, as it's supposed to go in through
  this tree.
 
 OK thanks, I assumed that because tegra: was the first tag it would go
 through tegra.
 
 But it doesn't seem to help:
 
 git remote -v |grep upstream-usb
 upstream-usb  http://git.denx.de/u-boot-usb.git (fetch)
 upstream-usb  http://git.denx.de/u-boot-usb.git (push)
 git fetch upstream-usb
 From http://git.denx.de/u-boot-usb
  * [new branch]  at91sam9x35-ek - upstream-usb/at91sam9x35-ek
  + 5b2e031...0b92a45 cdc-at91   - upstream-usb/cdc-at91  (forced update)
  + 6722fd5...76454b2 master - upstream-usb/master  (forced update)
  * [new branch]  merge_pending - upstream-usb/merge_pending
  + 2c8b43b...01afc4f next   - upstream-usb/next  (forced update)
  * [new branch]  uboot  - upstream-usb/uboot
 (try-usb=5cf309: include/ lq out/ tools/ x/) ~/u co -b try-usb2
 upstream-usb/master
 Branch try-usb2 set up to track remote branch master from upstream-usb.
 Switched to a new branch 'try-usb2'
 (try-usb2=76454b: include/ lq out/ tools/ x/) ~/u git am
 ~/Downloads/bundle-3480.mbox
 Applying: tegra: usb: convert USB_PORTS_MAX to be a define
 Applying: tegra: usb: make controller init functions more self contained
 Applying: tegra: usb: fold initial pll setup into board_usb_init
 Applying: tegra: usb: remove unneeded function parameter
 Applying: tegra: usb: move controller init into start_port
 Applying: tegra: usb: various small cleanups
 Applying: tegra: usb: move implementation into right directory
 error: drivers/usb/host/ehci-tegra.c: already exists in index
 Patch failed at 0007 tegra: usb: move implementation into right directory
 When you have resolved this problem run git am --resolved.
 If you would prefer to skip this patch, instead run git am --skip.
 To restore the original branch and stop patching run git am --abort.
 
 Where was the patch that removed drivers/usb/host/ehci-tegra.c?
 
Hm I'm no expert here, but I didn't actually remove the file. I just
copied over the contents of the old implementation file and both git
commit and git format-patch recognized this as a rename. Also the
cherry-pick from my devel to the usb branch worked flawlessly.
If git am can't cope with the rename to an already existing file I may
post the patch with the rename forcibly removed, but this will yield a
much bigger patch. I'll investigate this.

Thanks for the heads up.

Regards,
Lucas

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] OK6410 board uboot

2012-10-30 Thread Kaushal Billore
Hello,

I am working on LCD module for ARM11 ok6410 board, uboot1.1.6 source code is 
available but I didn't find support for lcd for smdk6410_config configuration 
file.

anyone having knowledge about this.

Thanks
Kaushal billore
Moschip Semiconductor  ___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/8] tegra: usb: make controller init functions more self contained

2012-10-30 Thread Simon Glass
Hi Lucas,

On Tue, Oct 30, 2012 at 6:16 AM, Lucas Stach d...@lynxeye.de wrote:
 Hello Simon,

 Am Dienstag, den 30.10.2012, 06:03 -0700 schrieb Simon Glass:
 Hi Lucas,

 On Tue, Oct 30, 2012 at 2:22 AM, Lucas Stach d...@lynxeye.de wrote:
  There is no need to pass around all those parameters. The init functions
  are able to easily extract all the needed setup info on their own.
 
  Signed-off-by: Lucas Stach d...@lynxeye.de
  ---
   arch/arm/cpu/armv7/tegra20/usb.c | 24 
   1 Datei geändert, 12 Zeilen hinzugefügt(+), 12 Zeilen entfernt(-)

 I'm not sure I agree with the premise of this patch.

 At the top level it calls clock_get_osc_freq() to get the frequency.
 That is then passed to the two places that need it.

 It doesn't seem right to me to call clock_get_osc_freq() again in the
 lower level function just to avoid a parameter. On ARM at least a few
 parameters are a cheap way of passing data around.

 The intent of this patch is not really to save up on parameters passed,
 but to make it possible to later move out the controller initialization
 into the ehci_hcd_init function without having to save away this global
 state for later use.

 We have to init at most 2 controllers where timing matters, so I think
 it's the right thing to get the SoC global clock state at those two
 occasions to avoid inflating the file global state.

OK fair enough, I see that you want to do these two types of init at
different times.


 It also allows the lower-level functions to deal with what they need
 to, rather than all functions having to reference the global state
 independently, each one digging down to what it actually needs.

 The controller init functions get passed the state only of the one port
 they have to initialize. There is no point in extracting things at an
 upper level and passing it into the functions, if it's exactly the same
 thing that is stored in the port state.

Well if the upper level is extracting it anyway, it often saves code
space to pass the extracted value. I would like to avoid this sort of
thing:

void do_something(struct level1 *level1)
{
   struct level2 *level2 = level1-level2;
   struct level3 *level3 = level2-level3;

   level3-...
   level3-...
}

void do_something_else(struct level1 *level1)
{
   struct level2 *level2 = level1-level2;
   struct level3 *level3 = level2-level3;

   level3-...
   level3-...
}

main()
{
   do_something(level1)
   do_something_else(level1)
}


I generally prefer:

void do_something(struct level3 *level3)
{
   level3-...
   level3-...
}

void do_something_else(struct level3 *level3)
{
   level3-...
   level3-...
}

main()
{
   struct level2 *level2 = level1-level2;
   struct level3 *level3 = level2-level3;

   do_something(level3)
   do_something_else(level3)
}


I hope that example makes sense.


 Regards,
 Lucas



Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v6 1/7] powerpc: Extract EPAPR_MAGIC constants into processor.h

2012-10-30 Thread Simon Glass
Hi Wolfgang, Stefan,

On Tue, Oct 30, 2012 at 6:33 AM, Stefan Roese s...@denx.de wrote:
 Hi Wolfgang,

 On 10/30/2012 12:05 PM, Wolfgang Denk wrote:
 As you know this patch is part of a patch-series. And this is the first
 time that this patch has a change. So this summary covers the complete
 history for this patch.

 But exactly this is information which I do not have, and which is not
 included in your patch.  As is, I can only intepret this to be version
 6 of this specific commit, and I wonder which changes were made in the
 previous 5 versions.

 *If* we agree upon a per patch series versioning (see below), then this
 would be enough. To only list the changes that have been made to this
 patch. Your suggestion from below is even better. To document that no
 changes have been made:

 V2: no changes
 ...

 I'm pretty sure that Simon (or other people with a bit of python
 knowledge) can easily add this to patman.

[snip]

 It appears that patman is oriented toward using a single version ID
 per series.  Simon - would it be possible to automatically add such
 no changes information when generating the patches?

 A little motivation: Simon, you could earn yourself another beer the
 next time we meet! ;)

Sold :-) It's pretty trivial I think - I will take a look.

Re the threading, and this is to some extent a separate issue, if I am
resending a single patch, I sometimes copy in the message ID when
patman (actually git send-email, called by patman) asks for it. We
could perhaps automate this - in two ways:

1. Patman could automatically send only the patches that have changed
for v6 (I suggest that unless this is combined with some sort of
automatic patchwork state change, it could get a bit tricky for
maintainers since they will be applying many different patch versions
in a series). At present you have to manually type 'y' or 'n' to each
patch.

2. Patman could (with a bit of effort) attach the message ID for the
previous version of the patch to the 'in reply to' tag of the next
version. This would mean that each patch would be in reply to its
earlier version. My understanding was that this was not desirable, and
that it is better to have the series stand alone. I recall some
discussion on this.

It may be that neither of these is desirable.


 Thanks,
 Stefan

Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 7/8] tegra: usb: move implementation into right directory

2012-10-30 Thread Tom Warren
Simon, et al,

 -Original Message-
 From: s...@google.com [mailto:s...@google.com] On Behalf Of Simon Glass
 Sent: Tuesday, October 30, 2012 6:34 AM
 To: Lucas Stach
 Cc: Marek Vasut; u-boot@lists.denx.de; Stephen Warren; Tom Warren
 Subject: Re: [PATCH 7/8] tegra: usb: move implementation into right
 directory
 
 Hi Lucas,
 
 On Tue, Oct 30, 2012 at 2:22 AM, Lucas Stach d...@lynxeye.de wrote:
  This moves the Tegra USB implementation into the drivers/usb/host
  directory.
 
  Signed-off-by: Lucas Stach d...@lynxeye.de
  ---
   arch/arm/cpu/armv7/tegra20/Makefile|  2 -
   .../tegra20/usb.c = drivers/usb/host/ehci-tegra.c | 60
  --
   2 Dateien geändert, 55 Zeilen hinzugefügt(+), 7 Zeilen entfernt(-)
  rename arch/arm/cpu/armv7/tegra20/usb.c =
  drivers/usb/host/ehci-tegra.c (92%)
 
 For me this patch did not apply:
 
 Applying: tegra: usb: move implementation into right directory
 error: drivers/usb/host/ehci-tegra.c: already exists in index Patch failed
 at 0007 tegra: usb: move implementation into right directory When you have
 resolved this problem run git am --resolved.
 If you would prefer to skip this patch, instead run git am --skip.
 To restore the original branch and stop patching run git am --abort.
 
 I tried master and tegra/master.
Please apply/develop all Tegra patches on tegra/next. That's where I'll be 
applying new patches as they come in. /master is usually behind /next until a 
pull request occurs (which just happens to be what the state is now, so master 
== next, but that's not the norm).

Thanks,

Tom
 
 Regards,
 Simon
-- 
nvpublic

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] patman: Issue empty change logs for unchanged patches

2012-10-30 Thread Simon Glass
Often a particular patch may change only for some versions of a series.
For versions where there is no change, issue a change log indicating
that (for example 'Changes in v4: None').

For such lines, don't add a blank line afterwards, to conserve space.
Use list.insert() instead of list = [item] + list.

Signed-off-by: Simon Glass s...@chromium.org
---
 tools/patman/series.py |   21 +
 1 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/tools/patman/series.py b/tools/patman/series.py
index a283a2d..d2971f4 100644
--- a/tools/patman/series.py
+++ b/tools/patman/series.py
@@ -145,10 +145,11 @@ class Series(dict):
 Return:
 The change log as a list of strings, one per line
 
-Changes in v2:
+Changes in v4:
 - Jog the dial back closer to the widget
 
-Changes in v1:
+Changes in v3: None
+Changes in v2:
 - Fix the widget
 - Jog the dial
 
@@ -162,12 +163,16 @@ class Series(dict):
 if commit and this_commit != commit:
 continue
 out.append(text)
-if out:
-out = ['Changes in v%d:' % change] + out
-if need_blank:
-out = [''] + out
-final += out
-need_blank = True
+line = 'Changes in v%d:' % change
+have_changes = len(out)  0
+if have_changes:
+out.insert(0, line)
+else:
+out = [line + ' None']
+if need_blank:
+out.insert(0, '')
+final += out
+need_blank = have_changes
 if self.changes:
 final.append('')
 return final
-- 
1.7.7.3

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] ping failed; host 192.168.1.101 is not alive

2012-10-30 Thread akdas75

Hi 

As per your suggestion I tried 2012.10 
Still the result is same. But it shows receive length is zero.

I have attached the logs
I have attached the changes to make ethernet work.

As I am new to this forum I hope you said me to reply to this mailing list.

Ajoy http://old.nabble.com/file/p34620403/uboot.txt uboot.txt 
http://old.nabble.com/file/p34620403/uboot.patch uboot.patch 



akdas75 wrote:
 
 hi 
 
 No I dont have any firewall running.
 I have enabled to receive all packets []
 
 i am using the uboot version 2011.03 with the following changes.
 But i think it will not affect the ping functionality.
 
 Any help. I will try putting more logs and pointing the issue.
 
 attached is the patch
 
 Ajoy
 
 
 
 akdas75 wrote:
 
 hi Anatolij
 I tried  your suggestion 
 I generate a macid from uboot/tools/gen_eth_addr.
 Still the ping says host not alive
 
 I have attached the uboot log
 and also the wireshark snapshot on the host
 
 host : 192.168.1.101
 development board : 192.168.1.100
 
 Ajoy
  http://old.nabble.com/file/p34610904/uboot_log_1.txt uboot_log_1.txt 
 http://old.nabble.com/file/p34610904/snap_wireshark_host.JPG
 snap_wireshark_host.JPG 
 
 akdas75 wrote:
 
 Hi http://old.nabble.com/file/p34608548/uboot-log.rtf uboot-log.rtf 
 
 I am using beagle board C4 with zippy expansion board.
 I am able to do NFS at the kernel level.
 I want to o tftp at the u-boot level.
 my beagle board is connected to the host via  cross ethernet cable.
 the phy chip is enc28j60. 
 when i ping  the host it says host not alive.
 
 i have attached the env variables
 
 please help
 
 
 
 
  http://old.nabble.com/file/p34615656/u-boot.patch u-boot.patch 
 

-- 
View this message in context: 
http://old.nabble.com/ping-failed--host-192.168.1.101-is-not-alive-tp34608548p34620403.html
Sent from the Uboot - Users mailing list archive at Nabble.com.

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 7/8] tegra: usb: move implementation into right directory

2012-10-30 Thread Simon Glass
Hi Tom,

On Tue, Oct 30, 2012 at 9:11 AM, Tom Warren twar...@nvidia.com wrote:
 Simon, et al,
[snip]
 Please apply/develop all Tegra patches on tegra/next. That's where I'll be 
 applying new patches as they come in. /master is usually behind /next until a 
 pull request occurs (which just happens to be what the state is now, so 
 master == next, but that's not the norm).

OK thanks for the clarification. I was tending towards that, but had
sometimes found next was old, if that makes any sense. Will do from
now on.

The LCD series applied on top of tegra/next for me without trouble.

Regards,
Simon


 Thanks,

 Tom

 Regards,
 Simon
 --
 nvpublic

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] x86: Anyone willing to take over the reigns

2012-10-30 Thread Simon Glass
Hi Graeme,

On Sun, Oct 28, 2012 at 4:44 AM, Graeme Russ graeme.r...@gmail.com wrote:
 Hi All,

 I think it's finally time I admitted that I simply have too much on my
 plate and need to give a few things up. Work and family life have got to
 the point where I can only manage to grab a quick hour here and there at my
 desk at home and I simply do not have enough time (or energy) to keep
 maintaining the x86 repo.

 It's been really good to see the Chromium guys giving U-Boot x86 some much
 needed love, but it has highlighted to me just how much work it has been
 (and will be) to keep up. To give you an idea, I haven't sync'd my local
 repo (much less built U-Boot) in over a month now. My bandwidth is down to
 making a few passing comments on very specific patches.

 Does anyone feel up to the task of taking on the x86 repo? If not, I'm sure
 that it could revert to the old days of being directly managed as
 'miscellaneous'

I would be happy to take this on for a while.

Will you still be able to do some review, perhaps just for the more
'core' patches?

Regards,
Simon


 Regards,

 Graeme
 ___
 U-Boot mailing list
 U-Boot@lists.denx.de
 http://lists.denx.de/mailman/listinfo/u-boot
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v6 1/7] powerpc: Extract EPAPR_MAGIC constants into processor.h

2012-10-30 Thread Tom Rini
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 10/30/12 06:33, Stefan Roese wrote:
 Hi Wolfgang,
 
 On 10/30/2012 12:05 PM, Wolfgang Denk wrote:
[snip]
 2) Versioning is done on a per-series base.
 
 One problem here is that it becomes difficult to keep track if 
 what is what when only single patches of the series change and
 get reposted - on the other hand it has always been a major PITA
 when people repost whole series after only changing a line of two
 in on of their many patches, so we strongly encourage posting of
 only the changed patches.  Once more, proper threading appears to
 be essential.
 
 Another problem is what we are running into here: after severl 
 versions of the patch series one patch that has been untouches 
 previously gets changed.  Now it gets posted as V6, and it's 
 impossible to know how many previous versions of this patch
 might have been posted before - one? 2? 3? 4? or 5?
 
 When the version ID refers to the patch series rather than to
 the individual patch, then I think it is mandatory to take this
 into consideration in the patch history, whih then must refer to
 all versions of the _series_.  In the present case, the patch
 history should have looked like this:
 
 V2: no changes V3: no changes V4: no changes V5: no changes V6:
 Fix compile warning: release.S:354:0: warning: EPAPR_MAGIC
 redefined
 
 
 Is there any clear majority of preferences for patch versioning? 
 My gut feeling is that more people would like version IDs on a 
 per-series base, but I would like to see some confirmation for
 this, and the we should document such expectations.
 
 As you have already guessed, I'm in favoring the 2nd option,
 versioning on a per-series base.
 
 What do other developers have to say? What's the recommended way to
 do this in the Linux world? Even if we don't need to do everything
 in the same way as done in Linux development, it is much easier to
 do it in a similar fashion for users working in both projects
 (U-Boot  Linux) regularly.

So, I am in favor of per-series versioning.  I also prefer whole
reposting (which I believe to be the norm in the kernel) with a dash
of common sense (posting just 1/7 makes sense here) due to how
patchwork bundles work.

- -- 
Tom
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQIcBAEBAgAGBQJQkAP+AAoJENk4IS6UOR1WNMkP/i7oxy0L7W2N6h730IsDgE9g
tHlgbBUsm5pWnqBC8/57mOmsWWv+j3zgojc3OYMasIyAkHpAJ2yM7qoAFxeGmDzS
TyHvb2bswSIoL2pwlems2m0lfx3V7H8StRcZjpeztfbWRbQXIkKeAon0Bd5R+iwm
v/mIMR6Sdfq+x0klnRIjkO++652nKRQ+JAHLNWNVxZ6DpOqqLBtTAXXyYHLpBEKz
hGdrk2gzryoMAZKiKuiz5mgTmeHoBvsCkIiAsnYoZg94KXohvQUkQzVGV4WA4qOQ
1jk4v7vjGR3gg7c/gOjauwsTalv/6SGZ+f8kSUVV8zKBUOAXhckF0o2+nC70G74W
hoOiSuS2hTz//xkGWmLl9mANCK9iYm/RtQIj4NlrwYabmQ0oUpHRv2HU2C47tffD
u/9RrRqj4onjNR4GtYiy8M4iDFZSiVRpNF6TozxKWyXt2fG01tAPmkdy2mLqfdD5
Mbn0KKBV+/PkPrvzmX0xrFEJVhiMo4P4gUPESLADTX0Xd3oziVKpKjQTRIOpztIT
ib98JeA5fMKPQJJnMnKwldU/0gek5JYpqFihwZMPf5lXi2G3beAXRPTOgZGif621
dCyWbfMEd/fI6393wFvODLjzKT09Q1uf6KxMitrziUEZBB6QVZYRQMKmz5Adz9v0
E9tj91WHgpF9zXOhQgkq
=OWfZ
-END PGP SIGNATURE-
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH V4 3/3] fs: add filesystem switch libary, implement ls and fsload commands

2012-10-30 Thread Tom Rini
On Tue, Oct 30, 2012 at 12:05:37PM +0100, Andreas Bie?mann wrote:
 Dear all,
 
 On 22.10.2012 18:43, Stephen Warren wrote:
  From: Stephen Warren swar...@nvidia.com
  
  Implement ls and fsload commands that act like {fat,ext2}{ls,load},
  and transparently handle either file-system. This scheme could easily be
  extended to other filesystem types; I only didn't do it for zfs because
  I don't have any filesystems of that type to test with.
  
  Replace the implementation of {fat,ext[24]}{ls,load} with this new code
  too.
  
  Signed-off-by: Stephen Warren swar...@nvidia.com
 
 this patch (namely 045fa1e1142552799ad3203e9e0bc22a11e866ea) seems to
 break avr32 on runtime. It seems there is a new array introduced (the
 fstypes array in fs/fs.c) which do not provide a relocation method
 (CONFIG_NEEDS_MANUAL_RELOC). This is currently only a weak assumption,
 but has any other requiring manual relocation m86k, mips, nds32m sparc)
 also encountered this problem?

Urk, sorry.  Can you prepare and test a patch?  Thanks!

-- 
Tom


signature.asc
Description: Digital signature
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 0/3] Bring in new I2C framework

2012-10-30 Thread Stephen Warren
On 10/29/2012 11:57 PM, Heiko Schocher wrote:
 Hello Stephen,
 
 On 29.10.2012 16:34, Stephen Warren wrote:
...
 If there are e.g. 4 I2C controllers in an SoC, the driver needs to know
 which one is in use. Passing that information directly to the driver
 functions is much simple than requiring the SoC I2C driver to go grovel
 in some I2C core global variables to find out the same information.
 
 Ah, do you mean we should change the i2c adapter struct from:
 
 struct i2c_adapter {
void(*init)(int speed, int slaveaddr);
int (*probe)(uint8_t chip);
int (*read)(uint8_t chip, uint addr, int alen,
uint8_t *buffer, int len);
int (*write)(uint8_t chip, uint addr, int alen,
uint8_t *buffer, int len);
uint(*set_bus_speed)(uint speed);
 [...]
 
 to
 
 struct i2c_adapter {
void(*init)(struct i2c_adapter *adap, int speed, int
 slaveaddr);
int (*probe)(struct i2c_adapter *adap, uint8_t chip);
int (*read)(struct i2c_adapter *adap, uint8_t chip,
 uint addr, int alen,
uint8_t *buffer, int len);
int (*write)(struct i2c_adapter *adap, uint8_t chip,
 uint addr, int alen,
uint8_t *buffer, int len);
uint(*set_bus_speed)(struct i2c_adapter *adap, uint
 speed);
 [...]
 ?
 
 We can do this. Simon suggested this too ...

Yes, exactly. (the functions will need some way to get information out
of the struct i2c_adapter; I assume there's some kind of driver_private
field in there too).
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v4 00/24] pmic: Redesign PMIC framework to support multiple instances of devices

2012-10-30 Thread Lukasz Majewski
PMIC framework has been redesigned to support multiple instances of power 
related devices
(e.g. fuel gauge, PMICs, chargers, micro USB IC, battery).

Due to that, code at other architectures and boards have been adjusted properly.

New power_init_board() method at ./lib/board.c file has been introduced. It is 
meant
to be an architecture dependent function to support advanced power management.
Since PMIC framework uses lists internally to link different devices, its 
initialization
must be done just after malloc initialization.

Please consider commits from this patch set as the example of advanced power 
management for a
particular HW (Trats board in this case).

In the new approach PMICs are selected with their names (e.g. 'pmic dump 
MAX8997_PMIC')
Presented patch set is a first step to change 'pmic' command to more generic 
(i.e. power)
to provide control for multiple devices.

Moreover device's battery is treated as an oridinary power device (like 
PMIC). Due to
that, framework unification is possible.
For even more versalite design, each power device instance can specify its 
parent.

For trats one can build a following scheme (it can de different for other 
boards):
-
| BAT   |
|   |   |   |
|   -   |
|   |   |
   \|/ \|/ \|/
--- -   -
|FG   | |MUIC   |   |CHRG   |
| | |   |   |   |
--- -   -

Finally, this patch series also comprises of a namespace cleanup - an attempt 
to rename
pmic to power to better reflect generality of this framework.



Test HW:
 - Exynos4210 Trats development board


Lukasz Majewski (24):
  pmic:i2c: Handle PMIC I2C transmission comprising of two bytes
  pmic:i2c: Add I2C sensor byte order (big/little) to PMIC framework
  pmic:max8997: Switch the MAX8997 PMIC to be used with multibus I2C
  pmic: Extend PMIC framework to support multiple instances of PMIC
devices
  pmic: Introduce power_init_board() method at ./lib/board.c file
  pmic: Enable power_board_init() support at TRATS
  pmic:chrg: Common information about charger and battery
(power_chrg.h)
  pmic: Move pmic related code to ./drivers/power directory
  pmic: Extend struct pmic to support battery and charger related
operations
  pmic:battery: Support for Trats Battery at PMIC framework
  pmic:muic: Support for MUIC built into MAX8997 device
  pmic:fuel-gauge: Support for MAX17042 fuel-gauge
  pmic:max8997: Function for calculating LDO internal register value
  arm:trats:pmic: Default PMIC(MAX8997) initialization for Samsung's
TRATS board
  arm:trats:pmic: Enable MUIC (MAX8997) at Samsung's TRATS board
  arm:trats:pmic: Enable fuel-gauge (MAX17042) at Samsung's TRATS board
  arm:trats:pmic: Enable battery support at Samsung's TRATS board
  pmic:max8997: Support for MAX8997 internal charger control
  arm:trats:pmic: Power consumption reduction state for Samsung's TRATS
board
  arm:trats:pmic: Support for charging battery at Samsung's TRATS board
  pmic: Extend PMIC framework to support battery related commands
  power:pmic: Rename ./drivers/power/pmic_* to ./drivers/power/power_*
files
  power:pmic: Rename CONFIG_PMIC* defines to CONFIG_POWER
  power:pmic: Rename CONFIG_DIALOG_PMIC defines to CONFIG_DIALOG_POWER

 Makefile   |5 +-
 arch/arm/lib/board.c   |8 +
 board/davedenx/qong/qong.c |6 +-
 board/freescale/mx31pdk/mx31pdk.c  |6 +-
 board/freescale/mx35pdk/mx35pdk.c  |8 +-
 board/freescale/mx51evk/mx51evk.c  |6 +-
 board/freescale/mx53evk/mx53evk.c  |6 +-
 board/freescale/mx53loco/mx53loco.c|   10 +-
 board/hale/tt01/tt01.c |6 +-
 board/samsung/goni/goni.c  |   11 +-
 board/samsung/trats/trats.c|  247 +++-
 board/samsung/universal_c210/universal.c   |   12 +-
 board/ttcontrol/vision2/vision2.c  |6 +-
 drivers/misc/Makefile  |7 -
 drivers/misc/pmic_core.c   |  147 
 drivers/misc/pmic_i2c.c|   98 
 drivers/misc/pmic_max8997.c|   43 
 drivers/power/Makefile |   12 +-
 drivers/power/battery/Makefile |   47 
 drivers/power/battery/bat_trats.c  |   94 
 drivers/power/fuel_gauge/Makefile  |   47 
 drivers/power/fuel_gauge/fg_max17042.c |  

[U-Boot] [PATCH v4 01/24] pmic:i2c: Handle PMIC I2C transmission comprising of two bytes

2012-10-30 Thread Lukasz Majewski
This patch adds support for proper handling of a PMIC I2C transmission
comprising of two bytes.

Signed-off-by: Lukasz Majewski l.majew...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
Cc: Stefano Babic sba...@denx.de
---
Changes for v2:
- None
Changes for v3:
- None
Changes for v4:
- None
---
 drivers/misc/pmic_i2c.c |9 -
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/drivers/misc/pmic_i2c.c b/drivers/misc/pmic_i2c.c
index 95a3365..e74c372 100644
--- a/drivers/misc/pmic_i2c.c
+++ b/drivers/misc/pmic_i2c.c
@@ -44,6 +44,10 @@ int pmic_reg_write(struct pmic *p, u32 reg, u32 val)
buf[1] = (val  8)  0xff;
buf[2] = val  0xff;
break;
+   case 2:
+   buf[0] = (val  8)  0xff;
+   buf[1] = val  0xff;
+   break;
case 1:
buf[0] = val  0xff;
break;
@@ -73,6 +77,9 @@ int pmic_reg_read(struct pmic *p, u32 reg, u32 *val)
case 3:
ret_val = buf[0]  16 | buf[1]  8 | buf[2];
break;
+   case 2:
+   ret_val = buf[0]  8 | buf[1];
+   break;
case 1:
ret_val = buf[0];
break;
@@ -88,7 +95,7 @@ int pmic_reg_read(struct pmic *p, u32 reg, u32 *val)
 int pmic_probe(struct pmic *p)
 {
I2C_SET_BUS(p-bus);
-   debug(PMIC:%s probed!\n, p-name);
+   debug(Bus: %d PMIC:%s probed!\n, p-bus, p-name);
if (i2c_probe(pmic_i2c_addr)) {
printf(Can't find PMIC:%s\n, p-name);
return -1;
-- 
1.7.2.3

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v4 03/24] pmic:max8997: Switch the MAX8997 PMIC to be used with multibus I2C

2012-10-30 Thread Lukasz Majewski
PMIC MAX8997 is now ready to work with single and multibus soft I2C
implementation.

Signed-off-by: Lukasz Majewski l.majew...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
Changes for v2:
- None
Changes for v3:
- None
Changes for v4:
- None
---
 drivers/misc/pmic_max8997.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/misc/pmic_max8997.c b/drivers/misc/pmic_max8997.c
index 62dbc05..4943f66 100644
--- a/drivers/misc/pmic_max8997.c
+++ b/drivers/misc/pmic_max8997.c
@@ -24,6 +24,7 @@
 #include common.h
 #include pmic.h
 #include max8997_pmic.h
+#include i2c.h
 
 int pmic_init(void)
 {
@@ -37,7 +38,7 @@ int pmic_init(void)
p-number_of_regs = PMIC_NUM_OF_REGS;
p-hw.i2c.addr = MAX8997_I2C_ADDR;
p-hw.i2c.tx_num = 1;
-   p-bus = I2C_PMIC;
+   p-bus = I2C_0;
 
return 0;
 }
-- 
1.7.2.3

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v4 02/24] pmic:i2c: Add I2C sensor byte order (big/little) to PMIC framework

2012-10-30 Thread Lukasz Majewski
Since the pmic_reg_read is the u32 value, the order in which bytes
are placed to form u32 value is important.

Support for big and little sensor endianess is added.

Moreover calls to [leXX|beXX]_to_cpu have been added to support
little and big endian SoCs.

Signed-off-by: Lukasz Majewski l.majew...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
Changes for v2:
- Move byte_order variable to struct pmic

Changes for v3:
- New names for sensor endianess (more readable)
- Support for SoCs with different endianess

Changes for v4:
- None
---
 drivers/misc/pmic_i2c.c |   38 +-
 include/pmic.h  |2 ++
 2 files changed, 31 insertions(+), 9 deletions(-)

diff --git a/drivers/misc/pmic_i2c.c b/drivers/misc/pmic_i2c.c
index e74c372..1064bfe 100644
--- a/drivers/misc/pmic_i2c.c
+++ b/drivers/misc/pmic_i2c.c
@@ -30,6 +30,7 @@
 #include linux/types.h
 #include pmic.h
 #include i2c.h
+#include compiler.h
 
 int pmic_reg_write(struct pmic *p, u32 reg, u32 val)
 {
@@ -40,16 +41,27 @@ int pmic_reg_write(struct pmic *p, u32 reg, u32 val)
 
switch (pmic_i2c_tx_num) {
case 3:
-   buf[0] = (val  16)  0xff;
-   buf[1] = (val  8)  0xff;
-   buf[2] = val  0xff;
+   if (p-sensor_byte_order == PMIC_SENSOR_BYTE_ORDER_BIG) {
+   buf[2] = (cpu_to_le32(val)  16)  0xff;
+   buf[1] = (cpu_to_le32(val)  8)  0xff;
+   buf[0] = cpu_to_le32(val)  0xff;
+   } else {
+   buf[0] = (cpu_to_le32(val)  16)  0xff;
+   buf[1] = (cpu_to_le32(val)  8)  0xff;
+   buf[2] = cpu_to_le32(val)  0xff;
+   }
break;
case 2:
-   buf[0] = (val  8)  0xff;
-   buf[1] = val  0xff;
+   if (p-sensor_byte_order == PMIC_SENSOR_BYTE_ORDER_BIG) {
+   buf[1] = (cpu_to_le32(val)  8)  0xff;
+   buf[0] = cpu_to_le32(val)  0xff;
+   } else {
+   buf[0] = (cpu_to_le32(val)  8)  0xff;
+   buf[1] = cpu_to_le32(val)  0xff;
+   }
break;
case 1:
-   buf[0] = val  0xff;
+   buf[0] = cpu_to_le32(val)  0xff;
break;
default:
printf(%s: invalid tx_num: %d, __func__, pmic_i2c_tx_num);
@@ -75,13 +87,21 @@ int pmic_reg_read(struct pmic *p, u32 reg, u32 *val)
 
switch (pmic_i2c_tx_num) {
case 3:
-   ret_val = buf[0]  16 | buf[1]  8 | buf[2];
+   if (p-sensor_byte_order == PMIC_SENSOR_BYTE_ORDER_BIG)
+   ret_val = le32_to_cpu(buf[2]  16
+ | buf[1]  8 | buf[0]);
+   else
+   ret_val = le32_to_cpu(buf[0]  16 |
+ buf[1]  8 | buf[2]);
break;
case 2:
-   ret_val = buf[0]  8 | buf[1];
+   if (p-sensor_byte_order == PMIC_SENSOR_BYTE_ORDER_BIG)
+   ret_val = le32_to_cpu(buf[1]  8 | buf[0]);
+   else
+   ret_val = le32_to_cpu(buf[0]  8 | buf[1]);
break;
case 1:
-   ret_val = buf[0];
+   ret_val = le32_to_cpu(buf[0]);
break;
default:
printf(%s: invalid tx_num: %d, __func__, pmic_i2c_tx_num);
diff --git a/include/pmic.h b/include/pmic.h
index 6a05b40..1a2db05 100644
--- a/include/pmic.h
+++ b/include/pmic.h
@@ -27,6 +27,7 @@
 enum { PMIC_I2C, PMIC_SPI, };
 enum { I2C_PMIC, I2C_NUM, };
 enum { PMIC_READ, PMIC_WRITE, };
+enum { PMIC_SENSOR_BYTE_ORDER_LITTLE, PMIC_SENSOR_BYTE_ORDER_BIG, };
 
 struct p_i2c {
unsigned char addr;
@@ -47,6 +48,7 @@ struct pmic {
const char *name;
unsigned char bus;
unsigned char interface;
+   unsigned char sensor_byte_order;
unsigned char number_of_regs;
union hw {
struct p_i2c i2c;
-- 
1.7.2.3

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v4 04/24] pmic: Extend PMIC framework to support multiple instances of PMIC devices

2012-10-30 Thread Lukasz Majewski
The PMIC framework has been extended to support multiple instances of
the variety of devices responsible for power management.
This change allows supporting of e.g. fuel gauge, charger, MUIC (Micro USB
Interface Circuit).
Power related includes have been moved to ./include/power directory.
This is a first of a series of patches - in the future pmic will be
replaced with power.

Two important issues:
1. The PMIC needs to be initialized just after malloc is configured
2. It uses list to hold information about available PMIC devices

Signed-off-by: Lukasz Majewski l.majew...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
Cc: Stefano Babic sba...@denx.de
---
Changes for v2:
- None
Changes for v3:
- None
Changes for v4:
- None
---
 board/davedenx/qong/qong.c   |6 +-
 board/freescale/mx31pdk/mx31pdk.c|6 +-
 board/freescale/mx35pdk/mx35pdk.c|8 +-
 board/freescale/mx51evk/mx51evk.c|6 +-
 board/freescale/mx53evk/mx53evk.c|6 +-
 board/freescale/mx53loco/mx53loco.c  |   10 ++--
 board/hale/tt01/tt01.c   |6 +-
 board/samsung/goni/goni.c|9 ++-
 board/samsung/trats/trats.c  |   12 ++--
 board/samsung/universal_c210/universal.c |   10 ++--
 board/ttcontrol/vision2/vision2.c|6 +-
 drivers/misc/pmic_core.c |  108 ++
 drivers/misc/pmic_dialog.c   |8 +-
 drivers/misc/pmic_fsl.c  |8 +-
 drivers/misc/pmic_i2c.c  |6 +-
 drivers/misc/pmic_max8997.c  |   10 ++--
 drivers/misc/pmic_max8998.c  |   10 ++--
 drivers/misc/pmic_spi.c  |4 +-
 drivers/rtc/mc13xxx-rtc.c|6 +-
 include/{ = power}/max8997_pmic.h   |   15 -
 include/{ = power}/max8998_pmic.h   |0
 include/{ = power}/pmic.h   |   19 --
 22 files changed, 176 insertions(+), 103 deletions(-)
 rename include/{ = power}/max8997_pmic.h (92%)
 rename include/{ = power}/max8998_pmic.h (100%)
 rename include/{ = power}/pmic.h (84%)

diff --git a/board/davedenx/qong/qong.c b/board/davedenx/qong/qong.c
index c41f11d..e8c23f8 100644
--- a/board/davedenx/qong/qong.c
+++ b/board/davedenx/qong/qong.c
@@ -28,7 +28,7 @@
 #include asm/arch/sys_proto.h
 #include asm/io.h
 #include nand.h
-#include pmic.h
+#include power/pmic.h
 #include fsl_pmic.h
 #include asm/gpio.h
 #include qong_fpga.h
@@ -173,8 +173,8 @@ int board_late_init(void)
u32 val;
struct pmic *p;
 
-   pmic_init();
-   p = get_pmic();
+   pmic_init(I2C_PMIC);
+   p = pmic_get(FSL_PMIC);
 
/* Enable RTC battery */
pmic_reg_read(p, REG_POWER_CTL0, val);
diff --git a/board/freescale/mx31pdk/mx31pdk.c 
b/board/freescale/mx31pdk/mx31pdk.c
index 9f8bc53..24c0a1e 100644
--- a/board/freescale/mx31pdk/mx31pdk.c
+++ b/board/freescale/mx31pdk/mx31pdk.c
@@ -30,7 +30,7 @@
 #include asm/arch/imx-regs.h
 #include asm/arch/sys_proto.h
 #include watchdog.h
-#include pmic.h
+#include power/pmic.h
 #include fsl_pmic.h
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -84,8 +84,8 @@ int board_late_init(void)
u32 val;
struct pmic *p;
 
-   pmic_init();
-   p = get_pmic();
+   pmic_init(I2C_PMIC);
+   p = pmic_get(FSL_PMIC);
 
/* Enable RTC battery */
pmic_reg_read(p, REG_POWER_CTL0, val);
diff --git a/board/freescale/mx35pdk/mx35pdk.c 
b/board/freescale/mx35pdk/mx35pdk.c
index 7cb6b30..7b3970b 100644
--- a/board/freescale/mx35pdk/mx35pdk.c
+++ b/board/freescale/mx35pdk/mx35pdk.c
@@ -30,7 +30,7 @@
 #include asm/arch/mx35_pins.h
 #include asm/arch/iomux.h
 #include i2c.h
-#include pmic.h
+#include power/pmic.h
 #include fsl_pmic.h
 #include mmc.h
 #include fsl_esdhc.h
@@ -206,7 +206,7 @@ int board_init(void)
 static inline int pmic_detect(void)
 {
unsigned int id;
-   struct pmic *p = get_pmic();
+   struct pmic *p = pmic_get(FSL_PMIC);
 
pmic_reg_read(p, REG_IDENTIFICATION, id);
 
@@ -231,9 +231,9 @@ int board_late_init(void)
u32 pmic_val;
struct pmic *p;
 
-   pmic_init();
+   pmic_init(I2C_PMIC);
if (pmic_detect()) {
-   p = get_pmic();
+   p = pmic_get(FSL_PMIC);
mxc_request_iomux(MX35_PIN_WATCHDOG_RST, MUX_CONFIG_SION |
MUX_CONFIG_ALT1);
 
diff --git a/board/freescale/mx51evk/mx51evk.c 
b/board/freescale/mx51evk/mx51evk.c
index a94701c..57dc175 100644
--- a/board/freescale/mx51evk/mx51evk.c
+++ b/board/freescale/mx51evk/mx51evk.c
@@ -32,7 +32,7 @@
 #include i2c.h
 #include mmc.h
 #include fsl_esdhc.h
-#include pmic.h
+#include power/pmic.h
 #include fsl_pmic.h
 #include mc13892.h
 #include usb/ehci-fsl.h
@@ -252,8 +252,8 @@ static void power_init(void)
struct mxc_ccm_reg *mxc_ccm = (struct mxc_ccm_reg *)MXC_CCM_BASE;
struct pmic *p;
 
-   pmic_init();
-   p = get_pmic();
+   

[U-Boot] [PATCH v4 05/24] pmic: Introduce power_init_board() method at ./lib/board.c file

2012-10-30 Thread Lukasz Majewski
It is necessary to introduce a new system wide function- power_init_board()

It turns out, that power initialization must be done as early as possible.
In the case of PMIC framework redesign, which aims to support multiple
instances of PMIC devices the initialization shall be performed just
after malloc configuration.

The power_init_board function is a weak function with default implementation.

Signed-off-by: Lukasz Majewski l.majew...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
Changes for v2:
- None

Changes for v3:
- rename power_board_init to power_init_board
- power_init_board() defined as __weak function with default implementation
- CONFIG_POWER_INIT flag removed since it is not needed

Changes for v4:
- None
---
 arch/arm/lib/board.c |8 
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c
index 92cad9a..22a4d9c 100644
--- a/arch/arm/lib/board.c
+++ b/arch/arm/lib/board.c
@@ -224,6 +224,13 @@ int __arch_cpu_init(void)
 int arch_cpu_init(void)
__attribute__((weak, alias(__arch_cpu_init)));
 
+int __power_init_board(void)
+{
+   return 0;
+}
+int power_init_board(void)
+   __attribute__((weak, alias(__power_init_board)));
+
 init_fnc_t *init_sequence[] = {
arch_cpu_init,  /* basic arch cpu dependent setup */
 
@@ -525,6 +532,7 @@ void board_init_r(gd_t *id, ulong dest_addr)
 #ifdef CONFIG_ARCH_EARLY_INIT_R
arch_early_init_r();
 #endif
+   power_init_board();
 
 #if !defined(CONFIG_SYS_NO_FLASH)
puts(Flash: );
-- 
1.7.2.3

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v4 06/24] pmic: Enable power_board_init() support at TRATS

2012-10-30 Thread Lukasz Majewski
Enable support for power_board_init() method at TRATS board.

Signed-off-by: Lukasz Majewski l.majew...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
Changes for v2:
- None
Changes for v3:
- Remove CONFIG_POWER_INIT flag
Changes for v4:
- None
---
 board/samsung/trats/trats.c |   11 +++
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c
index 80ec4ad..de14f0d 100644
--- a/board/samsung/trats/trats.c
+++ b/board/samsung/trats/trats.c
@@ -68,10 +68,6 @@ int board_init(void)
check_hw_revision();
printf(HW Revision:\t0x%x\n, board_rev);
 
-#if defined(CONFIG_PMIC)
-   pmic_init(I2C_5);
-#endif
-
return 0;
 }
 
@@ -90,6 +86,13 @@ void i2c_init_board(void)
s5p_gpio_direction_output(gpio2-y4, 1, 1);
 }
 
+int power_init_board(void)
+{
+   pmic_init(I2C_5);
+
+   return 0;
+}
+
 int dram_init(void)
 {
gd-ram_size = get_ram_size((long *)PHYS_SDRAM_1, PHYS_SDRAM_1_SIZE) +
-- 
1.7.2.3

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v4 07/24] pmic:chrg: Common information about charger and battery (power_chrg.h)

2012-10-30 Thread Lukasz Majewski
New power_chrg.h file has been added to bind together common
information about charging battery available in the system.

Signed-off-by: Lukasz Majewski l.majew...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
Cc: Stefano Babic sba...@denx.de
---
Changes for v2:
- Move struct battery elements to a separate file
Changes for v3:
- None
Changes for v4:
- None
---
 include/power/power_chrg.h |   43 +++
 1 files changed, 43 insertions(+), 0 deletions(-)
 create mode 100644 include/power/power_chrg.h

diff --git a/include/power/power_chrg.h b/include/power/power_chrg.h
new file mode 100644
index 000..24c4cde
--- /dev/null
+++ b/include/power/power_chrg.h
@@ -0,0 +1,43 @@
+/*
+ *  Copyright (C) 2012 Samsung Electronics
+ *  Lukasz Majewski l.majew...@samsung.com
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __POWER_CHARGER_H_
+#define __POWER_CHARGER_H_
+
+/* Type of available chargers */
+enum {
+   CHARGER_NO = 0,
+   CHARGER_TA,
+   CHARGER_USB,
+   CHARGER_TA_500,
+   CHARGER_UNKNOWN,
+};
+
+enum {
+   UNKNOWN,
+   EXT_SOURCE,
+   CHARGE,
+   NORMAL,
+};
+
+#endif /* __POWER_CHARGER_H_ */
-- 
1.7.2.3

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v4 09/24] pmic: Extend struct pmic to support battery and charger related operations

2012-10-30 Thread Lukasz Majewski
Now it is possible to provide specific function per PMIC/power
device instance.

Signed-off-by: Lukasz Majewski l.majew...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
Changes for v2:
- New at patch v2

Changes for v3:
- separate power_{battery|chrg|fg} structures to provide battery ops
- struct pmic *parent pointer added

Changes for v4:
- None
---
 include/power/battery.h |   38 ++
 include/power/pmic.h|   30 +-
 2 files changed, 67 insertions(+), 1 deletions(-)
 create mode 100644 include/power/battery.h

diff --git a/include/power/battery.h b/include/power/battery.h
new file mode 100644
index 000..e2fec68
--- /dev/null
+++ b/include/power/battery.h
@@ -0,0 +1,38 @@
+/*
+ *  Copyright (C) 2012 Samsung Electronics
+ *  Lukasz Majewski l.majew...@samsung.com
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __POWER_BATTERY_H_
+#define __POWER_BATTERY_H_
+
+struct battery {
+   unsigned int version;
+   unsigned int state_of_chrg;
+   unsigned int time_to_empty;
+   unsigned int capacity;
+   unsigned int voltage_uV;
+
+   unsigned int state;
+};
+
+int power_bat_init(unsigned char bus);
+#endif /* __POWER_BATTERY_H_ */
diff --git a/include/power/pmic.h b/include/power/pmic.h
index e9affc8..1ecfc05 100644
--- a/include/power/pmic.h
+++ b/include/power/pmic.h
@@ -27,8 +27,9 @@
 #include common.h
 #include linux/list.h
 #include i2c.h
+#include power/power_chrg.h
 
-enum { PMIC_I2C, PMIC_SPI, };
+enum { PMIC_I2C, PMIC_SPI, PMIC_NONE};
 enum { I2C_PMIC, I2C_NUM, };
 enum { PMIC_READ, PMIC_WRITE, };
 enum { PMIC_SENSOR_BYTE_ORDER_LITTLE, PMIC_SENSOR_BYTE_ORDER_BIG, };
@@ -48,6 +49,27 @@ struct p_spi {
u32 (*prepare_tx)(u32 reg, u32 *val, u32 write);
 };
 
+struct pmic;
+struct power_fg {
+   int (*fg_battery_check) (struct pmic *p, struct pmic *bat);
+   int (*fg_battery_update) (struct pmic *p, struct pmic *bat);
+};
+
+struct power_chrg {
+   int (*chrg_type) (struct pmic *p);
+   int (*chrg_bat_present) (struct pmic *p);
+   int (*chrg_state) (struct pmic *p, int state, int current);
+};
+
+struct power_battery {
+   struct battery *bat;
+   int (*battery_init) (struct pmic *bat, struct pmic *p1,
+struct pmic *p2, struct pmic *p3);
+   int (*battery_charge) (struct pmic *bat);
+   /* Keep info about power devices involved with battery operation */
+   struct pmic *chrg, *fg, *muic;
+};
+
 struct pmic {
const char *name;
unsigned char bus;
@@ -59,6 +81,12 @@ struct pmic {
struct p_spi spi;
} hw;
 
+   void (*low_power_mode) (void);
+   struct power_battery *pbat;
+   struct power_chrg *chrg;
+   struct power_fg *fg;
+
+   struct pmic *parent;
struct list_head list;
 };
 
-- 
1.7.2.3

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v4 10/24] pmic:battery: Support for Trats Battery at PMIC framework

2012-10-30 Thread Lukasz Majewski
Trats battery is now treated in the same way as other power related
devices. This approach allows for more unified handling of all devices
responsible for power management.

Signed-off-by: Lukasz Majewski l.majew...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
Cc: Stefano Babic sba...@denx.de
---
Changes for v2:
- New patch at v2.

Changes for v3:
- only battery dependent battery_init method added
- change code according to struct pmic redesign

Changes for v4:
- Adding ./power/battery/Makefile
- Introduce the libbattery.o at Makefile
- Change the state of charge value from 5 to 100
---
 Makefile  |3 +-
 drivers/power/battery/Makefile|   47 ++
 drivers/power/battery/bat_trats.c |   94 +
 3 files changed, 143 insertions(+), 1 deletions(-)
 create mode 100644 drivers/power/battery/Makefile
 create mode 100644 drivers/power/battery/bat_trats.c

diff --git a/Makefile b/Makefile
index f53f6ad..b48f724 100644
--- a/Makefile
+++ b/Makefile
@@ -293,7 +293,8 @@ LIBS-y += drivers/net/phy/libphy.o
 LIBS-y += drivers/pci/libpci.o
 LIBS-y += drivers/pcmcia/libpcmcia.o
 LIBS-y += drivers/power/libpower.o \
-   drivers/power/pmic/libpmic.o
+   drivers/power/pmic/libpmic.o \
+   drivers/power/battery/libbattery.o
 LIBS-y += drivers/spi/libspi.o
 LIBS-y += drivers/dfu/libdfu.o
 ifeq ($(CPU),mpc83xx)
diff --git a/drivers/power/battery/Makefile b/drivers/power/battery/Makefile
new file mode 100644
index 000..b176701
--- /dev/null
+++ b/drivers/power/battery/Makefile
@@ -0,0 +1,47 @@
+#
+# Copyright (C) 2012 Samsung Electronics
+# Lukasz Majewski l.majew...@samsung.com
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB:= $(obj)libbattery.o
+
+COBJS-$(CONFIG_POWER_BATTERY_TRATS) += bat_trats.o
+
+COBJS  := $(COBJS-y)
+SRCS   := $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+
+all:   $(LIB)
+
+$(LIB):$(obj).depend $(OBJS)
+   $(call cmd_link_o_target, $(OBJS))
+
+
+#
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+
diff --git a/drivers/power/battery/bat_trats.c 
b/drivers/power/battery/bat_trats.c
new file mode 100644
index 000..3cdf9b5
--- /dev/null
+++ b/drivers/power/battery/bat_trats.c
@@ -0,0 +1,94 @@
+/*
+ *  Copyright (C) 2012 Samsung Electronics
+ *  Lukasz Majewski l.majew...@samsung.com
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include common.h
+#include power/pmic.h
+#include power/battery.h
+#include power/max8997_pmic.h
+
+static struct battery battery_trats;
+
+static int power_battery_charge(struct pmic *bat)
+{
+   struct power_battery *p_bat = bat-pbat;
+   struct battery *battery = p_bat-bat;
+   int k;
+
+   if (bat-chrg-chrg_state(p_bat-chrg, CHARGER_ENABLE, 450))
+   return -1;
+
+   for (k = 0; bat-chrg-chrg_bat_present(p_bat-chrg) 
+bat-chrg-chrg_type(p_bat-muic) 
+battery-state_of_chrg  100; k++) {
+   udelay(1000);
+   puts(.);
+   bat-fg-fg_battery_update(p_bat-fg, bat);
+
+   if (k == 100) {
+   debug( %d [V], battery-voltage_uV);
+   puts(\n);
+   k = 0;

[U-Boot] [PATCH v4 08/24] pmic: Move pmic related code to ./drivers/power directory

2012-10-30 Thread Lukasz Majewski
The PMIC framework has been moved to its more natural place
./drivers/power from ./drivers/misc directory.

Signed-off-by: Lukasz Majewski l.majew...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
Changes for v2:
- New patch for v2
Changes for v3:
- None
Changes for v4:
- Move PMIC related code (max8997.c and max8998.c) to power/pmic
- Define ./power/pmic/libpmic.o library
---
 Makefile|3 +-
 drivers/misc/Makefile   |7 
 drivers/power/Makefile  |   12 +--
 drivers/power/pmic/Makefile |   48 +++
 drivers/{misc = power/pmic}/pmic_max8997.c |0
 drivers/{misc = power/pmic}/pmic_max8998.c |0
 drivers/{misc = power}/pmic_core.c |0
 drivers/{misc = power}/pmic_dialog.c   |0
 drivers/{misc = power}/pmic_fsl.c  |0
 drivers/{misc = power}/pmic_i2c.c  |0
 drivers/{misc = power}/pmic_spi.c  |0
 11 files changed, 59 insertions(+), 11 deletions(-)
 create mode 100644 drivers/power/pmic/Makefile
 rename drivers/{misc = power/pmic}/pmic_max8997.c (100%)
 rename drivers/{misc = power/pmic}/pmic_max8998.c (100%)
 rename drivers/{misc = power}/pmic_core.c (100%)
 rename drivers/{misc = power}/pmic_dialog.c (100%)
 rename drivers/{misc = power}/pmic_fsl.c (100%)
 rename drivers/{misc = power}/pmic_i2c.c (100%)
 rename drivers/{misc = power}/pmic_spi.c (100%)

diff --git a/Makefile b/Makefile
index d385467..f53f6ad 100644
--- a/Makefile
+++ b/Makefile
@@ -292,7 +292,8 @@ LIBS-y += drivers/net/libnet.o
 LIBS-y += drivers/net/phy/libphy.o
 LIBS-y += drivers/pci/libpci.o
 LIBS-y += drivers/pcmcia/libpcmcia.o
-LIBS-y += drivers/power/libpower.o
+LIBS-y += drivers/power/libpower.o \
+   drivers/power/pmic/libpmic.o
 LIBS-y += drivers/spi/libspi.o
 LIBS-y += drivers/dfu/libdfu.o
 ifeq ($(CPU),mpc83xx)
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index 271463c..cdec88b 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -34,13 +34,6 @@ COBJS-$(CONFIG_NS87308) += ns87308.o
 COBJS-$(CONFIG_PDSP188x) += pdsp188x.o
 COBJS-$(CONFIG_STATUS_LED) += status_led.o
 COBJS-$(CONFIG_TWL4030_LED) += twl4030_led.o
-COBJS-$(CONFIG_PMIC) += pmic_core.o
-COBJS-$(CONFIG_DIALOG_PMIC) += pmic_dialog.o
-COBJS-$(CONFIG_PMIC_FSL) += pmic_fsl.o
-COBJS-$(CONFIG_PMIC_I2C) += pmic_i2c.o
-COBJS-$(CONFIG_PMIC_SPI) += pmic_spi.o
-COBJS-$(CONFIG_PMIC_MAX8998) += pmic_max8998.o
-COBJS-$(CONFIG_PMIC_MAX8997) += pmic_max8997.o
 
 COBJS  := $(COBJS-y)
 SRCS   := $(COBJS:.o=.c)
diff --git a/drivers/power/Makefile b/drivers/power/Makefile
index 6bf388c..7fc5554 100644
--- a/drivers/power/Makefile
+++ b/drivers/power/Makefile
@@ -23,7 +23,7 @@
 
 include $(TOPDIR)/config.mk
 
-LIB:= $(obj)libpower.o
+LIB:= $(obj)libpower.o
 
 COBJS-$(CONFIG_FTPMU010_POWER) += ftpmu010.o
 COBJS-$(CONFIG_TPS6586X_POWER) += tps6586x.o
@@ -31,9 +31,15 @@ COBJS-$(CONFIG_TWL4030_POWER)+= twl4030.o
 COBJS-$(CONFIG_TWL6030_POWER)  += twl6030.o
 COBJS-$(CONFIG_TWL6035_POWER)  += twl6035.o
 
+COBJS-$(CONFIG_PMIC) += pmic_core.o
+COBJS-$(CONFIG_DIALOG_PMIC) += pmic_dialog.o
+COBJS-$(CONFIG_PMIC_FSL) += pmic_fsl.o
+COBJS-$(CONFIG_PMIC_I2C) += pmic_i2c.o
+COBJS-$(CONFIG_PMIC_SPI) += pmic_spi.o
+
 COBJS  := $(COBJS-y)
-SRCS   := $(COBJS:.o=.c)
-OBJS   := $(addprefix $(obj),$(COBJS))
+SRCS   := $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
 
 all:   $(LIB)
 
diff --git a/drivers/power/pmic/Makefile b/drivers/power/pmic/Makefile
new file mode 100644
index 000..8ccd6e9
--- /dev/null
+++ b/drivers/power/pmic/Makefile
@@ -0,0 +1,48 @@
+#
+# Copyright (C) 2012 Samsung Electronics
+# Lukasz Majewski l.majew...@samsung.com
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB:= $(obj)libpmic.o
+
+COBJS-$(CONFIG_PMIC_MAX8998) += pmic_max8998.o
+COBJS-$(CONFIG_PMIC_MAX8997) += pmic_max8997.o
+
+COBJS  := $(COBJS-y)
+SRCS   := $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+
+all:   $(LIB)
+
+$(LIB):$(obj).depend $(OBJS)
+   $(call cmd_link_o_target, $(OBJS))
+
+
+#
+
+# 

[U-Boot] [PATCH v4 11/24] pmic:muic: Support for MUIC built into MAX8997 device

2012-10-30 Thread Lukasz Majewski
Support for MUIC (Micro USB Integrated Circuit) built into the MAX8997
power management device.

The MUIC device will work with redesigned PMIC framework.

Signed-off-by: Lukasz Majewski l.majew...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
Cc: Stefano Babic sba...@denx.de

---
Changes for v2:
- power_init_battery now available as a callback from MUIC struct pmic
  instance
Changes for v3:
- change code according to struct pmic redesign
Changes for v4:
- Move muic code to ./drivers/power/pmic directory
---
 drivers/power/pmic/Makefile   |1 +
 drivers/power/pmic/muic_max8997.c |   84 +
 include/power/max8997_muic.h  |   61 +++
 3 files changed, 146 insertions(+), 0 deletions(-)
 create mode 100644 drivers/power/pmic/muic_max8997.c
 create mode 100644 include/power/max8997_muic.h

diff --git a/drivers/power/pmic/Makefile b/drivers/power/pmic/Makefile
index 8ccd6e9..9b71e55 100644
--- a/drivers/power/pmic/Makefile
+++ b/drivers/power/pmic/Makefile
@@ -27,6 +27,7 @@ LIB   := $(obj)libpmic.o
 
 COBJS-$(CONFIG_PMIC_MAX8998) += pmic_max8998.o
 COBJS-$(CONFIG_PMIC_MAX8997) += pmic_max8997.o
+COBJS-$(CONFIG_POWER_MUIC_MAX8997) += muic_max8997.o
 
 COBJS  := $(COBJS-y)
 SRCS   := $(COBJS:.o=.c)
diff --git a/drivers/power/pmic/muic_max8997.c 
b/drivers/power/pmic/muic_max8997.c
new file mode 100644
index 000..a1a9634
--- /dev/null
+++ b/drivers/power/pmic/muic_max8997.c
@@ -0,0 +1,84 @@
+/*
+ *  Copyright (C) 2012 Samsung Electronics
+ *  Lukasz Majewski l.majew...@samsung.com
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include common.h
+#include power/pmic.h
+#include power/power_chrg.h
+#include power/max8997_muic.h
+#include i2c.h
+
+static int power_chrg_get_type(struct pmic *p)
+{
+   unsigned int val;
+   unsigned char charge_type, charger;
+
+   if (pmic_probe(p))
+   return CHARGER_NO;
+
+   pmic_reg_read(p, MAX8997_MUIC_STATUS2, val);
+   charge_type = val  MAX8997_MUIC_CHG_MASK;
+
+   switch (charge_type) {
+   case MAX8997_MUIC_CHG_NO:
+   charger = CHARGER_NO;
+   break;
+   case MAX8997_MUIC_CHG_USB:
+   case MAX8997_MUIC_CHG_USB_D:
+   charger = CHARGER_USB;
+   break;
+   case MAX8997_MUIC_CHG_TA:
+   case MAX8997_MUIC_CHG_TA_1A:
+   charger = CHARGER_TA;
+   break;
+   case MAX8997_MUIC_CHG_TA_500:
+   charger = CHARGER_TA_500;
+   break;
+   default:
+   charger = CHARGER_UNKNOWN;
+   break;
+   }
+
+   return charger;
+}
+
+static struct power_chrg power_chrg_muic_ops = {
+   .chrg_type = power_chrg_get_type,
+};
+
+int power_muic_init(unsigned int bus)
+{
+   struct pmic *p = pmic_alloc();
+   static const char name[] = MAX8997_MUIC;
+
+   debug(Board Micro USB Interface Controller init\n);
+
+   p-name = name;
+   p-interface = PMIC_I2C;
+   p-number_of_regs = MUIC_NUM_OF_REGS;
+   p-hw.i2c.addr = MAX8997_MUIC_I2C_ADDR;
+   p-hw.i2c.tx_num = 1;
+   p-bus = bus;
+
+   p-chrg = power_chrg_muic_ops;
+   return 0;
+}
diff --git a/include/power/max8997_muic.h b/include/power/max8997_muic.h
new file mode 100644
index 000..0149c12
--- /dev/null
+++ b/include/power/max8997_muic.h
@@ -0,0 +1,61 @@
+/*
+ *  Copyright (C) 2012 Samsung Electronics
+ *  Lukasz Majewski l.majew...@samsung.com
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software

[U-Boot] [PATCH v4 12/24] pmic:fuel-gauge: Support for MAX17042 fuel-gauge

2012-10-30 Thread Lukasz Majewski
Support for MAX17042 fuel-gauge (FG), which is built into the MAX8997
power management device.
Special file - fg_battery_cell_params.h with cells characteristics
added.

The FG device will work with redesigned PMIC framework.

Signed-off-by: Lukasz Majewski l.majew...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
Cc: Stefano Babic sba...@denx.de

---
Changes for v2:
- File moved to separate directory at ./drivers/power
- {check|update}_battery available as callbacks from struct power_battery
Changes for v3:
- change code according to struct pmic redesign
Changes for v4:
- Introduce libfuel_gauge.o at ./Makefile
- Move fg_max17042.c file to ./drivers/power/fuel_gauge directory
---
 Makefile   |1 +
 drivers/power/fuel_gauge/Makefile  |   47 ++
 drivers/power/fuel_gauge/fg_max17042.c |  244 
 include/power/fg_battery_cell_params.h |   90 
 include/power/max17042_fg.h|   74 ++
 5 files changed, 456 insertions(+), 0 deletions(-)
 create mode 100644 drivers/power/fuel_gauge/Makefile
 create mode 100644 drivers/power/fuel_gauge/fg_max17042.c
 create mode 100644 include/power/fg_battery_cell_params.h
 create mode 100644 include/power/max17042_fg.h

diff --git a/Makefile b/Makefile
index b48f724..4170d5e 100644
--- a/Makefile
+++ b/Makefile
@@ -293,6 +293,7 @@ LIBS-y += drivers/net/phy/libphy.o
 LIBS-y += drivers/pci/libpci.o
 LIBS-y += drivers/pcmcia/libpcmcia.o
 LIBS-y += drivers/power/libpower.o \
+   drivers/power/fuel_gauge/libfuel_gauge.o \
drivers/power/pmic/libpmic.o \
drivers/power/battery/libbattery.o
 LIBS-y += drivers/spi/libspi.o
diff --git a/drivers/power/fuel_gauge/Makefile 
b/drivers/power/fuel_gauge/Makefile
new file mode 100644
index 000..da15414
--- /dev/null
+++ b/drivers/power/fuel_gauge/Makefile
@@ -0,0 +1,47 @@
+#
+# Copyright (C) 2012 Samsung Electronics
+# Lukasz Majewski l.majew...@samsung.com
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB:= $(obj)libfuel_gauge.o
+
+COBJS-$(CONFIG_POWER_FG_MAX17042) += fg_max17042.o
+
+COBJS  := $(COBJS-y)
+SRCS   := $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+
+all:   $(LIB)
+
+$(LIB):$(obj).depend $(OBJS)
+   $(call cmd_link_o_target, $(OBJS))
+
+
+#
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+
diff --git a/drivers/power/fuel_gauge/fg_max17042.c 
b/drivers/power/fuel_gauge/fg_max17042.c
new file mode 100644
index 000..7366e9d
--- /dev/null
+++ b/drivers/power/fuel_gauge/fg_max17042.c
@@ -0,0 +1,244 @@
+/*
+ *  Copyright (C) 2012 Samsung Electronics
+ *  Lukasz Majewski l.majew...@samsung.com
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include common.h
+#include power/pmic.h
+#include power/max17042_fg.h
+#include i2c.h
+#include power/max8997_pmic.h
+#include power/power_chrg.h
+#include power/battery.h
+#include power/fg_battery_cell_params.h
+
+static int fg_write_regs(struct pmic *p, u8 addr, u16 *data, int num)
+{
+   int ret = 0;
+   int i;
+
+   for (i = 0; i  num; i++, addr++)
+   ret |= pmic_reg_write(p, addr, *(data + i));
+
+   return ret;
+}
+
+static int fg_read_regs(struct pmic *p, u8 addr, u16 *data, int num)
+{

[U-Boot] [PATCH v4 13/24] pmic:max8997: Function for calculating LDO internal register value

2012-10-30 Thread Lukasz Majewski
Function for calculating LDO internal register value from passed micro
Volt.

Signed-off-by: Lukasz Majewski l.majew...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
Cc: Stefano Babic sba...@denx.de
---
Changes for v2:
- MAX8997_LDO_MAX_VAL defined
Changes for v3:
- None
Changes for v4:
- None
---
 drivers/power/pmic/pmic_max8997.c |   16 
 include/power/max8997_pmic.h  |2 ++
 2 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/drivers/power/pmic/pmic_max8997.c 
b/drivers/power/pmic/pmic_max8997.c
index 4e8283a..47ef7f6 100644
--- a/drivers/power/pmic/pmic_max8997.c
+++ b/drivers/power/pmic/pmic_max8997.c
@@ -26,6 +26,22 @@
 #include power/max8997_pmic.h
 #include i2c.h
 
+unsigned char max8997_reg_ldo(int uV)
+{
+   unsigned char ret;
+   if (uV = 80)
+   return 0;
+   if (uV = 395)
+   return MAX8997_LDO_MAX_VAL;
+   ret = (uV - 80) / 5;
+   if (ret  MAX8997_LDO_MAX_VAL) {
+   printf(MAX8997 LDO SETTING ERROR (%duV) - %u\n, uV, ret);
+   ret = MAX8997_LDO_MAX_VAL;
+   }
+
+   return ret;
+}
+
 int pmic_init(unsigned char bus)
 {
struct pmic *p = pmic_alloc();
diff --git a/include/power/max8997_pmic.h b/include/power/max8997_pmic.h
index 1db7deb..03cac04 100644
--- a/include/power/max8997_pmic.h
+++ b/include/power/max8997_pmic.h
@@ -200,4 +200,6 @@ enum {
EN_LDO = (0x3  6),
 };
 
+#define MAX8997_LDO_MAX_VAL 0x3F
+unsigned char max8997_reg_ldo(int uV);
 #endif /* __MAX8997_PMIC_H_ */
-- 
1.7.2.3

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v4 14/24] arm:trats:pmic: Default PMIC(MAX8997) initialization for Samsung's TRATS board

2012-10-30 Thread Lukasz Majewski
Default PMIC (MAX8997) initialization for Samsung's TRATS development board.

Signed-off-by: Lukasz Majewski l.majew...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
Cc: Minkyu Kang mk7.k...@samsung.com

---
Changes for v2:
- None
Changes for v3:
- None
Changes for v4:
- None
---
 board/samsung/trats/trats.c  |  150 ++
 include/power/max8997_pmic.h |9 +++
 2 files changed, 159 insertions(+), 0 deletions(-)

diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c
index de14f0d..7b6f6dc 100644
--- a/board/samsung/trats/trats.c
+++ b/board/samsung/trats/trats.c
@@ -86,10 +86,160 @@ void i2c_init_board(void)
s5p_gpio_direction_output(gpio2-y4, 1, 1);
 }
 
+static int pmic_init_max8997(void)
+{
+   struct pmic *p = pmic_get(MAX8997_PMIC);
+   int i = 0, ret = 0;
+   u32 val;
+
+   if (pmic_probe(p))
+   return -1;
+
+   /* BUCK1 VARM: 1.2V */
+   val = (120 - 65) / 25000;
+   ret |= pmic_reg_write(p, MAX8997_REG_BUCK1DVS1, val);
+   val = ENBUCK | ACTIVE_DISCHARGE;/* DVS OFF */
+   ret |= pmic_reg_write(p, MAX8997_REG_BUCK1CTRL, val);
+
+   /* BUCK2 VINT: 1.1V */
+   val = (110 - 65) / 25000;
+   ret |= pmic_reg_write(p, MAX8997_REG_BUCK2DVS1, val);
+   val = ENBUCK | ACTIVE_DISCHARGE;/* DVS OFF */
+   ret |= pmic_reg_write(p, MAX8997_REG_BUCK2CTRL, val);
+
+
+   /* BUCK3 G3D: 1.1V - OFF */
+   ret |= pmic_reg_read(p, MAX8997_REG_BUCK3CTRL, val);
+   val = ~ENBUCK;
+   ret |= pmic_reg_write(p, MAX8997_REG_BUCK3CTRL, val);
+
+   val = (110 - 75) / 5;
+   ret |= pmic_reg_write(p, MAX8997_REG_BUCK3DVS, val);
+
+   /* BUCK4 CAMISP: 1.2V - OFF */
+   ret |= pmic_reg_read(p, MAX8997_REG_BUCK4CTRL, val);
+   val = ~ENBUCK;
+   ret |= pmic_reg_write(p, MAX8997_REG_BUCK4CTRL, val);
+
+   val = (120 - 65) / 25000;
+   ret |= pmic_reg_write(p, MAX8997_REG_BUCK4DVS, val);
+
+   /* BUCK5 VMEM: 1.2V */
+   val = (120 - 65) / 25000;
+   for (i = 0; i  8; i++)
+   ret |= pmic_reg_write(p, MAX8997_REG_BUCK5DVS1 + i, val);
+
+   val = ENBUCK | ACTIVE_DISCHARGE;/* DVS OFF */
+   ret |= pmic_reg_write(p, MAX8997_REG_BUCK5CTRL, val);
+
+   /* BUCK6 CAM AF: 2.8V */
+   /* No Voltage Setting Register */
+   /* GNSLCT 3.0X */
+   val = GNSLCT;
+   ret |= pmic_reg_write(p, MAX8997_REG_BUCK6CTRL, val);
+
+   /* BUCK7 VCC_SUB: 2.0V */
+   val = (200 - 75) / 5;
+   ret |= pmic_reg_write(p, MAX8997_REG_BUCK7DVS, val);
+
+   /* LDO1 VADC: 3.3V */
+   val = max8997_reg_ldo(330) | DIS_LDO;   /* OFF */
+   ret |= pmic_reg_write(p, MAX8997_REG_LDO1CTRL, val);
+
+   /* LDO1 Disable active discharging */
+   ret |= pmic_reg_read(p, MAX8997_REG_LDO1CONFIG, val);
+   val = ~LDO_ADE;
+   ret |= pmic_reg_write(p, MAX8997_REG_LDO1CONFIG, val);
+
+   /* LDO2 VALIVE: 1.1V */
+   val = max8997_reg_ldo(110) | EN_LDO;
+   ret |= pmic_reg_write(p, MAX8997_REG_LDO2CTRL, val);
+
+   /* LDO3 VUSB/MIPI: 1.1V */
+   val = max8997_reg_ldo(110) | DIS_LDO;   /* OFF */
+   ret |= pmic_reg_write(p, MAX8997_REG_LDO3CTRL, val);
+
+   /* LDO4 VMIPI: 1.8V */
+   val = max8997_reg_ldo(180) | DIS_LDO;   /* OFF */
+   ret |= pmic_reg_write(p, MAX8997_REG_LDO4CTRL, val);
+
+   /* LDO5 VHSIC: 1.2V */
+   val = max8997_reg_ldo(120) | DIS_LDO;   /* OFF */
+   ret |= pmic_reg_write(p, MAX8997_REG_LDO5CTRL, val);
+
+   /* LDO6 VCC_1.8V_PDA: 1.8V */
+   val = max8997_reg_ldo(180) | EN_LDO;
+   ret |= pmic_reg_write(p, MAX8997_REG_LDO6CTRL, val);
+
+   /* LDO7 CAM_ISP: 1.8V */
+   val = max8997_reg_ldo(180) | DIS_LDO;   /* OFF */
+   ret |= pmic_reg_write(p, MAX8997_REG_LDO7CTRL, val);
+
+   /* LDO8 VDAC/VUSB: 3.3V */
+   val = max8997_reg_ldo(330) | DIS_LDO;   /* OFF */
+   ret |= pmic_reg_write(p, MAX8997_REG_LDO8CTRL, val);
+
+   /* LDO9 VCC_2.8V_PDA: 2.8V */
+   val = max8997_reg_ldo(280) | EN_LDO;
+   ret |= pmic_reg_write(p, MAX8997_REG_LDO9CTRL, val);
+
+   /* LDO10 VPLL: 1.1V */
+   val = max8997_reg_ldo(110) | EN_LDO;
+   ret |= pmic_reg_write(p, MAX8997_REG_LDO10CTRL, val);
+
+   /* LDO11 TOUCH: 2.8V */
+   val = max8997_reg_ldo(280) | DIS_LDO;   /* OFF */
+   ret |= pmic_reg_write(p, MAX8997_REG_LDO11CTRL, val);
+
+   /* LDO12 VTCAM: 1.8V */
+   val = max8997_reg_ldo(180) | DIS_LDO;   /* OFF */
+   ret |= pmic_reg_write(p, MAX8997_REG_LDO12CTRL, val);
+
+   /* LDO13 VCC_3.0_LCD: 3.0V */
+   val = max8997_reg_ldo(300) | DIS_LDO;   /* OFF */
+   ret |= pmic_reg_write(p, MAX8997_REG_LDO13CTRL, val);
+
+   /* LDO14 MOTOR: 3.0V */
+   val = 

[U-Boot] [PATCH v4 16/24] arm:trats:pmic: Enable fuel-gauge (MAX17042) at Samsung's TRATS board

2012-10-30 Thread Lukasz Majewski
FG IC built into the MAX8997 device (compliant to MAX17042) is enabled
at TRATS.

Signed-off-by: Lukasz Majewski l.majew...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
Cc: Minkyu Kang mk7.k...@samsung.com
---
Changes for v2:
- None
Changes for v3:
- None
Changes for v4:
- None
---
 board/samsung/trats/trats.c |2 ++
 include/configs/trats.h |2 ++
 2 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c
index ed44def..c0a7b90 100644
--- a/board/samsung/trats/trats.c
+++ b/board/samsung/trats/trats.c
@@ -39,6 +39,7 @@
 #include power/max8997_pmic.h
 #include libtizen.h
 #include power/max8997_muic.h
+#include power/max17042_fg.h
 
 #include setup.h
 
@@ -241,6 +242,7 @@ int power_init_board(void)
pmic_init(I2C_5);
 
pmic_init_max8997();
+   power_fg_init(I2C_9);
power_muic_init(I2C_5);
return 0;
 }
diff --git a/include/configs/trats.h b/include/configs/trats.h
index 74c4a23..0bc1f3a 100644
--- a/include/configs/trats.h
+++ b/include/configs/trats.h
@@ -238,6 +238,8 @@
 #define CONFIG_PMIC_I2C
 #define CONFIG_PMIC_MAX8997
 
+#define CONFIG_POWER_FG
+#define CONFIG_POWER_FG_MAX17042
 #define CONFIG_POWER_MUIC
 #define CONFIG_POWER_MUIC_MAX8997
 #define CONFIG_USB_GADGET
-- 
1.7.2.3

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v4 15/24] arm:trats:pmic: Enable MUIC (MAX8997) at Samsung's TRATS board

2012-10-30 Thread Lukasz Majewski
MUIC IC built into the MAX8997 device is enabled at TRATS.

Signed-off-by: Lukasz Majewski l.majew...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
Cc: Minkyu Kang mk7.k...@samsung.com
---
Changes for v2:
- None
Changes for v3:
- None
Changes for v4:
- None
---
 board/samsung/trats/trats.c |2 ++
 include/configs/trats.h |2 ++
 2 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c
index 7b6f6dc..ed44def 100644
--- a/board/samsung/trats/trats.c
+++ b/board/samsung/trats/trats.c
@@ -38,6 +38,7 @@
 #include usb/s3c_udc.h
 #include power/max8997_pmic.h
 #include libtizen.h
+#include power/max8997_muic.h
 
 #include setup.h
 
@@ -240,6 +241,7 @@ int power_init_board(void)
pmic_init(I2C_5);
 
pmic_init_max8997();
+   power_muic_init(I2C_5);
return 0;
 }
 
diff --git a/include/configs/trats.h b/include/configs/trats.h
index d7808aa..74c4a23 100644
--- a/include/configs/trats.h
+++ b/include/configs/trats.h
@@ -238,6 +238,8 @@
 #define CONFIG_PMIC_I2C
 #define CONFIG_PMIC_MAX8997
 
+#define CONFIG_POWER_MUIC
+#define CONFIG_POWER_MUIC_MAX8997
 #define CONFIG_USB_GADGET
 #define CONFIG_USB_GADGET_S3C_UDC_OTG
 #define CONFIG_USB_GADGET_DUALSPEED
-- 
1.7.2.3

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v4 17/24] arm:trats:pmic: Enable battery support at Samsung's TRATS board

2012-10-30 Thread Lukasz Majewski
Support for TRATS battery has been added. It is treated as a normal
power related device and thereof controlled by pmic/power subsystem.

Signed-off-by: Lukasz Majewski l.majew...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
Cc: Minkyu Kang mk7.k...@samsung.com
---
Changes for v2:
- New patch for v2.
Changes for v3:
- None
Changes for v4:
- None
---
 board/samsung/trats/trats.c |2 ++
 include/configs/trats.h |2 ++
 2 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c
index c0a7b90..5c23744 100644
--- a/board/samsung/trats/trats.c
+++ b/board/samsung/trats/trats.c
@@ -39,6 +39,7 @@
 #include power/max8997_pmic.h
 #include libtizen.h
 #include power/max8997_muic.h
+#include power/battery.h
 #include power/max17042_fg.h
 
 #include setup.h
@@ -244,6 +245,7 @@ int power_init_board(void)
pmic_init_max8997();
power_fg_init(I2C_9);
power_muic_init(I2C_5);
+   power_bat_init(0);
return 0;
 }
 
diff --git a/include/configs/trats.h b/include/configs/trats.h
index 0bc1f3a..2fdc597 100644
--- a/include/configs/trats.h
+++ b/include/configs/trats.h
@@ -242,6 +242,8 @@
 #define CONFIG_POWER_FG_MAX17042
 #define CONFIG_POWER_MUIC
 #define CONFIG_POWER_MUIC_MAX8997
+#define CONFIG_POWER_BATTERY
+#define CONFIG_POWER_BATTERY_TRATS
 #define CONFIG_USB_GADGET
 #define CONFIG_USB_GADGET_S3C_UDC_OTG
 #define CONFIG_USB_GADGET_DUALSPEED
-- 
1.7.2.3

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v4 18/24] pmic:max8997: Support for MAX8997 internal charger control

2012-10-30 Thread Lukasz Majewski
Support for MAX8997 built-in charger.

Signed-off-by: Lukasz Majewski l.majew...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
Cc: Stefano Babic sba...@denx.de
---
Changes for v2:
- power_init_battery() method added to be called from MAX8997 struct pmic
  instance
Changes for v3:
- change code according to struct pmic redesign
Changes for v4:
- None
---
 drivers/power/pmic/pmic_max8997.c |   59 -
 1 files changed, 58 insertions(+), 1 deletions(-)

diff --git a/drivers/power/pmic/pmic_max8997.c 
b/drivers/power/pmic/pmic_max8997.c
index 47ef7f6..0603d94 100644
--- a/drivers/power/pmic/pmic_max8997.c
+++ b/drivers/power/pmic/pmic_max8997.c
@@ -42,12 +42,68 @@ unsigned char max8997_reg_ldo(int uV)
return ret;
 }
 
+static int pmic_charger_state(struct pmic *p, int state, int current)
+{
+   unsigned char fc;
+   u32 val = 0;
+
+   if (pmic_probe(p))
+   return -1;
+
+   if (state == CHARGER_DISABLE) {
+   puts(Disable the charger.\n);
+   pmic_reg_read(p, MAX8997_REG_MBCCTRL2, val);
+   val = ~(MBCHOSTEN | VCHGR_FC);
+   pmic_reg_write(p, MAX8997_REG_MBCCTRL2, val);
+
+   return -1;
+   }
+
+   if (current  CHARGER_MIN_CURRENT || current  CHARGER_MAX_CURRENT) {
+   printf(%s: Wrong charge current: %d [mA]\n,
+  __func__, current);
+   return -1;
+   }
+
+   fc = (current - CHARGER_MIN_CURRENT) / CHARGER_CURRENT_RESOLUTION;
+   fc = fc  0xf; /* up to 950 mA */
+
+   printf(Enable the charger @ %d [mA]\n, fc * CHARGER_CURRENT_RESOLUTION
+  + CHARGER_MIN_CURRENT);
+
+   val = fc | MBCICHFCSET;
+   pmic_reg_write(p, MAX8997_REG_MBCCTRL4, val);
+
+   pmic_reg_read(p, MAX8997_REG_MBCCTRL2, val);
+   val = MBCHOSTEN | VCHGR_FC; /* enable charger  fast charge */
+   pmic_reg_write(p, MAX8997_REG_MBCCTRL2, val);
+
+   return 0;
+}
+
+static int pmic_charger_bat_present(struct pmic *p)
+{
+   u32 val;
+
+   if (pmic_probe(p))
+   return -1;
+
+   pmic_reg_read(p, MAX8997_REG_STATUS4, val);
+
+   return !(val  DETBAT);
+}
+
+static struct power_chrg power_chrg_pmic_ops = {
+   .chrg_bat_present = pmic_charger_bat_present,
+   .chrg_state = pmic_charger_state,
+};
+
 int pmic_init(unsigned char bus)
 {
struct pmic *p = pmic_alloc();
static const char name[] = MAX8997_PMIC;
 
-   puts(Board PMIC init\n);
+   debug(Board PMIC init\n);
 
p-name = name;
p-interface = PMIC_I2C;
@@ -56,5 +112,6 @@ int pmic_init(unsigned char bus)
p-hw.i2c.tx_num = 1;
p-bus = bus;
 
+   p-chrg = power_chrg_pmic_ops;
return 0;
 }
-- 
1.7.2.3

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v4 19/24] arm:trats:pmic: Power consumption reduction state for Samsung's TRATS board

2012-10-30 Thread Lukasz Majewski
When charging battery is necessary, the development board needs to
be turned into low power mode for better efficiency.

Signed-off-by: Lukasz Majewski l.majew...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
Cc: Minkyu Kang mk7.k...@samsung.com
---
Changes for v2:
- None
Changes for v3:
- None
Changes for v4:
- None
---
 board/samsung/trats/trats.c |   41 +
 1 files changed, 41 insertions(+), 0 deletions(-)

diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c
index 5c23744..a8a97bf 100644
--- a/board/samsung/trats/trats.c
+++ b/board/samsung/trats/trats.c
@@ -89,6 +89,47 @@ void i2c_init_board(void)
s5p_gpio_direction_output(gpio2-y4, 1, 1);
 }
 
+static void trats_low_power_mode(void)
+{
+   struct exynos4_clock *clk =
+   (struct exynos4_clock *)samsung_get_base_clock();
+   struct exynos4_power *pwr =
+   (struct exynos4_power *)samsung_get_base_power();
+
+   /* Power down CORE1 */
+   writel(0x0, pwr-arm_core1_configuration);
+
+   /* Change the APLL frequency */
+   writel(0xa0c80604, clk-apll_con0);
+   /* Change CPU0 clock divider */
+   writel(0x0100, clk-div_cpu0);
+   /* CLK_DIV_STAT_CPU0 - wait until clock gets stable */
+   while (readl(clk-div_stat_cpu0)  0x111)
+   ;
+
+   /* Change clock divider ratio for DMC */
+   writel(0x13113117, clk-div_dmc0);
+   while (readl(clk-div_stat_dmc0)  0x)
+   ;
+
+   /* Turn off unnecessary power domains */
+   writel(0x0, pwr-xxti_configuration);  /* XXTI */
+   writel(0x0, pwr-cam_configuration);   /* CAM */
+   writel(0x0, pwr-tv_configuration);/* TV */
+   writel(0x0, pwr-mfc_configuration);   /* MFC */
+   writel(0x0, pwr-g3d_configuration);   /* G3D */
+   writel(0x0, pwr-gps_configuration);   /* GPS */
+   writel(0x0, pwr-gps_alive_configuration); /* GPS_ALIVE */
+
+   /* Turn off unnecessary clocks */
+   writel(0x0, clk-gate_ip_cam); /* CAM */
+   writel(0x0, clk-gate_ip_tv);  /* TV */
+   writel(0x0, clk-gate_ip_mfc); /* MFC */
+   writel(0x0, clk-gate_ip_g3d); /* G3D */
+   writel(0x0, clk-gate_ip_image);   /* IMAGE */
+   writel(0x0, clk-gate_ip_gps); /* GPS */
+}
+
 static int pmic_init_max8997(void)
 {
struct pmic *p = pmic_get(MAX8997_PMIC);
-- 
1.7.2.3

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v4 20/24] arm:trats:pmic: Support for charging battery at Samsung's TRATS board

2012-10-30 Thread Lukasz Majewski
The battery connected to Samsung's Trats development board is now
charged when voltage drops below threshold.

Signed-off-by: Lukasz Majewski l.majew...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
Cc: Minkyu Kang mk7.k...@samsung.com
---
Changes for v2:
- Define separate *p_{} pointer instances for each power device available
  at Trats
- Only basic checks performed
- Core responsible for battery charging moved to separate file -
  ./drivers/power/bat_trats.c

Changes for v3:
- change code according to struct pmic redesign
Changes for v4:
- None
---
 board/samsung/trats/trats.c |   29 +
 1 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c
index a8a97bf..8252a00 100644
--- a/board/samsung/trats/trats.c
+++ b/board/samsung/trats/trats.c
@@ -281,12 +281,41 @@ static int pmic_init_max8997(void)
 
 int power_init_board(void)
 {
+   int chrg;
+   struct power_battery *pb;
+   struct pmic *p_fg, *p_chrg, *p_muic, *p_bat;
pmic_init(I2C_5);
 
pmic_init_max8997();
power_fg_init(I2C_9);
power_muic_init(I2C_5);
power_bat_init(0);
+   p_fg = pmic_get(MAX17042_FG);
+   p_chrg = pmic_get(MAX8997_PMIC);
+   p_muic = pmic_get(MAX8997_MUIC);
+   p_bat = pmic_get(BAT_TRATS);
+
+   p_fg-parent =  p_bat;
+   p_chrg-parent = p_bat;
+   p_muic-parent = p_bat;
+
+   p_bat-low_power_mode = trats_low_power_mode;
+   p_bat-pbat-battery_init(p_bat, p_fg, p_chrg, p_muic);
+
+   pb = p_bat-pbat;
+   chrg = p_muic-chrg-chrg_type(p_muic);
+   debug(CHARGER TYPE: %d\n, chrg);
+
+   if (!p_chrg-chrg-chrg_bat_present(p_chrg)) {
+   puts(No battery detected\n);
+   return -1;
+   }
+
+   p_fg-fg-fg_battery_check(p_fg, p_bat);
+
+   if (pb-bat-state == CHARGE  chrg == CHARGER_USB)
+   puts(CHARGE Battery !\n);
+
return 0;
 }
 
-- 
1.7.2.3

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v4 21/24] pmic: Extend PMIC framework to support battery related commands

2012-10-30 Thread Lukasz Majewski
Two extra commands:
pmic name bat state and pmic name bat charge has been added to
pmic framework. Those provides state display and charge capabilities
to named batteries.

The pmic_core.c file has been refactored to more consistent name scheme.

Signed-off-by: Lukasz Majewski l.majew...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
Cc: Stefano Babic sba...@denx.de
---
Changes for v2:
- New patch to v2.
Changes for v3:
- change code according to struct pmic redesign
Changes for v4:
- None
---
 drivers/power/pmic_core.c |   51 
 1 files changed, 41 insertions(+), 10 deletions(-)

diff --git a/drivers/power/pmic_core.c b/drivers/power/pmic_core.c
index 2908f66..01a240f 100644
--- a/drivers/power/pmic_core.c
+++ b/drivers/power/pmic_core.c
@@ -124,35 +124,46 @@ struct pmic *pmic_get(const char *s)
return NULL;
 }
 
+const char *power_get_interface(int interface)
+{
+   const char *power_interface[] = {I2C, SPI, |+|-|};
+   return power_interface[interface];
+}
+
 static void pmic_list_names(void)
 {
struct pmic *p;
 
puts(PMIC devices:\n);
list_for_each_entry(p, pmic_list, list) {
-   printf(name: %s\n, p-name);
+   printf(name: %s bus: %s_%d\n, p-name,
+  power_get_interface(p-interface), p-bus);
}
 }
 
 int do_pmic(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
u32 ret, reg, val;
+   char *cmd, *name;
struct pmic *p;
-   char *cmd;
 
/* at least two arguments please */
if (argc  2)
return CMD_RET_USAGE;
 
-   cmd = argv[1];
-
-   if (strcmp(cmd, list) == 0) {
+   if (strcmp(argv[1], list) == 0) {
pmic_list_names();
return CMD_RET_SUCCESS;
}
 
+   name = argv[1];
+   cmd = argv[2];
+
+   debug(%s: name: %s cmd: %s\n, __func__, name, cmd);
+   p = pmic_get(name);
+
if (strcmp(cmd, dump) == 0) {
-   if (pmic_dump(pmic_get(argv[2])))
+   if (pmic_dump(p))
return CMD_RET_FAILURE;
return CMD_RET_SUCCESS;
}
@@ -162,7 +173,6 @@ int do_pmic(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
return CMD_RET_USAGE;
 
reg = simple_strtoul(argv[3], NULL, 16);
-   p = pmic_get(argv[2]);
ret = pmic_reg_read(p, reg, val);
 
if (ret)
@@ -179,12 +189,31 @@ int do_pmic(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
 
reg = simple_strtoul(argv[3], NULL, 16);
val = simple_strtoul(argv[4], NULL, 16);
-   p = pmic_get(argv[2]);
pmic_reg_write(p, reg, val);
 
return CMD_RET_SUCCESS;
}
 
+   if (strcmp(cmd, bat) == 0) {
+   if (argc  4)
+   return CMD_RET_USAGE;
+
+   if (strcmp(argv[3], state) == 0)
+   p-fg-fg_battery_check(p-pbat-fg, p);
+
+   if (strcmp(argv[3], charge) == 0) {
+   if (p-pbat) {
+   printf(PRINT BAT charge %s\n, p-name);
+   if (p-low_power_mode)
+   p-low_power_mode();
+   if (p-pbat-battery_charge)
+   p-pbat-battery_charge(p);
+   }
+   }
+
+   return CMD_RET_SUCCESS;
+   }
+
/* No subcommand found */
return CMD_RET_SUCCESS;
 }
@@ -193,7 +222,9 @@ U_BOOT_CMD(
pmic,   CONFIG_SYS_MAXARGS, 1, do_pmic,
PMIC,
list - list available PMICs\n
-   pmic dump name - dump named PMIC registers\n
+   pmic name dump - dump named PMIC registers\n
pmic name read reg - read register\n
-   pmic name write reg value - write register
+   pmic name write reg value - write register\n
+   pmic name bat state - write register\n
+   pmic name bat charge - write register\n
 );
-- 
1.7.2.3

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v4 22/24] power:pmic: Rename ./drivers/power/pmic_* to ./drivers/power/power_* files

2012-10-30 Thread Lukasz Majewski
Rename pmic/power related files at ./drivers/power directory

Signed-off-by: Lukasz Majewski l.majew...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
Cc: Stefano Babic sba...@denx.de
---
Changes for v3:
- New patch at v3.
Changes for v4:
- None
---
 drivers/power/Makefile  |   10 +-
 drivers/power/{pmic_core.c = power_core.c} |0
 drivers/power/{pmic_dialog.c = power_dialog.c} |0
 drivers/power/{pmic_fsl.c = power_fsl.c}   |0
 drivers/power/{pmic_i2c.c = power_i2c.c}   |0
 drivers/power/{pmic_spi.c = power_spi.c}   |0
 6 files changed, 5 insertions(+), 5 deletions(-)
 rename drivers/power/{pmic_core.c = power_core.c} (100%)
 rename drivers/power/{pmic_dialog.c = power_dialog.c} (100%)
 rename drivers/power/{pmic_fsl.c = power_fsl.c} (100%)
 rename drivers/power/{pmic_i2c.c = power_i2c.c} (100%)
 rename drivers/power/{pmic_spi.c = power_spi.c} (100%)

diff --git a/drivers/power/Makefile b/drivers/power/Makefile
index 7fc5554..7733e01 100644
--- a/drivers/power/Makefile
+++ b/drivers/power/Makefile
@@ -31,11 +31,11 @@ COBJS-$(CONFIG_TWL4030_POWER)   += twl4030.o
 COBJS-$(CONFIG_TWL6030_POWER)  += twl6030.o
 COBJS-$(CONFIG_TWL6035_POWER)  += twl6035.o
 
-COBJS-$(CONFIG_PMIC) += pmic_core.o
-COBJS-$(CONFIG_DIALOG_PMIC) += pmic_dialog.o
-COBJS-$(CONFIG_PMIC_FSL) += pmic_fsl.o
-COBJS-$(CONFIG_PMIC_I2C) += pmic_i2c.o
-COBJS-$(CONFIG_PMIC_SPI) += pmic_spi.o
+COBJS-$(CONFIG_PMIC) += power_core.o
+COBJS-$(CONFIG_DIALOG_PMIC) += power_dialog.o
+COBJS-$(CONFIG_PMIC_FSL) += power_fsl.o
+COBJS-$(CONFIG_PMIC_I2C) += power_i2c.o
+COBJS-$(CONFIG_PMIC_SPI) += power_spi.o
 
 COBJS  := $(COBJS-y)
 SRCS   := $(COBJS:.o=.c)
diff --git a/drivers/power/pmic_core.c b/drivers/power/power_core.c
similarity index 100%
rename from drivers/power/pmic_core.c
rename to drivers/power/power_core.c
diff --git a/drivers/power/pmic_dialog.c b/drivers/power/power_dialog.c
similarity index 100%
rename from drivers/power/pmic_dialog.c
rename to drivers/power/power_dialog.c
diff --git a/drivers/power/pmic_fsl.c b/drivers/power/power_fsl.c
similarity index 100%
rename from drivers/power/pmic_fsl.c
rename to drivers/power/power_fsl.c
diff --git a/drivers/power/pmic_i2c.c b/drivers/power/power_i2c.c
similarity index 100%
rename from drivers/power/pmic_i2c.c
rename to drivers/power/power_i2c.c
diff --git a/drivers/power/pmic_spi.c b/drivers/power/power_spi.c
similarity index 100%
rename from drivers/power/pmic_spi.c
rename to drivers/power/power_spi.c
-- 
1.7.2.3

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v4 23/24] power:pmic: Rename CONFIG_PMIC* defines to CONFIG_POWER

2012-10-30 Thread Lukasz Majewski
Rename all CONFIG_PMIC* defines to CONFIG_POWER*

Signed-off-by: Lukasz Majewski l.majew...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
Cc: Stefano Babic sba...@denx.de
---
Changes for v3:
- New patch at v3.
Changes for v4:
- None
---
 board/samsung/goni/goni.c|2 +-
 board/samsung/universal_c210/universal.c |2 +-
 drivers/power/Makefile   |8 
 drivers/power/pmic/Makefile  |4 ++--
 drivers/power/power_fsl.c|8 
 include/configs/imx31_litekit.h  |6 +++---
 include/configs/mx31ads.h|6 +++---
 include/configs/mx31pdk.h|6 +++---
 include/configs/mx35pdk.h|6 +++---
 include/configs/mx51_efikamx.h   |6 +++---
 include/configs/mx51evk.h|6 +++---
 include/configs/mx53evk.h|6 +++---
 include/configs/mx53loco.h   |6 +++---
 include/configs/qong.h   |6 +++---
 include/configs/s5p_goni.h   |6 +++---
 include/configs/s5pc210_universal.h  |6 +++---
 include/configs/trats.h  |6 +++---
 include/configs/tt01.h   |6 +++---
 include/configs/vision2.h|6 +++---
 19 files changed, 54 insertions(+), 54 deletions(-)

diff --git a/board/samsung/goni/goni.c b/board/samsung/goni/goni.c
index 94731e4a..46254e0 100644
--- a/board/samsung/goni/goni.c
+++ b/board/samsung/goni/goni.c
@@ -41,7 +41,7 @@ int board_init(void)
gd-bd-bi_arch_number = MACH_TYPE_GONI;
gd-bd-bi_boot_params = PHYS_SDRAM_1 + 0x100;
 
-#if defined(CONFIG_PMIC)
+#if defined(CONFIG_POWER)
pmic_init(I2C_5);
 #endif
 
diff --git a/board/samsung/universal_c210/universal.c 
b/board/samsung/universal_c210/universal.c
index 80a7346..a50fa7b 100644
--- a/board/samsung/universal_c210/universal.c
+++ b/board/samsung/universal_c210/universal.c
@@ -58,7 +58,7 @@ int board_init(void)
gd-bd-bi_arch_number = MACH_TYPE_UNIVERSAL_C210;
gd-bd-bi_boot_params = PHYS_SDRAM_1 + 0x100;
 
-#if defined(CONFIG_PMIC)
+#if defined(CONFIG_POWER)
pmic_init(I2C_5);
 #endif
 
diff --git a/drivers/power/Makefile b/drivers/power/Makefile
index 7733e01..2723724 100644
--- a/drivers/power/Makefile
+++ b/drivers/power/Makefile
@@ -31,11 +31,11 @@ COBJS-$(CONFIG_TWL4030_POWER)   += twl4030.o
 COBJS-$(CONFIG_TWL6030_POWER)  += twl6030.o
 COBJS-$(CONFIG_TWL6035_POWER)  += twl6035.o
 
-COBJS-$(CONFIG_PMIC) += power_core.o
+COBJS-$(CONFIG_POWER) += power_core.o
 COBJS-$(CONFIG_DIALOG_PMIC) += power_dialog.o
-COBJS-$(CONFIG_PMIC_FSL) += power_fsl.o
-COBJS-$(CONFIG_PMIC_I2C) += power_i2c.o
-COBJS-$(CONFIG_PMIC_SPI) += power_spi.o
+COBJS-$(CONFIG_POWER_FSL) += power_fsl.o
+COBJS-$(CONFIG_POWER_I2C) += power_i2c.o
+COBJS-$(CONFIG_POWER_SPI) += power_spi.o
 
 COBJS  := $(COBJS-y)
 SRCS   := $(COBJS:.o=.c)
diff --git a/drivers/power/pmic/Makefile b/drivers/power/pmic/Makefile
index 9b71e55..e19a9a8 100644
--- a/drivers/power/pmic/Makefile
+++ b/drivers/power/pmic/Makefile
@@ -25,8 +25,8 @@ include $(TOPDIR)/config.mk
 
 LIB:= $(obj)libpmic.o
 
-COBJS-$(CONFIG_PMIC_MAX8998) += pmic_max8998.o
-COBJS-$(CONFIG_PMIC_MAX8997) += pmic_max8997.o
+COBJS-$(CONFIG_POWER_MAX8998) += pmic_max8998.o
+COBJS-$(CONFIG_POWER_MAX8997) += pmic_max8997.o
 COBJS-$(CONFIG_POWER_MUIC_MAX8997) += muic_max8997.o
 
 COBJS  := $(COBJS-y)
diff --git a/drivers/power/power_fsl.c b/drivers/power/power_fsl.c
index 868c3c4..1dd386b 100644
--- a/drivers/power/power_fsl.c
+++ b/drivers/power/power_fsl.c
@@ -26,7 +26,7 @@
 #include power/pmic.h
 #include fsl_pmic.h
 
-#if defined(CONFIG_PMIC_SPI)
+#if defined(CONFIG_POWER_SPI)
 static u32 pmic_spi_prepare_tx(u32 reg, u32 *val, u32 write)
 {
return (write  31) | (reg  25) | (*val  0x00FF);
@@ -41,7 +41,7 @@ int pmic_init(unsigned char bus)
p-name = name;
p-number_of_regs = PMIC_NUM_OF_REGS;
 
-#if defined(CONFIG_PMIC_SPI)
+#if defined(CONFIG_POWER_SPI)
p-interface = PMIC_SPI;
p-bus = CONFIG_FSL_PMIC_BUS;
p-hw.spi.cs = CONFIG_FSL_PMIC_CS;
@@ -50,13 +50,13 @@ int pmic_init(unsigned char bus)
p-hw.spi.bitlen = CONFIG_FSL_PMIC_BITLEN;
p-hw.spi.flags = SPI_XFER_BEGIN | SPI_XFER_END;
p-hw.spi.prepare_tx = pmic_spi_prepare_tx;
-#elif defined(CONFIG_PMIC_I2C)
+#elif defined(CONFIG_POWER_I2C)
p-interface = PMIC_I2C;
p-hw.i2c.addr = CONFIG_SYS_FSL_PMIC_I2C_ADDR;
p-hw.i2c.tx_num = 3;
p-bus = bus;
 #else
-#error You must select CONFIG_PMIC_SPI or CONFIG_PMIC_I2C
+#error You must select CONFIG_POWER_SPI or CONFIG_PMIC_I2C
 #endif
 
return 0;
diff --git a/include/configs/imx31_litekit.h b/include/configs/imx31_litekit.h
index 6ae764a..8fc3942 100644
--- a/include/configs/imx31_litekit.h
+++ b/include/configs/imx31_litekit.h
@@ -72,9 +72,9 @@
 #define CONFIG_DEFAULT_SPI_MODE

[U-Boot] [PATCH v4 24/24] power:pmic: Rename CONFIG_DIALOG_PMIC defines to CONFIG_DIALOG_POWER

2012-10-30 Thread Lukasz Majewski
Rename CONFIG_DIALOG_PMIC to CONFIG_DIALOG_POWER

Signed-off-by: Lukasz Majewski l.majew...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
Cc: Stefano Babic sba...@denx.de
---
Changes for v3:
- New patch at v3.
Changes for v4:
- None
---
 drivers/power/Makefile |2 +-
 include/configs/mx53loco.h |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/power/Makefile b/drivers/power/Makefile
index 2723724..8c71901 100644
--- a/drivers/power/Makefile
+++ b/drivers/power/Makefile
@@ -32,7 +32,7 @@ COBJS-$(CONFIG_TWL6030_POWER) += twl6030.o
 COBJS-$(CONFIG_TWL6035_POWER)  += twl6035.o
 
 COBJS-$(CONFIG_POWER) += power_core.o
-COBJS-$(CONFIG_DIALOG_PMIC) += power_dialog.o
+COBJS-$(CONFIG_DIALOG_POWER) += power_dialog.o
 COBJS-$(CONFIG_POWER_FSL) += power_fsl.o
 COBJS-$(CONFIG_POWER_I2C) += power_i2c.o
 COBJS-$(CONFIG_POWER_SPI) += power_spi.o
diff --git a/include/configs/mx53loco.h b/include/configs/mx53loco.h
index c83e7d7..8d2e856 100644
--- a/include/configs/mx53loco.h
+++ b/include/configs/mx53loco.h
@@ -92,7 +92,7 @@
 /* PMIC Controller */
 #define CONFIG_POWER
 #define CONFIG_POWER_I2C
-#define CONFIG_DIALOG_PMIC
+#define CONFIG_DIALOG_POWER
 #define CONFIG_POWER_FSL
 #define CONFIG_SYS_DIALOG_PMIC_I2C_ADDR0x48
 #define CONFIG_SYS_FSL_PMIC_I2C_ADDR   0x8
-- 
1.7.2.3

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 00/22] Convert p1_p2_rdb_pc to new spl

2012-10-30 Thread Tom Rini
On Mon, Oct 29, 2012 at 09:04:48PM -0500, Scott Wood wrote:

 Tested on p2020rdb-pca and p1020rdb-pc.
 
 Jos?? Miguel Gon??alves (1):
   Add u-boot-pad.bin target to the Makefile
 
 Scott Wood (21):
[snip]
   spl: rename u-boot-pad.bin to u-boot-with-spl.bin

OK, one thing I'm missing is where is PAD_TO being set?  I thought when
this was talked about before I was saying we should set a soft default
of 1 or something so we can re-use this target?  Looking at Stefan's
mpc5200 SPL series, u-boot-with-spl.bin would be fine there, if there
was a default PAD_TO set.

-- 
Tom


signature.asc
Description: Digital signature
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 0/3] Bring in new I2C framework

2012-10-30 Thread Simon Glass
Hi,

On Tue, Oct 30, 2012 at 9:50 AM, Stephen Warren swar...@wwwdotorg.org wrote:
 On 10/29/2012 11:57 PM, Heiko Schocher wrote:
 Hello Stephen,

 On 29.10.2012 16:34, Stephen Warren wrote:
 ...
 If there are e.g. 4 I2C controllers in an SoC, the driver needs to know
 which one is in use. Passing that information directly to the driver
 functions is much simple than requiring the SoC I2C driver to go grovel
 in some I2C core global variables to find out the same information.

 Ah, do you mean we should change the i2c adapter struct from:

 struct i2c_adapter {
void(*init)(int speed, int slaveaddr);
int (*probe)(uint8_t chip);
int (*read)(uint8_t chip, uint addr, int alen,
uint8_t *buffer, int len);
int (*write)(uint8_t chip, uint addr, int alen,
uint8_t *buffer, int len);
uint(*set_bus_speed)(uint speed);
 [...]

 to

 struct i2c_adapter {
void(*init)(struct i2c_adapter *adap, int speed, int
 slaveaddr);
int (*probe)(struct i2c_adapter *adap, uint8_t chip);
int (*read)(struct i2c_adapter *adap, uint8_t chip,
 uint addr, int alen,
uint8_t *buffer, int len);
int (*write)(struct i2c_adapter *adap, uint8_t chip,
 uint addr, int alen,
uint8_t *buffer, int len);
uint(*set_bus_speed)(struct i2c_adapter *adap, uint
 speed);
 [...]
 ?

 We can do this. Simon suggested this too ...

 Yes, exactly. (the functions will need some way to get information out
 of the struct i2c_adapter; I assume there's some kind of driver_private
 field in there too).

Yes.

I will post a few patches to move Tegra over to the new framework as
it is, so that people can see the impact. Given that every driver has
to change, it would be my preference to set the i2c API once. But I
suppose within a short while everything will move to the device model,
so perhaps the job of this series is just to move things in the right
direction?

Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 2/2] WIP: tegra: i2c: Enable new CONFIG_SYS_I2C framework

2012-10-30 Thread Simon Glass
(just for illustration, please don't merge)

This enables CONFIG_SYS_I2C on Tegra, updating existing boards and the Tegra
i2c driver to support this.

Signed-off-by: Simon Glass s...@chromium.org
---
 drivers/i2c/i2c_core.c  |3 ++
 drivers/i2c/tegra_i2c.c |   64 +--
 include/configs/seaboard.h  |4 ++-
 include/configs/trimslice.h |4 ++-
 include/configs/whistler.h  |4 ++-
 5 files changed, 37 insertions(+), 42 deletions(-)

diff --git a/drivers/i2c/i2c_core.c b/drivers/i2c/i2c_core.c
index 5a738d5..44f1297 100644
--- a/drivers/i2c/i2c_core.c
+++ b/drivers/i2c/i2c_core.c
@@ -9,6 +9,9 @@
 #ifdef CONFIG_SYS_I2C_SOFT
 extern struct i2c_adapter soft_i2c_adap[];
 #endif
+#ifdef CONFIG_TEGRA_I2C
+extern struct i2c_adapter tegra_i2c_adap[];
+#endif
 
 struct i2c_adapter *i2c_adap[CONFIG_SYS_NUM_I2C_ADAPTERS] =
CONFIG_SYS_I2C_ADAPTERS;
diff --git a/drivers/i2c/tegra_i2c.c b/drivers/i2c/tegra_i2c.c
index 3e157f4..b92bcf1 100644
--- a/drivers/i2c/tegra_i2c.c
+++ b/drivers/i2c/tegra_i2c.c
@@ -35,8 +35,6 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-static unsigned int i2c_bus_num;
-
 /* Information about i2c controller */
 struct i2c_bus {
int id;
@@ -327,21 +325,11 @@ static struct i2c_bus *tegra_i2c_get_bus(unsigned int 
bus_num)
return bus;
 }
 
-unsigned int i2c_get_bus_speed(void)
+static unsigned int tegra_i2c_set_bus_speed(unsigned int speed)
 {
struct i2c_bus *bus;
 
-   bus = tegra_i2c_get_bus(i2c_bus_num);
-   if (!bus)
-   return 0;
-   return bus-speed;
-}
-
-int i2c_set_bus_speed(unsigned int speed)
-{
-   struct i2c_bus *bus;
-
-   bus = tegra_i2c_get_bus(i2c_bus_num);
+   bus = tegra_i2c_get_bus(i2c_get_bus_num());
if (!bus)
return 0;
bus-speed = speed;
@@ -450,7 +438,7 @@ void i2c_init_board(void)
return;
 }
 
-void i2c_init(int speed, int slaveaddr)
+static void tegra_i2c_init(int speed, int slaveaddr)
 {
/* This will override the speed selected in the fdt for that port */
debug(i2c_init(speed=%u, slaveaddr=0x%x)\n, speed, slaveaddr);
@@ -500,7 +488,7 @@ int i2c_read_data(struct i2c_bus *bus, uchar chip, uchar 
*buffer, int len)
 }
 
 /* Probe to see if a chip is present. */
-int i2c_probe(uchar chip)
+static int tegra_i2c_probe(uchar chip)
 {
struct i2c_bus *bus;
int rc;
@@ -526,7 +514,8 @@ static int i2c_addr_ok(const uint addr, const int alen)
 }
 
 /* Read bytes */
-int i2c_read(uchar chip, uint addr, int alen, uchar *buffer, int len)
+static int tegra_i2c_read(uchar chip, uint addr, int alen, uchar *buffer,
+ int len)
 {
struct i2c_bus *bus;
uint offset;
@@ -534,7 +523,7 @@ int i2c_read(uchar chip, uint addr, int alen, uchar 
*buffer, int len)
 
debug(i2c_read: chip=0x%x, addr=0x%x, len=0x%x\n,
chip, addr, len);
-   bus = tegra_i2c_get_bus(i2c_bus_num);
+   bus = tegra_i2c_get_bus(i2c_get_bus_num());
if (!bus)
return 1;
if (!i2c_addr_ok(addr, alen)) {
@@ -564,7 +553,8 @@ int i2c_read(uchar chip, uint addr, int alen, uchar 
*buffer, int len)
 }
 
 /* Write bytes */
-int i2c_write(uchar chip, uint addr, int alen, uchar *buffer, int len)
+static int tegra_i2c_write(uchar chip, uint addr, int alen, uchar *buffer,
+  int len)
 {
struct i2c_bus *bus;
uint offset;
@@ -572,7 +562,7 @@ int i2c_write(uchar chip, uint addr, int alen, uchar 
*buffer, int len)
 
debug(i2c_write: chip=0x%x, addr=0x%x, len=0x%x\n,
chip, addr, len);
-   bus = tegra_i2c_get_bus(i2c_bus_num);
+   bus = tegra_i2c_get_bus(i2c_get_bus_num());
if (!bus)
return 1;
if (!i2c_addr_ok(addr, alen)) {
@@ -593,25 +583,6 @@ int i2c_write(uchar chip, uint addr, int alen, uchar 
*buffer, int len)
return 0;
 }
 
-#if defined(CONFIG_I2C_MULTI_BUS)
-/*
- * Functions for multiple I2C bus handling
- */
-unsigned int i2c_get_bus_num(void)
-{
-   return i2c_bus_num;
-}
-
-int i2c_set_bus_num(unsigned int bus)
-{
-   if (bus = TEGRA_I2C_NUM_CONTROLLERS || !i2c_controllers[bus].inited)
-   return -1;
-   i2c_bus_num = bus;
-
-   return 0;
-}
-#endif
-
 int tegra_i2c_get_dvc_bus_num(void)
 {
int i;
@@ -625,3 +596,18 @@ int tegra_i2c_get_dvc_bus_num(void)
 
return -1;
 }
+
+struct i2c_adapter tegra_i2c_adap[] = {
+   {
+   .init   = tegra_i2c_init,
+   .probe  = tegra_i2c_probe,
+   .read   = tegra_i2c_read,
+   .write  = tegra_i2c_write,
+   .set_bus_speed  = tegra_i2c_set_bus_speed,
+   .speed  = 10,
+   .slaveaddr  = 0,
+   .name   = tegra-i2c,
+   .init_done  = 0,

[U-Boot] [PATCH 1/2] tegra: i2c: Add function to know about current bus

2012-10-30 Thread Simon Glass
Rather than using a variable in various places, add a single function,
tegra_i2c_get_bus(), which returns a pointer to information about a
bus.

This will make it easier to move to the new i2c framework.

Signed-off-by: Simon Glass s...@chromium.org
---
 drivers/i2c/tegra_i2c.c |   78 --
 1 files changed, 61 insertions(+), 17 deletions(-)

diff --git a/drivers/i2c/tegra_i2c.c b/drivers/i2c/tegra_i2c.c
index efc77fa..3e157f4 100644
--- a/drivers/i2c/tegra_i2c.c
+++ b/drivers/i2c/tegra_i2c.c
@@ -262,7 +262,8 @@ exit:
return error;
 }
 
-static int tegra_i2c_write_data(u32 addr, u8 *data, u32 len)
+static int tegra_i2c_write_data(struct i2c_bus *bus, u32 addr, u8 *data,
+   u32 len)
 {
int error;
struct i2c_trans_info trans_info;
@@ -273,14 +274,15 @@ static int tegra_i2c_write_data(u32 addr, u8 *data, u32 
len)
trans_info.num_bytes = len;
trans_info.is_10bit_address = 0;
 
-   error = send_recv_packets(i2c_controllers[i2c_bus_num], trans_info);
+   error = send_recv_packets(bus, trans_info);
if (error)
debug(tegra_i2c_write_data: Error (%d) !!!\n, error);
 
return error;
 }
 
-static int tegra_i2c_read_data(u32 addr, u8 *data, u32 len)
+static int tegra_i2c_read_data(struct i2c_bus *bus, u32 addr, u8 *data,
+  u32 len)
 {
int error;
struct i2c_trans_info trans_info;
@@ -291,7 +293,7 @@ static int tegra_i2c_read_data(u32 addr, u8 *data, u32 len)
trans_info.num_bytes = len;
trans_info.is_10bit_address = 0;
 
-   error = send_recv_packets(i2c_controllers[i2c_bus_num], trans_info);
+   error = send_recv_packets(bus, trans_info);
if (error)
debug(tegra_i2c_read_data: Error (%d) !!!\n, error);
 
@@ -302,18 +304,48 @@ static int tegra_i2c_read_data(u32 addr, u8 *data, u32 
len)
 #error Please enable device tree support to use this driver
 #endif
 
+/**
+ * Check that a bus number is valid and return a pointer to it
+ *
+ * @param bus_num  Bus number to check / return
+ * @return pointer to bus, if valid, else NULL
+ */
+static struct i2c_bus *tegra_i2c_get_bus(unsigned int bus_num)
+{
+   struct i2c_bus *bus;
+
+   if (bus_num = TEGRA_I2C_NUM_CONTROLLERS) {
+   debug(%s: Invalid bus number %u\n, __func__, bus_num);
+   return NULL;
+   }
+   bus = i2c_controllers[bus_num];
+   if (!bus-inited) {
+   debug(%s: Bus %u not available\n, __func__, bus_num);
+   return NULL;
+   }
+
+   return bus;
+}
+
 unsigned int i2c_get_bus_speed(void)
 {
-   return i2c_controllers[i2c_bus_num].speed;
+   struct i2c_bus *bus;
+
+   bus = tegra_i2c_get_bus(i2c_bus_num);
+   if (!bus)
+   return 0;
+   return bus-speed;
 }
 
 int i2c_set_bus_speed(unsigned int speed)
 {
-   struct i2c_bus *i2c_bus;
+   struct i2c_bus *bus;
 
-   i2c_bus = i2c_controllers[i2c_bus_num];
-   i2c_bus-speed = speed;
-   i2c_init_controller(i2c_bus);
+   bus = tegra_i2c_get_bus(i2c_bus_num);
+   if (!bus)
+   return 0;
+   bus-speed = speed;
+   i2c_init_controller(bus);
 
return 0;
 }
@@ -426,7 +458,7 @@ void i2c_init(int speed, int slaveaddr)
 }
 
 /* i2c write version without the register address */
-int i2c_write_data(uchar chip, uchar *buffer, int len)
+int i2c_write_data(struct i2c_bus *bus, uchar chip, uchar *buffer, int len)
 {
int rc;
 
@@ -438,7 +470,7 @@ int i2c_write_data(uchar chip, uchar *buffer, int len)
debug(\n);
 
/* Shift 7-bit address over for lower-level i2c functions */
-   rc = tegra_i2c_write_data(chip  1, buffer, len);
+   rc = tegra_i2c_write_data(bus, chip  1, buffer, len);
if (rc)
debug(i2c_write_data(): rc=%d\n, rc);
 
@@ -446,13 +478,13 @@ int i2c_write_data(uchar chip, uchar *buffer, int len)
 }
 
 /* i2c read version without the register address */
-int i2c_read_data(uchar chip, uchar *buffer, int len)
+int i2c_read_data(struct i2c_bus *bus, uchar chip, uchar *buffer, int len)
 {
int rc;
 
debug(inside i2c_read_data():\n);
/* Shift 7-bit address over for lower-level i2c functions */
-   rc = tegra_i2c_read_data(chip  1, buffer, len);
+   rc = tegra_i2c_read_data(bus, chip  1, buffer, len);
if (rc) {
debug(i2c_read_data(): rc=%d\n, rc);
return rc;
@@ -470,12 +502,16 @@ int i2c_read_data(uchar chip, uchar *buffer, int len)
 /* Probe to see if a chip is present. */
 int i2c_probe(uchar chip)
 {
+   struct i2c_bus *bus;
int rc;
uchar reg;
 
debug(i2c_probe: addr=0x%x\n, chip);
+   bus = tegra_i2c_get_bus(i2c_get_bus_num());
+   if (!bus)
+   return 1;
reg = 0;
-   rc = i2c_write_data(chip, reg, 1);
+   rc = i2c_write_data(bus, chip, 

Re: [U-Boot] [PATCH] powerpc/esdhc: force the bus width to 4bit

2012-10-30 Thread Lukasz Majewski
Hi Jaehoon,

 On 10/23/2012 06:50 PM, Marek Vasut wrote:
  Dear Huang Changming-R66093,
  
  Best Regards
  Jerry Huang
 
  -Original Message-
  From: Marek Vasut [mailto:ma...@denx.de]
  Sent: Tuesday, October 23, 2012 3:24 PM
  To: Huang Changming-R66093
  Cc: u-boot@lists.denx.de; Andy Fleming
  Subject: Re: [PATCH] powerpc/esdhc: force the bus width to 4bit
 
  Dear chang-ming.hu...@freescale.com,
 
  From: Jerry Huang chang-ming.hu...@freescale.com
 
  For the current u-boot codes, only 4bit/1bit SD/SDHC bus width is
 
  support.
 
  So for MMC card, we also support 4bit bus width, otherwiase, we
  will
 
  get the 12bit bus width, which is not correct:
  Andy ... can you please explain? I don't quite understand the
  problem, I thought we had no problem supporting 8bit mmc (esp. if
  the controller handles that for us mostly).
 
  Yes, the controller support 8bit MMC.
 
  FSL ESDHC driver set the host_caps = MMC_MODE_4BIT | MMC_MODE_8BIT;
  But, the current codes for MMC card has been changed to:
 
  } else {
 width = ((mmc-host_caps  MMC_MODE_MASK_WIDTH_BITS) 
   MMC_MODE_WIDTH_BITS_SHIFT);

Hmm... looks like it is code done by me :-)
So little explanation shall be given.

This code is necessary for some targets (like Samsung's Goni) which can
only support 4 bit MMC mode.

 for (; width = 0; width--) {
 
 
  So for FSL ESDHC, the width = 3, after implement mmc_switch
  successfully, will set the bus to 4 * width. Therefore, I will get
  the 12bit (4 x 3) bus width.
 This problem is MMC subsystem's bug.
 I think good that will modify the code in mmc.c.
 If caps is set to MMC_MODE_4BIT | MMC_MODE_8BIT,
 we can see the 12bit support with using mmcinfo command
 

The mmc_set_bus_width(mmc, 4 * width) in conjunction to above code
causes the problem.

I agree, that this code shall be refactored.
Lei, what do you think?


 Best Regards,
 Jaehoon Chung
 
 
  Below is the old codes (width = 2):
  } else {
  for (width = EXT_CSD_BUS_WIDTH_8; width = 0;
  width--) {
  [...]
  
  
  Uh, so it's a bug in the MMC subsystem?
  Best regards,
  Marek Vasut
  ___
  U-Boot mailing list
  U-Boot@lists.denx.de
  http://lists.denx.de/mailman/listinfo/u-boot
  
 
 ___
 U-Boot mailing list
 U-Boot@lists.denx.de
 http://lists.denx.de/mailman/listinfo/u-boot



-- 
Best regards,

Lukasz Majewski

Samsung Poland RD Center | Linux Platform Group
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] Custodian branch base commits

2012-10-30 Thread Stephen Warren
The instructions at:

http://www.denx.de/wiki/U-Boot/CustodianGitTrees

... indicate that downstream branches should be rebased onto
${upstream}/master immediately prior to sending a pull request. I'm not
sure this is correct any more, given that upstream master branches now
pull in downstream branches via git merge rather than git rebase.
Should that page be changed?

The question then becomes: What commit should downstream branches use as
their baseline. I assert that they should be free to choose any commit
in their upstream master branch (or merge in any upstream commit), or
any further upstream branch all the way up to u-boot/master.

As background, I want to send a commit to the Tegra tree that enables
use of CONFIG_CMD_FS_GENERIC, and additionally, re-write bootcmd in
Tegra's default environment to use the new shell commands that config
option enables.

However, the commits that implement CONFIG_CMD_FS_GENERIC are in
u-boot/master but not yet in u-boot-arm/master. So, Tegra's master
branch can't simply be based on current u-boot-arm/master, since if it
was, applying my patch would break functionality until it was merged
with u-boot/master and so picked up the actual implementation.

Hopefully, u-boot-arm/master will merge in (or get reset to)
u-boot/master fairly shortly. However, should Tegra's repo have to wait
for this?

Instead, I propose that 2nd-level custodians should be able to do
something like:

# (in u-boot-tegra.git, assuming everything is merged already)
git checkout master
git reset --hard u-boot/master
git am patch_that_depends_on_uboot_master
# send pull request to u-boot-arm/master

# (in u-boot-tegra.git, assuming some patches already applied locally)
git checkout master
git merge u-boot/master
git am patch_that_depends_on_uboot_master
# send pull request to u-boot-arm/master

This should work fine provided that u-boot/master and u-boot-arm/master
guarantee never to rebase. If they don't make that guarantee, then I
don't think we can be using merges at all anyway, so that shouldn't be
an issue.

What do people think?
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] cmd_fdt.c: Use %p when printing pointers

2012-10-30 Thread Joe Hershberger
Hi Wolfgang,

On Tue, Oct 30, 2012 at 4:59 AM, Wolfgang Denk w...@denx.de wrote:
 Dear Tom Rini,

 In message 1351558398-6902-1-git-send-email-tr...@ti.com you wrote:
 When putting pointers into a format string use %p to ensure that they
 are printed correctly regardless of bitsize.  This fixes warnings on
 sandbox on 64bit systems.

 Cc: Joe Hershberger joe.hershber...@ni.com
 Cc: Gerald Van Baren vanba...@cideas.com
 Signed-off-by: Tom Rini tr...@ti.com
 ---
  common/cmd_fdt.c |6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

 diff --git a/common/cmd_fdt.c b/common/cmd_fdt.c
 index a5e2cfc..f9acfc1 100644
 --- a/common/cmd_fdt.c
 +++ b/common/cmd_fdt.c
 @@ -375,7 +375,7 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char 
 * const argv[])
   /* Get address */
   char buf[11];

 - sprintf(buf, 0x%08X, 
 (uint32_t)nodep);
 + sprintf(buf, 0x%p, nodep);
   setenv(var, buf);

 This may put bogus data (var=0x(null)) into the environment.

 I see two approaches to fix this:

 1) Handle this locally, say like that:

 char buf[11] = { '0', 0, };

 if (nodep)
 sprintf(buf, 0x%p, nodep);

 setenv(var, buf);

This is the solution with minimal global impact.

I think this solution is not needed.  In this particular case, we are
always printing the pointer to a member inside the fdt, so even if the
image is at 0, no pointer that we are printing will ever be at 0.
Therefore this is code that will never run and can be left out.

 2) Fix the root cause: given that we have valid situations where we
may want to dereference a pointer pointing to address 0x,
I wonder if it would not actually be better (i. e. more correct) to
get rid of the

 495 static char *pointer(const char *fmt, char *buf, char *end, void 
 *ptr,
 496 int field_width, int precision, int flags)
 497 {
 498 if (!ptr)
 499 return string(buf, end, (null), field_width, 
 precision,
 500   flags);

special handling in lib/vsprintf.c

Would anybody shed any tears if we drop this?

Getting rid of this would be good in general IMO.  I never did
understand why printing (null) was better than 0.

-Joe
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] fs: handle CONFIG_NEEDS_MANUAL_RELOC

2012-10-30 Thread Stephen Warren
From: Stephen Warren swar...@nvidia.com

Without this, fstypes[].probe points at the wrong place, so calling the
function results in undefined behaviour.

Signed-off-by: Stephen Warren swar...@nvidia.com
---
Note: I have compile-tested this with the relocation code forcibly
enabled, but have no way of actually testing the result.
---
 fs/fs.c |   13 -
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/fs/fs.c b/fs/fs.c
index 23ffa25..e148a07 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -21,6 +21,8 @@
 #include fat.h
 #include fs.h
 
+DECLARE_GLOBAL_DATA_PTR;
+
 static block_dev_desc_t *fs_dev_desc;
 static disk_partition_t fs_partition;
 static int fs_type = FS_TYPE_ANY;
@@ -141,7 +143,7 @@ static inline void fs_close_ext(void)
 #define fs_read_ext fs_read_unsupported
 #endif
 
-static const struct {
+static struct {
int fstype;
int (*probe)(void);
 } fstypes[] = {
@@ -158,6 +160,15 @@ static const struct {
 int fs_set_blk_dev(const char *ifname, const char *dev_part_str, int fstype)
 {
int part, i;
+#ifdef CONFIG_NEEDS_MANUAL_RELOC
+   static int relocated;
+
+   if (!relocated) {
+   for (i = 0; i  ARRAY_SIZE(fstypes); i++)
+   fstypes[i].probe += gd-reloc_off;
+   relocated = 1;
+   }
+#endif
 
part = get_device_and_partition(ifname, dev_part_str, fs_dev_desc,
fs_partition, 1);
-- 
1.7.0.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] Linker errors from .u_boot_list in powerpc

2012-10-30 Thread Joe Hershberger
Hi Marek,

Not sure if you were already aware of this, but I ran across these
errors with MAKEALL on PPC.

alpr:
powerpc-linux-gnu-ld: section .bootpg loaded at
[f000,f27f] overlaps section .u_boot_list
loaded at [ee8c,f3cb]
powerpc-linux-gnu-ld: u-boot: section .bootpg lma 0xf000 adjusted
to 0xf3cc

P2020DS_36BIT:
powerpc-linux-gnu-ld: section .bootpg loaded at
[e000,e4c3] overlaps section .u_boot_list
loaded at [efffef60,e7fb]
powerpc-linux-gnu-ld: u-boot: section .bootpg lma 0xe000 adjusted
to 0xe7fc

P2020DS_SDCARD:
powerpc-linux-gnu-ld: section .bootpg loaded at
[f8fff000,f8fff4b3] overlaps section .u_boot_list
loaded at [f8ffe874,f8fff10f]
powerpc-linux-gnu-ld: u-boot: section .bootpg lma 0xf8fff000 adjusted
to 0xf8fff110

P2020DS_SPIFLASH:
powerpc-linux-gnu-ld: section .bootpg loaded at
[f8fff000,f8fff4b3] overlaps section .u_boot_list
loaded at [f8ffe778,f8fff013]
powerpc-linux-gnu-ld: u-boot: section .bootpg lma 0xf8fff000 adjusted
to 0xf8fff014

Tom,

There are also several boards that fail due to missing
CONFIG_SYS_MPC85xx_DDR2_ADDR

MPC8641HPCN_36BIT, MPC8641HPCN, xpedite517x.

Cheers,
-Joe
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] Linker errors from .u_boot_list in powerpc

2012-10-30 Thread Tom Rini
On Tue, Oct 30, 2012 at 01:00:06PM -0500, Joe Hershberger wrote:

 Hi Marek,
 
 Not sure if you were already aware of this, but I ran across these
 errors with MAKEALL on PPC.
 
 alpr:
 powerpc-linux-gnu-ld: section .bootpg loaded at
 [f000,f27f] overlaps section .u_boot_list
 loaded at [ee8c,f3cb]
 powerpc-linux-gnu-ld: u-boot: section .bootpg lma 0xf000 adjusted
 to 0xf3cc
 
 P2020DS_36BIT:
 powerpc-linux-gnu-ld: section .bootpg loaded at
 [e000,e4c3] overlaps section .u_boot_list
 loaded at [efffef60,e7fb]
 powerpc-linux-gnu-ld: u-boot: section .bootpg lma 0xe000 adjusted
 to 0xe7fc
 
 P2020DS_SDCARD:
 powerpc-linux-gnu-ld: section .bootpg loaded at
 [f8fff000,f8fff4b3] overlaps section .u_boot_list
 loaded at [f8ffe874,f8fff10f]
 powerpc-linux-gnu-ld: u-boot: section .bootpg lma 0xf8fff000 adjusted
 to 0xf8fff110
 
 P2020DS_SPIFLASH:
 powerpc-linux-gnu-ld: section .bootpg loaded at
 [f8fff000,f8fff4b3] overlaps section .u_boot_list
 loaded at [f8ffe778,f8fff013]
 powerpc-linux-gnu-ld: u-boot: section .bootpg lma 0xf8fff000 adjusted
 to 0xf8fff014

What toolchain are you using?  I don't see that with ELDK 5.2.

 Tom,
 
 There are also several boards that fail due to missing
 CONFIG_SYS_MPC85xx_DDR2_ADDR
 
 MPC8641HPCN_36BIT, MPC8641HPCN, xpedite517x.

Andy is aware of these and has a patch he'll be pushing my way shortly.

-- 
Tom


signature.asc
Description: Digital signature
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] cmd_fdt.c: Use %p when printing pointers

2012-10-30 Thread Tom Rini
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 10/30/12 05:44, Jerry Van Baren wrote:
 On 10/30/2012 05:59 AM, Wolfgang Denk wrote:
 Dear Tom Rini,
[snip]
 2) Fix the root cause: given that we have valid situations where 
 we may want to dereference a pointer pointing to address 0x,
  I wonder if it would not actually be better (i. e. more
 correct) to get rid of the
 
 495 static char *pointer(const char *fmt, char *buf, char *end, 
 void *ptr, 496 int field_width, int precision, 
 int flags) 497 { 498 if (!ptr) 499
 return string(buf, end, (null), field_width, precision, 500 
 flags);
 
 special handling in lib/vsprintf.c
 
 Would anybody shed any tears if we drop this?
 
 I like that a lot better, gets my vote.  I would suggest replacing 
 the code with a comment that the (lack of) code intentionally does 
 not print (null) or someone may put it back in in the future. 
 :-/

Yes, a comment as a reminder is a good idea.  Please make it so.  And
as Joe notes (he pointed this out on IRC before I posted) we'll never
do this in the cmd_fdt.c code as it's always inside of a tree
somewhere.  Thanks!

- -- 
Tom
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQIcBAEBAgAGBQJQkBguAAoJENk4IS6UOR1WiKcP/RSFDevD6jDW8cV6TH1VbE0u
v+2ZMClL/DVcwTq+EasUyFStCJJgBZRjgpTva0S5/VPevC/Q7TAQSuOSQjhizTlO
6LlUNY3Qmrznd/70WO1uXGkZ9YxNqHwfbmjH3V67Ge+E6xM9QtIqsj4rI+TvEWub
NiFlynwi/DQRzO1RuCzuoey+nIPO8Vmy2L8HbT09s24B85IfLGkCPpf40wsZY9p8
pPf5qTBjaKuzxRax02msVEllpCC0l1AiDzdjiOjrNDkk+ULaHehzB/8kT/q3Bg7k
Q8j2msa/gDSCfqGfl4ravQ+5ekpwbW22ywhfL6DmFzw8tlPYlzLJs7x34GyFx6Me
/5RSAqpiq+qw9qc5NQKPNEgd9FyPC6QH6q9DG0Ns0NoMwnWbLe590bBuDNitsmwH
tfdBJspVGJnY0Lcf8nGl6xKw12Q2H4uOqofaI3MrtUIW2bUB3RHB421wZAWwuTez
EcuvF1CqcBcbf17wOksftg+51N5e4ng9L35mMCAv8pLuheEvhgRKLcvZZVHhXGX6
QqG7DIBR+lVAflFQU5ctNVOESknuzPOt4UveAZnuXyKPH5KH5k+kN5HpKghtC4aF
j/AWcqZaNXsFwuObgRbAk2O3eSnWzLODQL61C2u9gmEjbv9PIZ3c30UsX3g3QY8v
CxnWPsbwsFDoo/OmSCvj
=vTzN
-END PGP SIGNATURE-
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] Linker errors from .u_boot_list in powerpc

2012-10-30 Thread Joe Hershberger
Hi Tom,

On Tue, Oct 30, 2012 at 1:08 PM, Tom Rini tr...@ti.com wrote:
 On Tue, Oct 30, 2012 at 01:00:06PM -0500, Joe Hershberger wrote:

 Hi Marek,

 Not sure if you were already aware of this, but I ran across these
 errors with MAKEALL on PPC.

 alpr:
 powerpc-linux-gnu-ld: section .bootpg loaded at
 [f000,f27f] overlaps section .u_boot_list
 loaded at [ee8c,f3cb]
 powerpc-linux-gnu-ld: u-boot: section .bootpg lma 0xf000 adjusted
 to 0xf3cc

 P2020DS_36BIT:
 powerpc-linux-gnu-ld: section .bootpg loaded at
 [e000,e4c3] overlaps section .u_boot_list
 loaded at [efffef60,e7fb]
 powerpc-linux-gnu-ld: u-boot: section .bootpg lma 0xe000 adjusted
 to 0xe7fc

 P2020DS_SDCARD:
 powerpc-linux-gnu-ld: section .bootpg loaded at
 [f8fff000,f8fff4b3] overlaps section .u_boot_list
 loaded at [f8ffe874,f8fff10f]
 powerpc-linux-gnu-ld: u-boot: section .bootpg lma 0xf8fff000 adjusted
 to 0xf8fff110

 P2020DS_SPIFLASH:
 powerpc-linux-gnu-ld: section .bootpg loaded at
 [f8fff000,f8fff4b3] overlaps section .u_boot_list
 loaded at [f8ffe778,f8fff013]
 powerpc-linux-gnu-ld: u-boot: section .bootpg lma 0xf8fff000 adjusted
 to 0xf8fff014

 What toolchain are you using?  I don't see that with ELDK 5.2.

powerpc-linux-gnu-gcc (Sourcery G++ Lite 2010.09-55) 4.5.1

I may just be that there is barely enough space and my added 14 bytes
or so to the .u_boot_list section is pushing it over.

 Tom,

 There are also several boards that fail due to missing
 CONFIG_SYS_MPC85xx_DDR2_ADDR

 MPC8641HPCN_36BIT, MPC8641HPCN, xpedite517x.

 Andy is aware of these and has a patch he'll be pushing my way shortly.

Thanks,
-Joe
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] fs/fs.c: fix fs_set_blk_dev() for manual relocation

2012-10-30 Thread Andreas Bießmann
Commit 045fa1e1142552799ad3203e9e0bc22a11e866ea introduce an array with
filesystem accessors. On arches which need manual reloc this is broken cause the
function pointers still pointing to the privious location, fix it.

Signed-off-by: Andreas Bießmann andreas.de...@googlemail.com
Cc: swar...@wwwdotorg.org
Cc: tr...@ti.com
---
 fs/fs.c | 16 +++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/fs/fs.c b/fs/fs.c
index 23ffa25..66feb30 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -21,6 +21,8 @@
 #include fat.h
 #include fs.h
 
+DECLARE_GLOBAL_DATA_PTR;
+
 static block_dev_desc_t *fs_dev_desc;
 static disk_partition_t fs_partition;
 static int fs_type = FS_TYPE_ANY;
@@ -141,7 +143,7 @@ static inline void fs_close_ext(void)
 #define fs_read_ext fs_read_unsupported
 #endif
 
-static const struct {
+static struct {
int fstype;
int (*probe)(void);
 } fstypes[] = {
@@ -158,6 +160,18 @@ static const struct {
 int fs_set_blk_dev(const char *ifname, const char *dev_part_str, int fstype)
 {
int part, i;
+#ifdef CONFIG_NEEDS_MANUAL_RELOC
+   static int relocated = 0;
+
+   /* relocate fstypes[].probe */
+   if (!relocated) {
+   int i;
+   for (i = 0; i  ARRAY_SIZE(fstypes); i++)
+   if (fstypes[i].probe != NULL)
+   fstypes[i].probe += gd-reloc_off;
+   relocated = 1;
+   }
+#endif
 
part = get_device_and_partition(ifname, dev_part_str, fs_dev_desc,
fs_partition, 1);
-- 
1.8.0

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 5/8] tegra: usb: move controller init into start_port

2012-10-30 Thread Stephen Warren
On 10/30/2012 06:44 AM, Lucas Stach wrote:
 Hi Marek,
 
 Am Dienstag, den 30.10.2012, 13:33 +0100 schrieb Marek Vasut:
 Dear Lucas Stach,

 [...]

 -static int add_port(struct fdt_usb *config)

 Fix the comment instead of removing it?

 I don't think that this comment adds any real value. The whole function
 which this comment refers to is removed and it's content split between
 board_usb_init and ehci_hcd_init, which are self explanatory.

 Then add a proper comment please. Call me a docu-nazi, but I'd really love u-
 boot nicely and properly documented, please.

 I'm all in favour of adding proper documentation, but I'm opposed to add
 it in the middle of this cleanup/movement series.
 
 I'll send a patch on top of this series to add doc, so it doesn't
 interfere with the review of this series.

If the docs already exist and the function is simply changing its exact
semantics, the docs should remain and simply be updated.

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] Linker errors from .u_boot_list in powerpc

2012-10-30 Thread Joe Hershberger
Hi Andy,

On Tue, Oct 30, 2012 at 1:00 PM, Joe Hershberger
joe.hershber...@gmail.com wrote:
 Hi Marek,

 Not sure if you were already aware of this, but I ran across these
 errors with MAKEALL on PPC.

 alpr:
 powerpc-linux-gnu-ld: section .bootpg loaded at
 [f000,f27f] overlaps section .u_boot_list
 loaded at [ee8c,f3cb]
 powerpc-linux-gnu-ld: u-boot: section .bootpg lma 0xf000 adjusted
 to 0xf3cc

 P2020DS_36BIT:
 powerpc-linux-gnu-ld: section .bootpg loaded at
 [e000,e4c3] overlaps section .u_boot_list
 loaded at [efffef60,e7fb]
 powerpc-linux-gnu-ld: u-boot: section .bootpg lma 0xe000 adjusted
 to 0xe7fc

 P2020DS_SDCARD:
 powerpc-linux-gnu-ld: section .bootpg loaded at
 [f8fff000,f8fff4b3] overlaps section .u_boot_list
 loaded at [f8ffe874,f8fff10f]
 powerpc-linux-gnu-ld: u-boot: section .bootpg lma 0xf8fff000 adjusted
 to 0xf8fff110

 P2020DS_SPIFLASH:
 powerpc-linux-gnu-ld: section .bootpg loaded at
 [f8fff000,f8fff4b3] overlaps section .u_boot_list
 loaded at [f8ffe778,f8fff013]
 powerpc-linux-gnu-ld: u-boot: section .bootpg lma 0xf8fff000 adjusted
 to 0xf8fff014

These appear to simply be because my env changes make the u-boot build
a bit too big.  What are the memory areas on these 2 boards that can
be used?

Thanks,
-Joe
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 7/8] tegra: usb: move implementation into right directory

2012-10-30 Thread Stephen Warren
On 10/30/2012 03:22 AM, Lucas Stach wrote:
 This moves the Tegra USB implementation into the drivers/usb/host
 directory.

 diff --git a/arch/arm/cpu/armv7/tegra20/usb.c b/drivers/usb/host/ehci-tegra.c

 + * Copyright (c) 2009-2012 NVIDIA Corporation
   * Copyright (c) 2011 The Chromium OS Authors.
 - * (C) Copyright 2010,2011 NVIDIA Corporation www.nvidia.com

Why does NVIDIA's (c) notice change?
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] fs/fs.c: fix fs_set_blk_dev() for manual relocation

2012-10-30 Thread Stephen Warren
On 10/30/2012 12:29 PM, Andreas Bießmann wrote:
 Commit 045fa1e1142552799ad3203e9e0bc22a11e866ea introduce an array with
 filesystem accessors. On arches which need manual reloc this is broken cause 
 the
 function pointers still pointing to the privious location, fix it.

We found the same code to copy:-)

 diff --git a/fs/fs.c b/fs/fs.c

  int fs_set_blk_dev(const char *ifname, const char *dev_part_str, int fstype)

 +#ifdef CONFIG_NEEDS_MANUAL_RELOC
 + static int relocated = 0;

checkpatch bitches about the = 0 there. I assume BSS initialization
isn't also broken when CONFIG_NEEDS_MANUAL_RELOC is enabled?
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 7/8] tegra: usb: move implementation into right directory

2012-10-30 Thread Lucas Stach
Am Dienstag, den 30.10.2012, 12:38 -0600 schrieb Stephen Warren:
 On 10/30/2012 03:22 AM, Lucas Stach wrote:
  This moves the Tegra USB implementation into the drivers/usb/host
  directory.
 
  diff --git a/arch/arm/cpu/armv7/tegra20/usb.c 
  b/drivers/usb/host/ehci-tegra.c
 
  + * Copyright (c) 2009-2012 NVIDIA Corporation
* Copyright (c) 2011 The Chromium OS Authors.
  - * (C) Copyright 2010,2011 NVIDIA Corporation www.nvidia.com
 
 Why does NVIDIA's (c) notice change?
 
Just because I took most of the licence header from the ehci_tegra.c
file, but as the patch shows the the diff modulo the copied part it
looks like a change. I choose this one as it actually spans the longer
copyright timeframe of the both licence headers. Is this a problem?
Should I also include the web address?

Regards,
Lucas

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] Custodian branch base commits

2012-10-30 Thread Wolfgang Denk
Dear Stephen Warren,

In message 50900fed.6040...@wwwdotorg.org you wrote:
 
 # (in u-boot-tegra.git, assuming everything is merged already)
 git checkout master
 git reset --hard u-boot/master

What would this specific command sequence be good for? [And what
exactly is u-boot/master supposed to be?]

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: w...@denx.de
Ninety-Ninety Rule of Project Schedules:
The first ninety percent of the task takes ninety percent of
the time, and the last ten percent takes the other ninety percent.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 7/8] tegra: usb: move implementation into right directory

2012-10-30 Thread Stephen Warren
On 10/30/2012 12:45 PM, Lucas Stach wrote:
 Am Dienstag, den 30.10.2012, 12:38 -0600 schrieb Stephen Warren:
 On 10/30/2012 03:22 AM, Lucas Stach wrote:
 This moves the Tegra USB implementation into the drivers/usb/host
 directory.

 diff --git a/arch/arm/cpu/armv7/tegra20/usb.c 
 b/drivers/usb/host/ehci-tegra.c

 + * Copyright (c) 2009-2012 NVIDIA Corporation
   * Copyright (c) 2011 The Chromium OS Authors.
 - * (C) Copyright 2010,2011 NVIDIA Corporation www.nvidia.com

 Why does NVIDIA's (c) notice change?

 Just because I took most of the licence header from the ehci_tegra.c
 file, but as the patch shows the the diff modulo the copied part it
 looks like a change. I choose this one as it actually spans the longer
 copyright timeframe of the both licence headers. Is this a problem?
 Should I also include the web address?

Hmm. So this patch merges two files together into one? The diff looks
like it's creating a new file. If the new content in this patch came
from some other file, shouldn't the patch also remove it from the old
file? That would make the (c) header change more obvious.

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


  1   2   >