-
Notifications
You must be signed in to change notification settings - Fork 894
Adding legacy USB driver #2851
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding legacy USB driver #2851
Conversation
@@ -0,0 +1,85 @@ | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
maintainers: | ||
- Nathan Barrett-Morrison <nathan.morrison@timesys.com> | ||
- Greg Malysa <greg.malysa@timesys.com> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do they still want to maintain these if they ever make it upstream? Either way, I assume these e-mail addresses aren't valid anymore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably should be just adsp-linux@analog.com
* | ||
* Contact: Nathan Barrett-Morrison <nathan.morrison@timesys.com> | ||
* Contact: Greg Malysa <greg.malysa@timesys.com> | ||
* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* |
* | ||
* Contact: Nathan Barrett-Morrison <nathan.morrison@timesys.com> | ||
* Contact: Greg Malysa <greg.malysa@timesys.com> | ||
* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* |
module_platform_driver(adi_musb_driver); | ||
|
||
MODULE_DESCRIPTION("ADI MUSB Glue Layer"); | ||
MODULE_AUTHOR("Hao Liang <hliang1025@gmail.com>"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious, I see one mainline contribution from Hao Liang:
1569039db006 bfin uart: it will hang when read current y count if not disable dma irq
I wonder why he's listed as the author.
@@ -120,4 +120,6 @@ CONFIG_CRC_CCITT=y | |||
CONFIG_PRINTK_TIME=y | |||
CONFIG_DEBUG_KERNEL=y | |||
CONFIG_DEBUG_FS=y | |||
CONFIG_USB_MUSB_ADI=y | |||
CONFIG_USB_INVENTRA_DMA=y |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like there is a conflict, but also it is good practice to select through menuconfig
and savedefconfig
or to run make sc5890-mini_defconfig; make savedefconfig
before committing.
Ideally the commit message would be declarative and have a prefix matching mainline:
ARM: configs: sc589-mini: Enable MUSB DMA
ARM: defconfig:
would refer to multiple different defconfigs.
drivers/usb/musb/adi.c
Outdated
} | ||
pdata.mode = class; | ||
|
||
pdata.power = get_int_prop(pdev->dev.of_node, "mentor,power")/2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hope checkpatch would catch this:
pdata.power = get_int_prop(pdev->dev.of_node, "mentor,power")/2; | |
pdata.power = get_int_prop(pdev->dev.of_node, "mentor,power") / 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some initial comments. The commit message should be improved a lot... That you're adding some glue code we can see :). You need to explain why we need it for our platforms and some explanation on why all those platforms devices are needed would also be great.
drivers/usb/musb/adi.c
Outdated
.of_match_table = adi_musb_match, | ||
}, | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: no need for blank line
drivers/usb/musb/adi.h
Outdated
#define __ADI_H__ | ||
|
||
static int get_int_prop(struct device_node *node, const char *s); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
static?
|
||
platform_device_unregister(glue->musb); | ||
usb_phy_generic_unregister(glue->phy); | ||
kfree(glue); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fairly sure the above adi_musb_remove() is not needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The other musb glue layer implementations seem to have kept it:
https://elixir.bootlin.com/linux/v6.12/source/drivers/usb/musb/da8xx.c#L588
https://elixir.bootlin.com/linux/v6.12/source/drivers/usb/musb/mediatek.c#L507
Would this change be more in line with our particular case?
drivers/usb/musb/adi.c
Outdated
kfree(glue); | ||
|
||
err0: | ||
dev_err(&pdev->dev, "ADI MUSB device FAILED\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use device managed APIs and you should be able to remove all the above labels.
drivers/usb/musb/adi.c
Outdated
{}, | ||
}; | ||
|
||
MODULE_DEVICE_TABLE(of, adi_musb_match); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be closer to the driver initialization
config = devm_kzalloc(&pdev->dev, sizeof(*config), GFP_KERNEL); | ||
if (!config) { | ||
ret = -ENOMEM; | ||
goto err2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return dev_err_probe(). Ditto for all other places
drivers/usb/musb/adi.c
Outdated
|
||
musb->dev.parent = &pdev->dev; | ||
musb->dev.dma_mask = &musb_dmamask; | ||
musb->dev.coherent_dma_mask = musb_dmamask; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: use spaces
} | ||
|
||
/*alloc musb platform_device and register */ | ||
musb = platform_device_alloc("musb-hdrc", PLATFORM_DEVID_AUTO); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no new line
drivers/usb/musb/adi.c
Outdated
if (!match) { | ||
dev_err(&pdev->dev, "failed to matching of_match node\n"); | ||
return -EINVAL; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why having the above?
drivers/usb/musb/adi.c
Outdated
return 0; | ||
|
||
return val; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The above helper does not bring much
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some initial comments. The commit message should be improved a lot... That you're adding some glue code we can see :). You need to explain why we need it for our platforms and some explanation on why all those platforms devices are needed would also be great.
f6f0111
to
f137331
Compare
98afa1d
to
898097b
Compare
Changelog: Driver:
Documentation:
Configs:
|
Adding glue layer for adsp platforms sc57x/sc58x. This is enables support for the following: * usbboot: Mount and boot into file systems contained on USB devices by switching OTG to host mode. * usb gadget audio: Utilize linux's USB gadget for streaming audio from another device by switching OTG to device mode. Signed-off-by: Utsav Agarwal <utsav.agarwal@analog.com>
Adding documentation from legacy kernel for ADI musb glue layer Signed-off-by: Utsav Agarwal <utsav.agarwal@analog.com>
Enabling ADI musb to utilize DMA Signed-off-by: UtsavAgarwalADI <utsav.agarwal@analog.com>
c0e11e5
to
0362992
Compare
Changelog: Adding signature to last commit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can mount sdcard from usb adapter on sc589
PR Description
Adding legacy musb driver for sc57x/58x and enabling DMA where applicable
PR Type
PR Checklist