/* * phy-keystone - USB PHY, talking to dwc3 controller in Keystone. * * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com * 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. * * Author: WingMan Kwok * * 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. * */ #include #include #include #include #include #include "phy-generic.h" /* USB PHY control register offsets */ #define USB_PHY_CTL_UTMI 0x0000 #define USB_PHY_CTL_PIPE 0x0004 #define USB_PHY_CTL_PARAM_1 0x0008 #define USB_PHY_CTL_PARAM_2 0x000c #define USB_PHY_CTL_CLOCK 0x0010 #define USB_PHY_CTL_PLL 0x0014 #define PHY_REF_SSP_EN BIT(29) struct keystone_usbphy { struct usb_phy_generic usb_phy_gen; void __iomem *phy_ctrl; }; static inline u32 keystone_usbphy_readl(void __iomem *base, u32 offset) { return readl(base + offset); } static inline void keystone_usbphy_writel(void __iomem *base, u32 offset, u32 value) { writel(value, base + offset); } static int keystone_usbphy_init(struct usb_phy *phy) { struct keystone_usbphy *k_phy = dev_get_drvdata(phy->dev); u32 val; val = keystone_usbphy_readl(k_phy->phy_ctrl, USB_PHY_CTL_CLOCK); keystone_usbphy_writel(k_phy->phy_ctrl, USB_PHY_CTL_CLOCK, val | PHY_REF_SSP_EN); return 0; } static void keystone_usbphy_shutdown(struct usb_phy *phy) { struct keystone_usbphy *k_phy = dev_get_drvdata(phy->dev); u32 val; val = keystone_usbphy_readl(k_phy->phy_ctrl, USB_PHY_CTL_CLOCK); keystone_usbphy_writel(k_phy->phy_ctrl, USB_PHY_CTL_CLOCK, val &= ~PHY_REF_SSP_EN); } static int keystone_usbphy_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct keystone_usbphy *k_phy; struct resource *res; int ret; k_phy = devm_kzalloc(dev, sizeof(*k_phy), GFP_KERNEL); if (!k_phy) return -ENOMEM; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); k_phy->phy_ctrl = devm_ioremap_resource(dev, res); if (IS_ERR(k_phy->phy_ctrl)) return PTR_ERR(k_phy->phy_ctrl); ret = usb_phy_gen_create_phy(dev, &k_phy->usb_phy_gen, NULL); if (ret) return ret; k_phy->usb_phy_gen.phy.init = keystone_usbphy_init; k_phy->usb_phy_gen.phy.shutdown = keystone_usbphy_shutdown; platform_set_drvdata(pdev, k_phy); return usb_add_phy_dev(&k_phy->usb_phy_gen.phy); } static int keystone_usbphy_remove(struct platform_device *pdev) { struct keystone_usbphy *k_phy = platform_get_drvdata(pdev); usb_remove_phy(&k_phy->usb_phy_gen.phy); return 0; } static const struct of_device_id keystone_usbphy_ids[] = { { .compatible = "ti,keystone-usbphy" }, { } }; MODULE_DEVICE_TABLE(of, keystone_usbphy_ids); static struct platform_driver keystone_usbphy_driver = { .probe = keystone_usbphy_probe, .remove = keystone_usbphy_remove, .driver = { .name = "keystone-usbphy", .of_match_table = keystone_usbphy_ids, }, }; module_platform_driver(keystone_usbphy_driver); MODULE_ALIAS("platform:keystone-usbphy"); MODULE_AUTHOR("Texas Instruments Inc."); MODULE_DESCRIPTION("Keystone USB phy driver"); MODULE_LICENSE("GPL v2"); 66d3f9f96bc0f41d94b4830c0b2d0a50&showmsg=1'>Expand)AuthorFilesLines Olga Kornievskaia says: "I ran into this oops in the nfsd (below) (4.10-rc3 kernel). To trigger this I had a client (unsuccessfully) try to mount the server with krb5 where the server doesn't have the rpcsec_gss_krb5 module built." The problem is that rsci.cred is copied from a svc_cred structure that gss_proxy didn't properly initialize. Fix that. [120408.542387] general protection fault: 0000 [#1] SMP ... [120408.565724] CPU: 0 PID: 3601 Comm: nfsd Not tainted 4.10.0-rc3+ #16 [120408.567037] Hardware name: VMware, Inc. VMware Virtual = Platform/440BX Desktop Reference Platform, BIOS 6.00 07/02/2015 [120408.569225] task: ffff8800776f95c0 task.stack: ffffc90003d58000 [120408.570483] RIP: 0010:gss_mech_put+0xb/0x20 [auth_rpcgss] ... [120408.584946] ? rsc_free+0x55/0x90 [auth_rpcgss] [120408.585901] gss_proxy_save_rsc+0xb2/0x2a0 [auth_rpcgss] [120408.587017] svcauth_gss_proxy_init+0x3cc/0x520 [auth_rpcgss] [120408.588257] ? __enqueue_entity+0x6c/0x70 [120408.589101] svcauth_gss_accept+0x391/0xb90 [auth_rpcgss] [120408.590212] ? try_to_wake_up+0x4a/0x360 [120408.591036] ? wake_up_process+0x15/0x20 [120408.592093] ? svc_xprt_do_enqueue+0x12e/0x2d0 [sunrpc] [120408.593177] svc_authenticate+0xe1/0x100 [sunrpc] [120408.594168] svc_process_common+0x203/0x710 [sunrpc] [120408.595220] svc_process+0x105/0x1c0 [sunrpc] [120408.596278] nfsd+0xe9/0x160 [nfsd] [120408.597060] kthread+0x101/0x140 [120408.597734] ? nfsd_destroy+0x60/0x60 [nfsd] [120408.598626] ? kthread_park+0x90/0x90 [120408.599448] ret_from_fork+0x22/0x30 Fixes: 1d658336b05f "SUNRPC: Add RPC based upcall mechanism for RPCGSS auth" Cc: stable@vger.kernel.org Cc: Simo Sorce <simo@redhat.com> Reported-by: Olga Kornievskaia <kolga@netapp.com> Tested-by: Olga Kornievskaia <kolga@netapp.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>