From: Minkyu Kang <mk7.kang@samsung.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RESEND PATCH 4/4] arm:goni: Add support for USB mass storage
Date: Mon, 08 Jul 2013 16:20:09 +0900 [thread overview]
Message-ID: <51DA6829.2030607@samsung.com> (raw)
In-Reply-To: <1372935128-25343-5-git-send-email-l.majewski@samsung.com>
On 04/07/13 19:52, Lukasz Majewski wrote:
> From: Arkadiusz Wlodarczyk <a.wlodarczyk@samsung.com>
>
> This commit enables support for USB mass storage composite function.
> It defines platform code and enables it at config file.
>
> Signed-off-by: Arkadiusz Wlodarczyk <a.wlodarczyk@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> Tested-by: Arkadiusz Wlodarczyk <a.wlodarczyk@samsung.com>
> Cc: Minkyu Kang <mk7.kang@samsung.com>
> ---
> board/samsung/goni/goni.c | 68 ++++++++++++++++++++++++++++++++++++++++++++
> include/configs/s5p_goni.h | 5 ++++
> 2 files changed, 73 insertions(+)
>
please run checkpatch before submitting.
CHECK: Alignment should match open parenthesis
#51: FILE: board/samsung/goni/goni.c:173:
+ if (ums_dev->mmc->block_dev.block_read(ums_dev->dev_num,
+ start + ums_dev->offset, blkcnt, buf) != blkcnt)
CHECK: Alignment should match open parenthesis
#61: FILE: board/samsung/goni/goni.c:183:
+ if (ums_dev->mmc->block_dev.block_write(ums_dev->dev_num,
+ start + ums_dev->offset, blkcnt, buf) != blkcnt)
total: 0 errors, 0 warnings, 2 checks, 86 lines checked
> diff --git a/board/samsung/goni/goni.c b/board/samsung/goni/goni.c
> index 3c53106..a09daca 100644
> --- a/board/samsung/goni/goni.c
> +++ b/board/samsung/goni/goni.c
> @@ -29,6 +29,7 @@
> #include <usb/s3c_udc.h>
> #include <asm/arch/cpu.h>
> #include <power/max8998_pmic.h>
> +#include <usb_mass_storage.h>
> DECLARE_GLOBAL_DATA_PTR;
>
> static struct s5pc110_gpio *s5pc110_gpio;
> @@ -163,3 +164,70 @@ void board_usb_init(void)
> }
>
> #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;
indentation error.
> +
> + 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 = "GONI 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);
> + /* mmc initialization is necessary prior to the ums command usage
> + * due to fact that on goni target environment is read from oneNand
> + * memory, so the mmc remains uninitialized whenu-boot prompt appears
> + * */
> + if (!mmc || mmc_init(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/s5p_goni.h b/include/configs/s5p_goni.h
> index e8f2639..1cfbb88 100644
> --- a/include/configs/s5p_goni.h
> +++ b/include/configs/s5p_goni.h
> @@ -269,4 +269,9 @@
> #define CONFIG_USB_GADGET_DUALSPEED
> #define CONFIG_USB_GADGET_VBUS_DRAW 2
>
> +#define CONFIG_CMD_USB_MASS_STORAGE
> +#if defined(CONFIG_CMD_USB_MASS_STORAGE)
unnecessary ifdef.
this file is board specific and we already knew that CONFIG_CMD_USB_MASS_STORAGE is defined.
> +#define CONFIG_USB_GADGET_MASS_STORAGE
> +#endif
> +
> #endif /* __CONFIG_H */
>
next prev parent reply other threads:[~2013-07-08 7:20 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-24 15:36 [U-Boot] [PATCH 0/4] arm:goni: Update GONI configuration Lukasz Majewski
2013-06-24 15:36 ` [U-Boot] [PATCH 1/4] arm:goni: Update configuration for goni target Lukasz Majewski
2013-06-24 15:36 ` [U-Boot] [PATCH 2/4] arm:goni:dfu Add support for DFU at GONI target Lukasz Majewski
2013-06-25 5:19 ` Sumit Gemini
2013-06-25 6:44 ` Lukasz Majewski
2013-06-25 6:57 ` Sumit Gemini
2013-06-25 7:35 ` Lukasz Majewski
2013-06-25 8:12 ` Sumit Gemini
2013-06-26 8:24 ` Minkyu Kang
2013-06-26 10:23 ` [U-Boot] [PATCH v2 " Lukasz Majewski
2013-07-02 8:59 ` Minkyu Kang
2013-06-24 15:36 ` [U-Boot] [PATCH 3/4] arm:goni: Update of GONI partitioning scheme at eMMC Lukasz Majewski
2013-06-24 15:36 ` [U-Boot] [PATCH 4/4] arm:goni: Add support for USB mass storage Lukasz Majewski
2013-07-04 10:52 ` [U-Boot] [RESEND PATCH 0/4] arm:goni: Update GONI configuration Lukasz Majewski
2013-07-04 10:52 ` [U-Boot] [RESEND PATCH 1/4] arm:goni: Update configuration for goni target Lukasz Majewski
2013-07-05 4:17 ` Jaehoon Chung
2013-07-05 7:09 ` Lukasz Majewski
2013-07-04 10:52 ` [U-Boot] [RESEND PATCH 2/4] arm:goni:dfu Add support for DFU at GONI target Lukasz Majewski
2013-07-07 5:48 ` Minkyu Kang
2013-07-08 6:19 ` Lukasz Majewski
2013-07-08 7:20 ` Minkyu Kang
2013-07-04 10:52 ` [U-Boot] [RESEND PATCH 3/4] arm:goni: Update of GONI partitioning scheme at eMMC Lukasz Majewski
2013-07-04 10:52 ` [U-Boot] [RESEND PATCH 4/4] arm:goni: Add support for USB mass storage Lukasz Majewski
2013-07-08 7:20 ` Minkyu Kang [this message]
2013-07-08 12:25 ` [U-Boot] [PATCH " Minkyu Kang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=51DA6829.2030607@samsung.com \
--to=mk7.kang@samsung.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.