* [U-Boot] [PATCH 0/4] Enable 'ums' command on Trats2 board.
@ 2013-04-10 12:07 Piotr Wilczek
2013-04-10 12:07 ` [U-Boot] [PATCH 1/4] driver:usb:s3c_udc: add support for Exynos4x12 Piotr Wilczek
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Piotr Wilczek @ 2013-04-10 12:07 UTC (permalink / raw)
To: u-boot
This patchset enable 'ums' command on Trats2 board.
Definitions are added to pmic max77693 to enable safeout outputs.
USB s3c_udc is modified to support Exnos4x12
Piotr Wilczek (4):
driver:usb:s3c_udc: add support for Exynos4x12
usb:composite: use memcpy to avoid unaligned access
pmic: max77693: add defines for safeout 1 and 2
trats2: enable ums support on Trats2
board/samsung/trats2/trats2.c | 133 ++++++++++++++++++++++++++++++++++++++
drivers/usb/gadget/composite.c | 3 +-
drivers/usb/gadget/regs-otg.h | 5 ++
drivers/usb/gadget/s3c_udc_otg.c | 9 ++-
include/configs/trats2.h | 19 ++++++
include/power/max77693_pmic.h | 3 +
6 files changed, 169 insertions(+), 3 deletions(-)
--
1.7.9.5
^ permalink raw reply [flat|nested] 8+ messages in thread
* [U-Boot] [PATCH 1/4] driver:usb:s3c_udc: add support for Exynos4x12
2013-04-10 12:07 [U-Boot] [PATCH 0/4] Enable 'ums' command on Trats2 board Piotr Wilczek
@ 2013-04-10 12:07 ` Piotr Wilczek
2013-04-10 12:07 ` [U-Boot] [PATCH 2/4] usb:composite: use memcpy to avoid unaligned access Piotr Wilczek
` (2 subsequent siblings)
3 siblings, 0 replies; 8+ messages in thread
From: Piotr Wilczek @ 2013-04-10 12:07 UTC (permalink / raw)
To: u-boot
This patch add new defines for usb phy for Exynos4x12.
Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
CC: Minkyu Kang <mk7.kang@samsung.com>
---
drivers/usb/gadget/regs-otg.h | 5 +++++
drivers/usb/gadget/s3c_udc_otg.c | 9 +++++++--
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/gadget/regs-otg.h b/drivers/usb/gadget/regs-otg.h
index 3737e45..df7cda6 100644
--- a/drivers/usb/gadget/regs-otg.h
+++ b/drivers/usb/gadget/regs-otg.h
@@ -229,6 +229,11 @@ struct s3c_usbotg_reg {
#define CLK_SEL_12MHZ (0x2 << 0)
#define CLK_SEL_48MHZ (0x0 << 0)
+#define EXYNOS4X12_ID_PULLUP0 (0x01 << 3)
+#define EXYNOS4X12_COMMON_ON_N0 (0x01 << 4)
+#define EXYNOS4X12_CLK_SEL_12MHZ (0x02 << 0)
+#define EXYNOS4X12_CLK_SEL_24MHZ (0x05 << 0)
+
/* Device Configuration Register DCFG */
#define DEV_SPEED_HIGH_SPEED_20 (0x0 << 0)
#define DEV_SPEED_FULL_SPEED_20 (0x1 << 0)
diff --git a/drivers/usb/gadget/s3c_udc_otg.c b/drivers/usb/gadget/s3c_udc_otg.c
index f9d24e3..fb72662 100644
--- a/drivers/usb/gadget/s3c_udc_otg.c
+++ b/drivers/usb/gadget/s3c_udc_otg.c
@@ -180,8 +180,13 @@ void otg_phy_init(struct s3c_udc *dev)
writel((readl(&phy->phypwr) &~(OTG_DISABLE_0 | ANALOG_PWRDOWN)
&~FORCE_SUSPEND_0), &phy->phypwr);
- writel((readl(&phy->phyclk) &~(ID_PULLUP0 | COMMON_ON_N0)) |
- CLK_SEL_24MHZ, &phy->phyclk); /* PLL 24Mhz */
+ if (proid_is_exynos4412())
+ writel((readl(&phy->phyclk) &~(EXYNOS4X12_ID_PULLUP0 |
+ EXYNOS4X12_COMMON_ON_N0)) | EXYNOS4X12_CLK_SEL_24MHZ,
+ &phy->phyclk); /* PLL 24Mhz */
+ else
+ writel((readl(&phy->phyclk) &~(ID_PULLUP0 | COMMON_ON_N0)) |
+ CLK_SEL_24MHZ, &phy->phyclk); /* PLL 24Mhz */
writel((readl(&phy->rstcon) &~(LINK_SW_RST | PHYLNK_SW_RST))
| PHY_SW_RST0, &phy->rstcon);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [U-Boot] [PATCH 2/4] usb:composite: use memcpy to avoid unaligned access
2013-04-10 12:07 [U-Boot] [PATCH 0/4] Enable 'ums' command on Trats2 board Piotr Wilczek
2013-04-10 12:07 ` [U-Boot] [PATCH 1/4] driver:usb:s3c_udc: add support for Exynos4x12 Piotr Wilczek
@ 2013-04-10 12:07 ` Piotr Wilczek
2013-05-16 13:51 ` Heiko Schocher
2013-06-25 4:20 ` Heiko Schocher
2013-04-10 12:07 ` [U-Boot] [PATCH 3/4] pmic: max77693: add defines for safeout 1 and 2 Piotr Wilczek
2013-04-10 12:07 ` [U-Boot] [PATCH 4/4] trats2: enable ums support on Trats2 Piotr Wilczek
3 siblings, 2 replies; 8+ messages in thread
From: Piotr Wilczek @ 2013-04-10 12:07 UTC (permalink / raw)
To: u-boot
This patch memcpy is used instead of an assignment to
avoid unaligned access execption on some ARM platforms.
Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
CC: Lukasz Majewski <l.majewski@samsung.com>
---
drivers/usb/gadget/composite.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index 2c5600e..0716e52 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -997,7 +997,8 @@ static int composite_bind(struct usb_gadget *gadget)
if (status < 0)
goto fail;
- cdev->desc = *composite->dev;
+ memcpy(&cdev->desc, composite->dev,
+ sizeof(struct usb_device_descriptor));
cdev->desc.bMaxPacketSize0 = gadget->ep0->maxpacket;
debug("%s: ready\n", composite->name);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [U-Boot] [PATCH 3/4] pmic: max77693: add defines for safeout 1 and 2
2013-04-10 12:07 [U-Boot] [PATCH 0/4] Enable 'ums' command on Trats2 board Piotr Wilczek
2013-04-10 12:07 ` [U-Boot] [PATCH 1/4] driver:usb:s3c_udc: add support for Exynos4x12 Piotr Wilczek
2013-04-10 12:07 ` [U-Boot] [PATCH 2/4] usb:composite: use memcpy to avoid unaligned access Piotr Wilczek
@ 2013-04-10 12:07 ` Piotr Wilczek
2013-04-10 12:07 ` [U-Boot] [PATCH 4/4] trats2: enable ums support on Trats2 Piotr Wilczek
3 siblings, 0 replies; 8+ messages in thread
From: Piotr Wilczek @ 2013-04-10 12:07 UTC (permalink / raw)
To: u-boot
Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
include/power/max77693_pmic.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/include/power/max77693_pmic.h b/include/power/max77693_pmic.h
index 07c3dd6..c43ace0 100644
--- a/include/power/max77693_pmic.h
+++ b/include/power/max77693_pmic.h
@@ -50,6 +50,9 @@ enum {CHARGER_ENABLE, CHARGER_DISABLE};
#define MAX77693_CHG_LOCK (0x0 << 2) /* MAX77693_CHG_CNFG_06 */
#define MAX77693_CHG_UNLOCK (0x3 << 2) /* MAX77693_CHG_CNFG_06 */
+#define MAX77693_ENSAFEOUT1 (1 << 6)
+#define MAX77693_ENSAFEOUT2 (1 << 7)
+
#define MAX77693_PMIC_I2C_ADDR (0xCC >> 1)
int pmic_init_max77693(unsigned char bus);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [U-Boot] [PATCH 4/4] trats2: enable ums support on Trats2
2013-04-10 12:07 [U-Boot] [PATCH 0/4] Enable 'ums' command on Trats2 board Piotr Wilczek
` (2 preceding siblings ...)
2013-04-10 12:07 ` [U-Boot] [PATCH 3/4] pmic: max77693: add defines for safeout 1 and 2 Piotr Wilczek
@ 2013-04-10 12:07 ` Piotr Wilczek
3 siblings, 0 replies; 8+ messages in thread
From: Piotr Wilczek @ 2013-04-10 12:07 UTC (permalink / raw)
To: u-boot
This patch enables 'ums' command on Trats2 board.
Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
board/samsung/trats2/trats2.c | 133 +++++++++++++++++++++++++++++++++++++++++
include/configs/trats2.h | 19 ++++++
2 files changed, 152 insertions(+)
diff --git a/board/samsung/trats2/trats2.c b/board/samsung/trats2/trats2.c
index 32fb699..d9de862 100644
--- a/board/samsung/trats2/trats2.c
+++ b/board/samsung/trats2/trats2.c
@@ -45,6 +45,8 @@
#include <power/max77693_fg.h>
#include <libtizen.h>
#include <errno.h>
+#include <usb/s3c_udc.h>
+#include <usb_mass_storage.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -326,6 +328,75 @@ int board_mmc_init(bd_t *bis)
return err;
}
+#ifdef CONFIG_USB_GADGET
+static int s5pc210_phy_control(int on)
+{
+ int ret = 0;
+ unsigned int val;
+
+ struct pmic *p = pmic_get("MAX77686_PMIC");
+ if (!p)
+ return -ENODEV;
+
+ if (pmic_probe(p))
+ return -1;
+
+ if (on) {
+ ret = max77686_set_ldo_mode(p, 12, OPMODE_ON);
+
+ p = pmic_get("MAX77693_PMIC");
+ pmic_probe(p);
+ if (pmic_probe(p))
+ return -1;
+
+ /* SAFEOUT */
+ ret |= pmic_reg_read(p, MAX77693_SAFEOUT, &val);
+ val |= MAX77693_ENSAFEOUT1;
+ ret |= pmic_reg_write(p, MAX77693_SAFEOUT, val);
+
+ p = pmic_get("MAX77693_MUIC");
+ if (pmic_probe(p))
+ return -1;
+
+ /* PATH: USB */
+ ret |= pmic_reg_write(p, MAX77693_MUIC_CONTROL1,
+ MAX77693_MUIC_CTRL1_DN1DP2);
+
+ } else {
+ ret |= max77686_set_ldo_mode(p, 12, OPMODE_LPM);
+
+ p = pmic_get("MAX77693_MUIC");
+ if (pmic_probe(p))
+ return -1;
+
+ /* PATH: UART */
+ ret |= pmic_reg_write(p, MAX77693_MUIC_CONTROL1,
+ MAX77693_MUIC_CTRL1_UT1UR2);
+ }
+
+ if (ret) {
+ puts("MAX77693 setting error!\n");
+ return -1;
+ }
+
+ return 0;
+}
+
+struct s3c_plat_otg_data s5pc210_otg_data = {
+ .phy_control = s5pc210_phy_control,
+ .regs_phy = EXYNOS4X12_USBPHY_BASE,
+ .regs_otg = EXYNOS4X12_USBOTG_BASE,
+ .usb_phy_ctrl = EXYNOS4X12_USBPHY_CONTROL,
+ .usb_flags = PHY0_SLEEP,
+};
+
+void board_usb_init(void)
+{
+ debug("USB_udc_probe\n");
+ s3c_udc_probe(&s5pc210_otg_data);
+}
+#endif
+
static int pmic_init_max77686(void)
{
struct pmic *p = pmic_get("MAX77686_PMIC");
@@ -525,3 +596,65 @@ int misc_init_r(void)
return 0;
}
#endif
+
+#ifdef CONFIG_USB_GADGET_MASS_STORAGE
+static int ums_read_sector(struct ums_device *ums_dev,
+ ulong start, lbaint_t blkcnt, void *buf)
+{
+ if (ums_dev->mmc->block_dev.block_read(ums_dev->dev_num,
+ start + ums_dev->offset, blkcnt, buf) != blkcnt)
+ return -1;
+
+ return 0;
+}
+
+static int ums_write_sector(struct ums_device *ums_dev,
+ ulong start, lbaint_t blkcnt, const void *buf)
+{
+ if (ums_dev->mmc->block_dev.block_write(ums_dev->dev_num,
+ start + ums_dev->offset, blkcnt, buf) != blkcnt)
+ return -1;
+
+ return 0;
+}
+
+static void ums_get_capacity(struct ums_device *ums_dev,
+ long long int *capacity)
+{
+ long long int tmp_capacity;
+
+ tmp_capacity = (long long int) ((ums_dev->offset + ums_dev->part_size)
+ * SECTOR_SIZE);
+ *capacity = ums_dev->mmc->capacity - tmp_capacity;
+}
+
+static struct ums_board_info ums_board = {
+ .read_sector = ums_read_sector,
+ .write_sector = ums_write_sector,
+ .get_capacity = ums_get_capacity,
+ .name = "TRATS2 UMS disk",
+ .ums_dev = {
+ .mmc = NULL,
+ .dev_num = 0,
+ .offset = 0,
+ .part_size = 0.
+ },
+};
+
+struct ums_board_info *board_ums_init(unsigned int dev_num, unsigned int offset,
+ unsigned int part_size)
+{
+ struct mmc *mmc;
+
+ mmc = find_mmc_device(dev_num);
+ if (!mmc)
+ return NULL;
+
+ ums_board.ums_dev.mmc = mmc;
+ ums_board.ums_dev.dev_num = dev_num;
+ ums_board.ums_dev.offset = offset;
+ ums_board.ums_dev.part_size = part_size;
+
+ return &ums_board;
+}
+#endif
diff --git a/include/configs/trats2.h b/include/configs/trats2.h
index 5637734..8f86d8c 100644
--- a/include/configs/trats2.h
+++ b/include/configs/trats2.h
@@ -133,6 +133,16 @@
#define CONFIG_CMD_EXT4
#define CONFIG_CMD_EXT4_WRITE
+/* USB Composite download gadget - g_dnl */
+#define CONFIG_USBDOWNLOAD_GADGET
+#define CONFIG_DFU_FUNCTION
+#define CONFIG_DFU_MMC
+
+/* USB Samsung's IDs */
+#define CONFIG_G_DNL_VENDOR_NUM 0x04E8
+#define CONFIG_G_DNL_PRODUCT_NUM 0x6601
+#define CONFIG_G_DNL_MANUFACTURER "Samsung"
+
/* To use the TFTPBOOT over USB, Please enable the CONFIG_CMD_NET */
#undef CONFIG_CMD_NET
@@ -288,6 +298,10 @@
#define CONFIG_POWER_MUIC_MAX77693
#define CONFIG_POWER_FG_MAX77693
#define CONFIG_POWER_BATTERY_TRATS2
+#define CONFIG_USB_GADGET
+#define CONFIG_USB_GADGET_S3C_UDC_OTG
+#define CONFIG_USB_GADGET_DUALSPEED
+#define CONFIG_USB_GADGET_VBUS_DRAW 2
/* PWM */
#define CONFIG_PWM
@@ -306,4 +320,9 @@
#define CONFIG_VIDEO_BMP_GZIP
#define CONFIG_SYS_VIDEO_LOGO_MAX_SIZE ((500 * 250 * 4) + (1 << 12))
+#define CONFIG_CMD_USB_MASS_STORAGE
+#if defined(CONFIG_CMD_USB_MASS_STORAGE)
+#define CONFIG_USB_GADGET_MASS_STORAGE
+#endif
+
#endif /* __CONFIG_H */
--
1.7.9.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [U-Boot] [PATCH 2/4] usb:composite: use memcpy to avoid unaligned access
2013-04-10 12:07 ` [U-Boot] [PATCH 2/4] usb:composite: use memcpy to avoid unaligned access Piotr Wilczek
@ 2013-05-16 13:51 ` Heiko Schocher
2013-06-25 4:20 ` Heiko Schocher
1 sibling, 0 replies; 8+ messages in thread
From: Heiko Schocher @ 2013-05-16 13:51 UTC (permalink / raw)
To: u-boot
Hello Piotr,
Am 10.04.2013 14:07, schrieb Piotr Wilczek:
> This patch memcpy is used instead of an assignment to
> avoid unaligned access execption on some ARM platforms.
>
> Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> CC: Lukasz Majewski <l.majewski@samsung.com>
> ---
> drivers/usb/gadget/composite.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
just digged into this bug on an am335x based board, this patch
helped me out!
Thanks!
Tested-by: Heiko Schocher <hs@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>
bye,
Heiko
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
^ permalink raw reply [flat|nested] 8+ messages in thread
* [U-Boot] [PATCH 2/4] usb:composite: use memcpy to avoid unaligned access
2013-04-10 12:07 ` [U-Boot] [PATCH 2/4] usb:composite: use memcpy to avoid unaligned access Piotr Wilczek
2013-05-16 13:51 ` Heiko Schocher
@ 2013-06-25 4:20 ` Heiko Schocher
2013-06-26 11:32 ` Marek Vasut
1 sibling, 1 reply; 8+ messages in thread
From: Heiko Schocher @ 2013-06-25 4:20 UTC (permalink / raw)
To: u-boot
Hello Prafulla,
just saw, that the below patch is delegated to you:
(added also Marek Vasut to cc, as he is the usb maintainer)
Am 10.04.2013 14:07, schrieb Piotr Wilczek:
> This patch memcpy is used instead of an assignment to
> avoid unaligned access execption on some ARM platforms.
>
> Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> CC: Lukasz Majewski <l.majewski@samsung.com>
> ---
> drivers/usb/gadget/composite.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
> index 2c5600e..0716e52 100644
> --- a/drivers/usb/gadget/composite.c
> +++ b/drivers/usb/gadget/composite.c
> @@ -997,7 +997,8 @@ static int composite_bind(struct usb_gadget *gadget)
> if (status < 0)
> goto fail;
>
> - cdev->desc = *composite->dev;
> + memcpy(&cdev->desc, composite->dev,
> + sizeof(struct usb_device_descriptor));
> cdev->desc.bMaxPacketSize0 = gadget->ep0->maxpacket;
>
> debug("%s: ready\n", composite->name);
>
This fixes a bug... do you plan to work it in for this release? Or
are there some issues with this patch?
bye,
Heiko
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
^ permalink raw reply [flat|nested] 8+ messages in thread
* [U-Boot] [PATCH 2/4] usb:composite: use memcpy to avoid unaligned access
2013-06-25 4:20 ` Heiko Schocher
@ 2013-06-26 11:32 ` Marek Vasut
0 siblings, 0 replies; 8+ messages in thread
From: Marek Vasut @ 2013-06-26 11:32 UTC (permalink / raw)
To: u-boot
Dear Heiko Schocher,
> Hello Prafulla,
>
> just saw, that the below patch is delegated to you:
> (added also Marek Vasut to cc, as he is the usb maintainer)
Applied
Best regards,
Marek Vasut
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2013-06-26 11:32 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-10 12:07 [U-Boot] [PATCH 0/4] Enable 'ums' command on Trats2 board Piotr Wilczek
2013-04-10 12:07 ` [U-Boot] [PATCH 1/4] driver:usb:s3c_udc: add support for Exynos4x12 Piotr Wilczek
2013-04-10 12:07 ` [U-Boot] [PATCH 2/4] usb:composite: use memcpy to avoid unaligned access Piotr Wilczek
2013-05-16 13:51 ` Heiko Schocher
2013-06-25 4:20 ` Heiko Schocher
2013-06-26 11:32 ` Marek Vasut
2013-04-10 12:07 ` [U-Boot] [PATCH 3/4] pmic: max77693: add defines for safeout 1 and 2 Piotr Wilczek
2013-04-10 12:07 ` [U-Boot] [PATCH 4/4] trats2: enable ums support on Trats2 Piotr Wilczek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox