mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-09 19:51:25 -04:00
Merge tag 'linux-can-next-for-6.12-20240909' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next
Marc Kleine-Budde says: ==================== pull-request: can-next 2024-09-09 The first patch is by Rob Herring and simplifies the DT parsing in the cc770 driver. The next 2 patches both target the rockchip_canfd driver added in the last pull request to net-next. The first one is by Nathan Chancellor and fixes the return type of rkcanfd_start_xmit(), the second one is by me and fixes a 64 bit division on 32 bit platforms in rkcanfd_timestamp_init(). * tag 'linux-can-next-for-6.12-20240909' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next: can: rockchip_canfd: rkcanfd_timestamp_init(): fix 64 bit division on 32 bit platforms can: rockchip_canfd: fix return type of rkcanfd_start_xmit() net: can: cc770: Simplify parsing DT properties ==================== Link: https://patch.msgid.link/20240909063657.2287493-1-mkl@pengutronix.de Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
@@ -70,17 +70,10 @@ static void cc770_platform_write_reg(const struct cc770_priv *priv, int reg,
|
||||
static int cc770_get_of_node_data(struct platform_device *pdev,
|
||||
struct cc770_priv *priv)
|
||||
{
|
||||
u32 clkext = CC770_PLATFORM_CAN_CLOCK, clkout = 0;
|
||||
struct device_node *np = pdev->dev.of_node;
|
||||
const u32 *prop;
|
||||
int prop_size;
|
||||
u32 clkext;
|
||||
|
||||
prop = of_get_property(np, "bosch,external-clock-frequency",
|
||||
&prop_size);
|
||||
if (prop && (prop_size == sizeof(u32)))
|
||||
clkext = *prop;
|
||||
else
|
||||
clkext = CC770_PLATFORM_CAN_CLOCK; /* default */
|
||||
of_property_read_u32(np, "bosch,external-clock-frequency", &clkext);
|
||||
priv->can.clock.freq = clkext;
|
||||
|
||||
/* The system clock may not exceed 10 MHz */
|
||||
@@ -98,7 +91,7 @@ static int cc770_get_of_node_data(struct platform_device *pdev,
|
||||
if (of_property_read_bool(np, "bosch,iso-low-speed-mux"))
|
||||
priv->cpu_interface |= CPUIF_MUX;
|
||||
|
||||
if (!of_get_property(np, "bosch,no-comperator-bypass", NULL))
|
||||
if (!of_property_read_bool(np, "bosch,no-comperator-bypass"))
|
||||
priv->bus_config |= BUSCFG_CBY;
|
||||
if (of_property_read_bool(np, "bosch,disconnect-rx0-input"))
|
||||
priv->bus_config |= BUSCFG_DR0;
|
||||
@@ -109,25 +102,22 @@ static int cc770_get_of_node_data(struct platform_device *pdev,
|
||||
if (of_property_read_bool(np, "bosch,polarity-dominant"))
|
||||
priv->bus_config |= BUSCFG_POL;
|
||||
|
||||
prop = of_get_property(np, "bosch,clock-out-frequency", &prop_size);
|
||||
if (prop && (prop_size == sizeof(u32)) && *prop > 0) {
|
||||
u32 cdv = clkext / *prop;
|
||||
int slew;
|
||||
of_property_read_u32(np, "bosch,clock-out-frequency", &clkout);
|
||||
if (clkout > 0) {
|
||||
u32 cdv = clkext / clkout;
|
||||
|
||||
if (cdv > 0 && cdv < 16) {
|
||||
u32 slew;
|
||||
|
||||
priv->cpu_interface |= CPUIF_CEN;
|
||||
priv->clkout |= (cdv - 1) & CLKOUT_CD_MASK;
|
||||
|
||||
prop = of_get_property(np, "bosch,slew-rate",
|
||||
&prop_size);
|
||||
if (prop && (prop_size == sizeof(u32))) {
|
||||
slew = *prop;
|
||||
} else {
|
||||
if (of_property_read_u32(np, "bosch,slew-rate", &slew)) {
|
||||
/* Determine default slew rate */
|
||||
slew = (CLKOUT_SL_MASK >>
|
||||
CLKOUT_SL_SHIFT) -
|
||||
((cdv * clkext - 1) / 8000000);
|
||||
if (slew < 0)
|
||||
if (slew > (CLKOUT_SL_MASK >> CLKOUT_SL_SHIFT))
|
||||
slew = 0;
|
||||
}
|
||||
priv->clkout |= (slew << CLKOUT_SL_SHIFT) &
|
||||
|
||||
@@ -71,7 +71,7 @@ void rkcanfd_timestamp_init(struct rkcanfd_priv *priv)
|
||||
|
||||
max_cycles = div_u64(ULLONG_MAX, cc->mult);
|
||||
max_cycles = min(max_cycles, cc->mask);
|
||||
work_delay_ns = clocksource_cyc2ns(max_cycles, cc->mult, cc->shift) / 3;
|
||||
work_delay_ns = div_u64(clocksource_cyc2ns(max_cycles, cc->mult, cc->shift), 3);
|
||||
priv->work_delay_jiffies = nsecs_to_jiffies(work_delay_ns);
|
||||
INIT_DELAYED_WORK(&priv->timestamp, rkcanfd_timestamp_work);
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ void rkcanfd_xmit_retry(struct rkcanfd_priv *priv)
|
||||
rkcanfd_start_xmit_write_cmd(priv, reg_cmd);
|
||||
}
|
||||
|
||||
int rkcanfd_start_xmit(struct sk_buff *skb, struct net_device *ndev)
|
||||
netdev_tx_t rkcanfd_start_xmit(struct sk_buff *skb, struct net_device *ndev)
|
||||
{
|
||||
struct rkcanfd_priv *priv = netdev_priv(ndev);
|
||||
u32 reg_frameinfo, reg_id, reg_cmd;
|
||||
|
||||
@@ -546,7 +546,7 @@ void rkcanfd_timestamp_stop_sync(struct rkcanfd_priv *priv);
|
||||
|
||||
unsigned int rkcanfd_get_effective_tx_free(const struct rkcanfd_priv *priv);
|
||||
void rkcanfd_xmit_retry(struct rkcanfd_priv *priv);
|
||||
int rkcanfd_start_xmit(struct sk_buff *skb, struct net_device *ndev);
|
||||
netdev_tx_t rkcanfd_start_xmit(struct sk_buff *skb, struct net_device *ndev);
|
||||
void rkcanfd_handle_tx_done_one(struct rkcanfd_priv *priv, const u32 ts,
|
||||
unsigned int *frame_len_p);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user